@openrig/cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +2 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +36 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +66 -0
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -1
- package/daemon/dist/db/migrations/041_rig_policy.d.ts +32 -0
- package/daemon/dist/db/migrations/041_rig_policy.d.ts.map +1 -0
- package/daemon/dist/db/migrations/041_rig_policy.js +47 -0
- package/daemon/dist/db/migrations/041_rig_policy.js.map +1 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js +1 -1
- package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js +2 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +27 -0
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +86 -6
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/bundle-agent-images-router.d.ts +95 -0
- package/daemon/dist/domain/bundle-agent-images-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-agent-images-router.js +140 -0
- package/daemon/dist/domain/bundle-agent-images-router.js.map +1 -0
- package/daemon/dist/domain/bundle-assembler.d.ts +18 -1
- package/daemon/dist/domain/bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-assembler.js +11 -1
- package/daemon/dist/domain/bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/bundle-audit.d.ts +89 -0
- package/daemon/dist/domain/bundle-audit.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-audit.js +87 -0
- package/daemon/dist/domain/bundle-audit.js.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts +57 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.js +49 -0
- package/daemon/dist/domain/bundle-conflict-detector.js.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts +100 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.js +158 -0
- package/daemon/dist/domain/bundle-context-packs-router.js.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts +69 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.js +87 -0
- package/daemon/dist/domain/bundle-plugins-router.js.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts +62 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.js +90 -0
- package/daemon/dist/domain/bundle-skills-router.js.map +1 -0
- package/daemon/dist/domain/bundle-types.d.ts +106 -0
- package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-types.js +375 -0
- package/daemon/dist/domain/bundle-types.js.map +1 -1
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts +94 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js +144 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js.map +1 -0
- package/daemon/dist/domain/context-monitor.d.ts +5 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +28 -15
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/graph-projection.d.ts +6 -0
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +6 -0
- package/daemon/dist/domain/graph-projection.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +7 -7
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +18 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +98 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +12 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +25 -1
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/pod-bundle-assembler.d.ts +16 -1
- package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/pod-bundle-assembler.js +11 -1
- package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +10 -0
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +4 -0
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +22 -0
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +57 -0
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +37 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +99 -2
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +4 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +16 -7
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts +48 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js +96 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts +46 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js +171 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts +145 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js +52 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts +58 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js +211 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js.map +1 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +109 -18
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +79 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-activity-service.js +123 -0
- package/daemon/dist/domain/seat-activity-service.js.map +1 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts +12 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +23 -0
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-service.js +19 -0
- package/daemon/dist/domain/spec-library-service.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +79 -3
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +22 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +37 -0
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +156 -3
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts +197 -0
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/workspace-doctor.js +448 -0
- package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +11 -0
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/bundles.d.ts.map +1 -1
- package/daemon/dist/routes/bundles.js +966 -7
- package/daemon/dist/routes/bundles.js.map +1 -1
- package/daemon/dist/routes/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +19 -2
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/info.d.ts +3 -0
- package/daemon/dist/routes/info.d.ts.map +1 -0
- package/daemon/dist/routes/info.js +20 -0
- package/daemon/dist/routes/info.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts +18 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +97 -5
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rig-policy.d.ts +9 -0
- package/daemon/dist/routes/rig-policy.d.ts.map +1 -0
- package/daemon/dist/routes/rig-policy.js +174 -0
- package/daemon/dist/routes/rig-policy.js.map +1 -0
- package/daemon/dist/routes/rigs.d.ts.map +1 -1
- package/daemon/dist/routes/rigs.js +10 -2
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +26 -3
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/up.d.ts +25 -0
- package/daemon/dist/routes/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +70 -3
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/workspace.d.ts.map +1 -1
- package/daemon/dist/routes/workspace.js +80 -1
- package/daemon/dist/routes/workspace.js.map +1 -1
- package/daemon/dist/server.d.ts +10 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +11 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +45 -4
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +285 -8
- package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +2 -2
- package/daemon/specs/rigs/launch/conveyor/rig.yaml +1 -1
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/bundle.d.ts.map +1 -1
- package/dist/commands/bundle.js +123 -2
- package/dist/commands/bundle.js.map +1 -1
- package/dist/commands/config-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +40 -5
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +51 -8
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +6 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +103 -5
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/rig-policy.d.ts +48 -0
- package/dist/commands/rig-policy.d.ts.map +1 -0
- package/dist/commands/rig-policy.js +429 -0
- package/dist/commands/rig-policy.js.map +1 -0
- package/dist/commands/scope.d.ts +6 -0
- package/dist/commands/scope.d.ts.map +1 -0
- package/dist/commands/scope.js +659 -0
- package/dist/commands/scope.js.map +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +47 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/workflow.d.ts +9 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +139 -1
- package/dist/commands/workflow.js.map +1 -1
- package/dist/commands/workspace.d.ts +20 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +138 -7
- package/dist/commands/workspace.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +25 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +33 -2
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/scope/dot-id.d.ts +43 -0
- package/dist/lib/scope/dot-id.d.ts.map +1 -0
- package/dist/lib/scope/dot-id.js +165 -0
- package/dist/lib/scope/dot-id.js.map +1 -0
- package/dist/lib/scope/scope-fs.d.ts +79 -0
- package/dist/lib/scope/scope-fs.d.ts.map +1 -0
- package/dist/lib/scope/scope-fs.js +468 -0
- package/dist/lib/scope/scope-fs.js.map +1 -0
- package/dist/lib/scope/templates.d.ts +38 -0
- package/dist/lib/scope/templates.d.ts.map +1 -0
- package/dist/lib/scope/templates.js +109 -0
- package/dist/lib/scope/templates.js.map +1 -0
- package/dist/lib/scope/types.d.ts +61 -0
- package/dist/lib/scope/types.d.ts.map +1 -0
- package/dist/lib/scope/types.js +38 -0
- package/dist/lib/scope/types.js.map +1 -0
- package/dist/lib/scope-templates/backlog-deprecation.md +26 -0
- package/dist/lib/scope-templates/backlog-tech-debt.md +22 -0
- package/dist/lib/scope-templates/bug-fix.md +30 -0
- package/dist/lib/scope-templates/mission-notes.md +97 -0
- package/dist/lib/scope-templates/mission-placeholder.md +20 -0
- package/dist/lib/scope-templates/mission-release.md +25 -0
- package/dist/lib/scope-templates/placeholder.md +30 -0
- package/dist/lib/scope-templates/release-feature.md +26 -0
- package/dist/lib/scope-templates/research.md +22 -0
- package/package.json +2 -2
- package/ui/dist/assets/index-GjTxfi9S.js +547 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/index-Rl3ZBrUg.js +0 -547
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
var u7=Object.defineProperty;var bA=e=>{throw TypeError(e)};var d7=(e,t,n)=>t in e?u7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ns=(e,t,n)=>d7(e,typeof t!="symbol"?t+"":t,n),wy=(e,t,n)=>t.has(e)||bA("Cannot "+n);var W=(e,t,n)=>(wy(e,t,"read from private field"),n?n.call(e):t.get(e)),be=(e,t,n)=>t.has(e)?bA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pe=(e,t,n,s)=>(wy(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Ae=(e,t,n)=>(wy(e,t,"access private method"),n);var Qh=(e,t,n,s)=>({set _(r){pe(e,t,r,n)},get _(){return W(e,t,s)}});function f7(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const a=Object.getOwnPropertyDescriptor(s,r);a&&Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();var Xh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jy={exports:{}},Ou={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var wA;function h7(){if(wA)return Ou;wA=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,r,a){var l=null;if(a!==void 0&&(l=""+a),r.key!==void 0&&(l=""+r.key),"key"in r){a={};for(var u in r)u!=="key"&&(a[u]=r[u])}else a=r;return r=a.ref,{$$typeof:e,type:s,key:l,ref:r!==void 0?r:null,props:a}}return Ou.Fragment=t,Ou.jsx=n,Ou.jsxs=n,Ou}var jA;function p7(){return jA||(jA=1,jy.exports=h7()),jy.exports}var i=p7(),Sy={exports:{}},qe={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var SA;function m7(){if(SA)return qe;SA=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),x=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function S(D,F,te){this.props=D,this.context=F,this.refs=w,this.updater=te||b}S.prototype.isReactComponent={},S.prototype.setState=function(D,F){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,F,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function C(){}C.prototype=S.prototype;function k(D,F,te){this.props=D,this.context=F,this.refs=w,this.updater=te||b}var _=k.prototype=new C;_.constructor=k,v(_,S.prototype),_.isPureReactComponent=!0;var R=Array.isArray;function T(){}var A={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function L(D,F,te){var U=te.ref;return{$$typeof:e,type:D,key:F,ref:U!==void 0?U:null,props:te}}function $(D,F){return L(D.type,F,D.props)}function O(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function B(D){var F={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(te){return F[te]})}var H=/\/+/g;function P(D,F){return typeof D=="object"&&D!==null&&D.key!=null?B(""+D.key):F.toString(36)}function G(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(T,T):(D.status="pending",D.then(function(F){D.status==="pending"&&(D.status="fulfilled",D.value=F)},function(F){D.status==="pending"&&(D.status="rejected",D.reason=F)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function q(D,F,te,U,Q){var X=typeof D;(X==="undefined"||X==="boolean")&&(D=null);var se=!1;if(D===null)se=!0;else switch(X){case"bigint":case"string":case"number":se=!0;break;case"object":switch(D.$$typeof){case e:case t:se=!0;break;case p:return se=D._init,q(se(D._payload),F,te,U,Q)}}if(se)return Q=Q(D),se=U===""?"."+P(D,0):U,R(Q)?(te="",se!=null&&(te=se.replace(H,"$&/")+"/"),q(Q,F,te,"",function(me){return me})):Q!=null&&(O(Q)&&(Q=$(Q,te+(Q.key==null||D&&D.key===Q.key?"":(""+Q.key).replace(H,"$&/")+"/")+se)),F.push(Q)),1;se=0;var re=U===""?".":U+":";if(R(D))for(var ce=0;ce<D.length;ce++)U=D[ce],X=re+P(U,ce),se+=q(U,F,te,X,Q);else if(ce=y(D),typeof ce=="function")for(D=ce.call(D),ce=0;!(U=D.next()).done;)U=U.value,X=re+P(U,ce++),se+=q(U,F,te,X,Q);else if(X==="object"){if(typeof D.then=="function")return q(G(D),F,te,U,Q);throw F=String(D),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return se}function V(D,F,te){if(D==null)return D;var U=[],Q=0;return q(D,U,"","",function(X){return F.call(te,X,Q++)}),U}function K(D){if(D._status===-1){var F=D._result;F=F(),F.then(function(te){(D._status===0||D._status===-1)&&(D._status=1,D._result=te)},function(te){(D._status===0||D._status===-1)&&(D._status=2,D._result=te)}),D._status===-1&&(D._status=0,D._result=F)}if(D._status===1)return D._result.default;throw D._result}var Y=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},J={map:V,forEach:function(D,F,te){V(D,function(){F.apply(this,arguments)},te)},count:function(D){var F=0;return V(D,function(){F++}),F},toArray:function(D){return V(D,function(F){return F})||[]},only:function(D){if(!O(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return qe.Activity=m,qe.Children=J,qe.Component=S,qe.Fragment=n,qe.Profiler=r,qe.PureComponent=k,qe.StrictMode=s,qe.Suspense=f,qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,qe.__COMPILER_RUNTIME={__proto__:null,c:function(D){return A.H.useMemoCache(D)}},qe.cache=function(D){return function(){return D.apply(null,arguments)}},qe.cacheSignal=function(){return null},qe.cloneElement=function(D,F,te){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var U=v({},D.props),Q=D.key;if(F!=null)for(X in F.key!==void 0&&(Q=""+F.key),F)!I.call(F,X)||X==="key"||X==="__self"||X==="__source"||X==="ref"&&F.ref===void 0||(U[X]=F[X]);var X=arguments.length-2;if(X===1)U.children=te;else if(1<X){for(var se=Array(X),re=0;re<X;re++)se[re]=arguments[re+2];U.children=se}return L(D.type,Q,U)},qe.createContext=function(D){return D={$$typeof:l,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:a,_context:D},D},qe.createElement=function(D,F,te){var U,Q={},X=null;if(F!=null)for(U in F.key!==void 0&&(X=""+F.key),F)I.call(F,U)&&U!=="key"&&U!=="__self"&&U!=="__source"&&(Q[U]=F[U]);var se=arguments.length-2;if(se===1)Q.children=te;else if(1<se){for(var re=Array(se),ce=0;ce<se;ce++)re[ce]=arguments[ce+2];Q.children=re}if(D&&D.defaultProps)for(U in se=D.defaultProps,se)Q[U]===void 0&&(Q[U]=se[U]);return L(D,X,Q)},qe.createRef=function(){return{current:null}},qe.forwardRef=function(D){return{$$typeof:u,render:D}},qe.isValidElement=O,qe.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:K}},qe.memo=function(D,F){return{$$typeof:d,type:D,compare:F===void 0?null:F}},qe.startTransition=function(D){var F=A.T,te={};A.T=te;try{var U=D(),Q=A.S;Q!==null&&Q(te,U),typeof U=="object"&&U!==null&&typeof U.then=="function"&&U.then(T,Y)}catch(X){Y(X)}finally{F!==null&&te.types!==null&&(F.types=te.types),A.T=F}},qe.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},qe.use=function(D){return A.H.use(D)},qe.useActionState=function(D,F,te){return A.H.useActionState(D,F,te)},qe.useCallback=function(D,F){return A.H.useCallback(D,F)},qe.useContext=function(D){return A.H.useContext(D)},qe.useDebugValue=function(){},qe.useDeferredValue=function(D,F){return A.H.useDeferredValue(D,F)},qe.useEffect=function(D,F){return A.H.useEffect(D,F)},qe.useEffectEvent=function(D){return A.H.useEffectEvent(D)},qe.useId=function(){return A.H.useId()},qe.useImperativeHandle=function(D,F,te){return A.H.useImperativeHandle(D,F,te)},qe.useInsertionEffect=function(D,F){return A.H.useInsertionEffect(D,F)},qe.useLayoutEffect=function(D,F){return A.H.useLayoutEffect(D,F)},qe.useMemo=function(D,F){return A.H.useMemo(D,F)},qe.useOptimistic=function(D,F){return A.H.useOptimistic(D,F)},qe.useReducer=function(D,F,te){return A.H.useReducer(D,F,te)},qe.useRef=function(D){return A.H.useRef(D)},qe.useState=function(D){return A.H.useState(D)},qe.useSyncExternalStore=function(D,F,te){return A.H.useSyncExternalStore(D,F,te)},qe.useTransition=function(){return A.H.useTransition()},qe.version="19.2.6",qe}var NA;function Jd(){return NA||(NA=1,Sy.exports=m7()),Sy.exports}var E=Jd();const vo=Bm(E),c2=f7({__proto__:null,default:vo},[E]);var Ny={exports:{}},Lu={},ky={exports:{}},_y={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var kA;function g7(){return kA||(kA=1,(function(e){function t(q,V){var K=q.length;q.push(V);e:for(;0<K;){var Y=K-1>>>1,J=q[Y];if(0<r(J,V))q[Y]=V,q[K]=J,K=Y;else break e}}function n(q){return q.length===0?null:q[0]}function s(q){if(q.length===0)return null;var V=q[0],K=q.pop();if(K!==V){q[0]=K;e:for(var Y=0,J=q.length,D=J>>>1;Y<D;){var F=2*(Y+1)-1,te=q[F],U=F+1,Q=q[U];if(0>r(te,K))U<J&&0>r(Q,te)?(q[Y]=Q,q[U]=K,Y=U):(q[Y]=te,q[F]=K,Y=F);else if(U<J&&0>r(Q,K))q[Y]=Q,q[U]=K,Y=U;else break e}}return V}function r(q,V){var K=q.sortIndex-V.sortIndex;return K!==0?K:q.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],d=[],p=1,m=null,x=3,y=!1,b=!1,v=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function _(q){for(var V=n(d);V!==null;){if(V.callback===null)s(d);else if(V.startTime<=q)s(d),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(d)}}function R(q){if(v=!1,_(q),!b)if(n(f)!==null)b=!0,T||(T=!0,B());else{var V=n(d);V!==null&&G(R,V.startTime-q)}}var T=!1,A=-1,I=5,L=-1;function $(){return w?!0:!(e.unstable_now()-L<I)}function O(){if(w=!1,T){var q=e.unstable_now();L=q;var V=!0;try{e:{b=!1,v&&(v=!1,C(A),A=-1),y=!0;var K=x;try{t:{for(_(q),m=n(f);m!==null&&!(m.expirationTime>q&&$());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,x=m.priorityLevel;var J=Y(m.expirationTime<=q);if(q=e.unstable_now(),typeof J=="function"){m.callback=J,_(q),V=!0;break t}m===n(f)&&s(f),_(q)}else s(f);m=n(f)}if(m!==null)V=!0;else{var D=n(d);D!==null&&G(R,D.startTime-q),V=!1}}break e}finally{m=null,x=K,y=!1}V=void 0}}finally{V?B():T=!1}}}var B;if(typeof k=="function")B=function(){k(O)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,P=H.port2;H.port1.onmessage=O,B=function(){P.postMessage(null)}}else B=function(){S(O,0)};function G(q,V){A=S(function(){q(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(q){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var K=x;x=V;try{return q()}finally{x=K}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(q,V){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=x;x=q;try{return V()}finally{x=K}},e.unstable_scheduleCallback=function(q,V,K){var Y=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Y+K:Y):K=Y,q){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=K+J,q={id:p++,callback:V,priorityLevel:q,startTime:K,expirationTime:J,sortIndex:-1},K>Y?(q.sortIndex=K,t(d,q),n(f)===null&&q===n(d)&&(v?(C(A),A=-1):v=!0,G(R,K-Y))):(q.sortIndex=J,t(f,q),b||y||(b=!0,T||(T=!0,B()))),q},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(q){var V=x;return function(){var K=x;x=V;try{return q.apply(this,arguments)}finally{x=K}}}})(_y)),_y}var _A;function x7(){return _A||(_A=1,ky.exports=g7()),ky.exports}var Cy={exports:{}},gn={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var CA;function y7(){if(CA)return gn;CA=1;var e=Jd();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(f,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:m==null?null:""+m,children:f,containerInfo:d,implementation:p}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,gn.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return a(f,d,null,p)},gn.flushSync=function(f){var d=l.T,p=s.p;try{if(l.T=null,s.p=2,f)return f()}finally{l.T=d,s.p=p,s.d.f()}},gn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(f,d))},gn.prefetchDNS=function(f){typeof f=="string"&&s.d.D(f)},gn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?s.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:x,fetchPriority:y}):p==="script"&&s.d.X(f,{crossOrigin:m,integrity:x,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},gn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);s.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(f)},gn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin);s.d.L(f,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},gn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=u(d.as,d.crossOrigin);s.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(f)},gn.requestFormReset=function(f){s.d.r(f)},gn.unstable_batchedUpdates=function(f,d){return f(d)},gn.useFormState=function(f,d,p){return l.H.useFormState(f,d,p)},gn.useFormStatus=function(){return l.H.useHostTransitionStatus()},gn.version="19.2.6",gn}var EA;function $P(){if(EA)return Cy.exports;EA=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Cy.exports=y7(),Cy.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var RA;function v7(){if(RA)return Lu;RA=1;var e=x7(),t=Jd(),n=$P();function s(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var c=o,h=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(h=c.return),o=c.return;while(o)}return c.tag===3?h:null}function l(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(o.tag===31){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function f(o){if(a(o)!==o)throw Error(s(188))}function d(o){var c=o.alternate;if(!c){if(c=a(o),c===null)throw Error(s(188));return c!==o?null:o}for(var h=o,g=c;;){var j=h.return;if(j===null)break;var N=j.alternate;if(N===null){if(g=j.return,g!==null){h=g;continue}break}if(j.child===N.child){for(N=j.child;N;){if(N===h)return f(j),o;if(N===g)return f(j),c;N=N.sibling}throw Error(s(188))}if(h.return!==g.return)h=j,g=N;else{for(var M=!1,z=j.child;z;){if(z===h){M=!0,h=j,g=N;break}if(z===g){M=!0,g=j,h=N;break}z=z.sibling}if(!M){for(z=N.child;z;){if(z===h){M=!0,h=N,g=j;break}if(z===g){M=!0,g=N,h=j;break}z=z.sibling}if(!M)throw Error(s(189))}}if(h.alternate!==g)throw Error(s(190))}if(h.tag!==3)throw Error(s(188));return h.stateNode.current===h?o:c}function p(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=p(o),c!==null)return c;o=o.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),O=Symbol.iterator;function B(o){return o===null||typeof o!="object"?null:(o=O&&o[O]||o["@@iterator"],typeof o=="function"?o:null)}var H=Symbol.for("react.client.reference");function P(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===H?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case v:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case R:return"Suspense";case T:return"SuspenseList";case L:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case b:return"Portal";case k:return o.displayName||"Context";case C:return(o._context.displayName||"Context")+".Consumer";case _:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case A:return c=o.displayName||null,c!==null?c:P(o.type)||"Memo";case I:c=o._payload,o=o._init;try{return P(o(c))}catch{}}return null}var G=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Y=[],J=-1;function D(o){return{current:o}}function F(o){0>J||(o.current=Y[J],Y[J]=null,J--)}function te(o,c){J++,Y[J]=o.current,o.current=c}var U=D(null),Q=D(null),X=D(null),se=D(null);function re(o,c){switch(te(X,c),te(Q,o),te(U,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?HR(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=HR(c),o=UR(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}F(U),te(U,o)}function ce(){F(U),F(Q),F(X)}function me(o){o.memoizedState!==null&&te(se,o);var c=U.current,h=UR(c,o.type);c!==h&&(te(Q,o),te(U,h))}function ge(o){Q.current===o&&(F(U),F(Q)),se.current===o&&(F(se),Au._currentValue=K)}var ve,xe;function je(o){if(ve===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);ve=c&&c[1]||"",xe=-1<h.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+o+xe}var Se=!1;function $e(o,c){if(!o||Se)return"";Se=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(c){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var oe=le}Reflect.construct(o,[],fe)}else{try{fe.call()}catch(le){oe=le}o.call(fe.prototype)}}else{try{throw Error()}catch(le){oe=le}(fe=o())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&oe&&typeof le.stack=="string")return[le.stack,oe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=g.DetermineComponentFrameRoot(),M=N[0],z=N[1];if(M&&z){var Z=M.split(`
|
|
44
|
-
`),ae=z.split(`
|
|
45
|
-
`);for(j=g=0;g<Z.length&&!Z[g].includes("DetermineComponentFrameRoot");)g++;for(;j<ae.length&&!ae[j].includes("DetermineComponentFrameRoot");)j++;if(g===Z.length||j===ae.length)for(g=Z.length-1,j=ae.length-1;1<=g&&0<=j&&Z[g]!==ae[j];)j--;for(;1<=g&&0<=j;g--,j--)if(Z[g]!==ae[j]){if(g!==1||j!==1)do if(g--,j--,0>j||Z[g]!==ae[j]){var ue=`
|
|
46
|
-
`+Z[g].replace(" at new "," at ");return o.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",o.displayName)),ue}while(1<=g&&0<=j);break}}}finally{Se=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?je(h):""}function Re(o,c){switch(o.tag){case 26:case 27:case 5:return je(o.type);case 16:return je("Lazy");case 13:return o.child!==c&&c!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return $e(o.type,!1);case 11:return $e(o.type.render,!1);case 1:return $e(o.type,!0);case 31:return je("Activity");default:return""}}function xt(o){try{var c="",h=null;do c+=Re(o,h),h=o,o=o.return;while(o);return c}catch(g){return`
|
|
47
|
-
Error generating stack: `+g.message+`
|
|
48
|
-
`+g.stack}}var wt=Object.prototype.hasOwnProperty,Ot=e.unstable_scheduleCallback,fn=e.unstable_cancelCallback,Yt=e.unstable_shouldYield,jt=e.unstable_requestPaint,yt=e.unstable_now,Ke=e.unstable_getCurrentPriorityLevel,pt=e.unstable_ImmediatePriority,Qt=e.unstable_UserBlockingPriority,hn=e.unstable_NormalPriority,Do=e.unstable_LowPriority,pr=e.unstable_IdlePriority,zc=e.log,qo=e.unstable_setDisableYieldValue,pn=null,Et=null;function Gs(o){if(typeof zc=="function"&&qo(o),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(pn,o)}catch{}}var _n=Math.clz32?Math.clz32:cx,ox=Math.log,lx=Math.LN2;function cx(o){return o>>>=0,o===0?32:31-(ox(o)/lx|0)|0}var zo=256,Bo=262144,Fo=4194304;function mr(o){var c=o&42;if(c!==0)return c;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ho(o,c,h){var g=o.pendingLanes;if(g===0)return 0;var j=0,N=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var z=g&134217727;return z!==0?(g=z&~N,g!==0?j=mr(g):(M&=z,M!==0?j=mr(M):h||(h=z&~o,h!==0&&(j=mr(h))))):(z=g&~N,z!==0?j=mr(z):M!==0?j=mr(M):h||(h=g&~o,h!==0&&(j=mr(h)))),j===0?0:c!==0&&c!==j&&(c&N)===0&&(N=j&-j,h=c&-c,N>=h||N===32&&(h&4194048)!==0)?c:j}function ja(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function ux(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Cf(){var o=Fo;return Fo<<=1,(Fo&62914560)===0&&(Fo=4194304),o}function Bc(o){for(var c=[],h=0;31>h;h++)c.push(o);return c}function Sa(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function dx(o,c,h,g,j,N){var M=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var z=o.entanglements,Z=o.expirationTimes,ae=o.hiddenUpdates;for(h=M&~h;0<h;){var ue=31-_n(h),fe=1<<ue;z[ue]=0,Z[ue]=-1;var oe=ae[ue];if(oe!==null)for(ae[ue]=null,ue=0;ue<oe.length;ue++){var le=oe[ue];le!==null&&(le.lane&=-536870913)}h&=~fe}g!==0&&Ef(o,g,0),N!==0&&j===0&&o.tag!==0&&(o.suspendedLanes|=N&~(M&~c))}function Ef(o,c,h){o.pendingLanes|=c,o.suspendedLanes&=~c;var g=31-_n(c);o.entangledLanes|=c,o.entanglements[g]=o.entanglements[g]|1073741824|h&261930}function Rf(o,c){var h=o.entangledLanes|=c;for(o=o.entanglements;h;){var g=31-_n(h),j=1<<g;j&c|o[g]&c&&(o[g]|=c),h&=~j}}function Af(o,c){var h=c&-c;return h=(h&42)!==0?1:Fc(h),(h&(o.suspendedLanes|c))!==0?0:h}function Fc(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Hc(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Tf(){var o=V.p;return o!==0?o:(o=window.event,o===void 0?32:hA(o.type))}function If(o,c){var h=V.p;try{return V.p=o,c()}finally{V.p=h}}var Ks=Math.random().toString(36).slice(2),Xt="__reactFiber$"+Ks,mn="__reactProps$"+Ks,gr="__reactContainer$"+Ks,Uo="__reactEvents$"+Ks,Mf="__reactListeners$"+Ks,fx="__reactHandles$"+Ks,Of="__reactResources$"+Ks,Na="__reactMarker$"+Ks;function Uc(o){delete o[Xt],delete o[mn],delete o[Uo],delete o[Mf],delete o[fx]}function ri(o){var c=o[Xt];if(c)return c;for(var h=o.parentNode;h;){if(c=h[gr]||h[Xt]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(o=XR(o);o!==null;){if(h=o[Xt])return h;o=XR(o)}return c}o=h,h=o.parentNode}return null}function ii(o){if(o=o[Xt]||o[gr]){var c=o.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return o}return null}function ai(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(s(33))}function oi(o){var c=o[Of];return c||(c=o[Of]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function Bt(o){o[Na]=!0}var Lf=new Set,Pf={};function xr(o,c){li(o,c),li(o+"Capture",c)}function li(o,c){for(Pf[o]=c,o=0;o<c.length;o++)Lf.add(c[o])}var hx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Vc={},$f={};function px(o){return wt.call($f,o)?!0:wt.call(Vc,o)?!1:hx.test(o)?$f[o]=!0:(Vc[o]=!0,!1)}function Vo(o,c,h){if(px(c))if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+h)}}function Go(o,c,h){if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+h)}}function Cs(o,c,h,g){if(g===null)o.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(h);return}o.setAttributeNS(c,h,""+g)}}function Tn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Df(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function mx(o,c,h){var g=Object.getOwnPropertyDescriptor(o.constructor.prototype,c);if(!o.hasOwnProperty(c)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var j=g.get,N=g.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return j.call(this)},set:function(M){h=""+M,N.call(this,M)}}),Object.defineProperty(o,c,{enumerable:g.enumerable}),{getValue:function(){return h},setValue:function(M){h=""+M},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function ci(o){if(!o._valueTracker){var c=Df(o)?"checked":"value";o._valueTracker=mx(o,c,""+o[c])}}function qf(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var h=c.getValue(),g="";return o&&(g=Df(o)?o.checked?"true":"false":o.value),o=g,o!==h?(c.setValue(o),!0):!1}function ka(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var gx=/[\n"\\]/g;function In(o){return o.replace(gx,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function _a(o,c,h,g,j,N,M,z){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),c!=null?M==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Tn(c)):o.value!==""+Tn(c)&&(o.value=""+Tn(c)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),c!=null?Gc(o,M,Tn(c)):h!=null?Gc(o,M,Tn(h)):g!=null&&o.removeAttribute("value"),j==null&&N!=null&&(o.defaultChecked=!!N),j!=null&&(o.checked=j&&typeof j!="function"&&typeof j!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?o.name=""+Tn(z):o.removeAttribute("name")}function zf(o,c,h,g,j,N,M,z){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(o.type=N),c!=null||h!=null){if(!(N!=="submit"&&N!=="reset"||c!=null)){ci(o);return}h=h!=null?""+Tn(h):"",c=c!=null?""+Tn(c):h,z||c===o.value||(o.value=c),o.defaultValue=c}g=g??j,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=z?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),ci(o)}function Gc(o,c,h){c==="number"&&ka(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function yr(o,c,h,g){if(o=o.options,c){c={};for(var j=0;j<h.length;j++)c["$"+h[j]]=!0;for(h=0;h<o.length;h++)j=c.hasOwnProperty("$"+o[h].value),o[h].selected!==j&&(o[h].selected=j),j&&g&&(o[h].defaultSelected=!0)}else{for(h=""+Tn(h),c=null,j=0;j<o.length;j++){if(o[j].value===h){o[j].selected=!0,g&&(o[j].defaultSelected=!0);return}c!==null||o[j].disabled||(c=o[j])}c!==null&&(c.selected=!0)}}function D_(o,c,h){if(c!=null&&(c=""+Tn(c),c!==o.value&&(o.value=c),h==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=h!=null?""+Tn(h):""}function q_(o,c,h,g){if(c==null){if(g!=null){if(h!=null)throw Error(s(92));if(G(g)){if(1<g.length)throw Error(s(93));g=g[0]}h=g}h==null&&(h=""),c=h}h=Tn(c),o.defaultValue=h,g=o.textContent,g===h&&g!==""&&g!==null&&(o.value=g),ci(o)}function Ko(o,c){if(c){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=c;return}}o.textContent=c}var iB=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function z_(o,c,h){var g=c.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?g?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":g?o.setProperty(c,h):typeof h!="number"||h===0||iB.has(c)?c==="float"?o.cssFloat=h:o[c]=(""+h).trim():o[c]=h+"px"}function B_(o,c,h){if(c!=null&&typeof c!="object")throw Error(s(62));if(o=o.style,h!=null){for(var g in h)!h.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var j in c)g=c[j],c.hasOwnProperty(j)&&h[j]!==g&&z_(o,j,g)}else for(var N in c)c.hasOwnProperty(N)&&z_(o,N,c[N])}function xx(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var aB=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),oB=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bf(o){return oB.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function vr(){}var yx=null;function vx(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Wo=null,Yo=null;function F_(o){var c=ii(o);if(c&&(o=c.stateNode)){var h=o[mn]||null;e:switch(o=c.stateNode,c.type){case"input":if(_a(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),c=h.name,h.type==="radio"&&c!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+In(""+c)+'"][type="radio"]'),c=0;c<h.length;c++){var g=h[c];if(g!==o&&g.form===o.form){var j=g[mn]||null;if(!j)throw Error(s(90));_a(g,j.value,j.defaultValue,j.defaultValue,j.checked,j.defaultChecked,j.type,j.name)}}for(c=0;c<h.length;c++)g=h[c],g.form===o.form&&qf(g)}break e;case"textarea":D_(o,h.value,h.defaultValue);break e;case"select":c=h.value,c!=null&&yr(o,!!h.multiple,c,!1)}}}var bx=!1;function H_(o,c,h){if(bx)return o(c,h);bx=!0;try{var g=o(c);return g}finally{if(bx=!1,(Wo!==null||Yo!==null)&&(Eh(),Wo&&(c=Wo,o=Yo,Yo=Wo=null,F_(c),o)))for(c=0;c<o.length;c++)F_(o[c])}}function Kc(o,c){var h=o.stateNode;if(h===null)return null;var g=h[mn]||null;if(g===null)return null;h=g[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(s(231,c,typeof h));return h}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wx=!1;if(br)try{var Wc={};Object.defineProperty(Wc,"passive",{get:function(){wx=!0}}),window.addEventListener("test",Wc,Wc),window.removeEventListener("test",Wc,Wc)}catch{wx=!1}var ui=null,jx=null,Ff=null;function U_(){if(Ff)return Ff;var o,c=jx,h=c.length,g,j="value"in ui?ui.value:ui.textContent,N=j.length;for(o=0;o<h&&c[o]===j[o];o++);var M=h-o;for(g=1;g<=M&&c[h-g]===j[N-g];g++);return Ff=j.slice(o,1<g?1-g:void 0)}function Hf(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function Uf(){return!0}function V_(){return!1}function Mn(o){function c(h,g,j,N,M){this._reactName=h,this._targetInst=j,this.type=g,this.nativeEvent=N,this.target=M,this.currentTarget=null;for(var z in o)o.hasOwnProperty(z)&&(h=o[z],this[z]=h?h(N):N[z]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Uf:V_,this.isPropagationStopped=V_,this}return m(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Uf)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Uf)},persist:function(){},isPersistent:Uf}),c}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vf=Mn(Ca),Yc=m({},Ca,{view:0,detail:0}),lB=Mn(Yc),Sx,Nx,Qc,Gf=m({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_x,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Qc&&(Qc&&o.type==="mousemove"?(Sx=o.screenX-Qc.screenX,Nx=o.screenY-Qc.screenY):Nx=Sx=0,Qc=o),Sx)},movementY:function(o){return"movementY"in o?o.movementY:Nx}}),G_=Mn(Gf),cB=m({},Gf,{dataTransfer:0}),uB=Mn(cB),dB=m({},Yc,{relatedTarget:0}),kx=Mn(dB),fB=m({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),hB=Mn(fB),pB=m({},Ca,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),mB=Mn(pB),gB=m({},Ca,{data:0}),K_=Mn(gB),xB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yB={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},vB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bB(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=vB[o])?!!c[o]:!1}function _x(){return bB}var wB=m({},Yc,{key:function(o){if(o.key){var c=xB[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=Hf(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?yB[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_x,charCode:function(o){return o.type==="keypress"?Hf(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Hf(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),jB=Mn(wB),SB=m({},Gf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),W_=Mn(SB),NB=m({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_x}),kB=Mn(NB),_B=m({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),CB=Mn(_B),EB=m({},Gf,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),RB=Mn(EB),AB=m({},Ca,{newState:0,oldState:0}),TB=Mn(AB),IB=[9,13,27,32],Cx=br&&"CompositionEvent"in window,Xc=null;br&&"documentMode"in document&&(Xc=document.documentMode);var MB=br&&"TextEvent"in window&&!Xc,Y_=br&&(!Cx||Xc&&8<Xc&&11>=Xc),Q_=" ",X_=!1;function Z_(o,c){switch(o){case"keyup":return IB.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function J_(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qo=!1;function OB(o,c){switch(o){case"compositionend":return J_(c);case"keypress":return c.which!==32?null:(X_=!0,Q_);case"textInput":return o=c.data,o===Q_&&X_?null:o;default:return null}}function LB(o,c){if(Qo)return o==="compositionend"||!Cx&&Z_(o,c)?(o=U_(),Ff=jx=ui=null,Qo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return Y_&&c.locale!=="ko"?null:c.data;default:return null}}var PB={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function eC(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!PB[o.type]:c==="textarea"}function tC(o,c,h,g){Wo?Yo?Yo.push(g):Yo=[g]:Wo=g,c=Lh(c,"onChange"),0<c.length&&(h=new Vf("onChange","change",null,h,g),o.push({event:h,listeners:c}))}var Zc=null,Jc=null;function $B(o){$R(o,0)}function Kf(o){var c=ai(o);if(qf(c))return o}function nC(o,c){if(o==="change")return c}var sC=!1;if(br){var Ex;if(br){var Rx="oninput"in document;if(!Rx){var rC=document.createElement("div");rC.setAttribute("oninput","return;"),Rx=typeof rC.oninput=="function"}Ex=Rx}else Ex=!1;sC=Ex&&(!document.documentMode||9<document.documentMode)}function iC(){Zc&&(Zc.detachEvent("onpropertychange",aC),Jc=Zc=null)}function aC(o){if(o.propertyName==="value"&&Kf(Jc)){var c=[];tC(c,Jc,o,vx(o)),H_($B,c)}}function DB(o,c,h){o==="focusin"?(iC(),Zc=c,Jc=h,Zc.attachEvent("onpropertychange",aC)):o==="focusout"&&iC()}function qB(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Kf(Jc)}function zB(o,c){if(o==="click")return Kf(c)}function BB(o,c){if(o==="input"||o==="change")return Kf(c)}function FB(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Yn=typeof Object.is=="function"?Object.is:FB;function eu(o,c){if(Yn(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var h=Object.keys(o),g=Object.keys(c);if(h.length!==g.length)return!1;for(g=0;g<h.length;g++){var j=h[g];if(!wt.call(c,j)||!Yn(o[j],c[j]))return!1}return!0}function oC(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function lC(o,c){var h=oC(o);o=0;for(var g;h;){if(h.nodeType===3){if(g=o+h.textContent.length,o<=c&&g>=c)return{node:h,offset:c-o};o=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=oC(h)}}function cC(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?cC(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function uC(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=ka(o.document);c instanceof o.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)o=c.contentWindow;else break;c=ka(o.document)}return c}function Ax(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var HB=br&&"documentMode"in document&&11>=document.documentMode,Xo=null,Tx=null,tu=null,Ix=!1;function dC(o,c,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Ix||Xo==null||Xo!==ka(g)||(g=Xo,"selectionStart"in g&&Ax(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),tu&&eu(tu,g)||(tu=g,g=Lh(Tx,"onSelect"),0<g.length&&(c=new Vf("onSelect","select",null,c,h),o.push({event:c,listeners:g}),c.target=Xo)))}function Ea(o,c){var h={};return h[o.toLowerCase()]=c.toLowerCase(),h["Webkit"+o]="webkit"+c,h["Moz"+o]="moz"+c,h}var Zo={animationend:Ea("Animation","AnimationEnd"),animationiteration:Ea("Animation","AnimationIteration"),animationstart:Ea("Animation","AnimationStart"),transitionrun:Ea("Transition","TransitionRun"),transitionstart:Ea("Transition","TransitionStart"),transitioncancel:Ea("Transition","TransitionCancel"),transitionend:Ea("Transition","TransitionEnd")},Mx={},fC={};br&&(fC=document.createElement("div").style,"AnimationEvent"in window||(delete Zo.animationend.animation,delete Zo.animationiteration.animation,delete Zo.animationstart.animation),"TransitionEvent"in window||delete Zo.transitionend.transition);function Ra(o){if(Mx[o])return Mx[o];if(!Zo[o])return o;var c=Zo[o],h;for(h in c)if(c.hasOwnProperty(h)&&h in fC)return Mx[o]=c[h];return o}var hC=Ra("animationend"),pC=Ra("animationiteration"),mC=Ra("animationstart"),UB=Ra("transitionrun"),VB=Ra("transitionstart"),GB=Ra("transitioncancel"),gC=Ra("transitionend"),xC=new Map,Ox="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ox.push("scrollEnd");function Es(o,c){xC.set(o,c),xr(c,[o])}var Wf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},cs=[],Jo=0,Lx=0;function Yf(){for(var o=Jo,c=Lx=Jo=0;c<o;){var h=cs[c];cs[c++]=null;var g=cs[c];cs[c++]=null;var j=cs[c];cs[c++]=null;var N=cs[c];if(cs[c++]=null,g!==null&&j!==null){var M=g.pending;M===null?j.next=j:(j.next=M.next,M.next=j),g.pending=j}N!==0&&yC(h,j,N)}}function Qf(o,c,h,g){cs[Jo++]=o,cs[Jo++]=c,cs[Jo++]=h,cs[Jo++]=g,Lx|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function Px(o,c,h,g){return Qf(o,c,h,g),Xf(o)}function Aa(o,c){return Qf(o,null,null,c),Xf(o)}function yC(o,c,h){o.lanes|=h;var g=o.alternate;g!==null&&(g.lanes|=h);for(var j=!1,N=o.return;N!==null;)N.childLanes|=h,g=N.alternate,g!==null&&(g.childLanes|=h),N.tag===22&&(o=N.stateNode,o===null||o._visibility&1||(j=!0)),o=N,N=N.return;return o.tag===3?(N=o.stateNode,j&&c!==null&&(j=31-_n(h),o=N.hiddenUpdates,g=o[j],g===null?o[j]=[c]:g.push(c),c.lane=h|536870912),N):null}function Xf(o){if(50<Su)throw Su=0,V0=null,Error(s(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var el={};function KB(o,c,h,g){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(o,c,h,g){return new KB(o,c,h,g)}function $x(o){return o=o.prototype,!(!o||!o.isReactComponent)}function wr(o,c){var h=o.alternate;return h===null?(h=Qn(o.tag,c,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=c,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&65011712,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,c=o.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h.refCleanup=o.refCleanup,h}function vC(o,c){o.flags&=65011714;var h=o.alternate;return h===null?(o.childLanes=0,o.lanes=c,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=h.childLanes,o.lanes=h.lanes,o.child=h.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=h.memoizedProps,o.memoizedState=h.memoizedState,o.updateQueue=h.updateQueue,o.type=h.type,c=h.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function Zf(o,c,h,g,j,N){var M=0;if(g=o,typeof o=="function")$x(o)&&(M=1);else if(typeof o=="string")M=ZF(o,h,U.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case L:return o=Qn(31,h,c,j),o.elementType=L,o.lanes=N,o;case v:return Ta(h.children,j,N,c);case w:M=8,j|=24;break;case S:return o=Qn(12,h,c,j|2),o.elementType=S,o.lanes=N,o;case R:return o=Qn(13,h,c,j),o.elementType=R,o.lanes=N,o;case T:return o=Qn(19,h,c,j),o.elementType=T,o.lanes=N,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case k:M=10;break e;case C:M=9;break e;case _:M=11;break e;case A:M=14;break e;case I:M=16,g=null;break e}M=29,h=Error(s(130,o===null?"null":typeof o,"")),g=null}return c=Qn(M,h,c,j),c.elementType=o,c.type=g,c.lanes=N,c}function Ta(o,c,h,g){return o=Qn(7,o,g,c),o.lanes=h,o}function Dx(o,c,h){return o=Qn(6,o,null,c),o.lanes=h,o}function bC(o){var c=Qn(18,null,null,0);return c.stateNode=o,c}function qx(o,c,h){return c=Qn(4,o.children!==null?o.children:[],o.key,c),c.lanes=h,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var wC=new WeakMap;function us(o,c){if(typeof o=="object"&&o!==null){var h=wC.get(o);return h!==void 0?h:(c={value:o,source:c,stack:xt(c)},wC.set(o,c),c)}return{value:o,source:c,stack:xt(c)}}var tl=[],nl=0,Jf=null,nu=0,ds=[],fs=0,di=null,Ws=1,Ys="";function jr(o,c){tl[nl++]=nu,tl[nl++]=Jf,Jf=o,nu=c}function jC(o,c,h){ds[fs++]=Ws,ds[fs++]=Ys,ds[fs++]=di,di=o;var g=Ws;o=Ys;var j=32-_n(g)-1;g&=~(1<<j),h+=1;var N=32-_n(c)+j;if(30<N){var M=j-j%5;N=(g&(1<<M)-1).toString(32),g>>=M,j-=M,Ws=1<<32-_n(c)+j|h<<j|g,Ys=N+o}else Ws=1<<N|h<<j|g,Ys=o}function zx(o){o.return!==null&&(jr(o,1),jC(o,1,0))}function Bx(o){for(;o===Jf;)Jf=tl[--nl],tl[nl]=null,nu=tl[--nl],tl[nl]=null;for(;o===di;)di=ds[--fs],ds[fs]=null,Ys=ds[--fs],ds[fs]=null,Ws=ds[--fs],ds[fs]=null}function SC(o,c){ds[fs++]=Ws,ds[fs++]=Ys,ds[fs++]=di,Ws=c.id,Ys=c.overflow,di=o}var rn=null,vt=null,Ze=!1,fi=null,hs=!1,Fx=Error(s(519));function hi(o){var c=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw su(us(c,o)),Fx}function NC(o){var c=o.stateNode,h=o.type,g=o.memoizedProps;switch(c[Xt]=o,c[mn]=g,h){case"dialog":Ye("cancel",c),Ye("close",c);break;case"iframe":case"object":case"embed":Ye("load",c);break;case"video":case"audio":for(h=0;h<ku.length;h++)Ye(ku[h],c);break;case"source":Ye("error",c);break;case"img":case"image":case"link":Ye("error",c),Ye("load",c);break;case"details":Ye("toggle",c);break;case"input":Ye("invalid",c),zf(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Ye("invalid",c);break;case"textarea":Ye("invalid",c),q_(c,g.value,g.defaultValue,g.children)}h=g.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||c.textContent===""+h||g.suppressHydrationWarning===!0||BR(c.textContent,h)?(g.popover!=null&&(Ye("beforetoggle",c),Ye("toggle",c)),g.onScroll!=null&&Ye("scroll",c),g.onScrollEnd!=null&&Ye("scrollend",c),g.onClick!=null&&(c.onclick=vr),c=!0):c=!1,c||hi(o,!0)}function kC(o){for(rn=o.return;rn;)switch(rn.tag){case 5:case 31:case 13:hs=!1;return;case 27:case 3:hs=!0;return;default:rn=rn.return}}function sl(o){if(o!==rn)return!1;if(!Ze)return kC(o),Ze=!0,!1;var c=o.tag,h;if((h=c!==3&&c!==27)&&((h=c===5)&&(h=o.type,h=!(h!=="form"&&h!=="button")||ay(o.type,o.memoizedProps)),h=!h),h&&vt&&hi(o),kC(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));vt=QR(o)}else if(c===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));vt=QR(o)}else c===27?(c=vt,Ci(o.type)?(o=dy,dy=null,vt=o):vt=c):vt=rn?ms(o.stateNode.nextSibling):null;return!0}function Ia(){vt=rn=null,Ze=!1}function Hx(){var o=fi;return o!==null&&($n===null?$n=o:$n.push.apply($n,o),fi=null),o}function su(o){fi===null?fi=[o]:fi.push(o)}var Ux=D(null),Ma=null,Sr=null;function pi(o,c,h){te(Ux,c._currentValue),c._currentValue=h}function Nr(o){o._currentValue=Ux.current,F(Ux)}function Vx(o,c,h){for(;o!==null;){var g=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),o===h)break;o=o.return}}function Gx(o,c,h,g){var j=o.child;for(j!==null&&(j.return=o);j!==null;){var N=j.dependencies;if(N!==null){var M=j.child;N=N.firstContext;e:for(;N!==null;){var z=N;N=j;for(var Z=0;Z<c.length;Z++)if(z.context===c[Z]){N.lanes|=h,z=N.alternate,z!==null&&(z.lanes|=h),Vx(N.return,h,o),g||(M=null);break e}N=z.next}}else if(j.tag===18){if(M=j.return,M===null)throw Error(s(341));M.lanes|=h,N=M.alternate,N!==null&&(N.lanes|=h),Vx(M,h,o),M=null}else M=j.child;if(M!==null)M.return=j;else for(M=j;M!==null;){if(M===o){M=null;break}if(j=M.sibling,j!==null){j.return=M.return,M=j;break}M=M.return}j=M}}function rl(o,c,h,g){o=null;for(var j=c,N=!1;j!==null;){if(!N){if((j.flags&524288)!==0)N=!0;else if((j.flags&262144)!==0)break}if(j.tag===10){var M=j.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var z=j.type;Yn(j.pendingProps.value,M.value)||(o!==null?o.push(z):o=[z])}}else if(j===se.current){if(M=j.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==j.memoizedState.memoizedState&&(o!==null?o.push(Au):o=[Au])}j=j.return}o!==null&&Gx(c,o,h,g),c.flags|=262144}function eh(o){for(o=o.firstContext;o!==null;){if(!Yn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Oa(o){Ma=o,Sr=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function an(o){return _C(Ma,o)}function th(o,c){return Ma===null&&Oa(o),_C(o,c)}function _C(o,c){var h=c._currentValue;if(c={context:c,memoizedValue:h,next:null},Sr===null){if(o===null)throw Error(s(308));Sr=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else Sr=Sr.next=c;return h}var WB=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(h,g){o.push(g)}};this.abort=function(){c.aborted=!0,o.forEach(function(h){return h()})}},YB=e.unstable_scheduleCallback,QB=e.unstable_NormalPriority,Ft={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kx(){return{controller:new WB,data:new Map,refCount:0}}function ru(o){o.refCount--,o.refCount===0&&YB(QB,function(){o.controller.abort()})}var iu=null,Wx=0,il=0,al=null;function XB(o,c){if(iu===null){var h=iu=[];Wx=0,il=X0(),al={status:"pending",value:void 0,then:function(g){h.push(g)}}}return Wx++,c.then(CC,CC),c}function CC(){if(--Wx===0&&iu!==null){al!==null&&(al.status="fulfilled");var o=iu;iu=null,il=0,al=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function ZB(o,c){var h=[],g={status:"pending",value:null,reason:null,then:function(j){h.push(j)}};return o.then(function(){g.status="fulfilled",g.value=c;for(var j=0;j<h.length;j++)(0,h[j])(c)},function(j){for(g.status="rejected",g.reason=j,j=0;j<h.length;j++)(0,h[j])(void 0)}),g}var EC=q.S;q.S=function(o,c){dR=yt(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&XB(o,c),EC!==null&&EC(o,c)};var La=D(null);function Yx(){var o=La.current;return o!==null?o:ht.pooledCache}function nh(o,c){c===null?te(La,La.current):te(La,c.pool)}function RC(){var o=Yx();return o===null?null:{parent:Ft._currentValue,pool:o}}var ol=Error(s(460)),Qx=Error(s(474)),sh=Error(s(542)),rh={then:function(){}};function AC(o){return o=o.status,o==="fulfilled"||o==="rejected"}function TC(o,c,h){switch(h=o[h],h===void 0?o.push(c):h!==c&&(c.then(vr,vr),c=h),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,MC(o),o;default:if(typeof c.status=="string")c.then(vr,vr);else{if(o=ht,o!==null&&100<o.shellSuspendCounter)throw Error(s(482));o=c,o.status="pending",o.then(function(g){if(c.status==="pending"){var j=c;j.status="fulfilled",j.value=g}},function(g){if(c.status==="pending"){var j=c;j.status="rejected",j.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,MC(o),o}throw $a=c,ol}}function Pa(o){try{var c=o._init;return c(o._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?($a=h,ol):h}}var $a=null;function IC(){if($a===null)throw Error(s(459));var o=$a;return $a=null,o}function MC(o){if(o===ol||o===sh)throw Error(s(483))}var ll=null,au=0;function ih(o){var c=au;return au+=1,ll===null&&(ll=[]),TC(ll,o,c)}function ou(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function ah(o,c){throw c.$$typeof===x?Error(s(525)):(o=Object.prototype.toString.call(c),Error(s(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function OC(o){function c(ne,ee){if(o){var ie=ne.deletions;ie===null?(ne.deletions=[ee],ne.flags|=16):ie.push(ee)}}function h(ne,ee){if(!o)return null;for(;ee!==null;)c(ne,ee),ee=ee.sibling;return null}function g(ne){for(var ee=new Map;ne!==null;)ne.key!==null?ee.set(ne.key,ne):ee.set(ne.index,ne),ne=ne.sibling;return ee}function j(ne,ee){return ne=wr(ne,ee),ne.index=0,ne.sibling=null,ne}function N(ne,ee,ie){return ne.index=ie,o?(ie=ne.alternate,ie!==null?(ie=ie.index,ie<ee?(ne.flags|=67108866,ee):ie):(ne.flags|=67108866,ee)):(ne.flags|=1048576,ee)}function M(ne){return o&&ne.alternate===null&&(ne.flags|=67108866),ne}function z(ne,ee,ie,de){return ee===null||ee.tag!==6?(ee=Dx(ie,ne.mode,de),ee.return=ne,ee):(ee=j(ee,ie),ee.return=ne,ee)}function Z(ne,ee,ie,de){var Ee=ie.type;return Ee===v?ue(ne,ee,ie.props.children,de,ie.key):ee!==null&&(ee.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===I&&Pa(Ee)===ee.type)?(ee=j(ee,ie.props),ou(ee,ie),ee.return=ne,ee):(ee=Zf(ie.type,ie.key,ie.props,null,ne.mode,de),ou(ee,ie),ee.return=ne,ee)}function ae(ne,ee,ie,de){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=qx(ie,ne.mode,de),ee.return=ne,ee):(ee=j(ee,ie.children||[]),ee.return=ne,ee)}function ue(ne,ee,ie,de,Ee){return ee===null||ee.tag!==7?(ee=Ta(ie,ne.mode,de,Ee),ee.return=ne,ee):(ee=j(ee,ie),ee.return=ne,ee)}function fe(ne,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=Dx(""+ee,ne.mode,ie),ee.return=ne,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ie=Zf(ee.type,ee.key,ee.props,null,ne.mode,ie),ou(ie,ee),ie.return=ne,ie;case b:return ee=qx(ee,ne.mode,ie),ee.return=ne,ee;case I:return ee=Pa(ee),fe(ne,ee,ie)}if(G(ee)||B(ee))return ee=Ta(ee,ne.mode,ie,null),ee.return=ne,ee;if(typeof ee.then=="function")return fe(ne,ih(ee),ie);if(ee.$$typeof===k)return fe(ne,th(ne,ee),ie);ah(ne,ee)}return null}function oe(ne,ee,ie,de){var Ee=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Ee!==null?null:z(ne,ee,""+ie,de);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return ie.key===Ee?Z(ne,ee,ie,de):null;case b:return ie.key===Ee?ae(ne,ee,ie,de):null;case I:return ie=Pa(ie),oe(ne,ee,ie,de)}if(G(ie)||B(ie))return Ee!==null?null:ue(ne,ee,ie,de,null);if(typeof ie.then=="function")return oe(ne,ee,ih(ie),de);if(ie.$$typeof===k)return oe(ne,ee,th(ne,ie),de);ah(ne,ie)}return null}function le(ne,ee,ie,de,Ee){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return ne=ne.get(ie)||null,z(ee,ne,""+de,Ee);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return ne=ne.get(de.key===null?ie:de.key)||null,Z(ee,ne,de,Ee);case b:return ne=ne.get(de.key===null?ie:de.key)||null,ae(ee,ne,de,Ee);case I:return de=Pa(de),le(ne,ee,ie,de,Ee)}if(G(de)||B(de))return ne=ne.get(ie)||null,ue(ee,ne,de,Ee,null);if(typeof de.then=="function")return le(ne,ee,ie,ih(de),Ee);if(de.$$typeof===k)return le(ne,ee,ie,th(ee,de),Ee);ah(ee,de)}return null}function we(ne,ee,ie,de){for(var Ee=null,tt=null,Ce=ee,He=ee=0,Xe=null;Ce!==null&&He<ie.length;He++){Ce.index>He?(Xe=Ce,Ce=null):Xe=Ce.sibling;var nt=oe(ne,Ce,ie[He],de);if(nt===null){Ce===null&&(Ce=Xe);break}o&&Ce&&nt.alternate===null&&c(ne,Ce),ee=N(nt,ee,He),tt===null?Ee=nt:tt.sibling=nt,tt=nt,Ce=Xe}if(He===ie.length)return h(ne,Ce),Ze&&jr(ne,He),Ee;if(Ce===null){for(;He<ie.length;He++)Ce=fe(ne,ie[He],de),Ce!==null&&(ee=N(Ce,ee,He),tt===null?Ee=Ce:tt.sibling=Ce,tt=Ce);return Ze&&jr(ne,He),Ee}for(Ce=g(Ce);He<ie.length;He++)Xe=le(Ce,ne,He,ie[He],de),Xe!==null&&(o&&Xe.alternate!==null&&Ce.delete(Xe.key===null?He:Xe.key),ee=N(Xe,ee,He),tt===null?Ee=Xe:tt.sibling=Xe,tt=Xe);return o&&Ce.forEach(function(Ii){return c(ne,Ii)}),Ze&&jr(ne,He),Ee}function Te(ne,ee,ie,de){if(ie==null)throw Error(s(151));for(var Ee=null,tt=null,Ce=ee,He=ee=0,Xe=null,nt=ie.next();Ce!==null&&!nt.done;He++,nt=ie.next()){Ce.index>He?(Xe=Ce,Ce=null):Xe=Ce.sibling;var Ii=oe(ne,Ce,nt.value,de);if(Ii===null){Ce===null&&(Ce=Xe);break}o&&Ce&&Ii.alternate===null&&c(ne,Ce),ee=N(Ii,ee,He),tt===null?Ee=Ii:tt.sibling=Ii,tt=Ii,Ce=Xe}if(nt.done)return h(ne,Ce),Ze&&jr(ne,He),Ee;if(Ce===null){for(;!nt.done;He++,nt=ie.next())nt=fe(ne,nt.value,de),nt!==null&&(ee=N(nt,ee,He),tt===null?Ee=nt:tt.sibling=nt,tt=nt);return Ze&&jr(ne,He),Ee}for(Ce=g(Ce);!nt.done;He++,nt=ie.next())nt=le(Ce,ne,He,nt.value,de),nt!==null&&(o&&nt.alternate!==null&&Ce.delete(nt.key===null?He:nt.key),ee=N(nt,ee,He),tt===null?Ee=nt:tt.sibling=nt,tt=nt);return o&&Ce.forEach(function(c7){return c(ne,c7)}),Ze&&jr(ne,He),Ee}function ft(ne,ee,ie,de){if(typeof ie=="object"&&ie!==null&&ie.type===v&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:e:{for(var Ee=ie.key;ee!==null;){if(ee.key===Ee){if(Ee=ie.type,Ee===v){if(ee.tag===7){h(ne,ee.sibling),de=j(ee,ie.props.children),de.return=ne,ne=de;break e}}else if(ee.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===I&&Pa(Ee)===ee.type){h(ne,ee.sibling),de=j(ee,ie.props),ou(de,ie),de.return=ne,ne=de;break e}h(ne,ee);break}else c(ne,ee);ee=ee.sibling}ie.type===v?(de=Ta(ie.props.children,ne.mode,de,ie.key),de.return=ne,ne=de):(de=Zf(ie.type,ie.key,ie.props,null,ne.mode,de),ou(de,ie),de.return=ne,ne=de)}return M(ne);case b:e:{for(Ee=ie.key;ee!==null;){if(ee.key===Ee)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){h(ne,ee.sibling),de=j(ee,ie.children||[]),de.return=ne,ne=de;break e}else{h(ne,ee);break}else c(ne,ee);ee=ee.sibling}de=qx(ie,ne.mode,de),de.return=ne,ne=de}return M(ne);case I:return ie=Pa(ie),ft(ne,ee,ie,de)}if(G(ie))return we(ne,ee,ie,de);if(B(ie)){if(Ee=B(ie),typeof Ee!="function")throw Error(s(150));return ie=Ee.call(ie),Te(ne,ee,ie,de)}if(typeof ie.then=="function")return ft(ne,ee,ih(ie),de);if(ie.$$typeof===k)return ft(ne,ee,th(ne,ie),de);ah(ne,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,ee!==null&&ee.tag===6?(h(ne,ee.sibling),de=j(ee,ie),de.return=ne,ne=de):(h(ne,ee),de=Dx(ie,ne.mode,de),de.return=ne,ne=de),M(ne)):h(ne,ee)}return function(ne,ee,ie,de){try{au=0;var Ee=ft(ne,ee,ie,de);return ll=null,Ee}catch(Ce){if(Ce===ol||Ce===sh)throw Ce;var tt=Qn(29,Ce,null,ne.mode);return tt.lanes=de,tt.return=ne,tt}finally{}}}var Da=OC(!0),LC=OC(!1),mi=!1;function Xx(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zx(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function gi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function xi(o,c,h){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(rt&2)!==0){var j=g.pending;return j===null?c.next=c:(c.next=j.next,j.next=c),g.pending=c,c=Xf(o),yC(o,null,h),c}return Qf(o,g,c,h),Xf(o)}function lu(o,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194048)!==0)){var g=c.lanes;g&=o.pendingLanes,h|=g,c.lanes=h,Rf(o,h)}}function Jx(o,c){var h=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var j=null,N=null;if(h=h.firstBaseUpdate,h!==null){do{var M={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};N===null?j=N=M:N=N.next=M,h=h.next}while(h!==null);N===null?j=N=c:N=N.next=c}else j=N=c;h={baseState:g.baseState,firstBaseUpdate:j,lastBaseUpdate:N,shared:g.shared,callbacks:g.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=c}var e0=!1;function cu(){if(e0){var o=al;if(o!==null)throw o}}function uu(o,c,h,g){e0=!1;var j=o.updateQueue;mi=!1;var N=j.firstBaseUpdate,M=j.lastBaseUpdate,z=j.shared.pending;if(z!==null){j.shared.pending=null;var Z=z,ae=Z.next;Z.next=null,M===null?N=ae:M.next=ae,M=Z;var ue=o.alternate;ue!==null&&(ue=ue.updateQueue,z=ue.lastBaseUpdate,z!==M&&(z===null?ue.firstBaseUpdate=ae:z.next=ae,ue.lastBaseUpdate=Z))}if(N!==null){var fe=j.baseState;M=0,ue=ae=Z=null,z=N;do{var oe=z.lane&-536870913,le=oe!==z.lane;if(le?(Qe&oe)===oe:(g&oe)===oe){oe!==0&&oe===il&&(e0=!0),ue!==null&&(ue=ue.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var we=o,Te=z;oe=c;var ft=h;switch(Te.tag){case 1:if(we=Te.payload,typeof we=="function"){fe=we.call(ft,fe,oe);break e}fe=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Te.payload,oe=typeof we=="function"?we.call(ft,fe,oe):we,oe==null)break e;fe=m({},fe,oe);break e;case 2:mi=!0}}oe=z.callback,oe!==null&&(o.flags|=64,le&&(o.flags|=8192),le=j.callbacks,le===null?j.callbacks=[oe]:le.push(oe))}else le={lane:oe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ue===null?(ae=ue=le,Z=fe):ue=ue.next=le,M|=oe;if(z=z.next,z===null){if(z=j.shared.pending,z===null)break;le=z,z=le.next,le.next=null,j.lastBaseUpdate=le,j.shared.pending=null}}while(!0);ue===null&&(Z=fe),j.baseState=Z,j.firstBaseUpdate=ae,j.lastBaseUpdate=ue,N===null&&(j.shared.lanes=0),ji|=M,o.lanes=M,o.memoizedState=fe}}function PC(o,c){if(typeof o!="function")throw Error(s(191,o));o.call(c)}function $C(o,c){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;o<h.length;o++)PC(h[o],c)}var cl=D(null),oh=D(0);function DC(o,c){o=Mr,te(oh,o),te(cl,c),Mr=o|c.baseLanes}function t0(){te(oh,Mr),te(cl,cl.current)}function n0(){Mr=oh.current,F(cl),F(oh)}var Xn=D(null),ps=null;function yi(o){var c=o.alternate;te(Lt,Lt.current&1),te(Xn,o),ps===null&&(c===null||cl.current!==null||c.memoizedState!==null)&&(ps=o)}function s0(o){te(Lt,Lt.current),te(Xn,o),ps===null&&(ps=o)}function qC(o){o.tag===22?(te(Lt,Lt.current),te(Xn,o),ps===null&&(ps=o)):vi()}function vi(){te(Lt,Lt.current),te(Xn,Xn.current)}function Zn(o){F(Xn),ps===o&&(ps=null),F(Lt)}var Lt=D(0);function lh(o){for(var c=o;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||cy(h)||uy(h)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var kr=0,Fe=null,ut=null,Ht=null,ch=!1,ul=!1,qa=!1,uh=0,du=0,dl=null,JB=0;function Rt(){throw Error(s(321))}function r0(o,c){if(c===null)return!1;for(var h=0;h<c.length&&h<o.length;h++)if(!Yn(o[h],c[h]))return!1;return!0}function i0(o,c,h,g,j,N){return kr=N,Fe=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,q.H=o===null||o.memoizedState===null?jE:b0,qa=!1,N=h(g,j),qa=!1,ul&&(N=BC(c,h,g,j)),zC(o),N}function zC(o){q.H=pu;var c=ut!==null&&ut.next!==null;if(kr=0,Ht=ut=Fe=null,ch=!1,du=0,dl=null,c)throw Error(s(300));o===null||Ut||(o=o.dependencies,o!==null&&eh(o)&&(Ut=!0))}function BC(o,c,h,g){Fe=o;var j=0;do{if(ul&&(dl=null),du=0,ul=!1,25<=j)throw Error(s(301));if(j+=1,Ht=ut=null,o.updateQueue!=null){var N=o.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}q.H=SE,N=c(h,g)}while(ul);return N}function eF(){var o=q.H,c=o.useState()[0];return c=typeof c.then=="function"?fu(c):c,o=o.useState()[0],(ut!==null?ut.memoizedState:null)!==o&&(Fe.flags|=1024),c}function a0(){var o=uh!==0;return uh=0,o}function o0(o,c,h){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~h}function l0(o){if(ch){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}ch=!1}kr=0,Ht=ut=Fe=null,ul=!1,du=uh=0,dl=null}function Cn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Fe.memoizedState=Ht=o:Ht=Ht.next=o,Ht}function Pt(){if(ut===null){var o=Fe.alternate;o=o!==null?o.memoizedState:null}else o=ut.next;var c=Ht===null?Fe.memoizedState:Ht.next;if(c!==null)Ht=c,ut=o;else{if(o===null)throw Fe.alternate===null?Error(s(467)):Error(s(310));ut=o,o={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Ht===null?Fe.memoizedState=Ht=o:Ht=Ht.next=o}return Ht}function dh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fu(o){var c=du;return du+=1,dl===null&&(dl=[]),o=TC(dl,o,c),c=Fe,(Ht===null?c.memoizedState:Ht.next)===null&&(c=c.alternate,q.H=c===null||c.memoizedState===null?jE:b0),o}function fh(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return fu(o);if(o.$$typeof===k)return an(o)}throw Error(s(438,String(o)))}function c0(o){var c=null,h=Fe.updateQueue;if(h!==null&&(c=h.memoCache),c==null){var g=Fe.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(j){return j.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),h===null&&(h=dh(),Fe.updateQueue=h),h.memoCache=c,h=c.data[c.index],h===void 0)for(h=c.data[c.index]=Array(o),g=0;g<o;g++)h[g]=$;return c.index++,h}function _r(o,c){return typeof c=="function"?c(o):c}function hh(o){var c=Pt();return u0(c,ut,o)}function u0(o,c,h){var g=o.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=h;var j=o.baseQueue,N=g.pending;if(N!==null){if(j!==null){var M=j.next;j.next=N.next,N.next=M}c.baseQueue=j=N,g.pending=null}if(N=o.baseState,j===null)o.memoizedState=N;else{c=j.next;var z=M=null,Z=null,ae=c,ue=!1;do{var fe=ae.lane&-536870913;if(fe!==ae.lane?(Qe&fe)===fe:(kr&fe)===fe){var oe=ae.revertLane;if(oe===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),fe===il&&(ue=!0);else if((kr&oe)===oe){ae=ae.next,oe===il&&(ue=!0);continue}else fe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Z===null?(z=Z=fe,M=N):Z=Z.next=fe,Fe.lanes|=oe,ji|=oe;fe=ae.action,qa&&h(N,fe),N=ae.hasEagerState?ae.eagerState:h(N,fe)}else oe={lane:fe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Z===null?(z=Z=oe,M=N):Z=Z.next=oe,Fe.lanes|=fe,ji|=fe;ae=ae.next}while(ae!==null&&ae!==c);if(Z===null?M=N:Z.next=z,!Yn(N,o.memoizedState)&&(Ut=!0,ue&&(h=al,h!==null)))throw h;o.memoizedState=N,o.baseState=M,o.baseQueue=Z,g.lastRenderedState=N}return j===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function d0(o){var c=Pt(),h=c.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=o;var g=h.dispatch,j=h.pending,N=c.memoizedState;if(j!==null){h.pending=null;var M=j=j.next;do N=o(N,M.action),M=M.next;while(M!==j);Yn(N,c.memoizedState)||(Ut=!0),c.memoizedState=N,c.baseQueue===null&&(c.baseState=N),h.lastRenderedState=N}return[N,g]}function FC(o,c,h){var g=Fe,j=Pt(),N=Ze;if(N){if(h===void 0)throw Error(s(407));h=h()}else h=c();var M=!Yn((ut||j).memoizedState,h);if(M&&(j.memoizedState=h,Ut=!0),j=j.queue,p0(VC.bind(null,g,j,o),[o]),j.getSnapshot!==c||M||Ht!==null&&Ht.memoizedState.tag&1){if(g.flags|=2048,fl(9,{destroy:void 0},UC.bind(null,g,j,h,c),null),ht===null)throw Error(s(349));N||(kr&127)!==0||HC(g,c,h)}return h}function HC(o,c,h){o.flags|=16384,o={getSnapshot:c,value:h},c=Fe.updateQueue,c===null?(c=dh(),Fe.updateQueue=c,c.stores=[o]):(h=c.stores,h===null?c.stores=[o]:h.push(o))}function UC(o,c,h,g){c.value=h,c.getSnapshot=g,GC(c)&&KC(o)}function VC(o,c,h){return h(function(){GC(c)&&KC(o)})}function GC(o){var c=o.getSnapshot;o=o.value;try{var h=c();return!Yn(o,h)}catch{return!0}}function KC(o){var c=Aa(o,2);c!==null&&Dn(c,o,2)}function f0(o){var c=Cn();if(typeof o=="function"){var h=o;if(o=h(),qa){Gs(!0);try{h()}finally{Gs(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:o},c}function WC(o,c,h,g){return o.baseState=h,u0(o,ut,typeof g=="function"?g:_r)}function tF(o,c,h,g,j){if(gh(o))throw Error(s(485));if(o=c.action,o!==null){var N={payload:j,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){N.listeners.push(M)}};q.T!==null?h(!0):N.isTransition=!1,g(N),h=c.pending,h===null?(N.next=c.pending=N,YC(c,N)):(N.next=h.next,c.pending=h.next=N)}}function YC(o,c){var h=c.action,g=c.payload,j=o.state;if(c.isTransition){var N=q.T,M={};q.T=M;try{var z=h(j,g),Z=q.S;Z!==null&&Z(M,z),QC(o,c,z)}catch(ae){h0(o,c,ae)}finally{N!==null&&M.types!==null&&(N.types=M.types),q.T=N}}else try{N=h(j,g),QC(o,c,N)}catch(ae){h0(o,c,ae)}}function QC(o,c,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(g){XC(o,c,g)},function(g){return h0(o,c,g)}):XC(o,c,h)}function XC(o,c,h){c.status="fulfilled",c.value=h,ZC(c),o.state=h,c=o.pending,c!==null&&(h=c.next,h===c?o.pending=null:(h=h.next,c.next=h,YC(o,h)))}function h0(o,c,h){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=h,ZC(c),c=c.next;while(c!==g)}o.action=null}function ZC(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function JC(o,c){return c}function eE(o,c){if(Ze){var h=ht.formState;if(h!==null){e:{var g=Fe;if(Ze){if(vt){t:{for(var j=vt,N=hs;j.nodeType!==8;){if(!N){j=null;break t}if(j=ms(j.nextSibling),j===null){j=null;break t}}N=j.data,j=N==="F!"||N==="F"?j:null}if(j){vt=ms(j.nextSibling),g=j.data==="F!";break e}}hi(g)}g=!1}g&&(c=h[0])}}return h=Cn(),h.memoizedState=h.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:c},h.queue=g,h=vE.bind(null,Fe,g),g.dispatch=h,g=f0(!1),N=v0.bind(null,Fe,!1,g.queue),g=Cn(),j={state:c,dispatch:null,action:o,pending:null},g.queue=j,h=tF.bind(null,Fe,j,N,h),j.dispatch=h,g.memoizedState=o,[c,h,!1]}function tE(o){var c=Pt();return nE(c,ut,o)}function nE(o,c,h){if(c=u0(o,c,JC)[0],o=hh(_r)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=fu(c)}catch(M){throw M===ol?sh:M}else g=c;c=Pt();var j=c.queue,N=j.dispatch;return h!==c.memoizedState&&(Fe.flags|=2048,fl(9,{destroy:void 0},nF.bind(null,j,h),null)),[g,N,o]}function nF(o,c){o.action=c}function sE(o){var c=Pt(),h=ut;if(h!==null)return nE(c,h,o);Pt(),c=c.memoizedState,h=Pt();var g=h.queue.dispatch;return h.memoizedState=o,[c,g,!1]}function fl(o,c,h,g){return o={tag:o,create:h,deps:g,inst:c,next:null},c=Fe.updateQueue,c===null&&(c=dh(),Fe.updateQueue=c),h=c.lastEffect,h===null?c.lastEffect=o.next=o:(g=h.next,h.next=o,o.next=g,c.lastEffect=o),o}function rE(){return Pt().memoizedState}function ph(o,c,h,g){var j=Cn();Fe.flags|=o,j.memoizedState=fl(1|c,{destroy:void 0},h,g===void 0?null:g)}function mh(o,c,h,g){var j=Pt();g=g===void 0?null:g;var N=j.memoizedState.inst;ut!==null&&g!==null&&r0(g,ut.memoizedState.deps)?j.memoizedState=fl(c,N,h,g):(Fe.flags|=o,j.memoizedState=fl(1|c,N,h,g))}function iE(o,c){ph(8390656,8,o,c)}function p0(o,c){mh(2048,8,o,c)}function sF(o){Fe.flags|=4;var c=Fe.updateQueue;if(c===null)c=dh(),Fe.updateQueue=c,c.events=[o];else{var h=c.events;h===null?c.events=[o]:h.push(o)}}function aE(o){var c=Pt().memoizedState;return sF({ref:c,nextImpl:o}),function(){if((rt&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}function oE(o,c){return mh(4,2,o,c)}function lE(o,c){return mh(4,4,o,c)}function cE(o,c){if(typeof c=="function"){o=o();var h=c(o);return function(){typeof h=="function"?h():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function uE(o,c,h){h=h!=null?h.concat([o]):null,mh(4,4,cE.bind(null,c,o),h)}function m0(){}function dE(o,c){var h=Pt();c=c===void 0?null:c;var g=h.memoizedState;return c!==null&&r0(c,g[1])?g[0]:(h.memoizedState=[o,c],o)}function fE(o,c){var h=Pt();c=c===void 0?null:c;var g=h.memoizedState;if(c!==null&&r0(c,g[1]))return g[0];if(g=o(),qa){Gs(!0);try{o()}finally{Gs(!1)}}return h.memoizedState=[g,c],g}function g0(o,c,h){return h===void 0||(kr&1073741824)!==0&&(Qe&261930)===0?o.memoizedState=c:(o.memoizedState=h,o=hR(),Fe.lanes|=o,ji|=o,h)}function hE(o,c,h,g){return Yn(h,c)?h:cl.current!==null?(o=g0(o,h,g),Yn(o,c)||(Ut=!0),o):(kr&42)===0||(kr&1073741824)!==0&&(Qe&261930)===0?(Ut=!0,o.memoizedState=h):(o=hR(),Fe.lanes|=o,ji|=o,c)}function pE(o,c,h,g,j){var N=V.p;V.p=N!==0&&8>N?N:8;var M=q.T,z={};q.T=z,v0(o,!1,c,h);try{var Z=j(),ae=q.S;if(ae!==null&&ae(z,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var ue=ZB(Z,g);hu(o,c,ue,ts(o))}else hu(o,c,g,ts(o))}catch(fe){hu(o,c,{then:function(){},status:"rejected",reason:fe},ts())}finally{V.p=N,M!==null&&z.types!==null&&(M.types=z.types),q.T=M}}function rF(){}function x0(o,c,h,g){if(o.tag!==5)throw Error(s(476));var j=mE(o).queue;pE(o,j,c,K,h===null?rF:function(){return gE(o),h(g)})}function mE(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:K},next:null};var h={};return c.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:h},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function gE(o){var c=mE(o);c.next===null&&(c=o.alternate.memoizedState),hu(o,c.next.queue,{},ts())}function y0(){return an(Au)}function xE(){return Pt().memoizedState}function yE(){return Pt().memoizedState}function iF(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var h=ts();o=gi(h);var g=xi(c,o,h);g!==null&&(Dn(g,c,h),lu(g,c,h)),c={cache:Kx()},o.payload=c;return}c=c.return}}function aF(o,c,h){var g=ts();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},gh(o)?bE(c,h):(h=Px(o,c,h,g),h!==null&&(Dn(h,o,g),wE(h,c,g)))}function vE(o,c,h){var g=ts();hu(o,c,h,g)}function hu(o,c,h,g){var j={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(gh(o))bE(c,j);else{var N=o.alternate;if(o.lanes===0&&(N===null||N.lanes===0)&&(N=c.lastRenderedReducer,N!==null))try{var M=c.lastRenderedState,z=N(M,h);if(j.hasEagerState=!0,j.eagerState=z,Yn(z,M))return Qf(o,c,j,0),ht===null&&Yf(),!1}catch{}finally{}if(h=Px(o,c,j,g),h!==null)return Dn(h,o,g),wE(h,c,g),!0}return!1}function v0(o,c,h,g){if(g={lane:2,revertLane:X0(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},gh(o)){if(c)throw Error(s(479))}else c=Px(o,h,g,2),c!==null&&Dn(c,o,2)}function gh(o){var c=o.alternate;return o===Fe||c!==null&&c===Fe}function bE(o,c){ul=ch=!0;var h=o.pending;h===null?c.next=c:(c.next=h.next,h.next=c),o.pending=c}function wE(o,c,h){if((h&4194048)!==0){var g=c.lanes;g&=o.pendingLanes,h|=g,c.lanes=h,Rf(o,h)}}var pu={readContext:an,use:fh,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};pu.useEffectEvent=Rt;var jE={readContext:an,use:fh,useCallback:function(o,c){return Cn().memoizedState=[o,c===void 0?null:c],o},useContext:an,useEffect:iE,useImperativeHandle:function(o,c,h){h=h!=null?h.concat([o]):null,ph(4194308,4,cE.bind(null,c,o),h)},useLayoutEffect:function(o,c){return ph(4194308,4,o,c)},useInsertionEffect:function(o,c){ph(4,2,o,c)},useMemo:function(o,c){var h=Cn();c=c===void 0?null:c;var g=o();if(qa){Gs(!0);try{o()}finally{Gs(!1)}}return h.memoizedState=[g,c],g},useReducer:function(o,c,h){var g=Cn();if(h!==void 0){var j=h(c);if(qa){Gs(!0);try{h(c)}finally{Gs(!1)}}}else j=c;return g.memoizedState=g.baseState=j,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:j},g.queue=o,o=o.dispatch=aF.bind(null,Fe,o),[g.memoizedState,o]},useRef:function(o){var c=Cn();return o={current:o},c.memoizedState=o},useState:function(o){o=f0(o);var c=o.queue,h=vE.bind(null,Fe,c);return c.dispatch=h,[o.memoizedState,h]},useDebugValue:m0,useDeferredValue:function(o,c){var h=Cn();return g0(h,o,c)},useTransition:function(){var o=f0(!1);return o=pE.bind(null,Fe,o.queue,!0,!1),Cn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,h){var g=Fe,j=Cn();if(Ze){if(h===void 0)throw Error(s(407));h=h()}else{if(h=c(),ht===null)throw Error(s(349));(Qe&127)!==0||HC(g,c,h)}j.memoizedState=h;var N={value:h,getSnapshot:c};return j.queue=N,iE(VC.bind(null,g,N,o),[o]),g.flags|=2048,fl(9,{destroy:void 0},UC.bind(null,g,N,h,c),null),h},useId:function(){var o=Cn(),c=ht.identifierPrefix;if(Ze){var h=Ys,g=Ws;h=(g&~(1<<32-_n(g)-1)).toString(32)+h,c="_"+c+"R_"+h,h=uh++,0<h&&(c+="H"+h.toString(32)),c+="_"}else h=JB++,c="_"+c+"r_"+h.toString(32)+"_";return o.memoizedState=c},useHostTransitionStatus:y0,useFormState:eE,useActionState:eE,useOptimistic:function(o){var c=Cn();c.memoizedState=c.baseState=o;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=h,c=v0.bind(null,Fe,!0,h),h.dispatch=c,[o,c]},useMemoCache:c0,useCacheRefresh:function(){return Cn().memoizedState=iF.bind(null,Fe)},useEffectEvent:function(o){var c=Cn(),h={impl:o};return c.memoizedState=h,function(){if((rt&2)!==0)throw Error(s(440));return h.impl.apply(void 0,arguments)}}},b0={readContext:an,use:fh,useCallback:dE,useContext:an,useEffect:p0,useImperativeHandle:uE,useInsertionEffect:oE,useLayoutEffect:lE,useMemo:fE,useReducer:hh,useRef:rE,useState:function(){return hh(_r)},useDebugValue:m0,useDeferredValue:function(o,c){var h=Pt();return hE(h,ut.memoizedState,o,c)},useTransition:function(){var o=hh(_r)[0],c=Pt().memoizedState;return[typeof o=="boolean"?o:fu(o),c]},useSyncExternalStore:FC,useId:xE,useHostTransitionStatus:y0,useFormState:tE,useActionState:tE,useOptimistic:function(o,c){var h=Pt();return WC(h,ut,o,c)},useMemoCache:c0,useCacheRefresh:yE};b0.useEffectEvent=aE;var SE={readContext:an,use:fh,useCallback:dE,useContext:an,useEffect:p0,useImperativeHandle:uE,useInsertionEffect:oE,useLayoutEffect:lE,useMemo:fE,useReducer:d0,useRef:rE,useState:function(){return d0(_r)},useDebugValue:m0,useDeferredValue:function(o,c){var h=Pt();return ut===null?g0(h,o,c):hE(h,ut.memoizedState,o,c)},useTransition:function(){var o=d0(_r)[0],c=Pt().memoizedState;return[typeof o=="boolean"?o:fu(o),c]},useSyncExternalStore:FC,useId:xE,useHostTransitionStatus:y0,useFormState:sE,useActionState:sE,useOptimistic:function(o,c){var h=Pt();return ut!==null?WC(h,ut,o,c):(h.baseState=o,[o,h.queue.dispatch])},useMemoCache:c0,useCacheRefresh:yE};SE.useEffectEvent=aE;function w0(o,c,h,g){c=o.memoizedState,h=h(g,c),h=h==null?c:m({},c,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var j0={enqueueSetState:function(o,c,h){o=o._reactInternals;var g=ts(),j=gi(g);j.payload=c,h!=null&&(j.callback=h),c=xi(o,j,g),c!==null&&(Dn(c,o,g),lu(c,o,g))},enqueueReplaceState:function(o,c,h){o=o._reactInternals;var g=ts(),j=gi(g);j.tag=1,j.payload=c,h!=null&&(j.callback=h),c=xi(o,j,g),c!==null&&(Dn(c,o,g),lu(c,o,g))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var h=ts(),g=gi(h);g.tag=2,c!=null&&(g.callback=c),c=xi(o,g,h),c!==null&&(Dn(c,o,h),lu(c,o,h))}};function NE(o,c,h,g,j,N,M){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,N,M):c.prototype&&c.prototype.isPureReactComponent?!eu(h,g)||!eu(j,N):!0}function kE(o,c,h,g){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,g),c.state!==o&&j0.enqueueReplaceState(c,c.state,null)}function za(o,c){var h=c;if("ref"in c){h={};for(var g in c)g!=="ref"&&(h[g]=c[g])}if(o=o.defaultProps){h===c&&(h=m({},h));for(var j in o)h[j]===void 0&&(h[j]=o[j])}return h}function _E(o){Wf(o)}function CE(o){console.error(o)}function EE(o){Wf(o)}function xh(o,c){try{var h=o.onUncaughtError;h(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function RE(o,c,h){try{var g=o.onCaughtError;g(h.value,{componentStack:h.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(j){setTimeout(function(){throw j})}}function S0(o,c,h){return h=gi(h),h.tag=3,h.payload={element:null},h.callback=function(){xh(o,c)},h}function AE(o){return o=gi(o),o.tag=3,o}function TE(o,c,h,g){var j=h.type.getDerivedStateFromError;if(typeof j=="function"){var N=g.value;o.payload=function(){return j(N)},o.callback=function(){RE(c,h,g)}}var M=h.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(o.callback=function(){RE(c,h,g),typeof j!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var z=g.stack;this.componentDidCatch(g.value,{componentStack:z!==null?z:""})})}function oF(o,c,h,g,j){if(h.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=h.alternate,c!==null&&rl(c,h,j,!0),h=Xn.current,h!==null){switch(h.tag){case 31:case 13:return ps===null?Rh():h.alternate===null&&At===0&&(At=3),h.flags&=-257,h.flags|=65536,h.lanes=j,g===rh?h.flags|=16384:(c=h.updateQueue,c===null?h.updateQueue=new Set([g]):c.add(g),W0(o,g,j)),!1;case 22:return h.flags|=65536,g===rh?h.flags|=16384:(c=h.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},h.updateQueue=c):(h=c.retryQueue,h===null?c.retryQueue=new Set([g]):h.add(g)),W0(o,g,j)),!1}throw Error(s(435,h.tag))}return W0(o,g,j),Rh(),!1}if(Ze)return c=Xn.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=j,g!==Fx&&(o=Error(s(422),{cause:g}),su(us(o,h)))):(g!==Fx&&(c=Error(s(423),{cause:g}),su(us(c,h))),o=o.current.alternate,o.flags|=65536,j&=-j,o.lanes|=j,g=us(g,h),j=S0(o.stateNode,g,j),Jx(o,j),At!==4&&(At=2)),!1;var N=Error(s(520),{cause:g});if(N=us(N,h),ju===null?ju=[N]:ju.push(N),At!==4&&(At=2),c===null)return!0;g=us(g,h),h=c;do{switch(h.tag){case 3:return h.flags|=65536,o=j&-j,h.lanes|=o,o=S0(h.stateNode,g,o),Jx(h,o),!1;case 1:if(c=h.type,N=h.stateNode,(h.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Si===null||!Si.has(N))))return h.flags|=65536,j&=-j,h.lanes|=j,j=AE(j),TE(j,o,h,g),Jx(h,j),!1}h=h.return}while(h!==null);return!1}var N0=Error(s(461)),Ut=!1;function on(o,c,h,g){c.child=o===null?LC(c,null,h,g):Da(c,o.child,h,g)}function IE(o,c,h,g,j){h=h.render;var N=c.ref;if("ref"in g){var M={};for(var z in g)z!=="ref"&&(M[z]=g[z])}else M=g;return Oa(c),g=i0(o,c,h,M,N,j),z=a0(),o!==null&&!Ut?(o0(o,c,j),Cr(o,c,j)):(Ze&&z&&zx(c),c.flags|=1,on(o,c,g,j),c.child)}function ME(o,c,h,g,j){if(o===null){var N=h.type;return typeof N=="function"&&!$x(N)&&N.defaultProps===void 0&&h.compare===null?(c.tag=15,c.type=N,OE(o,c,N,g,j)):(o=Zf(h.type,null,g,c,c.mode,j),o.ref=c.ref,o.return=c,c.child=o)}if(N=o.child,!I0(o,j)){var M=N.memoizedProps;if(h=h.compare,h=h!==null?h:eu,h(M,g)&&o.ref===c.ref)return Cr(o,c,j)}return c.flags|=1,o=wr(N,g),o.ref=c.ref,o.return=c,c.child=o}function OE(o,c,h,g,j){if(o!==null){var N=o.memoizedProps;if(eu(N,g)&&o.ref===c.ref)if(Ut=!1,c.pendingProps=g=N,I0(o,j))(o.flags&131072)!==0&&(Ut=!0);else return c.lanes=o.lanes,Cr(o,c,j)}return k0(o,c,h,g,j)}function LE(o,c,h,g){var j=g.children,N=o!==null?o.memoizedState:null;if(o===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((c.flags&128)!==0){if(N=N!==null?N.baseLanes|h:h,o!==null){for(g=c.child=o.child,j=0;g!==null;)j=j|g.lanes|g.childLanes,g=g.sibling;g=j&~N}else g=0,c.child=null;return PE(o,c,N,h,g)}if((h&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&nh(c,N!==null?N.cachePool:null),N!==null?DC(c,N):t0(),qC(c);else return g=c.lanes=536870912,PE(o,c,N!==null?N.baseLanes|h:h,h,g)}else N!==null?(nh(c,N.cachePool),DC(c,N),vi(),c.memoizedState=null):(o!==null&&nh(c,null),t0(),vi());return on(o,c,j,h),c.child}function mu(o,c){return o!==null&&o.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function PE(o,c,h,g,j){var N=Yx();return N=N===null?null:{parent:Ft._currentValue,pool:N},c.memoizedState={baseLanes:h,cachePool:N},o!==null&&nh(c,null),t0(),qC(c),o!==null&&rl(o,c,g,!0),c.childLanes=j,null}function yh(o,c){return c=bh({mode:c.mode,children:c.children},o.mode),c.ref=o.ref,o.child=c,c.return=o,c}function $E(o,c,h){return Da(c,o.child,null,h),o=yh(c,c.pendingProps),o.flags|=2,Zn(c),c.memoizedState=null,o}function lF(o,c,h){var g=c.pendingProps,j=(c.flags&128)!==0;if(c.flags&=-129,o===null){if(Ze){if(g.mode==="hidden")return o=yh(c,g),c.lanes=536870912,mu(null,o);if(s0(c),(o=vt)?(o=YR(o,hs),o=o!==null&&o.data==="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:di!==null?{id:Ws,overflow:Ys}:null,retryLane:536870912,hydrationErrors:null},h=bC(o),h.return=c,c.child=h,rn=c,vt=null)):o=null,o===null)throw hi(c);return c.lanes=536870912,null}return yh(c,g)}var N=o.memoizedState;if(N!==null){var M=N.dehydrated;if(s0(c),j)if(c.flags&256)c.flags&=-257,c=$E(o,c,h);else if(c.memoizedState!==null)c.child=o.child,c.flags|=128,c=null;else throw Error(s(558));else if(Ut||rl(o,c,h,!1),j=(h&o.childLanes)!==0,Ut||j){if(g=ht,g!==null&&(M=Af(g,h),M!==0&&M!==N.retryLane))throw N.retryLane=M,Aa(o,M),Dn(g,o,M),N0;Rh(),c=$E(o,c,h)}else o=N.treeContext,vt=ms(M.nextSibling),rn=c,Ze=!0,fi=null,hs=!1,o!==null&&SC(c,o),c=yh(c,g),c.flags|=4096;return c}return o=wr(o.child,{mode:g.mode,children:g.children}),o.ref=c.ref,c.child=o,o.return=c,o}function vh(o,c){var h=c.ref;if(h===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(s(284));(o===null||o.ref!==h)&&(c.flags|=4194816)}}function k0(o,c,h,g,j){return Oa(c),h=i0(o,c,h,g,void 0,j),g=a0(),o!==null&&!Ut?(o0(o,c,j),Cr(o,c,j)):(Ze&&g&&zx(c),c.flags|=1,on(o,c,h,j),c.child)}function DE(o,c,h,g,j,N){return Oa(c),c.updateQueue=null,h=BC(c,g,h,j),zC(o),g=a0(),o!==null&&!Ut?(o0(o,c,N),Cr(o,c,N)):(Ze&&g&&zx(c),c.flags|=1,on(o,c,h,N),c.child)}function qE(o,c,h,g,j){if(Oa(c),c.stateNode===null){var N=el,M=h.contextType;typeof M=="object"&&M!==null&&(N=an(M)),N=new h(g,N),c.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=j0,c.stateNode=N,N._reactInternals=c,N=c.stateNode,N.props=g,N.state=c.memoizedState,N.refs={},Xx(c),M=h.contextType,N.context=typeof M=="object"&&M!==null?an(M):el,N.state=c.memoizedState,M=h.getDerivedStateFromProps,typeof M=="function"&&(w0(c,h,M,g),N.state=c.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(M=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),M!==N.state&&j0.enqueueReplaceState(N,N.state,null),uu(c,g,N,j),cu(),N.state=c.memoizedState),typeof N.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(o===null){N=c.stateNode;var z=c.memoizedProps,Z=za(h,z);N.props=Z;var ae=N.context,ue=h.contextType;M=el,typeof ue=="object"&&ue!==null&&(M=an(ue));var fe=h.getDerivedStateFromProps;ue=typeof fe=="function"||typeof N.getSnapshotBeforeUpdate=="function",z=c.pendingProps!==z,ue||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(z||ae!==M)&&kE(c,N,g,M),mi=!1;var oe=c.memoizedState;N.state=oe,uu(c,g,N,j),cu(),ae=c.memoizedState,z||oe!==ae||mi?(typeof fe=="function"&&(w0(c,h,fe,g),ae=c.memoizedState),(Z=mi||NE(c,h,Z,g,oe,ae,M))?(ue||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(c.flags|=4194308)):(typeof N.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=ae),N.props=g,N.state=ae,N.context=M,g=Z):(typeof N.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{N=c.stateNode,Zx(o,c),M=c.memoizedProps,ue=za(h,M),N.props=ue,fe=c.pendingProps,oe=N.context,ae=h.contextType,Z=el,typeof ae=="object"&&ae!==null&&(Z=an(ae)),z=h.getDerivedStateFromProps,(ae=typeof z=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(M!==fe||oe!==Z)&&kE(c,N,g,Z),mi=!1,oe=c.memoizedState,N.state=oe,uu(c,g,N,j),cu();var le=c.memoizedState;M!==fe||oe!==le||mi||o!==null&&o.dependencies!==null&&eh(o.dependencies)?(typeof z=="function"&&(w0(c,h,z,g),le=c.memoizedState),(ue=mi||NE(c,h,ue,g,oe,le,Z)||o!==null&&o.dependencies!==null&&eh(o.dependencies))?(ae||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(g,le,Z),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(g,le,Z)),typeof N.componentDidUpdate=="function"&&(c.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof N.componentDidUpdate!="function"||M===o.memoizedProps&&oe===o.memoizedState||(c.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||M===o.memoizedProps&&oe===o.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=le),N.props=g,N.state=le,N.context=Z,g=ue):(typeof N.componentDidUpdate!="function"||M===o.memoizedProps&&oe===o.memoizedState||(c.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||M===o.memoizedProps&&oe===o.memoizedState||(c.flags|=1024),g=!1)}return N=g,vh(o,c),g=(c.flags&128)!==0,N||g?(N=c.stateNode,h=g&&typeof h.getDerivedStateFromError!="function"?null:N.render(),c.flags|=1,o!==null&&g?(c.child=Da(c,o.child,null,j),c.child=Da(c,null,h,j)):on(o,c,h,j),c.memoizedState=N.state,o=c.child):o=Cr(o,c,j),o}function zE(o,c,h,g){return Ia(),c.flags|=256,on(o,c,h,g),c.child}var _0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function C0(o){return{baseLanes:o,cachePool:RC()}}function E0(o,c,h){return o=o!==null?o.childLanes&~h:0,c&&(o|=es),o}function BE(o,c,h){var g=c.pendingProps,j=!1,N=(c.flags&128)!==0,M;if((M=N)||(M=o!==null&&o.memoizedState===null?!1:(Lt.current&2)!==0),M&&(j=!0,c.flags&=-129),M=(c.flags&32)!==0,c.flags&=-33,o===null){if(Ze){if(j?yi(c):vi(),(o=vt)?(o=YR(o,hs),o=o!==null&&o.data!=="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:di!==null?{id:Ws,overflow:Ys}:null,retryLane:536870912,hydrationErrors:null},h=bC(o),h.return=c,c.child=h,rn=c,vt=null)):o=null,o===null)throw hi(c);return uy(o)?c.lanes=32:c.lanes=536870912,null}var z=g.children;return g=g.fallback,j?(vi(),j=c.mode,z=bh({mode:"hidden",children:z},j),g=Ta(g,j,h,null),z.return=c,g.return=c,z.sibling=g,c.child=z,g=c.child,g.memoizedState=C0(h),g.childLanes=E0(o,M,h),c.memoizedState=_0,mu(null,g)):(yi(c),R0(c,z))}var Z=o.memoizedState;if(Z!==null&&(z=Z.dehydrated,z!==null)){if(N)c.flags&256?(yi(c),c.flags&=-257,c=A0(o,c,h)):c.memoizedState!==null?(vi(),c.child=o.child,c.flags|=128,c=null):(vi(),z=g.fallback,j=c.mode,g=bh({mode:"visible",children:g.children},j),z=Ta(z,j,h,null),z.flags|=2,g.return=c,z.return=c,g.sibling=z,c.child=g,Da(c,o.child,null,h),g=c.child,g.memoizedState=C0(h),g.childLanes=E0(o,M,h),c.memoizedState=_0,c=mu(null,g));else if(yi(c),uy(z)){if(M=z.nextSibling&&z.nextSibling.dataset,M)var ae=M.dgst;M=ae,g=Error(s(419)),g.stack="",g.digest=M,su({value:g,source:null,stack:null}),c=A0(o,c,h)}else if(Ut||rl(o,c,h,!1),M=(h&o.childLanes)!==0,Ut||M){if(M=ht,M!==null&&(g=Af(M,h),g!==0&&g!==Z.retryLane))throw Z.retryLane=g,Aa(o,g),Dn(M,o,g),N0;cy(z)||Rh(),c=A0(o,c,h)}else cy(z)?(c.flags|=192,c.child=o.child,c=null):(o=Z.treeContext,vt=ms(z.nextSibling),rn=c,Ze=!0,fi=null,hs=!1,o!==null&&SC(c,o),c=R0(c,g.children),c.flags|=4096);return c}return j?(vi(),z=g.fallback,j=c.mode,Z=o.child,ae=Z.sibling,g=wr(Z,{mode:"hidden",children:g.children}),g.subtreeFlags=Z.subtreeFlags&65011712,ae!==null?z=wr(ae,z):(z=Ta(z,j,h,null),z.flags|=2),z.return=c,g.return=c,g.sibling=z,c.child=g,mu(null,g),g=c.child,z=o.child.memoizedState,z===null?z=C0(h):(j=z.cachePool,j!==null?(Z=Ft._currentValue,j=j.parent!==Z?{parent:Z,pool:Z}:j):j=RC(),z={baseLanes:z.baseLanes|h,cachePool:j}),g.memoizedState=z,g.childLanes=E0(o,M,h),c.memoizedState=_0,mu(o.child,g)):(yi(c),h=o.child,o=h.sibling,h=wr(h,{mode:"visible",children:g.children}),h.return=c,h.sibling=null,o!==null&&(M=c.deletions,M===null?(c.deletions=[o],c.flags|=16):M.push(o)),c.child=h,c.memoizedState=null,h)}function R0(o,c){return c=bh({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function bh(o,c){return o=Qn(22,o,null,c),o.lanes=0,o}function A0(o,c,h){return Da(c,o.child,null,h),o=R0(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function FE(o,c,h){o.lanes|=c;var g=o.alternate;g!==null&&(g.lanes|=c),Vx(o.return,c,h)}function T0(o,c,h,g,j,N){var M=o.memoizedState;M===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:h,tailMode:j,treeForkCount:N}:(M.isBackwards=c,M.rendering=null,M.renderingStartTime=0,M.last=g,M.tail=h,M.tailMode=j,M.treeForkCount=N)}function HE(o,c,h){var g=c.pendingProps,j=g.revealOrder,N=g.tail;g=g.children;var M=Lt.current,z=(M&2)!==0;if(z?(M=M&1|2,c.flags|=128):M&=1,te(Lt,M),on(o,c,g,h),g=Ze?nu:0,!z&&o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&FE(o,h,c);else if(o.tag===19)FE(o,h,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(j){case"forwards":for(h=c.child,j=null;h!==null;)o=h.alternate,o!==null&&lh(o)===null&&(j=h),h=h.sibling;h=j,h===null?(j=c.child,c.child=null):(j=h.sibling,h.sibling=null),T0(c,!1,j,h,N,g);break;case"backwards":case"unstable_legacy-backwards":for(h=null,j=c.child,c.child=null;j!==null;){if(o=j.alternate,o!==null&&lh(o)===null){c.child=j;break}o=j.sibling,j.sibling=h,h=j,j=o}T0(c,!0,h,null,N,g);break;case"together":T0(c,!1,null,null,void 0,g);break;default:c.memoizedState=null}return c.child}function Cr(o,c,h){if(o!==null&&(c.dependencies=o.dependencies),ji|=c.lanes,(h&c.childLanes)===0)if(o!==null){if(rl(o,c,h,!1),(h&c.childLanes)===0)return null}else return null;if(o!==null&&c.child!==o.child)throw Error(s(153));if(c.child!==null){for(o=c.child,h=wr(o,o.pendingProps),c.child=h,h.return=c;o.sibling!==null;)o=o.sibling,h=h.sibling=wr(o,o.pendingProps),h.return=c;h.sibling=null}return c.child}function I0(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&eh(o)))}function cF(o,c,h){switch(c.tag){case 3:re(c,c.stateNode.containerInfo),pi(c,Ft,o.memoizedState.cache),Ia();break;case 27:case 5:me(c);break;case 4:re(c,c.stateNode.containerInfo);break;case 10:pi(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,s0(c),null;break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(yi(c),c.flags|=128,null):(h&c.child.childLanes)!==0?BE(o,c,h):(yi(c),o=Cr(o,c,h),o!==null?o.sibling:null);yi(c);break;case 19:var j=(o.flags&128)!==0;if(g=(h&c.childLanes)!==0,g||(rl(o,c,h,!1),g=(h&c.childLanes)!==0),j){if(g)return HE(o,c,h);c.flags|=128}if(j=c.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),te(Lt,Lt.current),g)break;return null;case 22:return c.lanes=0,LE(o,c,h,c.pendingProps);case 24:pi(c,Ft,o.memoizedState.cache)}return Cr(o,c,h)}function UE(o,c,h){if(o!==null)if(o.memoizedProps!==c.pendingProps)Ut=!0;else{if(!I0(o,h)&&(c.flags&128)===0)return Ut=!1,cF(o,c,h);Ut=(o.flags&131072)!==0}else Ut=!1,Ze&&(c.flags&1048576)!==0&&jC(c,nu,c.index);switch(c.lanes=0,c.tag){case 16:e:{var g=c.pendingProps;if(o=Pa(c.elementType),c.type=o,typeof o=="function")$x(o)?(g=za(o,g),c.tag=1,c=qE(null,c,o,g,h)):(c.tag=0,c=k0(null,c,o,g,h));else{if(o!=null){var j=o.$$typeof;if(j===_){c.tag=11,c=IE(null,c,o,g,h);break e}else if(j===A){c.tag=14,c=ME(null,c,o,g,h);break e}}throw c=P(o)||o,Error(s(306,c,""))}}return c;case 0:return k0(o,c,c.type,c.pendingProps,h);case 1:return g=c.type,j=za(g,c.pendingProps),qE(o,c,g,j,h);case 3:e:{if(re(c,c.stateNode.containerInfo),o===null)throw Error(s(387));g=c.pendingProps;var N=c.memoizedState;j=N.element,Zx(o,c),uu(c,g,null,h);var M=c.memoizedState;if(g=M.cache,pi(c,Ft,g),g!==N.cache&&Gx(c,[Ft],h,!0),cu(),g=M.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:M.cache},c.updateQueue.baseState=N,c.memoizedState=N,c.flags&256){c=zE(o,c,g,h);break e}else if(g!==j){j=us(Error(s(424)),c),su(j),c=zE(o,c,g,h);break e}else{switch(o=c.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(vt=ms(o.firstChild),rn=c,Ze=!0,fi=null,hs=!0,h=LC(c,null,g,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling}else{if(Ia(),g===j){c=Cr(o,c,h);break e}on(o,c,g,h)}c=c.child}return c;case 26:return vh(o,c),o===null?(h=tA(c.type,null,c.pendingProps,null))?c.memoizedState=h:Ze||(h=c.type,o=c.pendingProps,g=Ph(X.current).createElement(h),g[Xt]=c,g[mn]=o,ln(g,h,o),Bt(g),c.stateNode=g):c.memoizedState=tA(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return me(c),o===null&&Ze&&(g=c.stateNode=ZR(c.type,c.pendingProps,X.current),rn=c,hs=!0,j=vt,Ci(c.type)?(dy=j,vt=ms(g.firstChild)):vt=j),on(o,c,c.pendingProps.children,h),vh(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&Ze&&((j=g=vt)&&(g=qF(g,c.type,c.pendingProps,hs),g!==null?(c.stateNode=g,rn=c,vt=ms(g.firstChild),hs=!1,j=!0):j=!1),j||hi(c)),me(c),j=c.type,N=c.pendingProps,M=o!==null?o.memoizedProps:null,g=N.children,ay(j,N)?g=null:M!==null&&ay(j,M)&&(c.flags|=32),c.memoizedState!==null&&(j=i0(o,c,eF,null,null,h),Au._currentValue=j),vh(o,c),on(o,c,g,h),c.child;case 6:return o===null&&Ze&&((o=h=vt)&&(h=zF(h,c.pendingProps,hs),h!==null?(c.stateNode=h,rn=c,vt=null,o=!0):o=!1),o||hi(c)),null;case 13:return BE(o,c,h);case 4:return re(c,c.stateNode.containerInfo),g=c.pendingProps,o===null?c.child=Da(c,null,g,h):on(o,c,g,h),c.child;case 11:return IE(o,c,c.type,c.pendingProps,h);case 7:return on(o,c,c.pendingProps,h),c.child;case 8:return on(o,c,c.pendingProps.children,h),c.child;case 12:return on(o,c,c.pendingProps.children,h),c.child;case 10:return g=c.pendingProps,pi(c,c.type,g.value),on(o,c,g.children,h),c.child;case 9:return j=c.type._context,g=c.pendingProps.children,Oa(c),j=an(j),g=g(j),c.flags|=1,on(o,c,g,h),c.child;case 14:return ME(o,c,c.type,c.pendingProps,h);case 15:return OE(o,c,c.type,c.pendingProps,h);case 19:return HE(o,c,h);case 31:return lF(o,c,h);case 22:return LE(o,c,h,c.pendingProps);case 24:return Oa(c),g=an(Ft),o===null?(j=Yx(),j===null&&(j=ht,N=Kx(),j.pooledCache=N,N.refCount++,N!==null&&(j.pooledCacheLanes|=h),j=N),c.memoizedState={parent:g,cache:j},Xx(c),pi(c,Ft,j)):((o.lanes&h)!==0&&(Zx(o,c),uu(c,null,null,h),cu()),j=o.memoizedState,N=c.memoizedState,j.parent!==g?(j={parent:g,cache:g},c.memoizedState=j,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=j),pi(c,Ft,g)):(g=N.cache,pi(c,Ft,g),g!==j.cache&&Gx(c,[Ft],h,!0))),on(o,c,c.pendingProps.children,h),c.child;case 29:throw c.pendingProps}throw Error(s(156,c.tag))}function Er(o){o.flags|=4}function M0(o,c,h,g,j){if((c=(o.mode&32)!==0)&&(c=!1),c){if(o.flags|=16777216,(j&335544128)===j)if(o.stateNode.complete)o.flags|=8192;else if(xR())o.flags|=8192;else throw $a=rh,Qx}else o.flags&=-16777217}function VE(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!aA(c))if(xR())o.flags|=8192;else throw $a=rh,Qx}function wh(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?Cf():536870912,o.lanes|=c,gl|=c)}function gu(o,c){if(!Ze)switch(o.tailMode){case"hidden":c=o.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function bt(o){var c=o.alternate!==null&&o.alternate.child===o.child,h=0,g=0;if(c)for(var j=o.child;j!==null;)h|=j.lanes|j.childLanes,g|=j.subtreeFlags&65011712,g|=j.flags&65011712,j.return=o,j=j.sibling;else for(j=o.child;j!==null;)h|=j.lanes|j.childLanes,g|=j.subtreeFlags,g|=j.flags,j.return=o,j=j.sibling;return o.subtreeFlags|=g,o.childLanes=h,c}function uF(o,c,h){var g=c.pendingProps;switch(Bx(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(c),null;case 1:return bt(c),null;case 3:return h=c.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Nr(Ft),ce(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(o===null||o.child===null)&&(sl(c)?Er(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Hx())),bt(c),null;case 26:var j=c.type,N=c.memoizedState;return o===null?(Er(c),N!==null?(bt(c),VE(c,N)):(bt(c),M0(c,j,null,g,h))):N?N!==o.memoizedState?(Er(c),bt(c),VE(c,N)):(bt(c),c.flags&=-16777217):(o=o.memoizedProps,o!==g&&Er(c),bt(c),M0(c,j,o,g,h)),null;case 27:if(ge(c),h=X.current,j=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(!g){if(c.stateNode===null)throw Error(s(166));return bt(c),null}o=U.current,sl(c)?NC(c):(o=ZR(j,g,h),c.stateNode=o,Er(c))}return bt(c),null;case 5:if(ge(c),j=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(!g){if(c.stateNode===null)throw Error(s(166));return bt(c),null}if(N=U.current,sl(c))NC(c);else{var M=Ph(X.current);switch(N){case 1:N=M.createElementNS("http://www.w3.org/2000/svg",j);break;case 2:N=M.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;default:switch(j){case"svg":N=M.createElementNS("http://www.w3.org/2000/svg",j);break;case"math":N=M.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;case"script":N=M.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?N.multiple=!0:g.size&&(N.size=g.size);break;default:N=typeof g.is=="string"?M.createElement(j,{is:g.is}):M.createElement(j)}}N[Xt]=c,N[mn]=g;e:for(M=c.child;M!==null;){if(M.tag===5||M.tag===6)N.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===c)break e;for(;M.sibling===null;){if(M.return===null||M.return===c)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}c.stateNode=N;e:switch(ln(N,j,g),j){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Er(c)}}return bt(c),M0(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,h),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(s(166));if(o=X.current,sl(c)){if(o=c.stateNode,h=c.memoizedProps,g=null,j=rn,j!==null)switch(j.tag){case 27:case 5:g=j.memoizedProps}o[Xt]=c,o=!!(o.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||BR(o.nodeValue,h)),o||hi(c,!0)}else o=Ph(o).createTextNode(g),o[Xt]=c,c.stateNode=o}return bt(c),null;case 31:if(h=c.memoizedState,o===null||o.memoizedState!==null){if(g=sl(c),h!==null){if(o===null){if(!g)throw Error(s(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(557));o[Xt]=c}else Ia(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;bt(c),o=!1}else h=Hx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return c.flags&256?(Zn(c),c):(Zn(c),null);if((c.flags&128)!==0)throw Error(s(558))}return bt(c),null;case 13:if(g=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(j=sl(c),g!==null&&g.dehydrated!==null){if(o===null){if(!j)throw Error(s(318));if(j=c.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(s(317));j[Xt]=c}else Ia(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;bt(c),j=!1}else j=Hx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=j),j=!0;if(!j)return c.flags&256?(Zn(c),c):(Zn(c),null)}return Zn(c),(c.flags&128)!==0?(c.lanes=h,c):(h=g!==null,o=o!==null&&o.memoizedState!==null,h&&(g=c.child,j=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(j=g.alternate.memoizedState.cachePool.pool),N=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(N=g.memoizedState.cachePool.pool),N!==j&&(g.flags|=2048)),h!==o&&h&&(c.child.flags|=8192),wh(c,c.updateQueue),bt(c),null);case 4:return ce(),o===null&&ty(c.stateNode.containerInfo),bt(c),null;case 10:return Nr(c.type),bt(c),null;case 19:if(F(Lt),g=c.memoizedState,g===null)return bt(c),null;if(j=(c.flags&128)!==0,N=g.rendering,N===null)if(j)gu(g,!1);else{if(At!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(N=lh(o),N!==null){for(c.flags|=128,gu(g,!1),o=N.updateQueue,c.updateQueue=o,wh(c,o),c.subtreeFlags=0,o=h,h=c.child;h!==null;)vC(h,o),h=h.sibling;return te(Lt,Lt.current&1|2),Ze&&jr(c,g.treeForkCount),c.child}o=o.sibling}g.tail!==null&&yt()>_h&&(c.flags|=128,j=!0,gu(g,!1),c.lanes=4194304)}else{if(!j)if(o=lh(N),o!==null){if(c.flags|=128,j=!0,o=o.updateQueue,c.updateQueue=o,wh(c,o),gu(g,!0),g.tail===null&&g.tailMode==="hidden"&&!N.alternate&&!Ze)return bt(c),null}else 2*yt()-g.renderingStartTime>_h&&h!==536870912&&(c.flags|=128,j=!0,gu(g,!1),c.lanes=4194304);g.isBackwards?(N.sibling=c.child,c.child=N):(o=g.last,o!==null?o.sibling=N:c.child=N,g.last=N)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yt(),o.sibling=null,h=Lt.current,te(Lt,j?h&1|2:h&1),Ze&&jr(c,g.treeForkCount),o):(bt(c),null);case 22:case 23:return Zn(c),n0(),g=c.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(h&536870912)!==0&&(c.flags&128)===0&&(bt(c),c.subtreeFlags&6&&(c.flags|=8192)):bt(c),h=c.updateQueue,h!==null&&wh(c,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048),o!==null&&F(La),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),c.memoizedState.cache!==h&&(c.flags|=2048),Nr(Ft),bt(c),null;case 25:return null;case 30:return null}throw Error(s(156,c.tag))}function dF(o,c){switch(Bx(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Nr(Ft),ce(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return ge(c),null;case 31:if(c.memoizedState!==null){if(Zn(c),c.alternate===null)throw Error(s(340));Ia()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(Zn(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(s(340));Ia()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return F(Lt),null;case 4:return ce(),null;case 10:return Nr(c.type),null;case 22:case 23:return Zn(c),n0(),o!==null&&F(La),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Nr(Ft),null;case 25:return null;default:return null}}function GE(o,c){switch(Bx(c),c.tag){case 3:Nr(Ft),ce();break;case 26:case 27:case 5:ge(c);break;case 4:ce();break;case 31:c.memoizedState!==null&&Zn(c);break;case 13:Zn(c);break;case 19:F(Lt);break;case 10:Nr(c.type);break;case 22:case 23:Zn(c),n0(),o!==null&&F(La);break;case 24:Nr(Ft)}}function xu(o,c){try{var h=c.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var j=g.next;h=j;do{if((h.tag&o)===o){g=void 0;var N=h.create,M=h.inst;g=N(),M.destroy=g}h=h.next}while(h!==j)}}catch(z){ct(c,c.return,z)}}function bi(o,c,h){try{var g=c.updateQueue,j=g!==null?g.lastEffect:null;if(j!==null){var N=j.next;g=N;do{if((g.tag&o)===o){var M=g.inst,z=M.destroy;if(z!==void 0){M.destroy=void 0,j=c;var Z=h,ae=z;try{ae()}catch(ue){ct(j,Z,ue)}}}g=g.next}while(g!==N)}}catch(ue){ct(c,c.return,ue)}}function KE(o){var c=o.updateQueue;if(c!==null){var h=o.stateNode;try{$C(c,h)}catch(g){ct(o,o.return,g)}}}function WE(o,c,h){h.props=za(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(g){ct(o,c,g)}}function yu(o,c){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof h=="function"?o.refCleanup=h(g):h.current=g}}catch(j){ct(o,c,j)}}function Qs(o,c){var h=o.ref,g=o.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(j){ct(o,c,j)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(j){ct(o,c,j)}else h.current=null}function YE(o){var c=o.type,h=o.memoizedProps,g=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(j){ct(o,o.return,j)}}function O0(o,c,h){try{var g=o.stateNode;MF(g,o.type,h,c),g[mn]=c}catch(j){ct(o,o.return,j)}}function QE(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ci(o.type)||o.tag===4}function L0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||QE(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ci(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function P0(o,c,h){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,c):(c=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,c.appendChild(o),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=vr));else if(g!==4&&(g===27&&Ci(o.type)&&(h=o.stateNode,c=null),o=o.child,o!==null))for(P0(o,c,h),o=o.sibling;o!==null;)P0(o,c,h),o=o.sibling}function jh(o,c,h){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?h.insertBefore(o,c):h.appendChild(o);else if(g!==4&&(g===27&&Ci(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(jh(o,c,h),o=o.sibling;o!==null;)jh(o,c,h),o=o.sibling}function XE(o){var c=o.stateNode,h=o.memoizedProps;try{for(var g=o.type,j=c.attributes;j.length;)c.removeAttributeNode(j[0]);ln(c,g,h),c[Xt]=o,c[mn]=h}catch(N){ct(o,o.return,N)}}var Rr=!1,Vt=!1,$0=!1,ZE=typeof WeakSet=="function"?WeakSet:Set,tn=null;function fF(o,c){if(o=o.containerInfo,ry=Hh,o=uC(o),Ax(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var j=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{h.nodeType,N.nodeType}catch{h=null;break e}var M=0,z=-1,Z=-1,ae=0,ue=0,fe=o,oe=null;t:for(;;){for(var le;fe!==h||j!==0&&fe.nodeType!==3||(z=M+j),fe!==N||g!==0&&fe.nodeType!==3||(Z=M+g),fe.nodeType===3&&(M+=fe.nodeValue.length),(le=fe.firstChild)!==null;)oe=fe,fe=le;for(;;){if(fe===o)break t;if(oe===h&&++ae===j&&(z=M),oe===N&&++ue===g&&(Z=M),(le=fe.nextSibling)!==null)break;fe=oe,oe=fe.parentNode}fe=le}h=z===-1||Z===-1?null:{start:z,end:Z}}else h=null}h=h||{start:0,end:0}}else h=null;for(iy={focusedElem:o,selectionRange:h},Hh=!1,tn=c;tn!==null;)if(c=tn,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,tn=o;else for(;tn!==null;){switch(c=tn,N=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h<o.length;h++)j=o[h],j.ref.impl=j.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&N!==null){o=void 0,h=c,j=N.memoizedProps,N=N.memoizedState,g=h.stateNode;try{var we=za(h.type,j);o=g.getSnapshotBeforeUpdate(we,N),g.__reactInternalSnapshotBeforeUpdate=o}catch(Te){ct(h,h.return,Te)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,h=o.nodeType,h===9)ly(o);else if(h===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":ly(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(s(163))}if(o=c.sibling,o!==null){o.return=c.return,tn=o;break}tn=c.return}}function JE(o,c,h){var g=h.flags;switch(h.tag){case 0:case 11:case 15:Tr(o,h),g&4&&xu(5,h);break;case 1:if(Tr(o,h),g&4)if(o=h.stateNode,c===null)try{o.componentDidMount()}catch(M){ct(h,h.return,M)}else{var j=za(h.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(j,c,o.__reactInternalSnapshotBeforeUpdate)}catch(M){ct(h,h.return,M)}}g&64&&KE(h),g&512&&yu(h,h.return);break;case 3:if(Tr(o,h),g&64&&(o=h.updateQueue,o!==null)){if(c=null,h.child!==null)switch(h.child.tag){case 27:case 5:c=h.child.stateNode;break;case 1:c=h.child.stateNode}try{$C(o,c)}catch(M){ct(h,h.return,M)}}break;case 27:c===null&&g&4&&XE(h);case 26:case 5:Tr(o,h),c===null&&g&4&&YE(h),g&512&&yu(h,h.return);break;case 12:Tr(o,h);break;case 31:Tr(o,h),g&4&&nR(o,h);break;case 13:Tr(o,h),g&4&&sR(o,h),g&64&&(o=h.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(h=wF.bind(null,h),BF(o,h))));break;case 22:if(g=h.memoizedState!==null||Rr,!g){c=c!==null&&c.memoizedState!==null||Vt,j=Rr;var N=Vt;Rr=g,(Vt=c)&&!N?Ir(o,h,(h.subtreeFlags&8772)!==0):Tr(o,h),Rr=j,Vt=N}break;case 30:break;default:Tr(o,h)}}function eR(o){var c=o.alternate;c!==null&&(o.alternate=null,eR(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&Uc(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var St=null,On=!1;function Ar(o,c,h){for(h=h.child;h!==null;)tR(o,c,h),h=h.sibling}function tR(o,c,h){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(pn,h)}catch{}switch(h.tag){case 26:Vt||Qs(h,c),Ar(o,c,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Vt||Qs(h,c);var g=St,j=On;Ci(h.type)&&(St=h.stateNode,On=!1),Ar(o,c,h),Cu(h.stateNode),St=g,On=j;break;case 5:Vt||Qs(h,c);case 6:if(g=St,j=On,St=null,Ar(o,c,h),St=g,On=j,St!==null)if(On)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(h.stateNode)}catch(N){ct(h,c,N)}else try{St.removeChild(h.stateNode)}catch(N){ct(h,c,N)}break;case 18:St!==null&&(On?(o=St,KR(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,h.stateNode),Nl(o)):KR(St,h.stateNode));break;case 4:g=St,j=On,St=h.stateNode.containerInfo,On=!0,Ar(o,c,h),St=g,On=j;break;case 0:case 11:case 14:case 15:bi(2,h,c),Vt||bi(4,h,c),Ar(o,c,h);break;case 1:Vt||(Qs(h,c),g=h.stateNode,typeof g.componentWillUnmount=="function"&&WE(h,c,g)),Ar(o,c,h);break;case 21:Ar(o,c,h);break;case 22:Vt=(g=Vt)||h.memoizedState!==null,Ar(o,c,h),Vt=g;break;default:Ar(o,c,h)}}function nR(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Nl(o)}catch(h){ct(c,c.return,h)}}}function sR(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Nl(o)}catch(h){ct(c,c.return,h)}}function hF(o){switch(o.tag){case 31:case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new ZE),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new ZE),c;default:throw Error(s(435,o.tag))}}function Sh(o,c){var h=hF(o);c.forEach(function(g){if(!h.has(g)){h.add(g);var j=jF.bind(null,o,g);g.then(j,j)}})}function Ln(o,c){var h=c.deletions;if(h!==null)for(var g=0;g<h.length;g++){var j=h[g],N=o,M=c,z=M;e:for(;z!==null;){switch(z.tag){case 27:if(Ci(z.type)){St=z.stateNode,On=!1;break e}break;case 5:St=z.stateNode,On=!1;break e;case 3:case 4:St=z.stateNode.containerInfo,On=!0;break e}z=z.return}if(St===null)throw Error(s(160));tR(N,M,j),St=null,On=!1,N=j.alternate,N!==null&&(N.return=null),j.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)rR(c,o),c=c.sibling}var Rs=null;function rR(o,c){var h=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ln(c,o),Pn(o),g&4&&(bi(3,o,o.return),xu(3,o),bi(5,o,o.return));break;case 1:Ln(c,o),Pn(o),g&512&&(Vt||h===null||Qs(h,h.return)),g&64&&Rr&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(h=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=h===null?g:h.concat(g))));break;case 26:var j=Rs;if(Ln(c,o),Pn(o),g&512&&(Vt||h===null||Qs(h,h.return)),g&4){var N=h!==null?h.memoizedState:null;if(g=o.memoizedState,h===null)if(g===null)if(o.stateNode===null){e:{g=o.type,h=o.memoizedProps,j=j.ownerDocument||j;t:switch(g){case"title":N=j.getElementsByTagName("title")[0],(!N||N[Na]||N[Xt]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=j.createElement(g),j.head.insertBefore(N,j.querySelector("head > title"))),ln(N,g,h),N[Xt]=o,Bt(N),g=N;break e;case"link":var M=rA("link","href",j).get(g+(h.href||""));if(M){for(var z=0;z<M.length;z++)if(N=M[z],N.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&N.getAttribute("rel")===(h.rel==null?null:h.rel)&&N.getAttribute("title")===(h.title==null?null:h.title)&&N.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){M.splice(z,1);break t}}N=j.createElement(g),ln(N,g,h),j.head.appendChild(N);break;case"meta":if(M=rA("meta","content",j).get(g+(h.content||""))){for(z=0;z<M.length;z++)if(N=M[z],N.getAttribute("content")===(h.content==null?null:""+h.content)&&N.getAttribute("name")===(h.name==null?null:h.name)&&N.getAttribute("property")===(h.property==null?null:h.property)&&N.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&N.getAttribute("charset")===(h.charSet==null?null:h.charSet)){M.splice(z,1);break t}}N=j.createElement(g),ln(N,g,h),j.head.appendChild(N);break;default:throw Error(s(468,g))}N[Xt]=o,Bt(N),g=N}o.stateNode=g}else iA(j,o.type,o.stateNode);else o.stateNode=sA(j,g,o.memoizedProps);else N!==g?(N===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):N.count--,g===null?iA(j,o.type,o.stateNode):sA(j,g,o.memoizedProps)):g===null&&o.stateNode!==null&&O0(o,o.memoizedProps,h.memoizedProps)}break;case 27:Ln(c,o),Pn(o),g&512&&(Vt||h===null||Qs(h,h.return)),h!==null&&g&4&&O0(o,o.memoizedProps,h.memoizedProps);break;case 5:if(Ln(c,o),Pn(o),g&512&&(Vt||h===null||Qs(h,h.return)),o.flags&32){j=o.stateNode;try{Ko(j,"")}catch(we){ct(o,o.return,we)}}g&4&&o.stateNode!=null&&(j=o.memoizedProps,O0(o,j,h!==null?h.memoizedProps:j)),g&1024&&($0=!0);break;case 6:if(Ln(c,o),Pn(o),g&4){if(o.stateNode===null)throw Error(s(162));g=o.memoizedProps,h=o.stateNode;try{h.nodeValue=g}catch(we){ct(o,o.return,we)}}break;case 3:if(qh=null,j=Rs,Rs=$h(c.containerInfo),Ln(c,o),Rs=j,Pn(o),g&4&&h!==null&&h.memoizedState.isDehydrated)try{Nl(c.containerInfo)}catch(we){ct(o,o.return,we)}$0&&($0=!1,iR(o));break;case 4:g=Rs,Rs=$h(o.stateNode.containerInfo),Ln(c,o),Pn(o),Rs=g;break;case 12:Ln(c,o),Pn(o);break;case 31:Ln(c,o),Pn(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Sh(o,g)));break;case 13:Ln(c,o),Pn(o),o.child.flags&8192&&o.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(kh=yt()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Sh(o,g)));break;case 22:j=o.memoizedState!==null;var Z=h!==null&&h.memoizedState!==null,ae=Rr,ue=Vt;if(Rr=ae||j,Vt=ue||Z,Ln(c,o),Vt=ue,Rr=ae,Pn(o),g&8192)e:for(c=o.stateNode,c._visibility=j?c._visibility&-2:c._visibility|1,j&&(h===null||Z||Rr||Vt||Ba(o)),h=null,c=o;;){if(c.tag===5||c.tag===26){if(h===null){Z=h=c;try{if(N=Z.stateNode,j)M=N.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{z=Z.stateNode;var fe=Z.memoizedProps.style,oe=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;z.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(we){ct(Z,Z.return,we)}}}else if(c.tag===6){if(h===null){Z=c;try{Z.stateNode.nodeValue=j?"":Z.memoizedProps}catch(we){ct(Z,Z.return,we)}}}else if(c.tag===18){if(h===null){Z=c;try{var le=Z.stateNode;j?WR(le,!0):WR(Z.stateNode,!1)}catch(we){ct(Z,Z.return,we)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;h===c&&(h=null),c=c.return}h===c&&(h=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=o.updateQueue,g!==null&&(h=g.retryQueue,h!==null&&(g.retryQueue=null,Sh(o,h))));break;case 19:Ln(c,o),Pn(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Sh(o,g)));break;case 30:break;case 21:break;default:Ln(c,o),Pn(o)}}function Pn(o){var c=o.flags;if(c&2){try{for(var h,g=o.return;g!==null;){if(QE(g)){h=g;break}g=g.return}if(h==null)throw Error(s(160));switch(h.tag){case 27:var j=h.stateNode,N=L0(o);jh(o,N,j);break;case 5:var M=h.stateNode;h.flags&32&&(Ko(M,""),h.flags&=-33);var z=L0(o);jh(o,z,M);break;case 3:case 4:var Z=h.stateNode.containerInfo,ae=L0(o);P0(o,ae,Z);break;default:throw Error(s(161))}}catch(ue){ct(o,o.return,ue)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function iR(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;iR(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function Tr(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)JE(o,c.alternate,c),c=c.sibling}function Ba(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:bi(4,c,c.return),Ba(c);break;case 1:Qs(c,c.return);var h=c.stateNode;typeof h.componentWillUnmount=="function"&&WE(c,c.return,h),Ba(c);break;case 27:Cu(c.stateNode);case 26:case 5:Qs(c,c.return),Ba(c);break;case 22:c.memoizedState===null&&Ba(c);break;case 30:Ba(c);break;default:Ba(c)}o=o.sibling}}function Ir(o,c,h){for(h=h&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,j=o,N=c,M=N.flags;switch(N.tag){case 0:case 11:case 15:Ir(j,N,h),xu(4,N);break;case 1:if(Ir(j,N,h),g=N,j=g.stateNode,typeof j.componentDidMount=="function")try{j.componentDidMount()}catch(ae){ct(g,g.return,ae)}if(g=N,j=g.updateQueue,j!==null){var z=g.stateNode;try{var Z=j.shared.hiddenCallbacks;if(Z!==null)for(j.shared.hiddenCallbacks=null,j=0;j<Z.length;j++)PC(Z[j],z)}catch(ae){ct(g,g.return,ae)}}h&&M&64&&KE(N),yu(N,N.return);break;case 27:XE(N);case 26:case 5:Ir(j,N,h),h&&g===null&&M&4&&YE(N),yu(N,N.return);break;case 12:Ir(j,N,h);break;case 31:Ir(j,N,h),h&&M&4&&nR(j,N);break;case 13:Ir(j,N,h),h&&M&4&&sR(j,N);break;case 22:N.memoizedState===null&&Ir(j,N,h),yu(N,N.return);break;case 30:break;default:Ir(j,N,h)}c=c.sibling}}function D0(o,c){var h=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==h&&(o!=null&&o.refCount++,h!=null&&ru(h))}function q0(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&ru(o))}function As(o,c,h,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)aR(o,c,h,g),c=c.sibling}function aR(o,c,h,g){var j=c.flags;switch(c.tag){case 0:case 11:case 15:As(o,c,h,g),j&2048&&xu(9,c);break;case 1:As(o,c,h,g);break;case 3:As(o,c,h,g),j&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&ru(o)));break;case 12:if(j&2048){As(o,c,h,g),o=c.stateNode;try{var N=c.memoizedProps,M=N.id,z=N.onPostCommit;typeof z=="function"&&z(M,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Z){ct(c,c.return,Z)}}else As(o,c,h,g);break;case 31:As(o,c,h,g);break;case 13:As(o,c,h,g);break;case 23:break;case 22:N=c.stateNode,M=c.alternate,c.memoizedState!==null?N._visibility&2?As(o,c,h,g):vu(o,c):N._visibility&2?As(o,c,h,g):(N._visibility|=2,hl(o,c,h,g,(c.subtreeFlags&10256)!==0||!1)),j&2048&&D0(M,c);break;case 24:As(o,c,h,g),j&2048&&q0(c.alternate,c);break;default:As(o,c,h,g)}}function hl(o,c,h,g,j){for(j=j&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var N=o,M=c,z=h,Z=g,ae=M.flags;switch(M.tag){case 0:case 11:case 15:hl(N,M,z,Z,j),xu(8,M);break;case 23:break;case 22:var ue=M.stateNode;M.memoizedState!==null?ue._visibility&2?hl(N,M,z,Z,j):vu(N,M):(ue._visibility|=2,hl(N,M,z,Z,j)),j&&ae&2048&&D0(M.alternate,M);break;case 24:hl(N,M,z,Z,j),j&&ae&2048&&q0(M.alternate,M);break;default:hl(N,M,z,Z,j)}c=c.sibling}}function vu(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var h=o,g=c,j=g.flags;switch(g.tag){case 22:vu(h,g),j&2048&&D0(g.alternate,g);break;case 24:vu(h,g),j&2048&&q0(g.alternate,g);break;default:vu(h,g)}c=c.sibling}}var bu=8192;function pl(o,c,h){if(o.subtreeFlags&bu)for(o=o.child;o!==null;)oR(o,c,h),o=o.sibling}function oR(o,c,h){switch(o.tag){case 26:pl(o,c,h),o.flags&bu&&o.memoizedState!==null&&JF(h,Rs,o.memoizedState,o.memoizedProps);break;case 5:pl(o,c,h);break;case 3:case 4:var g=Rs;Rs=$h(o.stateNode.containerInfo),pl(o,c,h),Rs=g;break;case 22:o.memoizedState===null&&(g=o.alternate,g!==null&&g.memoizedState!==null?(g=bu,bu=16777216,pl(o,c,h),bu=g):pl(o,c,h));break;default:pl(o,c,h)}}function lR(o){var c=o.alternate;if(c!==null&&(o=c.child,o!==null)){c.child=null;do c=o.sibling,o.sibling=null,o=c;while(o!==null)}}function wu(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var g=c[h];tn=g,uR(g,o)}lR(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)cR(o),o=o.sibling}function cR(o){switch(o.tag){case 0:case 11:case 15:wu(o),o.flags&2048&&bi(9,o,o.return);break;case 3:wu(o);break;case 12:wu(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,Nh(o)):wu(o);break;default:wu(o)}}function Nh(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var g=c[h];tn=g,uR(g,o)}lR(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:bi(8,c,c.return),Nh(c);break;case 22:h=c.stateNode,h._visibility&2&&(h._visibility&=-3,Nh(c));break;default:Nh(c)}o=o.sibling}}function uR(o,c){for(;tn!==null;){var h=tn;switch(h.tag){case 0:case 11:case 15:bi(8,h,c);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var g=h.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:ru(h.memoizedState.cache)}if(g=h.child,g!==null)g.return=h,tn=g;else e:for(h=o;tn!==null;){g=tn;var j=g.sibling,N=g.return;if(eR(g),g===h){tn=null;break e}if(j!==null){j.return=N,tn=j;break e}tn=N}}}var pF={getCacheForType:function(o){var c=an(Ft),h=c.data.get(o);return h===void 0&&(h=o(),c.data.set(o,h)),h},cacheSignal:function(){return an(Ft).controller.signal}},mF=typeof WeakMap=="function"?WeakMap:Map,rt=0,ht=null,We=null,Qe=0,lt=0,Jn=null,wi=!1,ml=!1,z0=!1,Mr=0,At=0,ji=0,Fa=0,B0=0,es=0,gl=0,ju=null,$n=null,F0=!1,kh=0,dR=0,_h=1/0,Ch=null,Si=null,Zt=0,Ni=null,xl=null,Or=0,H0=0,U0=null,fR=null,Su=0,V0=null;function ts(){return(rt&2)!==0&&Qe!==0?Qe&-Qe:q.T!==null?X0():Tf()}function hR(){if(es===0)if((Qe&536870912)===0||Ze){var o=Bo;Bo<<=1,(Bo&3932160)===0&&(Bo=262144),es=o}else es=536870912;return o=Xn.current,o!==null&&(o.flags|=32),es}function Dn(o,c,h){(o===ht&&(lt===2||lt===9)||o.cancelPendingCommit!==null)&&(yl(o,0),ki(o,Qe,es,!1)),Sa(o,h),((rt&2)===0||o!==ht)&&(o===ht&&((rt&2)===0&&(Fa|=h),At===4&&ki(o,Qe,es,!1)),Xs(o))}function pR(o,c,h){if((rt&6)!==0)throw Error(s(327));var g=!h&&(c&127)===0&&(c&o.expiredLanes)===0||ja(o,c),j=g?yF(o,c):K0(o,c,!0),N=g;do{if(j===0){ml&&!g&&ki(o,c,0,!1);break}else{if(h=o.current.alternate,N&&!gF(h)){j=K0(o,c,!1),N=!1;continue}if(j===2){if(N=c,o.errorRecoveryDisabledLanes&N)var M=0;else M=o.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){c=M;e:{var z=o;j=ju;var Z=z.current.memoizedState.isDehydrated;if(Z&&(yl(z,M).flags|=256),M=K0(z,M,!1),M!==2){if(z0&&!Z){z.errorRecoveryDisabledLanes|=N,Fa|=N,j=4;break e}N=$n,$n=j,N!==null&&($n===null?$n=N:$n.push.apply($n,N))}j=M}if(N=!1,j!==2)continue}}if(j===1){yl(o,0),ki(o,c,0,!0);break}e:{switch(g=o,N=j,N){case 0:case 1:throw Error(s(345));case 4:if((c&4194048)!==c)break;case 6:ki(g,c,es,!wi);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((c&62914560)===c&&(j=kh+300-yt(),10<j)){if(ki(g,c,es,!wi),Ho(g,0,!0)!==0)break e;Or=c,g.timeoutHandle=VR(mR.bind(null,g,h,$n,Ch,F0,c,es,Fa,gl,wi,N,"Throttled",-0,0),j);break e}mR(g,h,$n,Ch,F0,c,es,Fa,gl,wi,N,null,-0,0)}}break}while(!0);Xs(o)}function mR(o,c,h,g,j,N,M,z,Z,ae,ue,fe,oe,le){if(o.timeoutHandle=-1,fe=c.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vr},oR(c,N,fe);var we=(N&62914560)===N?kh-yt():(N&4194048)===N?dR-yt():0;if(we=e7(fe,we),we!==null){Or=N,o.cancelPendingCommit=we(SR.bind(null,o,c,N,h,g,j,M,z,Z,ue,fe,null,oe,le)),ki(o,N,M,!ae);return}}SR(o,c,N,h,g,j,M,z,Z)}function gF(o){for(var c=o;;){var h=c.tag;if((h===0||h===11||h===15)&&c.flags&16384&&(h=c.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var g=0;g<h.length;g++){var j=h[g],N=j.getSnapshot;j=j.value;try{if(!Yn(N(),j))return!1}catch{return!1}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function ki(o,c,h,g){c&=~B0,c&=~Fa,o.suspendedLanes|=c,o.pingedLanes&=~c,g&&(o.warmLanes|=c),g=o.expirationTimes;for(var j=c;0<j;){var N=31-_n(j),M=1<<N;g[N]=-1,j&=~M}h!==0&&Ef(o,h,c)}function Eh(){return(rt&6)===0?(Nu(0),!1):!0}function G0(){if(We!==null){if(lt===0)var o=We.return;else o=We,Sr=Ma=null,l0(o),ll=null,au=0,o=We;for(;o!==null;)GE(o.alternate,o),o=o.return;We=null}}function yl(o,c){var h=o.timeoutHandle;h!==-1&&(o.timeoutHandle=-1,PF(h)),h=o.cancelPendingCommit,h!==null&&(o.cancelPendingCommit=null,h()),Or=0,G0(),ht=o,We=h=wr(o.current,null),Qe=c,lt=0,Jn=null,wi=!1,ml=ja(o,c),z0=!1,gl=es=B0=Fa=ji=At=0,$n=ju=null,F0=!1,(c&8)!==0&&(c|=c&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=c;0<g;){var j=31-_n(g),N=1<<j;c|=o[j],g&=~N}return Mr=c,Yf(),h}function gR(o,c){Fe=null,q.H=pu,c===ol||c===sh?(c=IC(),lt=3):c===Qx?(c=IC(),lt=4):lt=c===N0?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Jn=c,We===null&&(At=1,xh(o,us(c,o.current)))}function xR(){var o=Xn.current;return o===null?!0:(Qe&4194048)===Qe?ps===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?o===ps:!1}function yR(){var o=q.H;return q.H=pu,o===null?pu:o}function vR(){var o=q.A;return q.A=pF,o}function Rh(){At=4,wi||(Qe&4194048)!==Qe&&Xn.current!==null||(ml=!0),(ji&134217727)===0&&(Fa&134217727)===0||ht===null||ki(ht,Qe,es,!1)}function K0(o,c,h){var g=rt;rt|=2;var j=yR(),N=vR();(ht!==o||Qe!==c)&&(Ch=null,yl(o,c)),c=!1;var M=At;e:do try{if(lt!==0&&We!==null){var z=We,Z=Jn;switch(lt){case 8:G0(),M=6;break e;case 3:case 2:case 9:case 6:Xn.current===null&&(c=!0);var ae=lt;if(lt=0,Jn=null,vl(o,z,Z,ae),h&&ml){M=0;break e}break;default:ae=lt,lt=0,Jn=null,vl(o,z,Z,ae)}}xF(),M=At;break}catch(ue){gR(o,ue)}while(!0);return c&&o.shellSuspendCounter++,Sr=Ma=null,rt=g,q.H=j,q.A=N,We===null&&(ht=null,Qe=0,Yf()),M}function xF(){for(;We!==null;)bR(We)}function yF(o,c){var h=rt;rt|=2;var g=yR(),j=vR();ht!==o||Qe!==c?(Ch=null,_h=yt()+500,yl(o,c)):ml=ja(o,c);e:do try{if(lt!==0&&We!==null){c=We;var N=Jn;t:switch(lt){case 1:lt=0,Jn=null,vl(o,c,N,1);break;case 2:case 9:if(AC(N)){lt=0,Jn=null,wR(c);break}c=function(){lt!==2&<!==9||ht!==o||(lt=7),Xs(o)},N.then(c,c);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:AC(N)?(lt=0,Jn=null,wR(c)):(lt=0,Jn=null,vl(o,c,N,7));break;case 5:var M=null;switch(We.tag){case 26:M=We.memoizedState;case 5:case 27:var z=We;if(M?aA(M):z.stateNode.complete){lt=0,Jn=null;var Z=z.sibling;if(Z!==null)We=Z;else{var ae=z.return;ae!==null?(We=ae,Ah(ae)):We=null}break t}}lt=0,Jn=null,vl(o,c,N,5);break;case 6:lt=0,Jn=null,vl(o,c,N,6);break;case 8:G0(),At=6;break e;default:throw Error(s(462))}}vF();break}catch(ue){gR(o,ue)}while(!0);return Sr=Ma=null,q.H=g,q.A=j,rt=h,We!==null?0:(ht=null,Qe=0,Yf(),At)}function vF(){for(;We!==null&&!Yt();)bR(We)}function bR(o){var c=UE(o.alternate,o,Mr);o.memoizedProps=o.pendingProps,c===null?Ah(o):We=c}function wR(o){var c=o,h=c.alternate;switch(c.tag){case 15:case 0:c=DE(h,c,c.pendingProps,c.type,void 0,Qe);break;case 11:c=DE(h,c,c.pendingProps,c.type.render,c.ref,Qe);break;case 5:l0(c);default:GE(h,c),c=We=vC(c,Mr),c=UE(h,c,Mr)}o.memoizedProps=o.pendingProps,c===null?Ah(o):We=c}function vl(o,c,h,g){Sr=Ma=null,l0(c),ll=null,au=0;var j=c.return;try{if(oF(o,j,c,h,Qe)){At=1,xh(o,us(h,o.current)),We=null;return}}catch(N){if(j!==null)throw We=j,N;At=1,xh(o,us(h,o.current)),We=null;return}c.flags&32768?(Ze||g===1?o=!0:ml||(Qe&536870912)!==0?o=!1:(wi=o=!0,(g===2||g===9||g===3||g===6)&&(g=Xn.current,g!==null&&g.tag===13&&(g.flags|=16384))),jR(c,o)):Ah(c)}function Ah(o){var c=o;do{if((c.flags&32768)!==0){jR(c,wi);return}o=c.return;var h=uF(c.alternate,c,Mr);if(h!==null){We=h;return}if(c=c.sibling,c!==null){We=c;return}We=c=o}while(c!==null);At===0&&(At=5)}function jR(o,c){do{var h=dF(o.alternate,o);if(h!==null){h.flags&=32767,We=h;return}if(h=o.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!c&&(o=o.sibling,o!==null)){We=o;return}We=o=h}while(o!==null);At=6,We=null}function SR(o,c,h,g,j,N,M,z,Z){o.cancelPendingCommit=null;do Th();while(Zt!==0);if((rt&6)!==0)throw Error(s(327));if(c!==null){if(c===o.current)throw Error(s(177));if(N=c.lanes|c.childLanes,N|=Lx,dx(o,h,N,M,z,Z),o===ht&&(We=ht=null,Qe=0),xl=c,Ni=o,Or=h,H0=N,U0=j,fR=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,SF(hn,function(){return ER(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=q.T,q.T=null,j=V.p,V.p=2,M=rt,rt|=4;try{fF(o,c,h)}finally{rt=M,V.p=j,q.T=g}}Zt=1,NR(),kR(),_R()}}function NR(){if(Zt===1){Zt=0;var o=Ni,c=xl,h=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||h){h=q.T,q.T=null;var g=V.p;V.p=2;var j=rt;rt|=4;try{rR(c,o);var N=iy,M=uC(o.containerInfo),z=N.focusedElem,Z=N.selectionRange;if(M!==z&&z&&z.ownerDocument&&cC(z.ownerDocument.documentElement,z)){if(Z!==null&&Ax(z)){var ae=Z.start,ue=Z.end;if(ue===void 0&&(ue=ae),"selectionStart"in z)z.selectionStart=ae,z.selectionEnd=Math.min(ue,z.value.length);else{var fe=z.ownerDocument||document,oe=fe&&fe.defaultView||window;if(oe.getSelection){var le=oe.getSelection(),we=z.textContent.length,Te=Math.min(Z.start,we),ft=Z.end===void 0?Te:Math.min(Z.end,we);!le.extend&&Te>ft&&(M=ft,ft=Te,Te=M);var ne=lC(z,Te),ee=lC(z,ft);if(ne&&ee&&(le.rangeCount!==1||le.anchorNode!==ne.node||le.anchorOffset!==ne.offset||le.focusNode!==ee.node||le.focusOffset!==ee.offset)){var ie=fe.createRange();ie.setStart(ne.node,ne.offset),le.removeAllRanges(),Te>ft?(le.addRange(ie),le.extend(ee.node,ee.offset)):(ie.setEnd(ee.node,ee.offset),le.addRange(ie))}}}}for(fe=[],le=z;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<fe.length;z++){var de=fe[z];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Hh=!!ry,iy=ry=null}finally{rt=j,V.p=g,q.T=h}}o.current=c,Zt=2}}function kR(){if(Zt===2){Zt=0;var o=Ni,c=xl,h=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||h){h=q.T,q.T=null;var g=V.p;V.p=2;var j=rt;rt|=4;try{JE(o,c.alternate,c)}finally{rt=j,V.p=g,q.T=h}}Zt=3}}function _R(){if(Zt===4||Zt===3){Zt=0,jt();var o=Ni,c=xl,h=Or,g=fR;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Zt=5:(Zt=0,xl=Ni=null,CR(o,o.pendingLanes));var j=o.pendingLanes;if(j===0&&(Si=null),Hc(h),c=c.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(pn,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=q.T,j=V.p,V.p=2,q.T=null;try{for(var N=o.onRecoverableError,M=0;M<g.length;M++){var z=g[M];N(z.value,{componentStack:z.stack})}}finally{q.T=c,V.p=j}}(Or&3)!==0&&Th(),Xs(o),j=o.pendingLanes,(h&261930)!==0&&(j&42)!==0?o===V0?Su++:(Su=0,V0=o):Su=0,Nu(0)}}function CR(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,ru(c)))}function Th(){return NR(),kR(),_R(),ER()}function ER(){if(Zt!==5)return!1;var o=Ni,c=H0;H0=0;var h=Hc(Or),g=q.T,j=V.p;try{V.p=32>h?32:h,q.T=null,h=U0,U0=null;var N=Ni,M=Or;if(Zt=0,xl=Ni=null,Or=0,(rt&6)!==0)throw Error(s(331));var z=rt;if(rt|=4,cR(N.current),aR(N,N.current,M,h),rt=z,Nu(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(pn,N)}catch{}return!0}finally{V.p=j,q.T=g,CR(o,c)}}function RR(o,c,h){c=us(h,c),c=S0(o.stateNode,c,2),o=xi(o,c,2),o!==null&&(Sa(o,2),Xs(o))}function ct(o,c,h){if(o.tag===3)RR(o,o,h);else for(;c!==null;){if(c.tag===3){RR(c,o,h);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Si===null||!Si.has(g))){o=us(h,o),h=AE(2),g=xi(c,h,2),g!==null&&(TE(h,g,c,o),Sa(g,2),Xs(g));break}}c=c.return}}function W0(o,c,h){var g=o.pingCache;if(g===null){g=o.pingCache=new mF;var j=new Set;g.set(c,j)}else j=g.get(c),j===void 0&&(j=new Set,g.set(c,j));j.has(h)||(z0=!0,j.add(h),o=bF.bind(null,o,c,h),c.then(o,o))}function bF(o,c,h){var g=o.pingCache;g!==null&&g.delete(c),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,ht===o&&(Qe&h)===h&&(At===4||At===3&&(Qe&62914560)===Qe&&300>yt()-kh?(rt&2)===0&&yl(o,0):B0|=h,gl===Qe&&(gl=0)),Xs(o)}function AR(o,c){c===0&&(c=Cf()),o=Aa(o,c),o!==null&&(Sa(o,c),Xs(o))}function wF(o){var c=o.memoizedState,h=0;c!==null&&(h=c.retryLane),AR(o,h)}function jF(o,c){var h=0;switch(o.tag){case 31:case 13:var g=o.stateNode,j=o.memoizedState;j!==null&&(h=j.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(c),AR(o,h)}function SF(o,c){return Ot(o,c)}var Ih=null,bl=null,Y0=!1,Mh=!1,Q0=!1,_i=0;function Xs(o){o!==bl&&o.next===null&&(bl===null?Ih=bl=o:bl=bl.next=o),Mh=!0,Y0||(Y0=!0,kF())}function Nu(o,c){if(!Q0&&Mh){Q0=!0;do for(var h=!1,g=Ih;g!==null;){if(o!==0){var j=g.pendingLanes;if(j===0)var N=0;else{var M=g.suspendedLanes,z=g.pingedLanes;N=(1<<31-_n(42|o)+1)-1,N&=j&~(M&~z),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(h=!0,OR(g,N))}else N=Qe,N=Ho(g,g===ht?N:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(N&3)===0||ja(g,N)||(h=!0,OR(g,N));g=g.next}while(h);Q0=!1}}function NF(){TR()}function TR(){Mh=Y0=!1;var o=0;_i!==0&&LF()&&(o=_i);for(var c=yt(),h=null,g=Ih;g!==null;){var j=g.next,N=IR(g,c);N===0?(g.next=null,h===null?Ih=j:h.next=j,j===null&&(bl=h)):(h=g,(o!==0||(N&3)!==0)&&(Mh=!0)),g=j}Zt!==0&&Zt!==5||Nu(o),_i!==0&&(_i=0)}function IR(o,c){for(var h=o.suspendedLanes,g=o.pingedLanes,j=o.expirationTimes,N=o.pendingLanes&-62914561;0<N;){var M=31-_n(N),z=1<<M,Z=j[M];Z===-1?((z&h)===0||(z&g)!==0)&&(j[M]=ux(z,c)):Z<=c&&(o.expiredLanes|=z),N&=~z}if(c=ht,h=Qe,h=Ho(o,o===c?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,h===0||o===c&&(lt===2||lt===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&fn(g),o.callbackNode=null,o.callbackPriority=0;if((h&3)===0||ja(o,h)){if(c=h&-h,c===o.callbackPriority)return c;switch(g!==null&&fn(g),Hc(h)){case 2:case 8:h=Qt;break;case 32:h=hn;break;case 268435456:h=pr;break;default:h=hn}return g=MR.bind(null,o),h=Ot(h,g),o.callbackPriority=c,o.callbackNode=h,c}return g!==null&&g!==null&&fn(g),o.callbackPriority=2,o.callbackNode=null,2}function MR(o,c){if(Zt!==0&&Zt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var h=o.callbackNode;if(Th()&&o.callbackNode!==h)return null;var g=Qe;return g=Ho(o,o===ht?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(pR(o,g,c),IR(o,yt()),o.callbackNode!=null&&o.callbackNode===h?MR.bind(null,o):null)}function OR(o,c){if(Th())return null;pR(o,c,!0)}function kF(){$F(function(){(rt&6)!==0?Ot(pt,NF):TR()})}function X0(){if(_i===0){var o=il;o===0&&(o=zo,zo<<=1,(zo&261888)===0&&(zo=256)),_i=o}return _i}function LR(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Bf(""+o)}function PR(o,c){var h=c.ownerDocument.createElement("input");return h.name=c.name,h.value=c.value,o.id&&h.setAttribute("form",o.id),c.parentNode.insertBefore(h,c),o=new FormData(o),h.parentNode.removeChild(h),o}function _F(o,c,h,g,j){if(c==="submit"&&h&&h.stateNode===j){var N=LR((j[mn]||null).action),M=g.submitter;M&&(c=(c=M[mn]||null)?LR(c.formAction):M.getAttribute("formAction"),c!==null&&(N=c,M=null));var z=new Vf("action","action",null,g,j);o.push({event:z,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(_i!==0){var Z=M?PR(j,M):new FormData(j);x0(h,{pending:!0,data:Z,method:j.method,action:N},null,Z)}}else typeof N=="function"&&(z.preventDefault(),Z=M?PR(j,M):new FormData(j),x0(h,{pending:!0,data:Z,method:j.method,action:N},N,Z))},currentTarget:j}]})}}for(var Z0=0;Z0<Ox.length;Z0++){var J0=Ox[Z0],CF=J0.toLowerCase(),EF=J0[0].toUpperCase()+J0.slice(1);Es(CF,"on"+EF)}Es(hC,"onAnimationEnd"),Es(pC,"onAnimationIteration"),Es(mC,"onAnimationStart"),Es("dblclick","onDoubleClick"),Es("focusin","onFocus"),Es("focusout","onBlur"),Es(UB,"onTransitionRun"),Es(VB,"onTransitionStart"),Es(GB,"onTransitionCancel"),Es(gC,"onTransitionEnd"),li("onMouseEnter",["mouseout","mouseover"]),li("onMouseLeave",["mouseout","mouseover"]),li("onPointerEnter",["pointerout","pointerover"]),li("onPointerLeave",["pointerout","pointerover"]),xr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xr("onBeforeInput",["compositionend","keypress","textInput","paste"]),xr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),RF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ku));function $R(o,c){c=(c&4)!==0;for(var h=0;h<o.length;h++){var g=o[h],j=g.event;g=g.listeners;e:{var N=void 0;if(c)for(var M=g.length-1;0<=M;M--){var z=g[M],Z=z.instance,ae=z.currentTarget;if(z=z.listener,Z!==N&&j.isPropagationStopped())break e;N=z,j.currentTarget=ae;try{N(j)}catch(ue){Wf(ue)}j.currentTarget=null,N=Z}else for(M=0;M<g.length;M++){if(z=g[M],Z=z.instance,ae=z.currentTarget,z=z.listener,Z!==N&&j.isPropagationStopped())break e;N=z,j.currentTarget=ae;try{N(j)}catch(ue){Wf(ue)}j.currentTarget=null,N=Z}}}}function Ye(o,c){var h=c[Uo];h===void 0&&(h=c[Uo]=new Set);var g=o+"__bubble";h.has(g)||(DR(c,o,2,!1),h.add(g))}function ey(o,c,h){var g=0;c&&(g|=4),DR(h,o,g,c)}var Oh="_reactListening"+Math.random().toString(36).slice(2);function ty(o){if(!o[Oh]){o[Oh]=!0,Lf.forEach(function(h){h!=="selectionchange"&&(RF.has(h)||ey(h,!1,o),ey(h,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[Oh]||(c[Oh]=!0,ey("selectionchange",!1,c))}}function DR(o,c,h,g){switch(hA(c)){case 2:var j=s7;break;case 8:j=r7;break;default:j=gy}h=j.bind(null,c,h,o),j=void 0,!wx||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(j=!0),g?j!==void 0?o.addEventListener(c,h,{capture:!0,passive:j}):o.addEventListener(c,h,!0):j!==void 0?o.addEventListener(c,h,{passive:j}):o.addEventListener(c,h,!1)}function ny(o,c,h,g,j){var N=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var z=g.stateNode.containerInfo;if(z===j)break;if(M===4)for(M=g.return;M!==null;){var Z=M.tag;if((Z===3||Z===4)&&M.stateNode.containerInfo===j)return;M=M.return}for(;z!==null;){if(M=ri(z),M===null)return;if(Z=M.tag,Z===5||Z===6||Z===26||Z===27){g=N=M;continue e}z=z.parentNode}}g=g.return}H_(function(){var ae=N,ue=vx(h),fe=[];e:{var oe=xC.get(o);if(oe!==void 0){var le=Vf,we=o;switch(o){case"keypress":if(Hf(h)===0)break e;case"keydown":case"keyup":le=jB;break;case"focusin":we="focus",le=kx;break;case"focusout":we="blur",le=kx;break;case"beforeblur":case"afterblur":le=kx;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=G_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=uB;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=kB;break;case hC:case pC:case mC:le=hB;break;case gC:le=CB;break;case"scroll":case"scrollend":le=lB;break;case"wheel":le=RB;break;case"copy":case"cut":case"paste":le=mB;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=W_;break;case"toggle":case"beforetoggle":le=TB}var Te=(c&4)!==0,ft=!Te&&(o==="scroll"||o==="scrollend"),ne=Te?oe!==null?oe+"Capture":null:oe;Te=[];for(var ee=ae,ie;ee!==null;){var de=ee;if(ie=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ie===null||ne===null||(de=Kc(ee,ne),de!=null&&Te.push(_u(ee,de,ie))),ft)break;ee=ee.return}0<Te.length&&(oe=new le(oe,we,null,h,ue),fe.push({event:oe,listeners:Te}))}}if((c&7)===0){e:{if(oe=o==="mouseover"||o==="pointerover",le=o==="mouseout"||o==="pointerout",oe&&h!==yx&&(we=h.relatedTarget||h.fromElement)&&(ri(we)||we[gr]))break e;if((le||oe)&&(oe=ue.window===ue?ue:(oe=ue.ownerDocument)?oe.defaultView||oe.parentWindow:window,le?(we=h.relatedTarget||h.toElement,le=ae,we=we?ri(we):null,we!==null&&(ft=a(we),Te=we.tag,we!==ft||Te!==5&&Te!==27&&Te!==6)&&(we=null)):(le=null,we=ae),le!==we)){if(Te=G_,de="onMouseLeave",ne="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(Te=W_,de="onPointerLeave",ne="onPointerEnter",ee="pointer"),ft=le==null?oe:ai(le),ie=we==null?oe:ai(we),oe=new Te(de,ee+"leave",le,h,ue),oe.target=ft,oe.relatedTarget=ie,de=null,ri(ue)===ae&&(Te=new Te(ne,ee+"enter",we,h,ue),Te.target=ie,Te.relatedTarget=ft,de=Te),ft=de,le&&we)t:{for(Te=AF,ne=le,ee=we,ie=0,de=ne;de;de=Te(de))ie++;de=0;for(var Ee=ee;Ee;Ee=Te(Ee))de++;for(;0<ie-de;)ne=Te(ne),ie--;for(;0<de-ie;)ee=Te(ee),de--;for(;ie--;){if(ne===ee||ee!==null&&ne===ee.alternate){Te=ne;break t}ne=Te(ne),ee=Te(ee)}Te=null}else Te=null;le!==null&&qR(fe,oe,le,Te,!1),we!==null&&ft!==null&&qR(fe,ft,we,Te,!0)}}e:{if(oe=ae?ai(ae):window,le=oe.nodeName&&oe.nodeName.toLowerCase(),le==="select"||le==="input"&&oe.type==="file")var tt=nC;else if(eC(oe))if(sC)tt=BB;else{tt=qB;var Ce=DB}else le=oe.nodeName,!le||le.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ae&&xx(ae.elementType)&&(tt=nC):tt=zB;if(tt&&(tt=tt(o,ae))){tC(fe,tt,h,ue);break e}Ce&&Ce(o,oe,ae),o==="focusout"&&ae&&oe.type==="number"&&ae.memoizedProps.value!=null&&Gc(oe,"number",oe.value)}switch(Ce=ae?ai(ae):window,o){case"focusin":(eC(Ce)||Ce.contentEditable==="true")&&(Xo=Ce,Tx=ae,tu=null);break;case"focusout":tu=Tx=Xo=null;break;case"mousedown":Ix=!0;break;case"contextmenu":case"mouseup":case"dragend":Ix=!1,dC(fe,h,ue);break;case"selectionchange":if(HB)break;case"keydown":case"keyup":dC(fe,h,ue)}var He;if(Cx)e:{switch(o){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Qo?Z_(o,h)&&(Xe="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(Xe="onCompositionStart");Xe&&(Y_&&h.locale!=="ko"&&(Qo||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Qo&&(He=U_()):(ui=ue,jx="value"in ui?ui.value:ui.textContent,Qo=!0)),Ce=Lh(ae,Xe),0<Ce.length&&(Xe=new K_(Xe,o,null,h,ue),fe.push({event:Xe,listeners:Ce}),He?Xe.data=He:(He=J_(h),He!==null&&(Xe.data=He)))),(He=MB?OB(o,h):LB(o,h))&&(Xe=Lh(ae,"onBeforeInput"),0<Xe.length&&(Ce=new K_("onBeforeInput","beforeinput",null,h,ue),fe.push({event:Ce,listeners:Xe}),Ce.data=He)),_F(fe,o,ae,h,ue)}$R(fe,c)})}function _u(o,c,h){return{instance:o,listener:c,currentTarget:h}}function Lh(o,c){for(var h=c+"Capture",g=[];o!==null;){var j=o,N=j.stateNode;if(j=j.tag,j!==5&&j!==26&&j!==27||N===null||(j=Kc(o,h),j!=null&&g.unshift(_u(o,j,N)),j=Kc(o,c),j!=null&&g.push(_u(o,j,N))),o.tag===3)return g;o=o.return}return[]}function AF(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function qR(o,c,h,g,j){for(var N=c._reactName,M=[];h!==null&&h!==g;){var z=h,Z=z.alternate,ae=z.stateNode;if(z=z.tag,Z!==null&&Z===g)break;z!==5&&z!==26&&z!==27||ae===null||(Z=ae,j?(ae=Kc(h,N),ae!=null&&M.unshift(_u(h,ae,Z))):j||(ae=Kc(h,N),ae!=null&&M.push(_u(h,ae,Z)))),h=h.return}M.length!==0&&o.push({event:c,listeners:M})}var TF=/\r\n?/g,IF=/\u0000|\uFFFD/g;function zR(o){return(typeof o=="string"?o:""+o).replace(TF,`
|
|
49
|
-
`).replace(IF,"")}function BR(o,c){return c=zR(c),zR(o)===c}function dt(o,c,h,g,j,N){switch(h){case"children":typeof g=="string"?c==="body"||c==="textarea"&&g===""||Ko(o,g):(typeof g=="number"||typeof g=="bigint")&&c!=="body"&&Ko(o,""+g);break;case"className":Go(o,"class",g);break;case"tabIndex":Go(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Go(o,h,g);break;case"style":B_(o,g,N);break;case"data":if(c!=="object"){Go(o,"data",g);break}case"src":case"href":if(g===""&&(c!=="a"||h!=="href")){o.removeAttribute(h);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(h);break}g=Bf(""+g),o.setAttribute(h,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(h==="formAction"?(c!=="input"&&dt(o,c,"name",j.name,j,null),dt(o,c,"formEncType",j.formEncType,j,null),dt(o,c,"formMethod",j.formMethod,j,null),dt(o,c,"formTarget",j.formTarget,j,null)):(dt(o,c,"encType",j.encType,j,null),dt(o,c,"method",j.method,j,null),dt(o,c,"target",j.target,j,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(h);break}g=Bf(""+g),o.setAttribute(h,g);break;case"onClick":g!=null&&(o.onclick=vr);break;case"onScroll":g!=null&&Ye("scroll",o);break;case"onScrollEnd":g!=null&&Ye("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(j.children!=null)throw Error(s(60));o.innerHTML=h}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}h=Bf(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,""+g):o.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,""):o.removeAttribute(h);break;case"capture":case"download":g===!0?o.setAttribute(h,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,g):o.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(h,g):o.removeAttribute(h);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(h):o.setAttribute(h,g);break;case"popover":Ye("beforetoggle",o),Ye("toggle",o),Vo(o,"popover",g);break;case"xlinkActuate":Cs(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Cs(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Cs(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Cs(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Cs(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Cs(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Vo(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=aB.get(h)||h,Vo(o,h,g))}}function sy(o,c,h,g,j,N){switch(h){case"style":B_(o,g,N);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(j.children!=null)throw Error(s(60));o.innerHTML=h}}break;case"children":typeof g=="string"?Ko(o,g):(typeof g=="number"||typeof g=="bigint")&&Ko(o,""+g);break;case"onScroll":g!=null&&Ye("scroll",o);break;case"onScrollEnd":g!=null&&Ye("scrollend",o);break;case"onClick":g!=null&&(o.onclick=vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pf.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(j=h.endsWith("Capture"),c=h.slice(2,j?h.length-7:void 0),N=o[mn]||null,N=N!=null?N[h]:null,typeof N=="function"&&o.removeEventListener(c,N,j),typeof g=="function")){typeof N!="function"&&N!==null&&(h in o?o[h]=null:o.hasAttribute(h)&&o.removeAttribute(h)),o.addEventListener(c,g,j);break e}h in o?o[h]=g:g===!0?o.setAttribute(h,""):Vo(o,h,g)}}}function ln(o,c,h){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",o),Ye("load",o);var g=!1,j=!1,N;for(N in h)if(h.hasOwnProperty(N)){var M=h[N];if(M!=null)switch(N){case"src":g=!0;break;case"srcSet":j=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,c));default:dt(o,c,N,M,h,null)}}j&&dt(o,c,"srcSet",h.srcSet,h,null),g&&dt(o,c,"src",h.src,h,null);return;case"input":Ye("invalid",o);var z=N=M=j=null,Z=null,ae=null;for(g in h)if(h.hasOwnProperty(g)){var ue=h[g];if(ue!=null)switch(g){case"name":j=ue;break;case"type":M=ue;break;case"checked":Z=ue;break;case"defaultChecked":ae=ue;break;case"value":N=ue;break;case"defaultValue":z=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,c));break;default:dt(o,c,g,ue,h,null)}}zf(o,N,z,Z,ae,M,j,!1);return;case"select":Ye("invalid",o),g=M=N=null;for(j in h)if(h.hasOwnProperty(j)&&(z=h[j],z!=null))switch(j){case"value":N=z;break;case"defaultValue":M=z;break;case"multiple":g=z;default:dt(o,c,j,z,h,null)}c=N,h=M,o.multiple=!!g,c!=null?yr(o,!!g,c,!1):h!=null&&yr(o,!!g,h,!0);return;case"textarea":Ye("invalid",o),N=j=g=null;for(M in h)if(h.hasOwnProperty(M)&&(z=h[M],z!=null))switch(M){case"value":g=z;break;case"defaultValue":j=z;break;case"children":N=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(s(91));break;default:dt(o,c,M,z,h,null)}q_(o,g,j,N);return;case"option":for(Z in h)if(h.hasOwnProperty(Z)&&(g=h[Z],g!=null))switch(Z){case"selected":o.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:dt(o,c,Z,g,h,null)}return;case"dialog":Ye("beforetoggle",o),Ye("toggle",o),Ye("cancel",o),Ye("close",o);break;case"iframe":case"object":Ye("load",o);break;case"video":case"audio":for(g=0;g<ku.length;g++)Ye(ku[g],o);break;case"image":Ye("error",o),Ye("load",o);break;case"details":Ye("toggle",o);break;case"embed":case"source":case"link":Ye("error",o),Ye("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in h)if(h.hasOwnProperty(ae)&&(g=h[ae],g!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,c));default:dt(o,c,ae,g,h,null)}return;default:if(xx(c)){for(ue in h)h.hasOwnProperty(ue)&&(g=h[ue],g!==void 0&&sy(o,c,ue,g,h,void 0));return}}for(z in h)h.hasOwnProperty(z)&&(g=h[z],g!=null&&dt(o,c,z,g,h,null))}function MF(o,c,h,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var j=null,N=null,M=null,z=null,Z=null,ae=null,ue=null;for(le in h){var fe=h[le];if(h.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":Z=fe;default:g.hasOwnProperty(le)||dt(o,c,le,null,g,fe)}}for(var oe in g){var le=g[oe];if(fe=h[oe],g.hasOwnProperty(oe)&&(le!=null||fe!=null))switch(oe){case"type":N=le;break;case"name":j=le;break;case"checked":ae=le;break;case"defaultChecked":ue=le;break;case"value":M=le;break;case"defaultValue":z=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,c));break;default:le!==fe&&dt(o,c,oe,le,g,fe)}}_a(o,M,z,Z,ae,ue,N,j);return;case"select":le=M=z=oe=null;for(N in h)if(Z=h[N],h.hasOwnProperty(N)&&Z!=null)switch(N){case"value":break;case"multiple":le=Z;default:g.hasOwnProperty(N)||dt(o,c,N,null,g,Z)}for(j in g)if(N=g[j],Z=h[j],g.hasOwnProperty(j)&&(N!=null||Z!=null))switch(j){case"value":oe=N;break;case"defaultValue":z=N;break;case"multiple":M=N;default:N!==Z&&dt(o,c,j,N,g,Z)}c=z,h=M,g=le,oe!=null?yr(o,!!h,oe,!1):!!g!=!!h&&(c!=null?yr(o,!!h,c,!0):yr(o,!!h,h?[]:"",!1));return;case"textarea":le=oe=null;for(z in h)if(j=h[z],h.hasOwnProperty(z)&&j!=null&&!g.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:dt(o,c,z,null,g,j)}for(M in g)if(j=g[M],N=h[M],g.hasOwnProperty(M)&&(j!=null||N!=null))switch(M){case"value":oe=j;break;case"defaultValue":le=j;break;case"children":break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(s(91));break;default:j!==N&&dt(o,c,M,j,g,N)}D_(o,oe,le);return;case"option":for(var we in h)if(oe=h[we],h.hasOwnProperty(we)&&oe!=null&&!g.hasOwnProperty(we))switch(we){case"selected":o.selected=!1;break;default:dt(o,c,we,null,g,oe)}for(Z in g)if(oe=g[Z],le=h[Z],g.hasOwnProperty(Z)&&oe!==le&&(oe!=null||le!=null))switch(Z){case"selected":o.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:dt(o,c,Z,oe,g,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in h)oe=h[Te],h.hasOwnProperty(Te)&&oe!=null&&!g.hasOwnProperty(Te)&&dt(o,c,Te,null,g,oe);for(ae in g)if(oe=g[ae],le=h[ae],g.hasOwnProperty(ae)&&oe!==le&&(oe!=null||le!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,c));break;default:dt(o,c,ae,oe,g,le)}return;default:if(xx(c)){for(var ft in h)oe=h[ft],h.hasOwnProperty(ft)&&oe!==void 0&&!g.hasOwnProperty(ft)&&sy(o,c,ft,void 0,g,oe);for(ue in g)oe=g[ue],le=h[ue],!g.hasOwnProperty(ue)||oe===le||oe===void 0&&le===void 0||sy(o,c,ue,oe,g,le);return}}for(var ne in h)oe=h[ne],h.hasOwnProperty(ne)&&oe!=null&&!g.hasOwnProperty(ne)&&dt(o,c,ne,null,g,oe);for(fe in g)oe=g[fe],le=h[fe],!g.hasOwnProperty(fe)||oe===le||oe==null&&le==null||dt(o,c,fe,oe,g,le)}function FR(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function OF(){if(typeof performance.getEntriesByType=="function"){for(var o=0,c=0,h=performance.getEntriesByType("resource"),g=0;g<h.length;g++){var j=h[g],N=j.transferSize,M=j.initiatorType,z=j.duration;if(N&&z&&FR(M)){for(M=0,z=j.responseEnd,g+=1;g<h.length;g++){var Z=h[g],ae=Z.startTime;if(ae>z)break;var ue=Z.transferSize,fe=Z.initiatorType;ue&&FR(fe)&&(Z=Z.responseEnd,M+=ue*(Z<z?1:(z-ae)/(Z-ae)))}if(--g,c+=8*(N+M)/(j.duration/1e3),o++,10<o)break}}if(0<o)return c/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var ry=null,iy=null;function Ph(o){return o.nodeType===9?o:o.ownerDocument}function HR(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function UR(o,c){if(o===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&c==="foreignObject"?0:o}function ay(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var oy=null;function LF(){var o=window.event;return o&&o.type==="popstate"?o===oy?!1:(oy=o,!0):(oy=null,!1)}var VR=typeof setTimeout=="function"?setTimeout:void 0,PF=typeof clearTimeout=="function"?clearTimeout:void 0,GR=typeof Promise=="function"?Promise:void 0,$F=typeof queueMicrotask=="function"?queueMicrotask:typeof GR<"u"?function(o){return GR.resolve(null).then(o).catch(DF)}:VR;function DF(o){setTimeout(function(){throw o})}function Ci(o){return o==="head"}function KR(o,c){var h=c,g=0;do{var j=h.nextSibling;if(o.removeChild(h),j&&j.nodeType===8)if(h=j.data,h==="/$"||h==="/&"){if(g===0){o.removeChild(j),Nl(c);return}g--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")g++;else if(h==="html")Cu(o.ownerDocument.documentElement);else if(h==="head"){h=o.ownerDocument.head,Cu(h);for(var N=h.firstChild;N;){var M=N.nextSibling,z=N.nodeName;N[Na]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&N.rel.toLowerCase()==="stylesheet"||h.removeChild(N),N=M}}else h==="body"&&Cu(o.ownerDocument.body);h=j}while(h);Nl(c)}function WR(o,c){var h=o;o=0;do{var g=h.nextSibling;if(h.nodeType===1?c?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(c?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),g&&g.nodeType===8)if(h=g.data,h==="/$"){if(o===0)break;o--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||o++;h=g}while(h)}function ly(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var h=c;switch(c=c.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":ly(h),Uc(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}o.removeChild(h)}}function qF(o,c,h,g){for(;o.nodeType===1;){var j=h;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[Na])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(N=o.getAttribute("rel"),N==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(N!==j.rel||o.getAttribute("href")!==(j.href==null||j.href===""?null:j.href)||o.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin)||o.getAttribute("title")!==(j.title==null?null:j.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(N=o.getAttribute("src"),(N!==(j.src==null?null:j.src)||o.getAttribute("type")!==(j.type==null?null:j.type)||o.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin))&&N&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var N=j.name==null?null:""+j.name;if(j.type==="hidden"&&o.getAttribute("name")===N)return o}else return o;if(o=ms(o.nextSibling),o===null)break}return null}function zF(o,c,h){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!h||(o=ms(o.nextSibling),o===null))return null;return o}function YR(o,c){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!c||(o=ms(o.nextSibling),o===null))return null;return o}function cy(o){return o.data==="$?"||o.data==="$~"}function uy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function BF(o,c){var h=o.ownerDocument;if(o.data==="$~")o._reactRetry=c;else if(o.data!=="$?"||h.readyState!=="loading")c();else{var g=function(){c(),h.removeEventListener("DOMContentLoaded",g)};h.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function ms(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return o}var dy=null;function QR(o){o=o.nextSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"||h==="/&"){if(c===0)return ms(o.nextSibling);c--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||c++}o=o.nextSibling}return null}function XR(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(c===0)return o;c--}else h!=="/$"&&h!=="/&"||c++}o=o.previousSibling}return null}function ZR(o,c,h){switch(c=Ph(h),o){case"html":if(o=c.documentElement,!o)throw Error(s(452));return o;case"head":if(o=c.head,!o)throw Error(s(453));return o;case"body":if(o=c.body,!o)throw Error(s(454));return o;default:throw Error(s(451))}}function Cu(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);Uc(o)}var gs=new Map,JR=new Set;function $h(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Lr=V.d;V.d={f:FF,r:HF,D:UF,C:VF,L:GF,m:KF,X:YF,S:WF,M:QF};function FF(){var o=Lr.f(),c=Eh();return o||c}function HF(o){var c=ii(o);c!==null&&c.tag===5&&c.type==="form"?gE(c):Lr.r(o)}var wl=typeof document>"u"?null:document;function eA(o,c,h){var g=wl;if(g&&typeof c=="string"&&c){var j=In(c);j='link[rel="'+o+'"][href="'+j+'"]',typeof h=="string"&&(j+='[crossorigin="'+h+'"]'),JR.has(j)||(JR.add(j),o={rel:o,crossOrigin:h,href:c},g.querySelector(j)===null&&(c=g.createElement("link"),ln(c,"link",o),Bt(c),g.head.appendChild(c)))}}function UF(o){Lr.D(o),eA("dns-prefetch",o,null)}function VF(o,c){Lr.C(o,c),eA("preconnect",o,c)}function GF(o,c,h){Lr.L(o,c,h);var g=wl;if(g&&o&&c){var j='link[rel="preload"][as="'+In(c)+'"]';c==="image"&&h&&h.imageSrcSet?(j+='[imagesrcset="'+In(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(j+='[imagesizes="'+In(h.imageSizes)+'"]')):j+='[href="'+In(o)+'"]';var N=j;switch(c){case"style":N=jl(o);break;case"script":N=Sl(o)}gs.has(N)||(o=m({rel:"preload",href:c==="image"&&h&&h.imageSrcSet?void 0:o,as:c},h),gs.set(N,o),g.querySelector(j)!==null||c==="style"&&g.querySelector(Eu(N))||c==="script"&&g.querySelector(Ru(N))||(c=g.createElement("link"),ln(c,"link",o),Bt(c),g.head.appendChild(c)))}}function KF(o,c){Lr.m(o,c);var h=wl;if(h&&o){var g=c&&typeof c.as=="string"?c.as:"script",j='link[rel="modulepreload"][as="'+In(g)+'"][href="'+In(o)+'"]',N=j;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=Sl(o)}if(!gs.has(N)&&(o=m({rel:"modulepreload",href:o},c),gs.set(N,o),h.querySelector(j)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Ru(N)))return}g=h.createElement("link"),ln(g,"link",o),Bt(g),h.head.appendChild(g)}}}function WF(o,c,h){Lr.S(o,c,h);var g=wl;if(g&&o){var j=oi(g).hoistableStyles,N=jl(o);c=c||"default";var M=j.get(N);if(!M){var z={loading:0,preload:null};if(M=g.querySelector(Eu(N)))z.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":c},h),(h=gs.get(N))&&fy(o,h);var Z=M=g.createElement("link");Bt(Z),ln(Z,"link",o),Z._p=new Promise(function(ae,ue){Z.onload=ae,Z.onerror=ue}),Z.addEventListener("load",function(){z.loading|=1}),Z.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Dh(M,c,g)}M={type:"stylesheet",instance:M,count:1,state:z},j.set(N,M)}}}function YF(o,c){Lr.X(o,c);var h=wl;if(h&&o){var g=oi(h).hoistableScripts,j=Sl(o),N=g.get(j);N||(N=h.querySelector(Ru(j)),N||(o=m({src:o,async:!0},c),(c=gs.get(j))&&hy(o,c),N=h.createElement("script"),Bt(N),ln(N,"link",o),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(j,N))}}function QF(o,c){Lr.M(o,c);var h=wl;if(h&&o){var g=oi(h).hoistableScripts,j=Sl(o),N=g.get(j);N||(N=h.querySelector(Ru(j)),N||(o=m({src:o,async:!0,type:"module"},c),(c=gs.get(j))&&hy(o,c),N=h.createElement("script"),Bt(N),ln(N,"link",o),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(j,N))}}function tA(o,c,h,g){var j=(j=X.current)?$h(j):null;if(!j)throw Error(s(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(c=jl(h.href),h=oi(j).hoistableStyles,g=h.get(c),g||(g={type:"style",instance:null,count:0,state:null},h.set(c,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=jl(h.href);var N=oi(j).hoistableStyles,M=N.get(o);if(M||(j=j.ownerDocument||j,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(o,M),(N=j.querySelector(Eu(o)))&&!N._p&&(M.instance=N,M.state.loading=5),gs.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},gs.set(o,h),N||XF(j,o,h,M.state))),c&&g===null)throw Error(s(528,""));return M}if(c&&g!==null)throw Error(s(529,""));return null;case"script":return c=h.async,h=h.src,typeof h=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Sl(h),h=oi(j).hoistableScripts,g=h.get(c),g||(g={type:"script",instance:null,count:0,state:null},h.set(c,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,o))}}function jl(o){return'href="'+In(o)+'"'}function Eu(o){return'link[rel="stylesheet"]['+o+"]"}function nA(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function XF(o,c,h,g){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?g.loading=1:(c=o.createElement("link"),g.preload=c,c.addEventListener("load",function(){return g.loading|=1}),c.addEventListener("error",function(){return g.loading|=2}),ln(c,"link",h),Bt(c),o.head.appendChild(c))}function Sl(o){return'[src="'+In(o)+'"]'}function Ru(o){return"script[async]"+o}function sA(o,c,h){if(c.count++,c.instance===null)switch(c.type){case"style":var g=o.querySelector('style[data-href~="'+In(h.href)+'"]');if(g)return c.instance=g,Bt(g),g;var j=m({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Bt(g),ln(g,"style",j),Dh(g,h.precedence,o),c.instance=g;case"stylesheet":j=jl(h.href);var N=o.querySelector(Eu(j));if(N)return c.state.loading|=4,c.instance=N,Bt(N),N;g=nA(h),(j=gs.get(j))&&fy(g,j),N=(o.ownerDocument||o).createElement("link"),Bt(N);var M=N;return M._p=new Promise(function(z,Z){M.onload=z,M.onerror=Z}),ln(N,"link",g),c.state.loading|=4,Dh(N,h.precedence,o),c.instance=N;case"script":return N=Sl(h.src),(j=o.querySelector(Ru(N)))?(c.instance=j,Bt(j),j):(g=h,(j=gs.get(N))&&(g=m({},h),hy(g,j)),o=o.ownerDocument||o,j=o.createElement("script"),Bt(j),ln(j,"link",g),o.head.appendChild(j),c.instance=j);case"void":return null;default:throw Error(s(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(g=c.instance,c.state.loading|=4,Dh(g,h.precedence,o));return c.instance}function Dh(o,c,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),j=g.length?g[g.length-1]:null,N=j,M=0;M<g.length;M++){var z=g[M];if(z.dataset.precedence===c)N=z;else if(N!==j)break}N?N.parentNode.insertBefore(o,N.nextSibling):(c=h.nodeType===9?h.head:h,c.insertBefore(o,c.firstChild))}function fy(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function hy(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var qh=null;function rA(o,c,h){if(qh===null){var g=new Map,j=qh=new Map;j.set(h,g)}else j=qh,g=j.get(h),g||(g=new Map,j.set(h,g));if(g.has(o))return g;for(g.set(o,null),h=h.getElementsByTagName(o),j=0;j<h.length;j++){var N=h[j];if(!(N[Na]||N[Xt]||o==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var M=N.getAttribute(c)||"";M=o+M;var z=g.get(M);z?z.push(N):g.set(M,[N])}}return g}function iA(o,c,h){o=o.ownerDocument||o,o.head.insertBefore(h,c==="title"?o.querySelector("head > title"):null)}function ZF(o,c,h){if(h===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function aA(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function JF(o,c,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var j=jl(g.href),N=c.querySelector(Eu(j));if(N){c=N._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=zh.bind(o),c.then(o,o)),h.state.loading|=4,h.instance=N,Bt(N);return}N=c.ownerDocument||c,g=nA(g),(j=gs.get(j))&&fy(g,j),N=N.createElement("link"),Bt(N);var M=N;M._p=new Promise(function(z,Z){M.onload=z,M.onerror=Z}),ln(N,"link",g),h.instance=N}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,c),(c=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=zh.bind(o),c.addEventListener("load",h),c.addEventListener("error",h))}}var py=0;function e7(o,c){return o.stylesheets&&o.count===0&&Fh(o,o.stylesheets),0<o.count||0<o.imgCount?function(h){var g=setTimeout(function(){if(o.stylesheets&&Fh(o,o.stylesheets),o.unsuspend){var N=o.unsuspend;o.unsuspend=null,N()}},6e4+c);0<o.imgBytes&&py===0&&(py=62500*OF());var j=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Fh(o,o.stylesheets),o.unsuspend)){var N=o.unsuspend;o.unsuspend=null,N()}},(o.imgBytes>py?50:800)+c);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(j)}}:null}function zh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bh=null;function Fh(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bh=new Map,c.forEach(t7,o),Bh=null,zh.call(o))}function t7(o,c){if(!(c.state.loading&4)){var h=Bh.get(o);if(h)var g=h.get(null);else{h=new Map,Bh.set(o,h);for(var j=o.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<j.length;N++){var M=j[N];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(h.set(M.dataset.precedence,M),g=M)}g&&h.set(null,g)}j=c.instance,M=j.getAttribute("data-precedence"),N=h.get(M)||g,N===g&&h.set(null,j),h.set(M,j),this.count++,g=zh.bind(this),j.addEventListener("load",g),j.addEventListener("error",g),N?N.parentNode.insertBefore(j,N.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(j,o.firstChild)),c.state.loading|=4}}var Au={$$typeof:k,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function n7(o,c,h,g,j,N,M,z,Z){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Bc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bc(0),this.hiddenUpdates=Bc(null),this.identifierPrefix=g,this.onUncaughtError=j,this.onCaughtError=N,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function oA(o,c,h,g,j,N,M,z,Z,ae,ue,fe){return o=new n7(o,c,h,M,Z,ae,ue,fe,z),c=1,N===!0&&(c|=24),N=Qn(3,null,null,c),o.current=N,N.stateNode=o,c=Kx(),c.refCount++,o.pooledCache=c,c.refCount++,N.memoizedState={element:g,isDehydrated:h,cache:c},Xx(N),o}function lA(o){return o?(o=el,o):el}function cA(o,c,h,g,j,N){j=lA(j),g.context===null?g.context=j:g.pendingContext=j,g=gi(c),g.payload={element:h},N=N===void 0?null:N,N!==null&&(g.callback=N),h=xi(o,g,c),h!==null&&(Dn(h,o,c),lu(h,o,c))}function uA(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<c?h:c}}function my(o,c){uA(o,c),(o=o.alternate)&&uA(o,c)}function dA(o){if(o.tag===13||o.tag===31){var c=Aa(o,67108864);c!==null&&Dn(c,o,67108864),my(o,67108864)}}function fA(o){if(o.tag===13||o.tag===31){var c=ts();c=Fc(c);var h=Aa(o,c);h!==null&&Dn(h,o,c),my(o,c)}}var Hh=!0;function s7(o,c,h,g){var j=q.T;q.T=null;var N=V.p;try{V.p=2,gy(o,c,h,g)}finally{V.p=N,q.T=j}}function r7(o,c,h,g){var j=q.T;q.T=null;var N=V.p;try{V.p=8,gy(o,c,h,g)}finally{V.p=N,q.T=j}}function gy(o,c,h,g){if(Hh){var j=xy(g);if(j===null)ny(o,c,g,Uh,h),pA(o,g);else if(a7(j,o,c,h,g))g.stopPropagation();else if(pA(o,g),c&4&&-1<i7.indexOf(o)){for(;j!==null;){var N=ii(j);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var M=mr(N.pendingLanes);if(M!==0){var z=N;for(z.pendingLanes|=2,z.entangledLanes|=2;M;){var Z=1<<31-_n(M);z.entanglements[1]|=Z,M&=~Z}Xs(N),(rt&6)===0&&(_h=yt()+500,Nu(0))}}break;case 31:case 13:z=Aa(N,2),z!==null&&Dn(z,N,2),Eh(),my(N,2)}if(N=xy(g),N===null&&ny(o,c,g,Uh,h),N===j)break;j=N}j!==null&&g.stopPropagation()}else ny(o,c,g,null,h)}}function xy(o){return o=vx(o),yy(o)}var Uh=null;function yy(o){if(Uh=null,o=ri(o),o!==null){var c=a(o);if(c===null)o=null;else{var h=c.tag;if(h===13){if(o=l(c),o!==null)return o;o=null}else if(h===31){if(o=u(c),o!==null)return o;o=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return Uh=o,null}function hA(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ke()){case pt:return 2;case Qt:return 8;case hn:case Do:return 32;case pr:return 268435456;default:return 32}default:return 32}}var vy=!1,Ei=null,Ri=null,Ai=null,Tu=new Map,Iu=new Map,Ti=[],i7="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function pA(o,c){switch(o){case"focusin":case"focusout":Ei=null;break;case"dragenter":case"dragleave":Ri=null;break;case"mouseover":case"mouseout":Ai=null;break;case"pointerover":case"pointerout":Tu.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Iu.delete(c.pointerId)}}function Mu(o,c,h,g,j,N){return o===null||o.nativeEvent!==N?(o={blockedOn:c,domEventName:h,eventSystemFlags:g,nativeEvent:N,targetContainers:[j]},c!==null&&(c=ii(c),c!==null&&dA(c)),o):(o.eventSystemFlags|=g,c=o.targetContainers,j!==null&&c.indexOf(j)===-1&&c.push(j),o)}function a7(o,c,h,g,j){switch(c){case"focusin":return Ei=Mu(Ei,o,c,h,g,j),!0;case"dragenter":return Ri=Mu(Ri,o,c,h,g,j),!0;case"mouseover":return Ai=Mu(Ai,o,c,h,g,j),!0;case"pointerover":var N=j.pointerId;return Tu.set(N,Mu(Tu.get(N)||null,o,c,h,g,j)),!0;case"gotpointercapture":return N=j.pointerId,Iu.set(N,Mu(Iu.get(N)||null,o,c,h,g,j)),!0}return!1}function mA(o){var c=ri(o.target);if(c!==null){var h=a(c);if(h!==null){if(c=h.tag,c===13){if(c=l(h),c!==null){o.blockedOn=c,If(o.priority,function(){fA(h)});return}}else if(c===31){if(c=u(h),c!==null){o.blockedOn=c,If(o.priority,function(){fA(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Vh(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var h=xy(o.nativeEvent);if(h===null){h=o.nativeEvent;var g=new h.constructor(h.type,h);yx=g,h.target.dispatchEvent(g),yx=null}else return c=ii(h),c!==null&&dA(c),o.blockedOn=h,!1;c.shift()}return!0}function gA(o,c,h){Vh(o)&&h.delete(c)}function o7(){vy=!1,Ei!==null&&Vh(Ei)&&(Ei=null),Ri!==null&&Vh(Ri)&&(Ri=null),Ai!==null&&Vh(Ai)&&(Ai=null),Tu.forEach(gA),Iu.forEach(gA)}function Gh(o,c){o.blockedOn===c&&(o.blockedOn=null,vy||(vy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,o7)))}var Kh=null;function xA(o){Kh!==o&&(Kh=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Kh===o&&(Kh=null);for(var c=0;c<o.length;c+=3){var h=o[c],g=o[c+1],j=o[c+2];if(typeof g!="function"){if(yy(g||h)===null)continue;break}var N=ii(h);N!==null&&(o.splice(c,3),c-=3,x0(N,{pending:!0,data:j,method:h.method,action:g},g,j))}}))}function Nl(o){function c(Z){return Gh(Z,o)}Ei!==null&&Gh(Ei,o),Ri!==null&&Gh(Ri,o),Ai!==null&&Gh(Ai,o),Tu.forEach(c),Iu.forEach(c);for(var h=0;h<Ti.length;h++){var g=Ti[h];g.blockedOn===o&&(g.blockedOn=null)}for(;0<Ti.length&&(h=Ti[0],h.blockedOn===null);)mA(h),h.blockedOn===null&&Ti.shift();if(h=(o.ownerDocument||o).$$reactFormReplay,h!=null)for(g=0;g<h.length;g+=3){var j=h[g],N=h[g+1],M=j[mn]||null;if(typeof N=="function")M||xA(h);else if(M){var z=null;if(N&&N.hasAttribute("formAction")){if(j=N,M=N[mn]||null)z=M.formAction;else if(yy(j)!==null)continue}else z=M.action;typeof z=="function"?h[g+1]=z:(h.splice(g,3),g-=3),xA(h)}}}function yA(){function o(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(M){return j=M})},focusReset:"manual",scroll:"manual"})}function c(){j!==null&&(j(),j=null),g||setTimeout(h,20)}function h(){if(!g&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,j=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(h,100),function(){g=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),j!==null&&(j(),j=null)}}}function by(o){this._internalRoot=o}Wh.prototype.render=by.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(s(409));var h=c.current,g=ts();cA(h,g,o,c,null,null)},Wh.prototype.unmount=by.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;cA(o.current,2,null,o,null,null),Eh(),c[gr]=null}};function Wh(o){this._internalRoot=o}Wh.prototype.unstable_scheduleHydration=function(o){if(o){var c=Tf();o={blockedOn:null,target:o,priority:c};for(var h=0;h<Ti.length&&c!==0&&c<Ti[h].priority;h++);Ti.splice(h,0,o),h===0&&mA(o)}};var vA=t.version;if(vA!=="19.2.6")throw Error(s(527,vA,"19.2.6"));V.findDOMNode=function(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(s(188)):(o=Object.keys(o).join(","),Error(s(268,o)));return o=d(c),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var l7={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yh.isDisabled&&Yh.supportsFiber)try{pn=Yh.inject(l7),Et=Yh}catch{}}return Lu.createRoot=function(o,c){if(!r(o))throw Error(s(299));var h=!1,g="",j=_E,N=CE,M=EE;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(j=c.onUncaughtError),c.onCaughtError!==void 0&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError)),c=oA(o,1,!1,null,null,h,g,null,j,N,M,yA),o[gr]=c.current,ty(o),new by(c)},Lu.hydrateRoot=function(o,c,h){if(!r(o))throw Error(s(299));var g=!1,j="",N=_E,M=CE,z=EE,Z=null;return h!=null&&(h.unstable_strictMode===!0&&(g=!0),h.identifierPrefix!==void 0&&(j=h.identifierPrefix),h.onUncaughtError!==void 0&&(N=h.onUncaughtError),h.onCaughtError!==void 0&&(M=h.onCaughtError),h.onRecoverableError!==void 0&&(z=h.onRecoverableError),h.formState!==void 0&&(Z=h.formState)),c=oA(o,1,!0,c,h??null,g,j,Z,N,M,z,yA),c.context=lA(null),h=c.current,g=ts(),g=Fc(g),j=gi(g),j.callback=null,xi(h,j,g),h=g,c.current.lanes=h,Sa(c,h),Xs(c),o[gr]=c.current,ty(o),new Wh(c)},Lu.version="19.2.6",Lu}var AA;function b7(){if(AA)return Ny.exports;AA=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ny.exports=v7(),Ny.exports}var w7=b7(),Bl=typeof window<"u"?E.useLayoutEffect:E.useEffect;function Ey(e){const t=E.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function j7(e,t,n={},s={}){E.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([a])=>{t(a)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,n,s.disabled,e])}function S7(e){const t=E.useRef(null);return E.useImperativeHandle(e,()=>t.current,[]),t}const DP=!1;function yd(e){return e[e.length-1]}function N7(e){return typeof e=="function"}function ta(e,t){return N7(e)?e(t):e}const qP=Object.prototype.hasOwnProperty,TA=Object.prototype.propertyIsEnumerable;function zP(e){for(const t in e)if(qP.call(e,t))return!0;return!1}const k7=()=>Object.create(null),Ha=(e,t)=>na(e,t,k7);function na(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const r=t,a=OA(e)&&OA(r);if(!a&&!(xc(e)&&xc(r)))return r;const l=a?e:IA(e);if(!l)return r;const u=a?r:IA(r);if(!u)return r;const f=l.length,d=u.length,p=a?new Array(d):n();let m=0;for(let x=0;x<d;x++){const y=a?x:u[x],b=e[y],v=r[y];if(b===v){p[y]=b,(a?x<f:qP.call(e,y))&&m++;continue}if(b===null||v===null||typeof b!="object"||typeof v!="object"){p[y]=v;continue}const w=na(b,v,n,s+1);p[y]=w,w===b&&m++}return f===d&&m===f?e:p}function IA(e){const t=Object.getOwnPropertyNames(e);for(const r of t)if(!TA.call(e,r))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const r of n){if(!TA.call(e,r))return!1;s.push(r)}return s}function xc(e){if(!MA(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!MA(n)||!n.hasOwnProperty("isPrototypeOf"))}function MA(e){return Object.prototype.toString.call(e)==="[object Object]"}function OA(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ho(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,r=e.length;s<r;s++)if(!ho(e[s],t[s],n))return!1;return!0}if(xc(e)&&xc(t)){const s=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const l in t)if((!s||t[l]!==void 0)&&!ho(e[l],t[l],n))return!1;return!0}let r=0;if(!s)r=Object.keys(e).length;else for(const l in e)e[l]!==void 0&&r++;let a=0;for(const l in t)if((!s||t[l]!==void 0)&&(a++,a>r||!ho(e[l],t[l],n)))return!1;return r===a}return!1}function yc(e){let t,n;const s=new Promise((r,a)=>{t=r,n=a});return s.status="pending",s.resolve=r=>{s.status="resolved",s.value=r,t(r),e==null||e(r)},s.reject=r=>{s.status="rejected",n(r)},s}function vd(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function _7(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function LA(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return _7(t)}const C7=["http:","https:","mailto:","tel:"];function um(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Pu(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",r;for(;(r=t.exec(e))!==null;)s+=LA(e.slice(n,r.index))+r[0],n=t.lastIndex;s=s+LA(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function E7(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function R7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wr(){throw new Error("Invariant failed")}function bd(e){const t=new Map;let n,s;const r=a=>{a.next&&(a.prev?(a.prev.next=a.next,a.next.prev=a.prev,a.next=void 0,s&&(s.next=a,a.prev=s)):(a.next.prev=void 0,n=a.next,a.next=void 0,s&&(a.prev=s,s.next=a)),s=a)};return{get(a){const l=t.get(a);if(l)return r(l),l.value},set(a,l){if(t.size>=e&&n){const f=n;t.delete(f.key),f.next&&(n=f.next,f.next.prev=void 0),f===s&&(s=void 0)}const u=t.get(a);if(u)u.value=l,r(u);else{const f={key:a,value:l,prev:s};s&&(s.next=f),s=f,n||(n=f),t.set(a,f)}},clear(){t.clear(),n=void 0,s=void 0}}}const sa=4,BP=5;function A7(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function FP(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),r=s===-1?e.length:s,a=e.substring(t,r);if(!a||!a.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n;if(a==="$"){const u=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=u,n[4]=u,n[5]=u,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=r,n[4]=r,n[5]=r,n;const l=A7(a);if(l){const[u,f]=l,d=a.charCodeAt(u+1);if(d===45){if(u+2<a.length&&a.charCodeAt(u+2)===36){const p=u+3,m=f;if(p<m)return n[0]=3,n[1]=t+u,n[2]=t+p,n[3]=t+m,n[4]=t+f+1,n[5]=r,n}}else if(d===36){const p=u+1,m=u+2;return m===f?(n[0]=2,n[1]=t+u,n[2]=t+p,n[3]=t+m,n[4]=t+f+1,n[5]=e.length,n):(n[0]=1,n[1]=t+u,n[2]=t+m,n[3]=t+f,n[4]=t+f+1,n[5]=r,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}function Fm(e,t,n,s,r,a,l){var f,d,p,m,x,y,b,v;l==null||l(n);let u=s;{const w=n.fullPath??n.from,S=w.length,C=((f=n.options)==null?void 0:f.caseSensitive)??e,k=((p=(d=n.options)==null?void 0:d.params)==null?void 0:p.parse)??((m=n.options)==null?void 0:m.parseParams);for(;u<S;){const R=FP(w,u,t);let T;const A=u,I=R[5];switch(u=I+1,a++,R[0]){case 0:{const L=w.substring(R[2],R[3]);if(C){const $=(x=r.static)==null?void 0:x.get(L);if($)T=$;else{r.static??(r.static=new Map);const O=Wa(n.fullPath??n.from);O.parent=r,O.depth=a,T=O,r.static.set(L,O)}}else{const $=L.toLowerCase(),O=(y=r.staticInsensitive)==null?void 0:y.get($);if(O)T=O;else{r.staticInsensitive??(r.staticInsensitive=new Map);const B=Wa(n.fullPath??n.from);B.parent=r,B.depth=a,T=B,r.staticInsensitive.set($,B)}}break}case 1:{const L=w.substring(A,R[1]),$=w.substring(R[4],I),O=C&&!!(L||$),B=L?O?L:L.toLowerCase():void 0,H=$?O?$:$.toLowerCase():void 0,P=!k&&((b=r.dynamic)==null?void 0:b.find(G=>!G.parse&&G.caseSensitive===O&&G.prefix===B&&G.suffix===H));if(P)T=P;else{const G=Ay(1,n.fullPath??n.from,O,B,H);T=G,G.depth=a,G.parent=r,r.dynamic??(r.dynamic=[]),r.dynamic.push(G)}break}case 3:{const L=w.substring(A,R[1]),$=w.substring(R[4],I),O=C&&!!(L||$),B=L?O?L:L.toLowerCase():void 0,H=$?O?$:$.toLowerCase():void 0,P=!k&&((v=r.optional)==null?void 0:v.find(G=>!G.parse&&G.caseSensitive===O&&G.prefix===B&&G.suffix===H));if(P)T=P;else{const G=Ay(3,n.fullPath??n.from,O,B,H);T=G,G.parent=r,G.depth=a,r.optional??(r.optional=[]),r.optional.push(G)}break}case 2:{const L=w.substring(A,R[1]),$=w.substring(R[4],I),O=C&&!!(L||$),B=L?O?L:L.toLowerCase():void 0,H=$?O?$:$.toLowerCase():void 0,P=Ay(2,n.fullPath??n.from,O,B,H);T=P,P.parent=r,P.depth=a,r.wildcard??(r.wildcard=[]),r.wildcard.push(P)}}r=T}if(k&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const R=Wa(n.fullPath??n.from);R.kind=BP,R.parent=r,a++,R.depth=a,r.pathless??(r.pathless=[]),r.pathless.push(R),r=R}const _=(n.path||!n.children)&&!n.isRoot;if(_&&w.endsWith("/")){const R=Wa(n.fullPath??n.from);R.kind=sa,R.parent=r,a++,R.depth=a,r.index=R,r=R}r.parse=k??null,_&&!r.route&&(r.route=n,r.fullPath=n.fullPath??n.from)}if(n.children)for(const w of n.children)Fm(e,t,w,u,r,a,l)}function Ry(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Fi(e){var t,n,s;if(e.pathless)for(const r of e.pathless)Fi(r);if(e.static)for(const r of e.static.values())Fi(r);if(e.staticInsensitive)for(const r of e.staticInsensitive.values())Fi(r);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Ry);for(const r of e.dynamic)Fi(r)}if((n=e.optional)!=null&&n.length){e.optional.sort(Ry);for(const r of e.optional)Fi(r)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(Ry);for(const r of e.wildcard)Fi(r)}}function Wa(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null}}function Ay(e,t,n,s,r){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,caseSensitive:n,prefix:s,suffix:r}}function T7(e,t){const n=Wa("/"),s=new Uint16Array(6);for(const r of e)Fm(!1,s,r,1,n,0);Fi(n),t.masksTree=n,t.flatCache=bd(1e3)}function I7(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=u2(e,t.masksTree);return t.flatCache.set(e,s),s}function M7(e,t,n,s,r){e||(e="/"),s||(s="/");const a=t?`case\0${e}`:e;let l=r.singleCache.get(a);return l||(l=Wa("/"),Fm(t,new Uint16Array(6),{from:e},1,l,0),r.singleCache.set(a,l)),u2(s,l,n)}function O7(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,r=t.matchCache.get(s);if(r!==void 0)return r;e||(e="/");let a;try{a=u2(e,t.segmentTree,n)}catch(l){if(l instanceof URIError)a=null;else throw l}return a&&(a.branch=UP(a.route)),t.matchCache.set(s,a),a}function L7(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function P7(e,t=!1,n){const s=Wa(e.fullPath),r=new Uint16Array(6),a={},l={};let u=0;return Fm(t,r,e,1,s,0,f=>{if(n==null||n(f,u),f.id in a&&Wr(),a[f.id]=f,u!==0&&f.path){const d=L7(f.fullPath);(!l[d]||f.fullPath.endsWith("/"))&&(l[d]=f)}u++}),Fi(s),{processedTree:{segmentTree:s,singleCache:bd(1e3),matchCache:bd(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:l}}function u2(e,t,n=!1){const s=e.split("/"),r=D7(e,s,t,n);if(!r)return null;const[a]=HP(e,s,r);return{route:r.node.route,rawParams:a}}function HP(e,t,n){var p,m,x,y,b,v,w,S,C,k;const s=$7(n.node);let r=null;const a=Object.create(null);let l=((p=n.extract)==null?void 0:p.part)??0,u=((m=n.extract)==null?void 0:m.node)??0,f=((x=n.extract)==null?void 0:x.path)??0,d=((y=n.extract)==null?void 0:y.segment)??0;for(;u<s.length;l++,u++,f++,d++){const _=s[u];if(_.kind===sa)break;if(_.kind===BP){d--,l--,f--;continue}const R=t[l],T=f;if(R&&(f+=R.length),_.kind===1){r??(r=n.node.fullPath.split("/"));const A=r[d],I=((b=_.prefix)==null?void 0:b.length)??0;if(A.charCodeAt(I)===123){const L=((v=_.suffix)==null?void 0:v.length)??0,$=A.substring(I+2,A.length-L-1),O=R.substring(I,R.length-L);a[$]=decodeURIComponent(O)}else{const L=A.substring(1);a[L]=decodeURIComponent(R)}}else if(_.kind===3){if(n.skipped&1<<u){l--,f=T-1;continue}r??(r=n.node.fullPath.split("/"));const A=r[d],I=((w=_.prefix)==null?void 0:w.length)??0,L=((S=_.suffix)==null?void 0:S.length)??0,$=A.substring(I+3,A.length-L-1),O=_.suffix||_.prefix?R.substring(I,R.length-L):R;O&&(a[$]=decodeURIComponent(O))}else if(_.kind===2){const A=_,I=e.substring(T+(((C=A.prefix)==null?void 0:C.length)??0),e.length-(((k=A.suffix)==null?void 0:k.length)??0)),L=decodeURIComponent(I);a["*"]=L,a._splat=L;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:l,node:u,path:f,segment:d}]}function UP(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function $7(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function D7(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const r=!yd(t),a=r&&e!=="/",l=t.length-(r?1:0),u=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let f=null,d=null;for(;u.length;){const p=u.pop(),{node:m,index:x,skipped:y,depth:b,statics:v,dynamics:w,optionals:S}=p;let{extract:C,rawParams:k}=p;if(m.kind===2&&m.route&&!Jh(d,p))continue;if(m.parse){if(!PA(e,t,p))continue;k=p.rawParams,C=p.extract}s&&m.route&&m.kind!==sa&&Jh(f,p)&&(f=p);const _=x===l;if(_&&(m.route&&(!a||m.kind===sa||m.kind===2)&&Jh(d,p)&&(d=p),!m.optional&&!m.wildcard&&!m.index&&!m.pathless))continue;const R=_?void 0:t[x];let T;if(_&&m.index){const A={node:m.index,index:x,skipped:y,depth:b+1,statics:v,dynamics:w,optionals:S,extract:C,rawParams:k};let I=!0;if(m.index.parse&&(PA(e,t,A)||(I=!1)),I){if(!w&&!S&&!y&&q7(v,l))return A;Jh(d,A)&&(d=A)}}if(m.wildcard)for(let A=m.wildcard.length-1;A>=0;A--){const I=m.wildcard[A],{prefix:L,suffix:$}=I;if(!(L&&(_||!(I.caseSensitive?R:T??(T=R.toLowerCase())).startsWith(L)))){if($){if(_)continue;const O=t.slice(x).join("/").slice(-$.length);if((I.caseSensitive?O:O.toLowerCase())!==$)continue}u.push({node:I,index:l,skipped:y,depth:b+1,statics:v,dynamics:w,optionals:S,extract:C,rawParams:k})}}if(m.optional){const A=y|1<<b,I=b+1;for(let L=m.optional.length-1;L>=0;L--){const $=m.optional[L];u.push({node:$,index:x,skipped:A,depth:I,statics:v,dynamics:w,optionals:S,extract:C,rawParams:k})}if(!_)for(let L=m.optional.length-1;L>=0;L--){const $=m.optional[L],{prefix:O,suffix:B}=$;if(O||B){const H=$.caseSensitive?R:T??(T=R.toLowerCase());if(O&&!H.startsWith(O)||B&&!H.endsWith(B))continue}u.push({node:$,index:x+1,skipped:y,depth:I,statics:v,dynamics:w,optionals:S+Zh(l,x),extract:C,rawParams:k})}}if(!_&&m.dynamic&&R)for(let A=m.dynamic.length-1;A>=0;A--){const I=m.dynamic[A],{prefix:L,suffix:$}=I;if(L||$){const O=I.caseSensitive?R:T??(T=R.toLowerCase());if(L&&!O.startsWith(L)||$&&!O.endsWith($))continue}u.push({node:I,index:x+1,skipped:y,depth:b+1,statics:v,dynamics:w+Zh(l,x),optionals:S,extract:C,rawParams:k})}if(!_&&m.staticInsensitive){const A=m.staticInsensitive.get(T??(T=R.toLowerCase()));A&&u.push({node:A,index:x+1,skipped:y,depth:b+1,statics:v+Zh(l,x),dynamics:w,optionals:S,extract:C,rawParams:k})}if(!_&&m.static){const A=m.static.get(R);A&&u.push({node:A,index:x+1,skipped:y,depth:b+1,statics:v+Zh(l,x),dynamics:w,optionals:S,extract:C,rawParams:k})}if(m.pathless){const A=b+1;for(let I=m.pathless.length-1;I>=0;I--){const L=m.pathless[I];u.push({node:L,index:x,skipped:y,depth:A,statics:v,dynamics:w,optionals:S,extract:C,rawParams:k})}}}if(d)return d;if(s&&f){let p=f.index;for(let x=0;x<f.index;x++)p+=t[x].length;const m=p===e.length?"/":e.slice(p);return f.rawParams??(f.rawParams=Object.create(null)),f.rawParams["**"]=decodeURIComponent(m),f}return null}function Zh(e,t){return 2**(e-t-1)}function q7(e,t){return e===2**(t-1)-1}function PA(e,t,n){let s,r;try{[s,r]=HP(e,t,n)}catch{return null}if(n.rawParams=s,n.extract=r,!n.node.parse)return!0;try{if(n.node.parse(s)===!1)return null}catch{}return!0}function Jh(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===sa)>(e.node.kind===sa)||t.node.kind===sa==(e.node.kind===sa)&&t.depth>e.depth))):!0}function Vp(e){return d2(e.filter(t=>t!==void 0).join("/"))}function d2(e){return e.replace(/\/{2,}/g,"/")}function VP(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Vr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function GP(e){return Vr(VP(e))}function dm(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function z7(e,t,n){return dm(e,n)===dm(t,n)}function B7({base:e,to:t,trailingSlash:n="never",cache:s}){const r=t.startsWith("/"),a=!r&&t===".";let l;if(s){l=r?t:a?e:e+"\0"+t;const d=s.get(l);if(d)return d}let u;if(a)u=e.split("/");else if(r)u=t.split("/");else{for(u=e.split("/");u.length>1&&yd(u)==="";)u.pop();const d=t.split("/");for(let p=0,m=d.length;p<m;p++){const x=d[p];x===""?p?p===m-1&&u.push(x):u=[x]:x===".."?u.pop():x==="."||u.push(x)}}u.length>1&&(yd(u)===""?n==="never"&&u.pop():n==="always"&&u.push(""));const f=d2(u.join("/"))||"/";return l&&s&&s.set(l,f),f}function F7(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),n=Array.from(t.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return r=>r.replace(s,a=>t.get(a)??a)}function Ty(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(r=>DA(r,n)).join("/"):DA(s,n)}function $A({path:e,params:t,decoder:n,...s}){let r=!1;const a=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:r};if(!e.includes("$"))return{interpolatedPath:e,usedParams:a,isMissingParams:r};const l=e.length;let u=0,f,d="";for(;u<l;){const p=u;f=FP(e,p,f);const m=f[5];if(u=m+1,p===m)continue;const x=f[0];if(x===0){d+="/"+e.substring(p,m);continue}if(x===2){const y=t._splat;a._splat=y,a["*"]=y;const b=e.substring(p,f[1]),v=e.substring(f[4],m);if(!y){r=!0,(b||v)&&(d+="/"+b+v);continue}const w=Ty("_splat",t,n);d+="/"+b+w+v;continue}if(x===1){const y=e.substring(f[2],f[3]);!r&&!(y in t)&&(r=!0),a[y]=t[y];const b=e.substring(p,f[1]),v=e.substring(f[4],m),w=Ty(y,t,n)??"undefined";d+="/"+b+w+v;continue}if(x===3){const y=e.substring(f[2],f[3]),b=t[y];if(b==null)continue;a[y]=b;const v=e.substring(p,f[1]),w=e.substring(f[4],m),S=Ty(y,t,n)??"";d+="/"+v+S+w;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:a,interpolatedPath:d||"/",isMissingParams:r}}function DA(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function jn(e){return(e==null?void 0:e.isNotFound)===!0}function H7(){try{return typeof window<"u"&&typeof window.sessionStorage=="object"?window.sessionStorage:void 0}catch{return}}const U7="tsr-scroll-restoration-v1_3";function V7(){const e=H7();if(!e)return null;let t={};try{const s=JSON.parse(e.getItem("tsr-scroll-restoration-v1_3")||"{}");xc(s)&&(t=s)}catch{}return{get state(){return t},set:s=>{t=ta(s,t)||t},persist:()=>{try{e.setItem(U7,JSON.stringify(t))}catch{}}}}const qA=V7(),G7=e=>e.state.__TSR_key||e.href;function K7(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let ep=!1;const $u="window",zA="data-scroll-restoration-id";function W7(e,t){if(!qA)return;const n=qA;if((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!n)return;e.isScrollRestorationSetup=!0,ep=!1;const s=e.options.getScrollRestorationKey||G7,r=new Map;window.history.scrollRestoration="manual";const a=u=>{if(!(ep||!e.isScrollRestoring))if(u.target===document||u.target===window)r.set($u,{scrollX:window.scrollX||0,scrollY:window.scrollY||0});else{const f=u.target;r.set(f,{scrollX:f.scrollLeft||0,scrollY:f.scrollTop||0})}},l=u=>{var d;if(!e.isScrollRestoring||!u||r.size===0||!n)return;const f=(d=n.state)[u]||(d[u]={});for(const[p,m]of r){let x;if(p===$u)x=$u;else if(p.isConnected){const y=p.getAttribute(zA);x=y?`[${zA}="${y}"]`:K7(p)}x&&(f[x]=m)}};document.addEventListener("scroll",a,!0),e.subscribe("onBeforeLoad",u=>{l(u.fromLocation?s(u.fromLocation):void 0),r.clear()}),window.addEventListener("pagehide",()=>{l(s(e.stores.resolvedLocation.get()??e.stores.location.get())),n.persist()}),e.subscribe("onRendered",u=>{var m;const f=s(u.toLocation),d=e.options.scrollRestorationBehavior,p=e.options.scrollToTopSelectors;if(r.clear(),!e.resetNextScroll){e.resetNextScroll=!0;return}if(!(typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))){ep=!0;try{const x=e.isScrollRestoring?n.state[f]:void 0;let y=!1;if(x)for(const b in x){const v=x[b];if(!xc(v))continue;const{scrollX:w,scrollY:S}=v;if(!(!Number.isFinite(w)||!Number.isFinite(S))){if(b===$u)window.scrollTo({top:S,left:w,behavior:d}),y=!0;else if(b){let C;try{C=document.querySelector(b)}catch{continue}C&&(C.scrollLeft=w,C.scrollTop=S,y=!0)}}}if(!y){const b=e.history.location.hash.slice(1);if(b){const v=((m=window.history.state)==null?void 0:m.__hashScrollIntoViewOptions)??!0;if(v){const w=document.getElementById(b);w&&w.scrollIntoView(v)}}else{const v={top:0,left:0,behavior:d};if(window.scrollTo(v),p)for(const w of p){if(w===$u)continue;const S=typeof w=="function"?w():document.querySelector(w);S&&S.scrollTo(v)}}}}finally{ep=!1}e.isScrollRestoring&&n.set(x=>(x[f]||(x[f]={}),x))}})}function Y7(e,t=String){const n=new URLSearchParams;for(const s in e){const r=e[s];r!==void 0&&n.set(s,t(r))}return n.toString()}function Iy(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Q7(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,r]of t.entries()){const a=n[s];a==null?n[s]=Iy(r):Array.isArray(a)?a.push(Iy(r)):n[s]=[a,Iy(r)]}return n}const X7=J7(JSON.parse),Z7=eH(JSON.stringify,JSON.parse);function J7(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Q7(t);for(const s in n){const r=n[s];if(typeof r=="string")try{n[s]=e(r)}catch{}}return n}}function eH(e,t){const n=typeof t=="function";function s(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(n&&typeof r=="string")try{return t(r),e(r)}catch{}return r}return r=>{const a=Y7(r,s);return a?`?${a}`:""}}const po="__root__";function tH(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Fn(e){return e instanceof Response&&!!e.options}function nH(e){return{input:({url:t})=>{for(const n of e)t=QS(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=KP(e[n],t);return t}}}function sH(e){const t=GP(e.basepath),n=`/${t}`,s=`${n}/`,r=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?s:s.toLowerCase();return{input:({url:l})=>{const u=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return u===r?l.pathname="/":u.startsWith(a)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=Vp(["/",t,l.pathname]),l)}}function QS(e,t){var s;const n=(s=e==null?void 0:e.input)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function KP(e,t){var s;const n=(s=e==null?void 0:e.output)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function rH(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:r,init:a}=t,l=new Map,u=new Map,f=new Map,d=n(e.status),p=n(e.loadedAt),m=n(e.isLoading),x=n(e.isTransitioning),y=n(e.location),b=n(e.resolvedLocation),v=n(e.statusCode),w=n(e.redirect),S=n([]),C=n([]),k=n([]),_=s(()=>My(l,S.get())),R=s(()=>My(u,C.get())),T=s(()=>My(f,k.get())),A=s(()=>S.get()[0]),I=s(()=>S.get().some(V=>{var K;return((K=l.get(V))==null?void 0:K.get().status)==="pending"})),L=s(()=>{var V;return{locationHref:y.get().href,resolvedLocationHref:(V=b.get())==null?void 0:V.href,status:d.get()}}),$=s(()=>({status:d.get(),loadedAt:p.get(),isLoading:m.get(),isTransitioning:x.get(),matches:_.get(),location:y.get(),resolvedLocation:b.get(),statusCode:v.get(),redirect:w.get()})),O=bd(64);function B(V){let K=O.get(V);return K||(K=s(()=>{const Y=S.get();for(const J of Y){const D=l.get(J);if(D&&D.routeId===V)return D.get()}}),O.set(V,K)),K}const H={status:d,loadedAt:p,isLoading:m,isTransitioning:x,location:y,resolvedLocation:b,statusCode:v,redirect:w,matchesId:S,pendingIds:C,cachedIds:k,matches:_,pendingMatches:R,cachedMatches:T,firstId:A,hasPending:I,matchRouteDeps:L,matchStores:l,pendingMatchStores:u,cachedMatchStores:f,__store:$,getRouteMatchStore:B,setMatches:P,setPending:G,setCached:q};P(e.matches),a==null||a(H);function P(V){Oy(V,l,S,n,r)}function G(V){Oy(V,u,C,n,r)}function q(V){Oy(V,f,k,n,r)}return H}function My(e,t){const n=[];for(const s of t){const r=e.get(s);r&&n.push(r.get())}return n}function Oy(e,t,n,s,r){const a=e.map(u=>u.id),l=new Set(a);r(()=>{for(const u of t.keys())l.has(u)||t.delete(u);for(const u of e){const f=t.get(u.id);if(!f){const d=s(u);d.routeId=u.routeId,t.set(u.id,d);continue}f.routeId=u.routeId,f.get()!==u&&f.set(u)}R7(n.get(),a)||n.set(a)})}const XS=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},iH=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),Hm=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),mo=(e,t,n=!0)=>{const s={...e.router.options.context??{}},r=n?t:t-1;for(let a=0;a<=r;a++){const l=e.matches[a];if(!l)continue;const u=e.router.getMatch(l.id);u&&Object.assign(s,u.__routeContext,u.__beforeLoadContext)}return s},BA=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(l=>l.routeId===e.router.routeTree.id),r=s>=0?s:0;let a=n?e.matches.findIndex(l=>l.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=r);for(let l=a;l>=0;l--){const u=e.matches[l];if(e.router.looseRoutesById[u.routeId].options.notFoundComponent)return l}return n?a:r},ra=(e,t,n)=>{var s,r,a;if(!(!Fn(n)&&!jn(n)))throw Fn(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((s=t._nonReactive.beforeLoadPromise)==null||s.resolve(),(r=t._nonReactive.loaderPromise)==null||r.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,l=>({...l,status:Fn(n)?"redirected":jn(n)?"notFound":l.status==="pending"?"success":l.status,context:mo(e,t.index),isFetching:!1,error:n})),jn(n)&&!n.routeId&&(n.routeId=t.routeId),(a=t._nonReactive.loadPromise)==null||a.resolve()),Fn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},WP=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},FA=(e,t,n)=>{const s=mo(e,n);e.updateMatch(t,r=>({...r,context:s}))},Du=(e,t,n,s)=>{var u,f;const{id:r,routeId:a}=e.matches[t],l=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=s,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),ra(e,e.router.getMatch(r),n);try{(f=(u=l.options).onError)==null||f.call(u,n)}catch(d){n=d,ra(e,e.router.getMatch(r),n)}e.updateMatch(r,d=>{var p,m;return(p=d._nonReactive.beforeLoadPromise)==null||p.resolve(),d._nonReactive.beforeLoadPromise=void 0,(m=d._nonReactive.loadPromise)==null||m.resolve(),{...d,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!Fn(n)&&!jn(n)&&(e.serialError??(e.serialError=n))},YP=(e,t,n,s)=>{var a;if(s._nonReactive.pendingTimeout!==void 0)return;const r=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Hm(e,t)&&(n.options.loader||n.options.beforeLoad||XP(n))&&typeof r=="number"&&r!==1/0&&(n.options.pendingComponent??((a=e.router.options)==null?void 0:a.defaultPendingComponent))){const l=setTimeout(()=>{XS(e)},r);s._nonReactive.pendingTimeout=l}},aH=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;YP(e,t,n,s);const r=()=>{const a=e.router.getMatch(t);a.preload&&(a.status==="redirected"||a.status==="notFound")&&ra(e,a,a.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(r):r()},oH=(e,t,n,s)=>{const r=e.router.getMatch(t);let a=r._nonReactive.loadPromise;r._nonReactive.loadPromise=yc(()=>{a==null||a.resolve(),a=void 0});const{paramsError:l,searchError:u}=r;l&&Du(e,n,l,"PARSE_PARAMS"),u&&Du(e,n,u,"VALIDATE_SEARCH"),YP(e,t,s,r);const f=new AbortController;let d=!1;const p=()=>{d||(d=!0,e.updateMatch(t,_=>({..._,isFetching:"beforeLoad",fetchCount:_.fetchCount+1,abortController:f})))},m=()=>{var _;(_=r._nonReactive.beforeLoadPromise)==null||_.resolve(),r._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,R=>({...R,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{p(),m()});return}r._nonReactive.beforeLoadPromise=yc();const x={...mo(e,n,!1),...r.__routeContext},{search:y,params:b,cause:v}=r,w=Hm(e,t),S={search:y,abortController:f,params:b,preload:w,context:x,location:e.location,navigate:_=>e.router.navigate({..._,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:w?"preload":v,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},C=_=>{if(_===void 0){e.router.batch(()=>{p(),m()});return}(Fn(_)||jn(_))&&(p(),Du(e,n,_,"BEFORE_LOAD")),e.router.batch(()=>{p(),e.updateMatch(t,R=>({...R,__beforeLoadContext:_})),m()})};let k;try{if(k=s.options.beforeLoad(S),vd(k))return p(),k.catch(_=>{Du(e,n,_,"BEFORE_LOAD")}).then(C)}catch(_){p(),Du(e,n,_,"BEFORE_LOAD")}C(k)},lH=(e,t)=>{const{id:n,routeId:s}=e.matches[t],r=e.router.looseRoutesById[s],a=()=>u(),l=()=>oH(e,n,t,r),u=()=>{if(WP(e,n))return;const f=aH(e,n,r);return vd(f)?f.then(l):l()};return a()},cH=(e,t,n)=>{var a,l,u,f,d,p;const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const r={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([(l=(a=n.options).head)==null?void 0:l.call(a,r),(f=(u=n.options).scripts)==null?void 0:f.call(u,r),(p=(d=n.options).headers)==null?void 0:p.call(d,r)]).then(([m,x,y])=>({meta:m==null?void 0:m.meta,links:m==null?void 0:m.links,headScripts:m==null?void 0:m.scripts,headers:y,scripts:x,styles:m==null?void 0:m.styles}))},QP=(e,t,n,s,r)=>{const a=t[s-1],{params:l,loaderDeps:u,abortController:f,cause:d}=e.router.getMatch(n),p=mo(e,s),m=Hm(e,n);return{params:l,deps:u,preload:!!m,parentMatchPromise:a,abortController:f,context:p,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:m?"preload":d,route:r,...e.router.options.additionalContext}},HA=async(e,t,n,s,r)=>{var a,l,u,f,d;try{const p=e.router.getMatch(n);try{(!(DP??e.router.isServer)||p.ssr===!0)&&wd(r);const m=r.options.loader,x=typeof m=="function"?m:m==null?void 0:m.handler,y=x==null?void 0:x(QP(e,t,n,s,r)),b=!!x&&vd(y);if((b||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||p._nonReactive.minPendingPromise)&&e.updateMatch(n,w=>({...w,isFetching:"loader"})),x){const w=b?await y:y;ra(e,e.router.getMatch(n),w),w!==void 0&&e.updateMatch(n,S=>({...S,loaderData:w}))}r._lazyPromise&&await r._lazyPromise;const v=p._nonReactive.minPendingPromise;v&&await v,r._componentsPromise&&await r._componentsPromise,e.updateMatch(n,w=>({...w,error:void 0,context:mo(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(m){let x=m;if((x==null?void 0:x.name)==="AbortError"){if(p.abortController.signal.aborted){(a=p._nonReactive.loaderPromise)==null||a.resolve(),p._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,b=>({...b,status:b.status==="pending"?"success":b.status,isFetching:!1,context:mo(e,s)}));return}const y=p._nonReactive.minPendingPromise;y&&await y,jn(m)&&await((u=(l=r.options.notFoundComponent)==null?void 0:l.preload)==null?void 0:u.call(l)),ra(e,e.router.getMatch(n),m);try{(d=(f=r.options).onError)==null||d.call(f,m)}catch(b){x=b,ra(e,e.router.getMatch(n),b)}!Fn(x)&&!jn(x)&&await wd(r,["errorComponent"]),e.updateMatch(n,b=>({...b,error:x,context:mo(e,s),status:"error",isFetching:!1}))}}catch(p){const m=e.router.getMatch(n);m&&(m._nonReactive.loaderPromise=void 0),ra(e,m,p)}},uH=async(e,t,n)=>{var y,b,v,w;async function s(S,C,k,_,R){const T=Date.now()-C.updatedAt,A=S?R.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:R.options.staleTime??e.router.options.defaultStaleTime??0,I=R.options.shouldReload,L=typeof I=="function"?I(QP(e,t,r,n,R)):I,{status:$,invalid:O}=_,B=T>=A&&(!!e.forceStaleReload||_.cause==="enter"||k!==void 0&&k!==_.id);l=$==="success"&&(O||(L??B)),S&&R.options.preload===!1||(l&&!e.sync&&p?(u=!0,(async()=>{var H,P;try{await HA(e,t,r,n,R);const G=e.router.getMatch(r);(H=G._nonReactive.loaderPromise)==null||H.resolve(),(P=G._nonReactive.loadPromise)==null||P.resolve(),G._nonReactive.loaderPromise=void 0,G._nonReactive.loadPromise=void 0}catch(G){Fn(G)&&await e.router.navigate(G.options)}})()):$!=="success"||l?await HA(e,t,r,n,R):FA(e,r,n))}const{id:r,routeId:a}=e.matches[n];let l=!1,u=!1;const f=e.router.looseRoutesById[a],d=f.options.loader,p=((typeof d=="function"||d==null?void 0:d.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(WP(e,r)){if(!e.router.getMatch(r))return e.matches[n];FA(e,r,n)}else{const S=e.router.getMatch(r),C=e.router.stores.matchesId.get()[n],k=((y=C&&e.router.stores.matchStores.get(C)||null)==null?void 0:y.routeId)===a?C:(b=e.router.stores.matches.get().find(R=>R.routeId===a))==null?void 0:b.id,_=Hm(e,r);if(S._nonReactive.loaderPromise){if(S.status==="success"&&!e.sync&&!S.preload&&p)return S;await S._nonReactive.loaderPromise;const R=e.router.getMatch(r),T=R._nonReactive.error||R.error;T&&ra(e,R,T),R.status==="pending"&&await s(_,S,k,R,f)}else{const R=_&&!e.router.stores.matchStores.has(r),T=e.router.getMatch(r);T._nonReactive.loaderPromise=yc(),R!==T.preload&&e.updateMatch(r,A=>({...A,preload:R})),await s(_,S,k,T,f)}}const m=e.router.getMatch(r);u||((v=m._nonReactive.loaderPromise)==null||v.resolve(),(w=m._nonReactive.loadPromise)==null||w.resolve(),m._nonReactive.loadPromise=void 0),clearTimeout(m._nonReactive.pendingTimeout),m._nonReactive.pendingTimeout=void 0,u||(m._nonReactive.loaderPromise=void 0),m._nonReactive.dehydrated=void 0;const x=u?m.isFetching:!1;return x!==m.isFetching||m.invalid!==!1?(e.updateMatch(r,S=>({...S,isFetching:x,invalid:!1})),e.router.getMatch(r)):m};async function UA(e){var x,y;const t=e,n=[];iH(t.router)&&XS(t);let s;for(let b=0;b<t.matches.length;b++){try{const v=lH(t,b);vd(v)&&await v}catch(v){if(Fn(v))throw v;if(jn(v))s=v;else if(!t.preload)throw v;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const r=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?BA(t,s):void 0,l=s&&t.preload?0:a!==void 0?Math.min(a+1,r):r;let u,f;for(let b=0;b<l;b++)n.push(uH(t,n,b));try{await Promise.all(n)}catch{const b=await Promise.allSettled(n);for(const v of b){if(v.status!=="rejected")continue;const w=v.reason;if(Fn(w))throw w;jn(w)?u??(u=w):f??(f=w)}if(f!==void 0)throw f}const d=u??(s&&!t.preload?s:void 0);let p=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!d&&s&&t.preload)return t.matches;if(d){const b=BA(t,d);b===void 0&&Wr();const v=t.matches[b],w=t.router.looseRoutesById[v.routeId],S=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!w.options.notFoundComponent&&S&&(w.options.notFoundComponent=S),d.routeId=v.routeId;const C=v.routeId===t.router.routeTree.id;t.updateMatch(v.id,k=>({...k,...C?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:d},isFetching:!1})),p=b,await wd(w,["notFoundComponent"])}else if(!t.preload){const b=t.matches[0];b.globalNotFound||(y=t.router.getMatch(b.id))!=null&&y.globalNotFound&&t.updateMatch(b.id,v=>({...v,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const b=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await wd(b,["errorComponent"])}for(let b=0;b<=p;b++){const{id:v,routeId:w}=t.matches[b],S=t.router.looseRoutesById[w];try{const C=cH(t,v,S);if(C){const k=await C;t.updateMatch(v,_=>({..._,...k}))}}catch(C){console.error(`Error executing head for route ${w}:`,C)}}const m=XS(t);if(vd(m)&&await m,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function VA(e,t){const n=t.map(s=>{var r,a;return(a=(r=e.options[s])==null?void 0:r.preload)==null?void 0:a.call(r)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function wd(e,t=Gp){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:r,...a}=s.options;Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Gp?(()=>{if(e._componentsPromise===void 0){const s=VA(e,Gp);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():VA(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function XP(e){var t;for(const n of Gp)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const Gp=["component","errorComponent","pendingComponent","notFoundComponent"];var aa="__TSR_index",GA="popstate",KA="beforeunload";function dH(e){let t=e.getLocation();const n=new Set,s=l=>{t=e.getLocation(),n.forEach(u=>u({location:t,action:l}))},r=l=>{e.notifyOnIndexChange??!0?s(l):t=e.getLocation()},a=async({task:l,navigateOpts:u,...f})=>{var m,x;if((u==null?void 0:u.ignoreBlocker)??!1){l();return}const d=((m=e.getBlockers)==null?void 0:m.call(e))??[],p=f.type==="PUSH"||f.type==="REPLACE";if(typeof document<"u"&&d.length&&p)for(const y of d){const b=fm(f.path,f.state);if(await y.blockerFn({currentLocation:t,nextLocation:b,action:f.type})){(x=e.onBlocked)==null||x.call(e);return}}l()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,u,f)=>{const d=t.state[aa];u=WA(d+1,u),a({task:()=>{e.pushState(l,u),s({type:"PUSH"})},navigateOpts:f,type:"PUSH",path:l,state:u})},replace:(l,u,f)=>{const d=t.state[aa];u=WA(d,u),a({task:()=>{e.replaceState(l,u),s({type:"REPLACE"})},navigateOpts:f,type:"REPLACE",path:l,state:u})},go:(l,u)=>{a({task:()=>{e.go(l),r({type:"GO",index:l})},navigateOpts:u,type:"GO"})},back:l=>{a({task:()=>{e.back((l==null?void 0:l.ignoreBlocker)??!1),r({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{a({task:()=>{e.forward((l==null?void 0:l.ignoreBlocker)??!1),r({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[aa]!==0,createHref:l=>e.createHref(l),block:l=>{var f;if(!e.setBlockers)return()=>{};const u=((f=e.getBlockers)==null?void 0:f.call(e))??[];return e.setBlockers([...u,l]),()=>{var p,m;const d=((p=e.getBlockers)==null?void 0:p.call(e))??[];(m=e.setBlockers)==null||m.call(e,d.filter(x=>x!==l))}},flush:()=>{var l;return(l=e.flush)==null?void 0:l.call(e)},destroy:()=>{var l;return(l=e.destroy)==null?void 0:l.call(e)},notify:s}}function WA(e,t){t||(t={});const n=f2();return{...t,key:n,__TSR_key:n,[aa]:e}}function fH(e){var I,L;const t=typeof document<"u"?window:void 0,n=t.history.pushState,s=t.history.replaceState;let r=[];const a=()=>r,l=$=>r=$,u=($=>$),f=(()=>fm(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((I=t.history.state)!=null&&I.__TSR_key)&&!((L=t.history.state)!=null&&L.key)){const $=f2();t.history.replaceState({[aa]:0,key:$,__TSR_key:$},"")}let d=f(),p,m=!1,x=!1,y=!1,b=!1;const v=()=>d;let w,S;const C=()=>{w&&(A._ignoreSubscribers=!0,(w.isPush?t.history.pushState:t.history.replaceState)(w.state,"",w.href),A._ignoreSubscribers=!1,w=void 0,S=void 0,p=void 0)},k=($,O,B)=>{const H=u(O);S||(p=d),d=fm(O,B),w={href:H,state:B,isPush:(w==null?void 0:w.isPush)||$==="push"},S||(S=Promise.resolve().then(()=>C()))},_=$=>{d=f(),A.notify({type:$})},R=async()=>{if(x){x=!1;return}const $=f(),O=$.state[aa]-d.state[aa],B=O===1,H=O===-1,P=!B&&!H||m;m=!1;const G=P?"GO":H?"BACK":"FORWARD",q=P?{type:"GO",index:O}:{type:H?"BACK":"FORWARD"};if(y)y=!1;else{const V=a();if(typeof document<"u"&&V.length){for(const K of V)if(await K.blockerFn({currentLocation:d,nextLocation:$,action:G})){x=!0,t.history.go(1),A.notify(q);return}}}d=f(),A.notify(q)},T=$=>{if(b){b=!1;return}let O=!1;const B=a();if(typeof document<"u"&&B.length)for(const H of B){const P=H.enableBeforeUnload??!0;if(P===!0){O=!0;break}if(typeof P=="function"&&P()===!0){O=!0;break}}if(O)return $.preventDefault(),$.returnValue=""},A=dH({getLocation:v,getLength:()=>t.history.length,pushState:($,O)=>k("push",$,O),replaceState:($,O)=>k("replace",$,O),back:$=>($&&(y=!0),b=!0,t.history.back()),forward:$=>{$&&(y=!0),b=!0,t.history.forward()},go:$=>{m=!0,t.history.go($)},createHref:$=>u($),flush:C,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(KA,T,{capture:!0}),t.removeEventListener(GA,R)},onBlocked:()=>{p&&d!==p&&(d=p)},getBlockers:a,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(KA,T,{capture:!0}),t.addEventListener(GA,R),t.history.pushState=function(...$){const O=n.apply(t.history,$);return A._ignoreSubscribers||_("PUSH"),O},t.history.replaceState=function(...$){const O=s.apply(t.history,$);return A._ignoreSubscribers||_("REPLACE"),O},A}function hH(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function fm(e,t){const n=hH(e),s=n.indexOf("#"),r=n.indexOf("?"),a=f2();return{href:n,pathname:n.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:n.length),hash:s>-1?n.substring(s):"",search:r>-1?n.slice(r,s===-1?void 0:s):"",state:t||{[aa]:0,key:a,__TSR_key:a}}}function f2(){return(Math.random()+1).toString(36).substring(7)}function Wl(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:(n==null?void 0:n.pathname)!==s.pathname,hrefChanged:(n==null?void 0:n.href)!==s.href,hashChanged:(n==null?void 0:n.hash)!==s.hash}}var pH=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{var p;const s=this.options,r=this.basepath??(s==null?void 0:s.basepath)??"/",a=this.basepath===void 0,l=s==null?void 0:s.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=F7(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=fH()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let m;this.resolvePathCache=bd(1e3),m=this.buildRouteTree(),this.setRoutes(m)}if(!this.stores&&this.latestLocation){const m=this.getStoreConfig(this);this.batch=m.batch,this.stores=rH(gH(this.latestLocation),m),W7(this)}let u=!1;const f=this.options.basepath??"/",d=this.options.rewrite;if(a||r!==f||l!==d){this.basepath=f;const m=[],x=GP(f);x&&x!=="/"&&m.push(sH({basepath:f})),d&&m.push(d),this.rewrite=m.length===0?void 0:m.length===1?m[0]:nH(m),this.history&&this.updateLatestLocation(),u=!0}u&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((p=window.CSS)==null?void 0:p.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=P7(this.routeTree,this.options.caseSensitive,(s,r)=>{s.init({originalIndex:r})});return this.options.routeMasks&&T7(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const r={eventType:n,fn:s};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const r=({pathname:f,search:d,hash:p,href:m,state:x})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(f)){const S=this.options.parseSearch(d),C=this.options.stringifySearch(S);return{href:f+C+p,publicHref:f+C+p,pathname:Pu(f).path,external:!1,searchStr:C,search:Ha(s==null?void 0:s.search,S),hash:Pu(p.slice(1)).path,state:na(s==null?void 0:s.state,x)}}const y=new URL(m,this.origin),b=QS(this.rewrite,y),v=this.options.parseSearch(b.search),w=this.options.stringifySearch(v);return b.search=w,{href:b.href.replace(b.origin,""),publicHref:m,pathname:Pu(b.pathname).path,external:!!this.rewrite&&b.origin!==this.origin,searchStr:w,search:Ha(s==null?void 0:s.search,v),hash:Pu(b.hash.slice(1)).path,state:na(s==null?void 0:s.state,x)}},a=r(n),{__tempLocation:l,__tempKey:u}=a.state;if(l&&(!u||u===this.tempLocationKey)){const f=r(l);return f.state.key=a.state.key,f.state.__TSR_key=a.state.__TSR_key,delete f.state.__tempLocation,{...f,maskedLocation:a}}return a},this.resolvePathWithBase=(n,s)=>B7({base:n,to:s.includes("//")?d2(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,r)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},r):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>xH({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{var r;if(this.stores.pendingMatchStores.has(n))return;const s=(r=this.stores.matchStores.get(n))==null?void 0:r.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(a={})=>{var O,B;const l=a._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutesLightweight(l);a.from;const f=a.unsafeRelative==="path"?l.pathname:a.from??u.fullPath,d=a.to?`${a.to}`:void 0,p=u.search,m=Object.assign(Object.create(null),u.params),x=(d==null?void 0:d.charCodeAt(0))===47?"/":this.resolvePathWithBase(f,"."),y=d?this.resolvePathWithBase(x,d):x,b=a.params===!1||a.params===null?Object.create(null):(a.params??!0)===!0?m:Object.assign(m,ta(a.params,m)),v=this.routesByPath[Vr(y)];let w;if(v)w=this.getRouteBranch(v);else if(y.includes("$"))w=[];else{const H=this.getMatchedRoutes(y);w=H.matchedRoutes,this.options.notFoundRoute&&(!H.foundRoute||H.foundRoute.path!=="/"&&H.routeParams["**"])&&(w=[...w,this.options.notFoundRoute])}if(w.length&&zP(b))for(const H of w){const P=((O=H.options.params)==null?void 0:O.stringify)??H.options.stringifyParams;if(P)try{Object.assign(b,P(b))}catch{}}const S=n.leaveParams?y:Pu($A({path:y,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=p;if(n._includeValidateSearch&&((B=this.options.search)!=null&&B.strict)){const H={};w.forEach(P=>{if(P.options.validateSearch)try{Object.assign(H,Kp(P.options.validateSearch,{...H,...C}))}catch{}}),C=H}C=yH({search:C,dest:a,destRoutes:w,_includeValidateSearch:n._includeValidateSearch}),C=Ha(p,C);const k=this.options.stringifySearch(C),_=a.hash===!0?l.hash:a.hash?ta(a.hash,l.hash):void 0,R=_?`#${_}`:"";let T=a.state===!0?l.state:a.state?ta(a.state,l.state):{};T=na(l.state,T);const A=`${S}${k}${R}`;let I,L,$=!1;if(this.rewrite){const H=new URL(A,this.origin),P=KP(this.rewrite,H);I=H.href.replace(H.origin,""),P.origin!==this.origin?(L=P.href,$=!0):L=P.pathname+P.search+P.hash}else I=E7(A),L=I;return{publicHref:L,href:I,pathname:S,search:C,searchStr:k,state:T,hash:_??"",external:$,unmaskOnReload:a.unmaskOnReload}},r=(a={},l)=>{const u=s(a);let f=l?s(l):void 0;if(!f){const d=Object.create(null);if(this.options.routeMasks){const p=I7(u.pathname,this.processedTree);if(p){Object.assign(d,p.rawParams);const{from:m,params:x,...y}=p.route,b=x===!1||x===null?Object.create(null):(x??!0)===!0?d:Object.assign(d,ta(x,d));l={from:n.from,...y,params:b},f=s(l)}}}return f&&(u.maskedLocation=f),u};return n.mask?r(n,{from:n.from,...n.mask}):r(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...r})=>{const a=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(p=>{r.state[p]=this.latestLocation.state[p]});const d=ho(r.state,this.latestLocation.state);return f.forEach(p=>{delete r.state[p]}),d},l=Vr(this.latestLocation.href)===Vr(r.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=yc(()=>{u==null||u.resolve(),u=void 0}),l&&a())this.load();else{let{maskedLocation:f,hashScrollIntoView:d,...p}=r;f&&(p={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[r.replace?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:s})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:r,viewTransition:a,ignoreBlocker:l,href:u,...f}={})=>{if(u){const m=this.history.location.state.__TSR_index,x=fm(u,{__TSR_index:n?m:m+1}),y=new URL(x.pathname,this.origin);f.to=QS(this.rewrite,y).pathname,f.search=this.options.parseSearch(x.search),f.hash=x.hash.slice(1)}const d=this.buildLocation({...f,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const p=this.commitLocation({...d,viewTransition:a,replace:n,resetScroll:s,hashScrollIntoView:r,ignoreBlocker:l});return Promise.resolve().then(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:n,reloadDocument:s,href:r,publicHref:a,...l})=>{var f,d;let u=!1;if(r)try{new URL(`${r}`),u=!0}catch{}if(u&&!s&&(s=!0),s){if(n!==void 0||!r){const m=this.buildLocation({to:n,...l});r=r??m.publicHref,a=a??m.publicHref}const p=!u&&a?a:r;if(um(p,this.protocolAllowlist))return Promise.resolve();if(!l.ignoreBlocker){const m=((d=(f=this.history).getBlockers)==null?void 0:d.call(f))??[];for(const x of m)if(x!=null&&x.blockerFn&&await x.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return l.replace?window.location.replace(p):window.location.href=p,Promise.resolve()}return this.buildAndCommitLocation({...l,href:r,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(r=>!n.some(a=>a.id===r.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(s)})},this.load=async n=>{let s,r,a;const l=this.stores.resolvedLocation.get()??this.stores.location.get();for(a=new Promise(f=>{this.startTransition(async()=>{var d;try{this.beforeLoad();const p=this.latestLocation,m=Wl(p,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...m}),this.emit({type:"onBeforeLoad",...m}),await UA({router:this,sync:n==null?void 0:n.sync,forceStaleReload:l.href===p.href,matches:this.stores.pendingMatches.get(),location:p,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var w,S;let x=null,y=null,b=null,v=null;this.batch(()=>{const C=this.stores.pendingMatches.get(),k=C.length,_=this.stores.matches.get();x=k?_.filter(A=>!this.stores.pendingMatchStores.has(A.id)):null;const R=new Set;for(const A of this.stores.pendingMatchStores.values())A.routeId&&R.add(A.routeId);const T=new Set;for(const A of this.stores.matchStores.values())A.routeId&&T.add(A.routeId);y=k?_.filter(A=>!R.has(A.routeId)):null,b=k?C.filter(A=>!T.has(A.routeId)):null,v=k?C.filter(A=>T.has(A.routeId)):_,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),k&&(this.stores.setMatches(C),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...x.filter(A=>A.status!=="error"&&A.status!=="notFound"&&A.status!=="redirected")]),this.clearExpiredCache())});for(const[C,k]of[[y,"onLeave"],[b,"onEnter"],[v,"onStay"]])if(C)for(const _ of C)(S=(w=this.looseRoutesById[_.routeId].options)[k])==null||S.call(w,_)})})}})}catch(p){Fn(p)?(s=p,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):jn(p)&&(r=p);const m=s?s.status:r?404:this.stores.matches.get().some(x=>x.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(m),this.stores.redirect.set(s)})}this.latestLoadPromise===a&&((d=this.commitLocationPromise)==null||d.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=a,await a;this.latestLoadPromise&&a!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(f=>f.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const a=this.latestLocation,l=this.stores.resolvedLocation.get(),u=typeof s.types=="function"?s.types(Wl(a,l)):s.types;if(u===!1){n();return}r={update:n,types:u}}else r=n;document.startViewTransition(r)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const r=this.stores.pendingMatchStores.get(n);if(r){r.set(s);return}const a=this.stores.matchStores.get(n);if(a){a.set(s);return}const l=this.stores.cachedMatchStores.get(n);if(l){const u=s(l.get());u.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(f=>f.filter(d=>d!==n)):l.set(u)}})},this.getMatch=n=>{var s,r,a;return((s=this.stores.cachedMatchStores.get(n))==null?void 0:s.get())??((r=this.stores.pendingMatchStores.get(n))==null?void 0:r.get())??((a=this.stores.matchStores.get(n))==null?void 0:a.get())},this.invalidate=n=>{const s=r=>{var a;return((a=n==null?void 0:n.filter)==null?void 0:a.call(n,r))??!0?{...r,invalid:!0,...n!=null&&n.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const r=n.options._builtLocation??this.buildLocation(n.options),a=this.getParsedLocationHref(r);n.options.href=a,n.headers.set("Location",a)}else if(s)try{const r=new URL(s);if(this.origin&&r.origin===this.origin){const a=r.pathname+r.search+r.hash;n.options.href=a,n.headers.set("Location",a)}}catch{}if(n.options.href&&!n.options._builtLocation&&um(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n==null?void 0:n.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(r=>!s(r))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),s=r=>{const a=this.looseRoutesById[r.routeId];if(!a.options.loader)return!0;const l=(r.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:n-r.updatedAt>=l};this.clearCache({filter:s})},this.loadRouteChunk=wd,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let r=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const a=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),l=new Set([...a,...this.stores.cachedIds.get()]),u=r.filter(f=>!l.has(f.id));if(u.length){const f=this.stores.cachedMatches.get();this.stores.setCached([...f,...u])}try{return r=await UA({router:this,matches:r,location:s,preload:!0,updateMatch:(f,d)=>{a.has(f)?r=r.map(p=>p.id===f?d(p):p):this.updateMatch(f,d)}}),r}catch(f){if(Fn(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:s});jn(f)||console.error(f);return}},this.matchRoute=(n,s)=>{const r={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},a=this.buildLocation(r);if(s!=null&&s.pending&&this.stores.status.get()!=="pending")return!1;const l=((s==null?void 0:s.pending)===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),u=M7(a.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,l.pathname,this.processedTree);return!u||n.params&&!ho(u.rawParams,n.params,{partial:!0})?!1:(s==null?void 0:s.includeSearch)??!0?ho(l.search,a.search,{partial:!0})?u.rawParams:!1:u.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Z7,parseSearch:e.parseSearch??X7,protocolAllowlist:e.protocolAllowlist??C7}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=UP(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var p,m;const n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:r}=n;let{matchedRoutes:a}=n,l=!1;(s?s.path!=="/"&&r["**"]:Vr(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:l=!0);const u=l?bH(this.options.notFoundMode,a):void 0,f=new Array(a.length),d=new Map;for(const x of this.stores.matchStores.values())x.routeId&&d.set(x.routeId,x.get());for(let x=0;x<a.length;x++){const y=a[x],b=f[x-1];let v,w,S;{const P=(b==null?void 0:b.search)??e.search,G=(b==null?void 0:b._strictSearch)??void 0;try{const q=Kp(y.options.validateSearch,{...P})??void 0;v={...P,...q},w={...G,...q},S=void 0}catch(q){let V=q;if(q instanceof hm||(V=new hm(q.message,{cause:q})),t!=null&&t.throwOnError)throw V;v=P,w={},S=V}}const C=((m=(p=y.options).loaderDeps)==null?void 0:m.call(p,{search:v}))??"",k=C?JSON.stringify(C):"",{interpolatedPath:_,usedParams:R}=$A({path:y.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),T=y.id+_+k,A=this.getMatch(T),I=d.get(y.id),L=(A==null?void 0:A._strictParams)??R;let $;if(!A)try{YA(y,L)}catch(P){if(jn(P)||Fn(P)?$=P:$=new mH(P.message,{cause:P}),t!=null&&t.throwOnError)throw $}Object.assign(r,L);const O=I?"stay":"enter";let B;if(A)B={...A,cause:O,params:(I==null?void 0:I.params)??r,_strictParams:L,search:Ha(I?I.search:A.search,v),_strictSearch:w};else{const P=y.options.loader||y.options.beforeLoad||y.lazyFn||XP(y)?"pending":"success";B={id:T,ssr:y.options.ssr,index:x,routeId:y.id,params:(I==null?void 0:I.params)??r,_strictParams:L,pathname:_,updatedAt:Date.now(),search:I?Ha(I.search,v):v,_strictSearch:w,searchError:void 0,status:P,isFetching:!1,error:void 0,paramsError:$,__routeContext:void 0,_nonReactive:{loadPromise:yc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:O,loaderDeps:I?na(I.loaderDeps,C):C,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:y.options.staticData||{},fullPath:y.fullPath}}t!=null&&t.preload||(B.globalNotFound=u===y.id),B.searchError=S;const H=this.getParentContext(b);B.context={...H,...B.__routeContext,...B.__beforeLoadContext},f[x]=B}for(let x=0;x<f.length;x++){const y=f[x],b=this.looseRoutesById[y.routeId],v=this.getMatch(y.id),w=d.get(y.routeId);if(y.params=w?Ha(w.params,r):r,!v){const S=f[x-1],C=this.getParentContext(S);if(b.options.context){const k={deps:y.loaderDeps,params:y.params,context:C??{},location:e,navigate:_=>this.navigate({..._,_fromLocation:e}),buildLocation:this.buildLocation,cause:y.cause,abortController:y.abortController,preload:!!y.preload,matches:f,routeId:b.id};y.__routeContext=b.options.context(k)??void 0}y.context={...C,...y.__routeContext,...y.__beforeLoadContext}}}return f}matchRoutesLightweight(e){var d;const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),s=yd(t),r={...e.search};for(const p of t)try{Object.assign(r,Kp(p.options.validateSearch,r))}catch{}const a=yd(this.stores.matchesId.get()),l=a&&((d=this.stores.matchStores.get(a))==null?void 0:d.get()),u=l&&l.routeId===s.id&&l.pathname===e.pathname;let f;if(u)f=l.params;else{const p=Object.assign(Object.create(null),n);for(const m of t)try{YA(m,p)}catch{}f=p}return{matchedRoutes:t,fullPath:s.fullPath,search:r,params:f}}},hm=class extends Error{},mH=class extends Error{};function gH(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Kp(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new hm("Async validation not supported");if(n.issues)throw new hm(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function xH({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),r=Vr(e);let a;const l=O7(r,n,!0);return l&&(a=l.route,Object.assign(s,l.rawParams)),{matchedRoutes:(l==null?void 0:l.branch)||[t.__root__],routeParams:s,foundRoute:a}}function yH({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return vH(n)(e,t,s??!1)}function vH(e){var r;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const a of e){if("search"in a.options)(r=a.options.search)!=null&&r.middlewares&&t.middlewares.push(...a.options.search.middlewares);else if(a.options.preSearchFilters||a.options.postSearchFilters){const l=({search:u,next:f})=>{let d=u;"preSearchFilters"in a.options&&a.options.preSearchFilters&&(d=a.options.preSearchFilters.reduce((m,x)=>x(m),u));const p=f(d);return"postSearchFilters"in a.options&&a.options.postSearchFilters?a.options.postSearchFilters.reduce((m,x)=>x(m),p):p};t.middlewares.push(l)}if(a.options.validateSearch){const l=({search:u,next:f})=>{const d=f(u);if(!t._includeValidateSearch)return d;try{return{...d,...Kp(a.options.validateSearch,d)??void 0}}catch{return d}};t.middlewares.push(l)}}const n=({search:a})=>{const l=t.dest;return l.search?l.search===!0?a:ta(l.search,a):{}};t.middlewares.push(n);const s=(a,l,u)=>{if(a>=u.length)return l;const f=u[a];return f({search:l,next:p=>s(a+1,p,u)})};return function(l,u,f){return t.dest=u,t._includeValidateSearch=f,s(0,l,t.middlewares)}}function bH(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return po}function YA(e,t){var s;const n=((s=e.options.params)==null?void 0:s.parse)??e.options.parseParams;if(n){const r=n(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}const wH="Error preloading route! ☝️";var ZP=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var f,d;this.originalIndex=t.originalIndex;const n=this.options,s=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(d=(f=this.options).getParentRoute)==null?void 0:d.call(f),s?this._path=po:this.parentRoute||Wr();let r=s?po:n==null?void 0:n.path;r&&r!=="/"&&(r=VP(r));const a=(n==null?void 0:n.id)||r;let l=s?po:Vp([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);r==="__root__"&&(r="/"),l!=="__root__"&&(l=Vp(["/",l]));const u=l==="__root__"?"/":Vp([this.parentRoute.fullPath,r]);this._path=r,this._id=l,this._fullPath=u,this._to=Vr(u)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>tH({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},jH=class extends ZP{constructor(e){super(e)}};function SH(e){if(typeof document<"u"&&document.querySelector){const t=e.stores.location.get(),n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==""){const s=document.getElementById(t.hash);s&&s.scrollIntoView(n)}}}function h2(e){const t=e.errorComponent??p2;return i.jsx(NH,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?E.createElement(t,{error:n,reset:s}):e.children})}var NH=class extends E.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function p2({error:e}){const[t,n]=E.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function kH({children:e,fallback:t=null}){return JP()?i.jsx(vo.Fragment,{children:e}):i.jsx(vo.Fragment,{children:t})}function JP(){return vo.useSyncExternalStore(_H,()=>!0,()=>!1)}function _H(){return()=>{}}var e$=E.createContext(null);function Wn(e){return E.useContext(e$)}var Um=E.createContext(void 0),CH=E.createContext(void 0),Nt=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(Nt||{});function EH({update:e,notify:t,unwatched:n}){return{link:s,unlink:r,propagate:a,checkDirty:l,shallowPropagate:u};function s(d,p,m){const x=p.depsTail;if(x!==void 0&&x.dep===d)return;const y=x!==void 0?x.nextDep:p.deps;if(y!==void 0&&y.dep===d){y.version=m,p.depsTail=y;return}const b=d.subsTail;if(b!==void 0&&b.version===m&&b.sub===p)return;const v=p.depsTail=d.subsTail={version:m,dep:d,sub:p,prevDep:x,nextDep:y,prevSub:b,nextSub:void 0};y!==void 0&&(y.prevDep=v),x!==void 0?x.nextDep=v:p.deps=v,b!==void 0?b.nextSub=v:d.subs=v}function r(d,p=d.sub){const m=d.dep,x=d.prevDep,y=d.nextDep,b=d.nextSub,v=d.prevSub;return y!==void 0?y.prevDep=x:p.depsTail=x,x!==void 0?x.nextDep=y:p.deps=y,b!==void 0?b.prevSub=v:m.subsTail=v,v!==void 0?v.nextSub=b:(m.subs=b)===void 0&&n(m),y}function a(d){let p=d.nextSub,m;e:do{const x=d.sub;let y=x.flags;if(y&60?y&12?y&4?!(y&48)&&f(d,x)?(x.flags=y|40,y&=1):y=0:x.flags=y&-9|32:y=0:x.flags=y|32,y&2&&t(x),y&1){const b=x.subs;if(b!==void 0){const v=(d=b).nextSub;v!==void 0&&(m={value:p,prev:m},p=v);continue}}if((d=p)!==void 0){p=d.nextSub;continue}for(;m!==void 0;)if(d=m.value,m=m.prev,d!==void 0){p=d.nextSub;continue e}break}while(!0)}function l(d,p){let m,x=0,y=!1;e:do{const b=d.dep,v=b.flags;if(p.flags&16)y=!0;else if((v&17)===17){if(e(b)){const w=b.subs;w.nextSub!==void 0&&u(w),y=!0}}else if((v&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(m={value:d,prev:m}),d=b.deps,p=b,++x;continue}if(!y){const w=d.nextDep;if(w!==void 0){d=w;continue}}for(;x--;){const w=p.subs,S=w.nextSub!==void 0;if(S?(d=m.value,m=m.prev):d=w,y){if(e(p)){S&&u(w),p=d.sub;continue}y=!1}else p.flags&=-33;p=d.sub;const C=d.nextDep;if(C!==void 0){d=C;continue e}}return y}while(!0)}function u(d){do{const p=d.sub,m=p.flags;(m&48)===32&&(p.flags=m|16,(m&6)===2&&t(p))}while((d=d.nextSub)!==void 0)}function f(d,p){let m=p.depsTail;for(;m!==void 0;){if(m===d)return!0;m=m.prevDep}return!1}}function RH(e,t,n){var a,l,u;const s=typeof e=="object",r=s?e:void 0;return{next:(a=s?e.next:e)==null?void 0:a.bind(r),error:(l=s?e.error:t)==null?void 0:l.bind(r),complete:(u=s?e.complete:n)==null?void 0:u.bind(r)}}const ZS=[];let Wp=0;const{link:QA,unlink:AH,propagate:TH,checkDirty:t$,shallowPropagate:XA}=EH({update(e){return e._update()},notify(e){ZS[JS++]=e,e.flags&=~Nt.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Nt.Mutable|Nt.Dirty,pm(e))}});let tp=0,JS=0,Zs,eN=0;function n$(e){try{++eN,e()}finally{--eN||s$()}}function pm(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=AH(n,e)}function s$(){if(!(eN>0)){for(;tp<JS;){const e=ZS[tp];ZS[tp++]=void 0,e.notify()}tp=0,JS=0}}function ZA(e,t){const n=typeof e=="function",s=e,r={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Nt.None:Nt.Mutable,get(){return Zs!==void 0&&QA(r,Zs,Wp),r._snapshot},subscribe(a){const l=RH(a),u={current:!1},f=IH(()=>{var d;r.get(),u.current?(d=l.next)==null||d.call(l,r._snapshot):u.current=!0});return{unsubscribe:()=>{f.stop()}}},_update(a){const l=Zs,u=(t==null?void 0:t.compare)??Object.is;if(n)Zs=r,++Wp,r.depsTail=void 0;else if(a===void 0)return!1;n&&(r.flags=Nt.Mutable|Nt.RecursedCheck);try{const f=r._snapshot,d=typeof a=="function"?a(f):a===void 0&&n?s(f):a;return f===void 0||!u(f,d)?(r._snapshot=d,!0):!1}finally{Zs=l,n&&(r.flags&=~Nt.RecursedCheck),pm(r)}}};return n?(r.flags=Nt.Mutable|Nt.Dirty,r.get=function(){const a=r.flags;if(a&Nt.Dirty||a&Nt.Pending&&t$(r.deps,r)){if(r._update()){const l=r.subs;l!==void 0&&XA(l)}}else a&Nt.Pending&&(r.flags=a&~Nt.Pending);return Zs!==void 0&&QA(r,Zs,Wp),r._snapshot}):r.set=function(a){if(r._update(a)){const l=r.subs;l!==void 0&&(TH(l),XA(l),s$())}},r}function IH(e){const t=()=>{const s=Zs;Zs=n,++Wp,n.depsTail=void 0,n.flags=Nt.Watching|Nt.RecursedCheck;try{return e()}finally{Zs=s,n.flags&=~Nt.RecursedCheck,pm(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Nt.Watching|Nt.RecursedCheck,notify(){const s=this.flags;s&Nt.Dirty||s&Nt.Pending&&t$(this.deps,this)?t():this.flags=Nt.Watching},stop(){this.flags=Nt.None,this.depsTail=void 0,pm(this)}};return t(),n}var Ly={exports:{}},Py={},$y={exports:{}},Dy={};/**
|
|
50
|
-
* @license React
|
|
51
|
-
* use-sync-external-store-shim.production.js
|
|
52
|
-
*
|
|
53
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the MIT license found in the
|
|
56
|
-
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var JA;function MH(){if(JA)return Dy;JA=1;var e=Jd();function t(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(m,x){var y=x(),b=s({inst:{value:y,getSnapshot:x}}),v=b[0].inst,w=b[1];return a(function(){v.value=y,v.getSnapshot=x,f(v)&&w({inst:v})},[m,y,x]),r(function(){return f(v)&&w({inst:v}),m(function(){f(v)&&w({inst:v})})},[m]),l(y),y}function f(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function d(m,x){return x()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return Dy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Dy}var eT;function OH(){return eT||(eT=1,$y.exports=MH()),$y.exports}/**
|
|
58
|
-
* @license React
|
|
59
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
60
|
-
*
|
|
61
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the MIT license found in the
|
|
64
|
-
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var tT;function LH(){if(tT)return Py;tT=1;var e=Jd(),t=OH();function n(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Py.useSyncExternalStoreWithSelector=function(d,p,m,x,y){var b=a(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=u(function(){function S(T){if(!C){if(C=!0,k=T,T=x(T),y!==void 0&&v.hasValue){var A=v.value;if(y(A,T))return _=A}return _=T}if(A=_,s(k,T))return A;var I=x(T);return y!==void 0&&y(A,I)?(k=T,A):(k=T,_=I)}var C=!1,k,_,R=m===void 0?null:m;return[function(){return S(p())},R===null?void 0:function(){return S(R())}]},[p,m,x,y]);var w=r(d,b[0],b[1]);return l(function(){v.hasValue=!0,v.value=w},[w]),f(w),w},Py}var nT;function PH(){return nT||(nT=1,Ly.exports=LH()),Ly.exports}var r$=PH();const $H=Bm(r$);function DH(e,t){return e===t}function Gn(e,t,n=DH){const s=E.useCallback(l=>{if(!e)return()=>{};const{unsubscribe:u}=e.subscribe(l);return u},[e]),r=E.useCallback(()=>e==null?void 0:e.get(),[e]);return r$.useSyncExternalStoreWithSelector(s,r,r,t,n)}var qH={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function Co(e){const t=Wn(),n=E.useContext(e.from?CH:Um),s=e.from??n,r=s?e.from?t.stores.getRouteMatchStore(s):t.stores.matchStores.get(s):void 0,a=E.useRef(void 0);return Gn(r??qH,l=>{if((e.shouldThrow??!0)&&!l&&Wr(),l===void 0)return;const u=e.select?e.select(l):l;if(e.structuralSharing??t.options.defaultStructuralSharing){const f=na(a.current,u);return a.current=f,f}return u})}function i$(e){return Co({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function a$(e){const{select:t,...n}=e;return Co({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function kn(e){return Co({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function o$(e){return Co({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function zt(e){const t=Wn();return E.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Eo(e){const t=Wn(),n=zt(),s=E.useRef(null);return Bl(()=>{s.current!==e&&(n(e),s.current=e)},[t,e,n]),null}function l$(e){return Co({...e,select:t=>e.select?e.select(t.context):t.context})}var Vm=$P();const zH=Bm(Vm);function BH(e,t){const n=Wn(),s=S7(t),{activeProps:r,inactiveProps:a,activeOptions:l,to:u,preload:f,preloadDelay:d,preloadIntentProximity:p,hashScrollIntoView:m,replace:x,startTransition:y,resetScroll:b,viewTransition:v,children:w,target:S,disabled:C,style:k,className:_,onClick:R,onBlur:T,onFocus:A,onMouseEnter:I,onMouseLeave:L,onTouchStart:$,ignoreBlocker:O,params:B,search:H,hash:P,state:G,mask:q,reloadDocument:V,unsafeRelative:K,from:Y,_fromLocation:J,...D}=e,F=JP(),te=E.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),U=Gn(n.stores.location,Ke=>Ke,(Ke,pt)=>Ke.href===pt.href),Q=E.useMemo(()=>{const Ke={_fromLocation:U,...te};return n.buildLocation(Ke)},[n,U,te]),X=Q.maskedLocation?Q.maskedLocation.publicHref:Q.publicHref,se=Q.maskedLocation?Q.maskedLocation.external:Q.external,re=E.useMemo(()=>KH(X,se,n.history,C),[C,se,X,n.history]),ce=E.useMemo(()=>{if(re!=null&&re.external)return um(re.href,n.protocolAllowlist)?void 0:re.href;if(!WH(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),um(u,n.protocolAllowlist)?void 0:u}catch{}},[u,re,n.protocolAllowlist]),me=E.useMemo(()=>{if(ce)return!1;if(l!=null&&l.exact){if(!z7(U.pathname,Q.pathname,n.basepath))return!1}else{const Ke=dm(U.pathname,n.basepath),pt=dm(Q.pathname,n.basepath);if(!(Ke.startsWith(pt)&&(Ke.length===pt.length||Ke[pt.length]==="/")))return!1}return((l==null?void 0:l.includeSearch)??!0)&&!ho(U.search,Q.search,{partial:!(l!=null&&l.exact),ignoreUndefined:!(l!=null&&l.explicitUndefined)})?!1:l!=null&&l.includeHash?F&&U.hash===Q.hash:!0},[l==null?void 0:l.exact,l==null?void 0:l.explicitUndefined,l==null?void 0:l.includeHash,l==null?void 0:l.includeSearch,U,ce,F,Q.hash,Q.pathname,Q.search,n.basepath]),ge=me?ta(r,{})??FH:qy,ve=me?qy:ta(a,{})??qy,xe=[_,ge.className,ve.className].filter(Boolean).join(" "),je=(k||ge.style||ve.style)&&{...k,...ge.style,...ve.style},[Se,$e]=E.useState(!1),Re=E.useRef(!1),xt=e.reloadDocument||ce?!1:f??n.options.defaultPreload,wt=d??n.options.defaultPreloadDelay??0,Ot=E.useCallback(()=>{n.preloadRoute({...te,_builtLocation:Q}).catch(Ke=>{console.warn(Ke),console.warn(wH)})},[n,te,Q]);j7(s,E.useCallback(Ke=>{Ke!=null&&Ke.isIntersecting&&Ot()},[Ot]),GH,{disabled:!!C||xt!=="viewport"}),E.useEffect(()=>{Re.current||!C&&xt==="render"&&(Ot(),Re.current=!0)},[C,Ot,xt]);const fn=Ke=>{const pt=Ke.currentTarget.getAttribute("target"),Qt=S!==void 0?S:pt;if(!C&&!YH(Ke)&&!Ke.defaultPrevented&&(!Qt||Qt==="_self")&&Ke.button===0){Ke.preventDefault(),Vm.flushSync(()=>{$e(!0)});const hn=n.subscribe("onResolved",()=>{hn(),$e(!1)});n.navigate({...te,replace:x,resetScroll:b,hashScrollIntoView:m,startTransition:y,viewTransition:v,ignoreBlocker:O})}};if(ce)return{...D,ref:s,href:ce,...w&&{children:w},...S&&{target:S},...C&&{disabled:C},...k&&{style:k},..._&&{className:_},...R&&{onClick:R},...T&&{onBlur:T},...A&&{onFocus:A},...I&&{onMouseEnter:I},...L&&{onMouseLeave:L},...$&&{onTouchStart:$}};const Yt=Ke=>{if(C||xt!=="intent")return;if(!wt){Ot();return}const pt=Ke.currentTarget;if(qu.has(pt))return;const Qt=setTimeout(()=>{qu.delete(pt),Ot()},wt);qu.set(pt,Qt)},jt=Ke=>{C||xt!=="intent"||Ot()},yt=Ke=>{if(C||!xt||!wt)return;const pt=Ke.currentTarget,Qt=qu.get(pt);Qt&&(clearTimeout(Qt),qu.delete(pt))};return{...D,...ge,...ve,href:re==null?void 0:re.href,ref:s,onClick:kl([R,fn]),onBlur:kl([T,yt]),onFocus:kl([A,Yt]),onMouseEnter:kl([I,Yt]),onMouseLeave:kl([L,yt]),onTouchStart:kl([$,jt]),disabled:!!C,target:S,...je&&{style:je},...xe&&{className:xe},...C&&HH,...me&&UH,...F&&Se&&VH}}var qy={},FH={className:"active"},HH={role:"link","aria-disabled":!0},UH={"data-status":"active","aria-current":"page"},VH={"data-transitioning":"transitioning"},qu=new WeakMap,GH={rootMargin:"100px"},kl=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function KH(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function WH(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ue=E.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:r,...a}=BH(s,t),l=typeof s.children=="function"?s.children({isActive:a["data-status"]==="active"}):s.children;if(!n){const{disabled:u,...f}=a;return E.createElement("a",f,l)}return E.createElement(n,a,l)});function YH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var QH=class extends ZP{constructor(t){super(t),this.useMatch=n=>Co({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>l$({...n,from:this.id}),this.useSearch=n=>o$({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>kn({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>a$({...n,from:this.id}),this.useLoaderData=n=>i$({...n,from:this.id}),this.useNavigate=()=>zt({from:this.fullPath}),this.Link=vo.forwardRef((n,s)=>i.jsx(Ue,{ref:s,from:this.fullPath,...n}))}};function Me(e){return new QH(e)}var XH=class extends jH{constructor(e){super(e),this.useMatch=t=>Co({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>l$({...t,from:this.id}),this.useSearch=t=>o$({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>kn({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>a$({...t,from:this.id}),this.useLoaderData=t=>i$({...t,from:this.id}),this.useNavigate=()=>zt({from:this.fullPath}),this.Link=vo.forwardRef((t,n)=>i.jsx(Ue,{ref:n,from:this.fullPath,...t}))}};function ZH(e){return new XH(e)}function JH(e){const t=Wn(),n=`not-found-${Gn(t.stores.location,s=>s.pathname)}-${Gn(t.stores.status,s=>s)}`;return i.jsx(h2,{getResetKey:()=>n,onCatch:(s,r)=>{var a;if(jn(s))(a=e.onCatch)==null||a.call(e,s,r);else throw s},errorComponent:({error:s})=>{var r;if(jn(s))return(r=e.fallback)==null?void 0:r.call(e,s);throw s},children:e.children})}function eU(){return i.jsx("p",{children:"Not Found"})}function $l(e){return i.jsx(i.Fragment,{children:e.children})}function c$(e,t,n){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...n}):i.jsx(eU,{})}function tU(e){return null}function nU(){return tU(Wn()),null}var u$=E.memo(function({matchId:t}){const n=Wn(),s=n.stores.matchStores.get(t);s||Wr();const r=Gn(n.stores.loadedAt,l=>l),a=Gn(s,l=>l);return i.jsx(sU,{router:n,matchId:t,resetKey:r,matchState:E.useMemo(()=>{var f;const l=a.routeId,u=(f=n.routesById[l].parentRoute)==null?void 0:f.id;return{routeId:l,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:u}},[a._displayPending,a.routeId,a.ssr,n.routesById])})});function sU({router:e,matchId:t,resetKey:n,matchState:s}){var b,v;const r=e.routesById[s.routeId],a=r.options.pendingComponent??e.options.defaultPendingComponent,l=a?i.jsx(a,{}):null,u=r.options.errorComponent??e.options.defaultErrorComponent,f=r.options.onCatch??e.options.defaultOnCatch,d=r.isRoot?r.options.notFoundComponent??((b=e.options.notFoundRoute)==null?void 0:b.options.component):r.options.notFoundComponent,p=s.ssr===!1||s.ssr==="data-only",m=(!r.isRoot||r.options.wrapInSuspense||p)&&(r.options.wrapInSuspense??a??(((v=r.options.errorComponent)==null?void 0:v.preload)||p))?E.Suspense:$l,x=u?h2:$l,y=d?JH:$l;return i.jsxs(r.isRoot?r.options.shellComponent??$l:$l,{children:[i.jsx(Um.Provider,{value:t,children:i.jsx(m,{fallback:l,children:i.jsx(x,{getResetKey:()=>n,errorComponent:u||p2,onCatch:(w,S)=>{if(jn(w))throw w.routeId??(w.routeId=s.routeId),w;f==null||f(w,S)},children:i.jsx(y,{fallback:w=>{if(w.routeId??(w.routeId=s.routeId),!d||w.routeId&&w.routeId!==s.routeId||!w.routeId&&!r.isRoot)throw w;return E.createElement(d,w)},children:p||s._displayPending?i.jsx(kH,{fallback:l,children:i.jsx(sT,{matchId:t})}):i.jsx(sT,{matchId:t})})})})}),s.parentRouteId===po?i.jsxs(i.Fragment,{children:[i.jsx(rU,{resetKey:n}),e.options.scrollRestoration&&DP?i.jsx(nU,{}):null]}):null]})}function rU({resetKey:e}){const t=Wn(),n=E.useRef(void 0);return Bl(()=>{const s=t.latestLocation.href;(n.current===void 0||n.current!==s)&&(t.emit({type:"onRendered",...Wl(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=s)},[t.latestLocation.state.__TSR_key,e,t]),null}var sT=E.memo(function({matchId:t}){const n=Wn(),s=(p,m)=>{var x;return((x=n.getMatch(p.id))==null?void 0:x._nonReactive[m])??p._nonReactive[m]},r=n.stores.matchStores.get(t);r||Wr();const a=Gn(r,p=>p),l=a.routeId,u=n.routesById[l],f=E.useMemo(()=>{var m;const p=(m=n.routesById[l].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:m({routeId:l,loaderDeps:a.loaderDeps,params:a._strictParams,search:a._strictSearch});return p?JSON.stringify(p):void 0},[l,a.loaderDeps,a._strictParams,a._strictSearch,n.options.defaultRemountDeps,n.routesById]),d=E.useMemo(()=>{const p=u.options.component??n.options.defaultComponent;return p?i.jsx(p,{},f):i.jsx(d$,{})},[f,u.options.component,n.options.defaultComponent]);if(a._displayPending)throw s(a,"displayPendingPromise");if(a._forcePending)throw s(a,"minPendingPromise");if(a.status==="pending"){const p=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(p){const m=n.getMatch(a.id);if(m&&!m._nonReactive.minPendingPromise){const x=yc();m._nonReactive.minPendingPromise=x,setTimeout(()=>{x.resolve(),m._nonReactive.minPendingPromise=void 0},p)}}throw s(a,"loadPromise")}if(a.status==="notFound")return jn(a.error)||Wr(),c$(n,u,a.error);if(a.status==="redirected")throw Fn(a.error)||Wr(),s(a,"loadPromise");if(a.status==="error")throw a.error;return d}),d$=E.memo(function(){const t=Wn(),n=E.useContext(Um);let s,r=!1,a;{const d=n?t.stores.matchStores.get(n):void 0;[s,r]=Gn(d,p=>[p==null?void 0:p.routeId,(p==null?void 0:p.globalNotFound)??!1]),a=Gn(t.stores.matchesId,p=>p[p.findIndex(m=>m===n)+1])}const l=s?t.routesById[s]:void 0,u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(r)return l||Wr(),c$(t,l,void 0);if(!a)return null;const f=i.jsx(u$,{matchId:a});return s===po?i.jsx(E.Suspense,{fallback:u,children:f}):f});function iU(){const e=Wn(),t=E.useRef({router:e,mounted:!1}),[n,s]=E.useState(!1),r=Gn(e.stores.isLoading,m=>m),a=Gn(e.stores.hasPending,m=>m),l=Ey(r),u=r||n||a,f=Ey(u),d=r||a,p=Ey(d);return e.startTransition=m=>{s(!0),E.startTransition(()=>{m(),s(!1)})},E.useEffect(()=>{const m=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Vr(e.latestLocation.publicHref)!==Vr(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{m()}},[e,e.history]),Bl(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(x){console.error(x)}})()},[e]),Bl(()=>{l&&!r&&e.emit({type:"onLoad",...Wl(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,e,r]),Bl(()=>{p&&!d&&e.emit({type:"onBeforeRouteMount",...Wl(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,p,e]),Bl(()=>{if(f&&!u){const m=Wl(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...m}),n$(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())}),m.hrefChanged&&SH(e)}},[u,f,e]),null}function aU(){const e=Wn(),t=e.routesById[po].options.pendingComponent??e.options.defaultPendingComponent,n=t?i.jsx(t,{}):null,s=i.jsxs(typeof document<"u"&&e.ssr?$l:E.Suspense,{fallback:n,children:[i.jsx(iU,{}),i.jsx(oU,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:s}):s}function oU(){const e=Wn(),t=Gn(e.stores.firstId,r=>r),n=Gn(e.stores.loadedAt,r=>r),s=t?i.jsx(u$,{matchId:t}):null;return i.jsx(Um.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:i.jsx(h2,{getResetKey:()=>n,errorComponent:p2,onCatch:void 0,children:s})})}var lU=e=>({createMutableStore:ZA,createReadonlyStore:ZA,batch:n$}),cU=e=>new uU(e),uU=class extends pH{constructor(e){super(e,lU)}};function dU({router:e,children:t,...n}){zP(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=i.jsx(e$.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:s}):s}function fU({router:e,...t}){return i.jsx(dU,{router:e,...t,children:i.jsx(aU,{})})}function ya(e){const t=Wn({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,s=E.useRef(void 0);return Gn(n.stores.__store,r=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const a=na(s.current,e.select(r));return s.current=a,a}return e.select(r)}return r})}var Ro=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},no,Vi,nc,kP,hU=(kP=class extends Ro{constructor(){super();be(this,no);be(this,Vi);be(this,nc);pe(this,nc,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){W(this,Vi)||this.setEventListener(W(this,nc))}onUnsubscribe(){var t;this.hasListeners()||((t=W(this,Vi))==null||t.call(this),pe(this,Vi,void 0))}setEventListener(t){var n;pe(this,nc,t),(n=W(this,Vi))==null||n.call(this),pe(this,Vi,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){W(this,no)!==t&&(pe(this,no,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof W(this,no)=="boolean"?W(this,no):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},no=new WeakMap,Vi=new WeakMap,nc=new WeakMap,kP),m2=new hU,pU={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Gi,l2,_P,mU=(_P=class{constructor(){be(this,Gi,pU);be(this,l2,!1)}setTimeoutProvider(e){pe(this,Gi,e)}setTimeout(e,t){return W(this,Gi).setTimeout(e,t)}clearTimeout(e){W(this,Gi).clearTimeout(e)}setInterval(e,t){return W(this,Gi).setInterval(e,t)}clearInterval(e){W(this,Gi).clearInterval(e)}},Gi=new WeakMap,l2=new WeakMap,_P),Ya=new mU;function gU(e){setTimeout(e,0)}var xU=typeof window>"u"||"Deno"in globalThis;function bn(){}function yU(e,t){return typeof e=="function"?e(t):e}function tN(e){return typeof e=="number"&&e>=0&&e!==1/0}function f$(e,t){return Math.max(e+(t||0)-Date.now(),0)}function oa(e,t){return typeof e=="function"?e(t):e}function is(e,t){return typeof e=="function"?e(t):e}function rT(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:a,queryKey:l,stale:u}=e;if(l){if(s){if(t.queryHash!==g2(l,t.options))return!1}else if(!jd(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||r&&r!==t.state.fetchStatus||a&&!a(t))}function iT(e,t){const{exact:n,status:s,predicate:r,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(bo(t.options.mutationKey)!==bo(a))return!1}else if(!jd(t.options.mutationKey,a))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function g2(e,t){return((t==null?void 0:t.queryKeyHashFn)||bo)(e)}function bo(e){return JSON.stringify(e,(t,n)=>nN(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function jd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>jd(e[n],t[n])):!1}var vU=Object.prototype.hasOwnProperty;function x2(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=aT(e)&&aT(t);if(!s&&!(nN(e)&&nN(t)))return t;const a=(s?e:Object.keys(e)).length,l=s?t:Object.keys(t),u=l.length,f=s?new Array(u):{};let d=0;for(let p=0;p<u;p++){const m=s?p:l[p],x=e[m],y=t[m];if(x===y){f[m]=x,(s?p<a:vU.call(e,m))&&d++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){f[m]=y;continue}const b=x2(x,y,n+1);f[m]=b,b===x&&d++}return a===u&&d===a?e:f}function Sd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function aT(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nN(e){if(!oT(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!oT(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function oT(e){return Object.prototype.toString.call(e)==="[object Object]"}function bU(e){return new Promise(t=>{Ya.setTimeout(t,e)})}function sN(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?x2(e,t):t}function wU(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function jU(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var y2=Symbol();function h$(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===y2?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function v2(e,t){return typeof e=="function"?e(...t):!!e}function SU(e,t,n){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}var Nd=(()=>{let e=()=>xU;return{isServer(){return e()},setIsServer(t){e=t}}})();function rN(){let e,t;const n=new Promise((r,a)=>{e=r,t=a});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var NU=gU;function kU(){let e=[],t=0,n=u=>{u()},s=u=>{u()},r=NU;const a=u=>{t?e.push(u):r(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&r(()=>{s(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;t++;try{f=u()}finally{t--,t||l()}return f},batchCalls:u=>(...f)=>{a(()=>{u(...f)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{s=u},setScheduler:u=>{r=u}}}var It=kU(),sc,Ki,rc,CP,_U=(CP=class extends Ro{constructor(){super();be(this,sc,!0);be(this,Ki);be(this,rc);pe(this,rc,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){W(this,Ki)||this.setEventListener(W(this,rc))}onUnsubscribe(){var t;this.hasListeners()||((t=W(this,Ki))==null||t.call(this),pe(this,Ki,void 0))}setEventListener(t){var n;pe(this,rc,t),(n=W(this,Ki))==null||n.call(this),pe(this,Ki,t(this.setOnline.bind(this)))}setOnline(t){W(this,sc)!==t&&(pe(this,sc,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return W(this,sc)}},sc=new WeakMap,Ki=new WeakMap,rc=new WeakMap,CP),mm=new _U;function CU(e){return Math.min(1e3*2**e,3e4)}function p$(e){return(e??"online")==="online"?mm.isOnline():!0}var iN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function m$(e){let t=!1,n=0,s;const r=rN(),a=()=>r.status!=="pending",l=v=>{var w;if(!a()){const S=new iN(v);x(S),(w=e.onCancel)==null||w.call(e,S)}},u=()=>{t=!0},f=()=>{t=!1},d=()=>m2.isFocused()&&(e.networkMode==="always"||mm.isOnline())&&e.canRun(),p=()=>p$(e.networkMode)&&e.canRun(),m=v=>{a()||(s==null||s(),r.resolve(v))},x=v=>{a()||(s==null||s(),r.reject(v))},y=()=>new Promise(v=>{var w;s=S=>{(a()||d())&&v(S)},(w=e.onPause)==null||w.call(e)}).then(()=>{var v;s=void 0,a()||(v=e.onContinue)==null||v.call(e)}),b=()=>{if(a())return;let v;const w=n===0?e.initialPromise:void 0;try{v=w??e.fn()}catch(S){v=Promise.reject(S)}Promise.resolve(v).then(m).catch(S=>{var T;if(a())return;const C=e.retry??(Nd.isServer()?0:3),k=e.retryDelay??CU,_=typeof k=="function"?k(n,S):k,R=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,S);if(t||!R){x(S);return}n++,(T=e.onFail)==null||T.call(e,n,S),bU(_).then(()=>d()?void 0:y()).then(()=>{t?x(S):b()})})};return{promise:r,status:()=>r.status,cancel:l,continue:()=>(s==null||s(),r),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?b():y().then(b),r)}}var so,EP,g$=(EP=class{constructor(){be(this,so)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tN(this.gcTime)&&pe(this,so,Ya.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Nd.isServer()?1/0:300*1e3))}clearGcTimeout(){W(this,so)!==void 0&&(Ya.clearTimeout(W(this,so)),pe(this,so,void 0))}},so=new WeakMap,EP);function EU(e){return{onFetch:(t,n)=>{var p,m,x,y,b;const s=t.options,r=(x=(m=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:m.fetchMore)==null?void 0:x.direction,a=((y=t.state.data)==null?void 0:y.pages)||[],l=((b=t.state.data)==null?void 0:b.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const d=async()=>{let v=!1;const w=k=>{SU(k,()=>t.signal,()=>v=!0)},S=h$(t.options,t.fetchOptions),C=async(k,_,R)=>{if(v)return Promise.reject(t.signal.reason);if(_==null&&k.pages.length)return Promise.resolve(k);const A=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:_,direction:R?"backward":"forward",meta:t.options.meta};return w(O),O})(),I=await S(A),{maxPages:L}=t.options,$=R?jU:wU;return{pages:$(k.pages,I,L),pageParams:$(k.pageParams,_,L)}};if(r&&a.length){const k=r==="backward",_=k?RU:lT,R={pages:a,pageParams:l},T=_(s,R);u=await C(R,T,k)}else{const k=e??a.length;do{const _=f===0?l[0]??s.initialPageParam:lT(s,u);if(f>0&&_==null)break;u=await C(u,_),f++}while(f<k)}return u};t.options.persister?t.fetchFn=()=>{var v,w;return(w=(v=t.options).persister)==null?void 0:w.call(v,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function lT(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function RU(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var ic,ro,ac,ys,io,nn,Ud,ao,rs,x$,qr,RP,AU=(RP=class extends g${constructor(t){super();be(this,rs);be(this,ic);be(this,ro);be(this,ac);be(this,ys);be(this,io);be(this,nn);be(this,Ud);be(this,ao);pe(this,ao,!1),pe(this,Ud,t.defaultOptions),this.setOptions(t.options),this.observers=[],pe(this,io,t.client),pe(this,ys,W(this,io).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,pe(this,ro,uT(this.options)),this.state=t.state??W(this,ro),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return W(this,ic)}get promise(){var t;return(t=W(this,nn))==null?void 0:t.promise}setOptions(t){if(this.options={...W(this,Ud),...t},t!=null&&t._type&&pe(this,ic,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=uT(this.options);n.data!==void 0&&(this.setState(cT(n.data,n.dataUpdatedAt)),pe(this,ro,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&W(this,ys).remove(this)}setData(t,n){const s=sN(this.state.data,t,this.options);return Ae(this,rs,qr).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t){Ae(this,rs,qr).call(this,{type:"setState",state:t})}cancel(t){var s,r;const n=(s=W(this,nn))==null?void 0:s.promise;return(r=W(this,nn))==null||r.cancel(t),n?n.then(bn).catch(bn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return W(this,ro)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>is(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===y2||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>oa(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!f$(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=W(this,nn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=W(this,nn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),W(this,ys).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(W(this,nn)&&(W(this,ao)||Ae(this,rs,x$).call(this)?W(this,nn).cancel({revert:!0}):W(this,nn).cancelRetry()),this.scheduleGc()),W(this,ys).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,rs,qr).call(this,{type:"invalidate"})}async fetch(t,n){var d,p,m,x,y,b,v,w,S,C,k;if(this.state.fetchStatus!=="idle"&&((d=W(this,nn))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(W(this,nn))return W(this,nn).continueRetry(),W(this,nn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(R=>R.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,r=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(pe(this,ao,!0),s.signal)})},a=()=>{const _=h$(this.options,n),T=(()=>{const A={client:W(this,io),queryKey:this.queryKey,meta:this.meta};return r(A),A})();return pe(this,ao,!1),this.options.persister?this.options.persister(_,T,this):_(T)},u=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:W(this,io),state:this.state,fetchFn:a};return r(_),_})(),f=W(this,ic)==="infinite"?EU(this.options.pages):this.options.behavior;f==null||f.onFetch(u,this),pe(this,ac,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&Ae(this,rs,qr).call(this,{type:"fetch",meta:(m=u.fetchOptions)==null?void 0:m.meta}),pe(this,nn,m$({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:_=>{_ instanceof iN&&_.revert&&this.setState({...W(this,ac),fetchStatus:"idle"}),s.abort()},onFail:(_,R)=>{Ae(this,rs,qr).call(this,{type:"failed",failureCount:_,error:R})},onPause:()=>{Ae(this,rs,qr).call(this,{type:"pause"})},onContinue:()=>{Ae(this,rs,qr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const _=await W(this,nn).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(y=(x=W(this,ys).config).onSuccess)==null||y.call(x,_,this),(v=(b=W(this,ys).config).onSettled)==null||v.call(b,_,this.state.error,this),_}catch(_){if(_ instanceof iN){if(_.silent)return W(this,nn).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw Ae(this,rs,qr).call(this,{type:"error",error:_}),(S=(w=W(this,ys).config).onError)==null||S.call(w,_,this),(k=(C=W(this,ys).config).onSettled)==null||k.call(C,this.state.data,_,this),_}finally{this.scheduleGc()}}},ic=new WeakMap,ro=new WeakMap,ac=new WeakMap,ys=new WeakMap,io=new WeakMap,nn=new WeakMap,Ud=new WeakMap,ao=new WeakMap,rs=new WeakSet,x$=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},qr=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...y$(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...cT(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pe(this,ac,t.manual?r:void 0),r;case"error":const a=t.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),It.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),W(this,ys).notify({query:this,type:"updated",action:t})})},RP);function y$(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:p$(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cT(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function uT(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qn,Je,Vd,En,oo,oc,Br,Wi,Gd,lc,cc,lo,co,Yi,uc,ot,td,aN,oN,lN,cN,uN,dN,fN,v$,AP,b2=(AP=class extends Ro{constructor(t,n){super();be(this,ot);be(this,qn);be(this,Je);be(this,Vd);be(this,En);be(this,oo);be(this,oc);be(this,Br);be(this,Wi);be(this,Gd);be(this,lc);be(this,cc);be(this,lo);be(this,co);be(this,Yi);be(this,uc,new Set);this.options=n,pe(this,qn,t),pe(this,Wi,null),pe(this,Br,rN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(W(this,Je).addObserver(this),dT(W(this,Je),this.options)?Ae(this,ot,td).call(this):this.updateResult(),Ae(this,ot,cN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hN(W(this,Je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hN(W(this,Je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,ot,uN).call(this),Ae(this,ot,dN).call(this),W(this,Je).removeObserver(this)}setOptions(t){const n=this.options,s=W(this,Je);if(this.options=W(this,qn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof is(this.options.enabled,W(this,Je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,ot,fN).call(this),W(this,Je).setOptions(this.options),n._defaulted&&!Sd(this.options,n)&&W(this,qn).getQueryCache().notify({type:"observerOptionsUpdated",query:W(this,Je),observer:this});const r=this.hasListeners();r&&fT(W(this,Je),s,this.options,n)&&Ae(this,ot,td).call(this),this.updateResult(),r&&(W(this,Je)!==s||is(this.options.enabled,W(this,Je))!==is(n.enabled,W(this,Je))||oa(this.options.staleTime,W(this,Je))!==oa(n.staleTime,W(this,Je)))&&Ae(this,ot,aN).call(this);const a=Ae(this,ot,oN).call(this);r&&(W(this,Je)!==s||is(this.options.enabled,W(this,Je))!==is(n.enabled,W(this,Je))||a!==W(this,Yi))&&Ae(this,ot,lN).call(this,a)}getOptimisticResult(t){const n=W(this,qn).getQueryCache().build(W(this,qn),t),s=this.createResult(n,t);return IU(this,s)&&(pe(this,En,s),pe(this,oc,this.options),pe(this,oo,W(this,Je).state)),s}getCurrentResult(){return W(this,En)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&W(this,Br).status==="pending"&&W(this,Br).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){W(this,uc).add(t)}getCurrentQuery(){return W(this,Je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=W(this,qn).defaultQueryOptions(t),s=W(this,qn).getQueryCache().build(W(this,qn),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return Ae(this,ot,td).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),W(this,En)))}createResult(t,n){var L;const s=W(this,Je),r=this.options,a=W(this,En),l=W(this,oo),u=W(this,oc),d=t!==s?t.state:W(this,Vd),{state:p}=t;let m={...p},x=!1,y;if(n._optimisticResults){const $=this.hasListeners(),O=!$&&dT(t,n),B=$&&fT(t,s,n,r);(O||B)&&(m={...m,...y$(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:w}=m;y=m.data;let S=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let $;a!=null&&a.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?($=a.data,S=!0):$=typeof n.placeholderData=="function"?n.placeholderData((L=W(this,cc))==null?void 0:L.state.data,W(this,cc)):n.placeholderData,$!==void 0&&(w="success",y=sN(a==null?void 0:a.data,$,n),x=!0)}if(n.select&&y!==void 0&&!S)if(a&&y===(l==null?void 0:l.data)&&n.select===W(this,Gd))y=W(this,lc);else try{pe(this,Gd,n.select),y=n.select(y),y=sN(a==null?void 0:a.data,y,n),pe(this,lc,y),pe(this,Wi,null)}catch($){pe(this,Wi,$)}W(this,Wi)&&(b=W(this,Wi),y=W(this,lc),v=Date.now(),w="error");const C=m.fetchStatus==="fetching",k=w==="pending",_=w==="error",R=k&&C,T=y!==void 0,I={status:w,fetchStatus:m.fetchStatus,isPending:k,isSuccess:w==="success",isError:_,isInitialLoading:R,isLoading:R,data:y,dataUpdatedAt:m.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:_&&!T,isPaused:m.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:_&&T,isStale:w2(t,n),refetch:this.refetch,promise:W(this,Br),isEnabled:is(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=I.data!==void 0,O=I.status==="error"&&!$,B=G=>{O?G.reject(I.error):$&&G.resolve(I.data)},H=()=>{const G=pe(this,Br,I.promise=rN());B(G)},P=W(this,Br);switch(P.status){case"pending":t.queryHash===s.queryHash&&B(P);break;case"fulfilled":(O||I.data!==P.value)&&H();break;case"rejected":(!O||I.error!==P.reason)&&H();break}}return I}updateResult(){const t=W(this,En),n=this.createResult(W(this,Je),this.options);if(pe(this,oo,W(this,Je).state),pe(this,oc,this.options),W(this,oo).data!==void 0&&pe(this,cc,W(this,Je)),Sd(n,t))return;pe(this,En,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!W(this,uc).size)return!0;const l=new Set(a??W(this,uc));return this.options.throwOnError&&l.add("error"),Object.keys(W(this,En)).some(u=>{const f=u;return W(this,En)[f]!==t[f]&&l.has(f)})};Ae(this,ot,v$).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,ot,cN).call(this)}},qn=new WeakMap,Je=new WeakMap,Vd=new WeakMap,En=new WeakMap,oo=new WeakMap,oc=new WeakMap,Br=new WeakMap,Wi=new WeakMap,Gd=new WeakMap,lc=new WeakMap,cc=new WeakMap,lo=new WeakMap,co=new WeakMap,Yi=new WeakMap,uc=new WeakMap,ot=new WeakSet,td=function(t){Ae(this,ot,fN).call(this);let n=W(this,Je).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(bn)),n},aN=function(){Ae(this,ot,uN).call(this);const t=oa(this.options.staleTime,W(this,Je));if(Nd.isServer()||W(this,En).isStale||!tN(t))return;const s=f$(W(this,En).dataUpdatedAt,t)+1;pe(this,lo,Ya.setTimeout(()=>{W(this,En).isStale||this.updateResult()},s))},oN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(W(this,Je)):this.options.refetchInterval)??!1},lN=function(t){Ae(this,ot,dN).call(this),pe(this,Yi,t),!(Nd.isServer()||is(this.options.enabled,W(this,Je))===!1||!tN(W(this,Yi))||W(this,Yi)===0)&&pe(this,co,Ya.setInterval(()=>{(this.options.refetchIntervalInBackground||m2.isFocused())&&Ae(this,ot,td).call(this)},W(this,Yi)))},cN=function(){Ae(this,ot,aN).call(this),Ae(this,ot,lN).call(this,Ae(this,ot,oN).call(this))},uN=function(){W(this,lo)!==void 0&&(Ya.clearTimeout(W(this,lo)),pe(this,lo,void 0))},dN=function(){W(this,co)!==void 0&&(Ya.clearInterval(W(this,co)),pe(this,co,void 0))},fN=function(){const t=W(this,qn).getQueryCache().build(W(this,qn),this.options);if(t===W(this,Je))return;const n=W(this,Je);pe(this,Je,t),pe(this,Vd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},v$=function(t){It.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(W(this,En))}),W(this,qn).getQueryCache().notify({query:W(this,Je),type:"observerResultsUpdated"})})},AP);function TU(e,t){return is(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&is(t.retryOnMount,e)===!1)}function dT(e,t){return TU(e,t)||e.state.data!==void 0&&hN(e,t,t.refetchOnMount)}function hN(e,t,n){if(is(t.enabled,e)!==!1&&oa(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&w2(e,t)}return!1}function fT(e,t,n,s){return(e!==t||is(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&w2(e,n)}function w2(e,t){return is(t.enabled,e)!==!1&&e.isStaleByTime(oa(t.staleTime,e))}function IU(e,t){return!Sd(e.getCurrentResult(),t)}var Kd,Js,yn,uo,er,zi,TP,MU=(TP=class extends g${constructor(t){super();be(this,er);be(this,Kd);be(this,Js);be(this,yn);be(this,uo);pe(this,Kd,t.client),this.mutationId=t.mutationId,pe(this,yn,t.mutationCache),pe(this,Js,[]),this.state=t.state||b$(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){W(this,Js).includes(t)||(W(this,Js).push(t),this.clearGcTimeout(),W(this,yn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){pe(this,Js,W(this,Js).filter(n=>n!==t)),this.scheduleGc(),W(this,yn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){W(this,Js).length||(this.state.status==="pending"?this.scheduleGc():W(this,yn).remove(this))}continue(){var t;return((t=W(this,uo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,u,f,d,p,m,x,y,b,v,w,S,C,k,_,R,T,A;const n=()=>{Ae(this,er,zi).call(this,{type:"continue"})},s={client:W(this,Kd),meta:this.options.meta,mutationKey:this.options.mutationKey};pe(this,uo,m$({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(I,L)=>{Ae(this,er,zi).call(this,{type:"failed",failureCount:I,error:L})},onPause:()=>{Ae(this,er,zi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>W(this,yn).canRun(this)}));const r=this.state.status==="pending",a=!W(this,uo).canStart();try{if(r)n();else{Ae(this,er,zi).call(this,{type:"pending",variables:t,isPaused:a}),W(this,yn).config.onMutate&&await W(this,yn).config.onMutate(t,this,s);const L=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,s));L!==this.state.context&&Ae(this,er,zi).call(this,{type:"pending",context:L,variables:t,isPaused:a})}const I=await W(this,uo).start();return await((d=(f=W(this,yn).config).onSuccess)==null?void 0:d.call(f,I,t,this.state.context,this,s)),await((m=(p=this.options).onSuccess)==null?void 0:m.call(p,I,t,this.state.context,s)),await((y=(x=W(this,yn).config).onSettled)==null?void 0:y.call(x,I,null,this.state.variables,this.state.context,this,s)),await((v=(b=this.options).onSettled)==null?void 0:v.call(b,I,null,t,this.state.context,s)),Ae(this,er,zi).call(this,{type:"success",data:I}),I}catch(I){try{await((S=(w=W(this,yn).config).onError)==null?void 0:S.call(w,I,t,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((k=(C=this.options).onError)==null?void 0:k.call(C,I,t,this.state.context,s))}catch(L){Promise.reject(L)}try{await((R=(_=W(this,yn).config).onSettled)==null?void 0:R.call(_,void 0,I,this.state.variables,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((A=(T=this.options).onSettled)==null?void 0:A.call(T,void 0,I,t,this.state.context,s))}catch(L){Promise.reject(L)}throw Ae(this,er,zi).call(this,{type:"error",error:I}),I}finally{W(this,yn).runNext(this)}}},Kd=new WeakMap,Js=new WeakMap,yn=new WeakMap,uo=new WeakMap,er=new WeakSet,zi=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),It.batch(()=>{W(this,Js).forEach(s=>{s.onMutationUpdate(t)}),W(this,yn).notify({mutation:this,type:"updated",action:t})})},TP);function b$(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fr,Os,Wd,IP,OU=(IP=class extends Ro{constructor(t={}){super();be(this,Fr);be(this,Os);be(this,Wd);this.config=t,pe(this,Fr,new Set),pe(this,Os,new Map),pe(this,Wd,0)}build(t,n,s){const r=new MU({client:t,mutationCache:this,mutationId:++Qh(this,Wd)._,options:t.defaultMutationOptions(n),state:s});return this.add(r),r}add(t){W(this,Fr).add(t);const n=np(t);if(typeof n=="string"){const s=W(this,Os).get(n);s?s.push(t):W(this,Os).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(W(this,Fr).delete(t)){const n=np(t);if(typeof n=="string"){const s=W(this,Os).get(n);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&W(this,Os).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=np(t);if(typeof n=="string"){const s=W(this,Os).get(n),r=s==null?void 0:s.find(a=>a.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const n=np(t);if(typeof n=="string"){const r=(s=W(this,Os).get(n))==null?void 0:s.find(a=>a!==t&&a.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){It.batch(()=>{W(this,Fr).forEach(t=>{this.notify({type:"removed",mutation:t})}),W(this,Fr).clear(),W(this,Os).clear()})}getAll(){return Array.from(W(this,Fr))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>iT(n,s))}findAll(t={}){return this.getAll().filter(n=>iT(t,n))}notify(t){It.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return It.batch(()=>Promise.all(t.map(n=>n.continue().catch(bn))))}},Fr=new WeakMap,Os=new WeakMap,Wd=new WeakMap,IP);function np(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Hr,Qi,zn,Ur,Qr,Yp,pN,MP,LU=(MP=class extends Ro{constructor(n,s){super();be(this,Qr);be(this,Hr);be(this,Qi);be(this,zn);be(this,Ur);pe(this,Hr,n),this.setOptions(s),this.bindMethods(),Ae(this,Qr,Yp).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=W(this,Hr).defaultMutationOptions(n),Sd(this.options,s)||W(this,Hr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:W(this,zn),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&bo(s.mutationKey)!==bo(this.options.mutationKey)?this.reset():((r=W(this,zn))==null?void 0:r.state.status)==="pending"&&W(this,zn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=W(this,zn))==null||n.removeObserver(this)}onMutationUpdate(n){Ae(this,Qr,Yp).call(this),Ae(this,Qr,pN).call(this,n)}getCurrentResult(){return W(this,Qi)}reset(){var n;(n=W(this,zn))==null||n.removeObserver(this),pe(this,zn,void 0),Ae(this,Qr,Yp).call(this),Ae(this,Qr,pN).call(this)}mutate(n,s){var r;return pe(this,Ur,s),(r=W(this,zn))==null||r.removeObserver(this),pe(this,zn,W(this,Hr).getMutationCache().build(W(this,Hr),this.options)),W(this,zn).addObserver(this),W(this,zn).execute(n)}},Hr=new WeakMap,Qi=new WeakMap,zn=new WeakMap,Ur=new WeakMap,Qr=new WeakSet,Yp=function(){var s;const n=((s=W(this,zn))==null?void 0:s.state)??b$();pe(this,Qi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},pN=function(n){It.batch(()=>{var s,r,a,l,u,f,d,p;if(W(this,Ur)&&this.hasListeners()){const m=W(this,Qi).variables,x=W(this,Qi).context,y={client:W(this,Hr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=W(this,Ur)).onSuccess)==null||r.call(s,n.data,m,x,y)}catch(b){Promise.reject(b)}try{(l=(a=W(this,Ur)).onSettled)==null||l.call(a,n.data,null,m,x,y)}catch(b){Promise.reject(b)}}else if((n==null?void 0:n.type)==="error"){try{(f=(u=W(this,Ur)).onError)==null||f.call(u,n.error,m,x,y)}catch(b){Promise.reject(b)}try{(p=(d=W(this,Ur)).onSettled)==null||p.call(d,void 0,n.error,m,x,y)}catch(b){Promise.reject(b)}}}this.listeners.forEach(m=>{m(W(this,Qi))})})},MP);function hT(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function PU(e,t,n){const s=e.slice(0);return s[t]=n,s}var dc,Bn,fc,fo,ss,Xi,Yd,Qd,Xd,Zd,en,mN,gN,w$,xN,yN,vN,OP,$U=(OP=class extends Ro{constructor(t,n,s){super();be(this,en);be(this,dc);be(this,Bn);be(this,fc);be(this,fo);be(this,ss);be(this,Xi);be(this,Yd);be(this,Qd);be(this,Xd);be(this,Zd,[]);pe(this,dc,t),pe(this,fo,s),pe(this,fc,[]),pe(this,ss,[]),pe(this,Bn,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&W(this,ss).forEach(t=>{t.subscribe(n=>{Ae(this,en,yN).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,W(this,ss).forEach(t=>{t.destroy()})}setQueries(t,n){pe(this,fc,t),pe(this,fo,n),It.batch(()=>{const s=W(this,ss),r=Ae(this,en,xN).call(this,W(this,fc));r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const a=r.map(m=>m.observer),l=a.map(m=>m.getCurrentResult()),u=s.length!==a.length,f=a.some((m,x)=>m!==s[x]),d=u||f,p=d?!0:l.some((m,x)=>{const y=W(this,Bn)[x];return!y||!Sd(m,y)});!d&&!p||(d&&(pe(this,Zd,r),pe(this,ss,a)),pe(this,Bn,l),this.hasListeners()&&(d&&(hT(s,a).forEach(m=>{m.destroy()}),hT(a,s).forEach(m=>{m.subscribe(x=>{Ae(this,en,yN).call(this,m,x)})})),Ae(this,en,vN).call(this)))})}getCurrentResult(){return W(this,Bn)}getQueries(){return W(this,ss).map(t=>t.getCurrentQuery())}getObservers(){return W(this,ss)}getOptimisticResult(t,n){const s=Ae(this,en,xN).call(this,t),r=s.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),a=s.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>Ae(this,en,gN).call(this,l??r,n,a),()=>Ae(this,en,mN).call(this,r,s)]}},dc=new WeakMap,Bn=new WeakMap,fc=new WeakMap,fo=new WeakMap,ss=new WeakMap,Xi=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,Xd=new WeakMap,Zd=new WeakMap,en=new WeakSet,mN=function(t,n){return n.map((s,r)=>{const a=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?a:s.observer.trackResult(a,l=>{n.forEach(u=>{u.observer.trackProp(l)})})})},gN=function(t,n,s){if(n){const r=W(this,Xd),a=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((l,u)=>l!==r[u]));return(!W(this,Xi)||W(this,Bn)!==W(this,Qd)||a||n!==W(this,Yd))&&(pe(this,Yd,n),pe(this,Qd,W(this,Bn)),s!==void 0&&pe(this,Xd,s),pe(this,Xi,x2(W(this,Xi),n(t)))),W(this,Xi)}return t},w$=function(){var t;return((t=W(this,fo))==null?void 0:t.combine)!==void 0&&W(this,ss).some((n,s)=>{var r;return n.options.suspense&&((r=W(this,Bn)[s])==null?void 0:r.data)===void 0})},xN=function(t){const n=new Map;W(this,ss).forEach(r=>{const a=r.options.queryHash;if(!a)return;const l=n.get(a);l?l.push(r):n.set(a,[r])});const s=[];return t.forEach(r=>{var f;const a=W(this,dc).defaultQueryOptions(r),u=((f=n.get(a.queryHash))==null?void 0:f.shift())??new b2(W(this,dc),a);s.push({defaultedQueryOptions:a,observer:u})}),s},yN=function(t,n){const s=W(this,ss).indexOf(t);s!==-1&&(pe(this,Bn,PU(W(this,Bn),s,n)),Ae(this,en,vN).call(this))},vN=function(){var t;if(this.hasListeners()){const n=Ae(this,en,mN).call(this,W(this,Bn),W(this,Zd)),s=Ae(this,en,w$).call(this),r=W(this,Xi),a=s?r:Ae(this,en,gN).call(this,n,(t=W(this,fo))==null?void 0:t.combine);(s||r!==a)&&It.batch(()=>{this.listeners.forEach(l=>{l(W(this,Bn))})})}},OP),tr,LP,DU=(LP=class extends Ro{constructor(t={}){super();be(this,tr);this.config=t,pe(this,tr,new Map)}build(t,n,s){const r=n.queryKey,a=n.queryHash??g2(r,n);let l=this.get(a);return l||(l=new AU({client:t,queryKey:r,queryHash:a,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(l)),l}add(t){W(this,tr).has(t.queryHash)||(W(this,tr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=W(this,tr).get(t.queryHash);n&&(t.destroy(),n===t&&W(this,tr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){It.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return W(this,tr).get(t)}getAll(){return[...W(this,tr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>rT(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>rT(t,s)):n}notify(t){It.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){It.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){It.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tr=new WeakMap,LP),Tt,Zi,Ji,hc,pc,ea,mc,gc,PP,qU=(PP=class{constructor(e={}){be(this,Tt);be(this,Zi);be(this,Ji);be(this,hc);be(this,pc);be(this,ea);be(this,mc);be(this,gc);pe(this,Tt,e.queryCache||new DU),pe(this,Zi,e.mutationCache||new OU),pe(this,Ji,e.defaultOptions||{}),pe(this,hc,new Map),pe(this,pc,new Map),pe(this,ea,0)}mount(){Qh(this,ea)._++,W(this,ea)===1&&(pe(this,mc,m2.subscribe(async e=>{e&&(await this.resumePausedMutations(),W(this,Tt).onFocus())})),pe(this,gc,mm.subscribe(async e=>{e&&(await this.resumePausedMutations(),W(this,Tt).onOnline())})))}unmount(){var e,t;Qh(this,ea)._--,W(this,ea)===0&&((e=W(this,mc))==null||e.call(this),pe(this,mc,void 0),(t=W(this,gc))==null||t.call(this),pe(this,gc,void 0))}isFetching(e){return W(this,Tt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return W(this,Zi).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=W(this,Tt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=W(this,Tt).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(oa(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return W(this,Tt).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),r=W(this,Tt).get(s.queryHash),a=r==null?void 0:r.state.data,l=yU(t,a);if(l!==void 0)return W(this,Tt).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return It.batch(()=>W(this,Tt).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=W(this,Tt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=W(this,Tt);It.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=W(this,Tt);return It.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=It.batch(()=>W(this,Tt).findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(bn).catch(bn)}invalidateQueries(e,t={}){return It.batch(()=>(W(this,Tt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=It.batch(()=>W(this,Tt).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let a=r.fetch(void 0,n);return n.throwOnError||(a=a.catch(bn)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(bn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=W(this,Tt).build(this,t);return n.isStaleByTime(oa(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bn).catch(bn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bn).catch(bn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return mm.isOnline()?W(this,Zi).resumePausedMutations():Promise.resolve()}getQueryCache(){return W(this,Tt)}getMutationCache(){return W(this,Zi)}getDefaultOptions(){return W(this,Ji)}setDefaultOptions(e){pe(this,Ji,e)}setQueryDefaults(e,t){W(this,hc).set(bo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...W(this,hc).values()],n={};return t.forEach(s=>{jd(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){W(this,pc).set(bo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...W(this,pc).values()],n={};return t.forEach(s=>{jd(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...W(this,Ji).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=g2(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===y2&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...W(this,Ji).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){W(this,Tt).clear(),W(this,Zi).clear()}},Tt=new WeakMap,Zi=new WeakMap,Ji=new WeakMap,hc=new WeakMap,pc=new WeakMap,ea=new WeakMap,mc=new WeakMap,gc=new WeakMap,PP),j$=E.createContext(void 0),Mt=e=>{const t=E.useContext(j$);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zU=({client:e,children:t})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(j$.Provider,{value:e,children:t})),S$=E.createContext(!1),N$=()=>E.useContext(S$);S$.Provider;function BU(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var FU=E.createContext(BU()),k$=()=>E.useContext(FU),_$=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?v2(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},C$=e=>{E.useEffect(()=>{e.clearReset()},[e])},E$=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||v2(n,[e.error,s])),R$=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},HU=(e,t)=>e.isLoading&&e.isFetching&&!t,bN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,wN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ef({queries:e,...t},n){const s=Mt(),r=N$(),a=k$(),l=E.useMemo(()=>e.map(v=>{const w=s.defaultQueryOptions(v);return w._optimisticResults=r?"isRestoring":"optimistic",w}),[e,s,r]);l.forEach(v=>{R$(v);const w=s.getQueryCache().get(v.queryHash);_$(v,a,w)}),C$(a);const[u]=E.useState(()=>new $U(s,l,t)),[f,d,p]=u.getOptimisticResult(l,t.combine),m=!r&&t.subscribed!==!1;E.useSyncExternalStore(E.useCallback(v=>m?u.subscribe(It.batchCalls(v)):bn,[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),E.useEffect(()=>{u.setQueries(l,t)},[l,t,u]);const y=f.some((v,w)=>bN(l[w],v))?f.flatMap((v,w)=>{const S=l[w];if(S&&bN(S,v)){const C=new b2(s,S);return wN(S,C,a)}return[]}):[];if(y.length>0)throw Promise.all(y);const b=f.find((v,w)=>{const S=l[w];return S&&E$({result:v,errorResetBoundary:a,throwOnError:S.throwOnError,query:s.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(b!=null&&b.error)throw b.error;return d(p())}function UU(e,t,n){var x,y,b,v;const s=N$(),r=k$(),a=Mt(),l=a.defaultQueryOptions(e);(y=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||y.call(x,l);const u=a.getQueryCache().get(l.queryHash);l._optimisticResults=s?"isRestoring":"optimistic",R$(l),_$(l,r,u),C$(r);const f=!a.getQueryCache().get(l.queryHash),[d]=E.useState(()=>new t(a,l)),p=d.getOptimisticResult(l),m=!s&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(w=>{const S=m?d.subscribe(It.batchCalls(w)):bn;return d.updateResult(),S},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),E.useEffect(()=>{d.setOptions(l)},[l,d]),bN(l,p))throw wN(l,d,r);if(E$({result:p,errorResetBoundary:r,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw p.error;if((v=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||v.call(b,l,p),l.experimental_prefetchInRender&&!Nd.isServer()&&HU(p,s)){const w=f?wN(l,d,r):u==null?void 0:u.promise;w==null||w.catch(bn).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?p:d.trackResult(p)}function De(e,t){return UU(e,b2)}function sn(e,t){const n=Mt(),[s]=E.useState(()=>new LU(n,e));E.useEffect(()=>{s.setOptions(e)},[s,e]);const r=E.useSyncExternalStore(E.useCallback(l=>s.subscribe(It.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=E.useCallback((l,u)=>{s.mutate(l,u).catch(bn)},[s]);if(r.error&&v2(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const VU=new qU({defaultOptions:{queries:{staleTime:5e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});/**
|
|
66
|
-
* @license lucide-react v1.14.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const A$=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
|
|
71
|
-
* @license lucide-react v1.14.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const GU=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
76
|
-
* @license lucide-react v1.14.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const KU=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
|
|
81
|
-
* @license lucide-react v1.14.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const pT=e=>{const t=KU(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
86
|
-
* @license lucide-react v1.14.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/var zy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
91
|
-
* @license lucide-react v1.14.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const WU=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},YU=E.createContext({}),QU=()=>E.useContext(YU),XU=E.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:a,iconNode:l,...u},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:m=!1,color:x="currentColor",className:y=""}=QU()??{},b=s??m?Number(n??p)*24/Number(t??d):n??p;return E.createElement("svg",{ref:f,...zy,width:t??d??zy.width,height:t??d??zy.height,stroke:e??x,strokeWidth:b,className:A$("lucide",y,r),...!a&&!WU(u)&&{"aria-hidden":"true"},...u},[...l.map(([v,w])=>E.createElement(v,w)),...Array.isArray(a)?a:[a]])});/**
|
|
96
|
-
* @license lucide-react v1.14.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const ze=(e,t)=>{const n=E.forwardRef(({className:s,...r},a)=>E.createElement(XU,{ref:a,iconNode:t,className:A$(`lucide-${GU(pT(e))}`,`lucide-${e}`,s),...r}));return n.displayName=pT(e),n};/**
|
|
101
|
-
* @license lucide-react v1.14.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const ZU=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],gm=ze("arrow-right",ZU);/**
|
|
106
|
-
* @license lucide-react v1.14.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const JU=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],eV=ze("arrow-up-right",JU);/**
|
|
111
|
-
* @license lucide-react v1.14.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const tV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],T$=ze("ban",tV);/**
|
|
116
|
-
* @license lucide-react v1.14.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const nV=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],sV=ze("bot",nV);/**
|
|
121
|
-
* @license lucide-react v1.14.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const rV=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],iV=ze("brain",rV);/**
|
|
126
|
-
* @license lucide-react v1.14.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const aV=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],j2=ze("calendar-days",aV);/**
|
|
131
|
-
* @license lucide-react v1.14.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const oV=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fa=ze("chevron-down",oV);/**
|
|
136
|
-
* @license lucide-react v1.14.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const lV=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],cV=ze("chevron-left",lV);/**
|
|
141
|
-
* @license lucide-react v1.14.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const uV=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lr=ze("chevron-right",uV);/**
|
|
146
|
-
* @license lucide-react v1.14.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const dV=[["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"}]],ha=ze("circle-alert",dV);/**
|
|
151
|
-
* @license lucide-react v1.14.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const fV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kd=ze("circle-check",fV);/**
|
|
156
|
-
* @license lucide-react v1.14.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const hV=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],pV=ze("circle-play",hV);/**
|
|
161
|
-
* @license lucide-react v1.14.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const mV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],I$=ze("circle-plus",mV);/**
|
|
166
|
-
* @license lucide-react v1.14.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const gV=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],jN=ze("clipboard-check",gV);/**
|
|
171
|
-
* @license lucide-react v1.14.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const xV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],_d=ze("clock",xV);/**
|
|
176
|
-
* @license lucide-react v1.14.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const yV=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],M$=ze("cog",yV);/**
|
|
181
|
-
* @license lucide-react v1.14.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const vV=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],bV=ze("file-image",vV);/**
|
|
186
|
-
* @license lucide-react v1.14.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const wV=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],jV=ze("file-pen-line",wV);/**
|
|
191
|
-
* @license lucide-react v1.14.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const SV=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],O$=ze("file-text",SV);/**
|
|
196
|
-
* @license lucide-react v1.14.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const NV=[["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"}]],S2=ze("folder",NV);/**
|
|
201
|
-
* @license lucide-react v1.14.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const kV=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],_V=ze("git-branch",kV);/**
|
|
206
|
-
* @license lucide-react v1.14.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const CV=[["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"}]],EV=ze("globe",CV);/**
|
|
211
|
-
* @license lucide-react v1.14.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const RV=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Yl=ze("history",RV);/**
|
|
216
|
-
* @license lucide-react v1.14.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const AV=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],L$=ze("inbox",AV);/**
|
|
221
|
-
* @license lucide-react v1.14.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const TV=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],IV=ze("layout-dashboard",TV);/**
|
|
226
|
-
* @license lucide-react v1.14.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const MV=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],OV=ze("maximize-2",MV);/**
|
|
231
|
-
* @license lucide-react v1.14.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const LV=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],Gm=ze("message-square-text",LV);/**
|
|
236
|
-
* @license lucide-react v1.14.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const PV=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],$V=ze("minimize-2",PV);/**
|
|
241
|
-
* @license lucide-react v1.14.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const DV=[["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"}]],N2=ze("network",DV);/**
|
|
246
|
-
* @license lucide-react v1.14.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const qV=[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 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.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]],k2=ze("package-check",qV);/**
|
|
251
|
-
* @license lucide-react v1.14.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const zV=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],BV=ze("pause",zV);/**
|
|
256
|
-
* @license lucide-react v1.14.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const FV=[["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"}]],HV=ze("refresh-cw",FV);/**
|
|
261
|
-
* @license lucide-react v1.14.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const UV=[["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"}]],VV=ze("rotate-ccw",UV);/**
|
|
266
|
-
* @license lucide-react v1.14.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const GV=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],P$=ze("route",GV);/**
|
|
271
|
-
* @license lucide-react v1.14.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const KV=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],WV=ze("search",KV);/**
|
|
276
|
-
* @license lucide-react v1.14.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const YV=[["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"}]],Km=ze("send",YV);/**
|
|
281
|
-
* @license lucide-react v1.14.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const QV=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],XV=ze("server-cog",QV);/**
|
|
286
|
-
* @license lucide-react v1.14.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const ZV=[["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:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],JV=ze("shield-x",ZV);/**
|
|
291
|
-
* @license lucide-react v1.14.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const eG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],_2=ze("sparkles",eG);/**
|
|
296
|
-
* @license lucide-react v1.14.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const tG=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],nG=ze("trash-2",tG);/**
|
|
301
|
-
* @license lucide-react v1.14.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const sG=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],$$=ze("user-check",sG);/**
|
|
306
|
-
* @license lucide-react v1.14.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const rG=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],iG=ze("user-round",rG);/**
|
|
311
|
-
* @license lucide-react v1.14.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const aG=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],oG=ze("wrench",aG);/**
|
|
316
|
-
* @license lucide-react v1.14.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const lG=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],C2=ze("x",lG);async function cG(){const e=await fetch("/api/rigs/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function dr(){return De({queryKey:["rigs","summary"],queryFn:cG})}async function uG(){const e=await fetch("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Wm(){return De({queryKey:["ps"],queryFn:uG})}function D$(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=D$(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function q$(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=D$(e))&&(s&&(s+=" "),s+=t);return s}const dG=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},fG=(e,t)=>({classGroupId:e,validator:t}),z$=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),xm="-",mT=[],hG="arbitrary..",pG=e=>{const t=gG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return mG(l);const u=l.split(xm),f=u[0]===""&&u.length>1?1:0;return B$(u,f,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const f=s[l],d=n[l];return f?d?dG(d,f):f:d||mT}return n[l]||mT}}},B$=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],a=n.nextPart.get(r);if(a){const d=B$(e,t+1,a);if(d)return d}const l=n.validators;if(l===null)return;const u=t===0?e.join(xm):e.slice(t).join(xm),f=l.length;for(let d=0;d<f;d++){const p=l[d];if(p.validator(u))return p.classGroupId}},mG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?hG+s:void 0})(),gG=e=>{const{theme:t,classGroups:n}=e;return xG(n,t)},xG=(e,t)=>{const n=z$();for(const s in e){const r=e[s];E2(r,n,s,t)}return n},E2=(e,t,n,s)=>{const r=e.length;for(let a=0;a<r;a++){const l=e[a];yG(l,t,n,s)}},yG=(e,t,n,s)=>{if(typeof e=="string"){vG(e,t,n);return}if(typeof e=="function"){bG(e,t,n,s);return}wG(e,t,n,s)},vG=(e,t,n)=>{const s=e===""?t:F$(t,e);s.classGroupId=n},bG=(e,t,n,s)=>{if(jG(e)){E2(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(fG(n,e))},wG=(e,t,n,s)=>{const r=Object.entries(e),a=r.length;for(let l=0;l<a;l++){const[u,f]=r[l];E2(f,F$(t,u),n,s)}},F$=(e,t)=>{let n=e;const s=t.split(xm),r=s.length;for(let a=0;a<r;a++){const l=s[a];let u=n.nextPart.get(l);u||(u=z$(),n.nextPart.set(l,u)),n=u}return n},jG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,SG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(a,l)=>{n[a]=l,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=s[a])!==void 0)return r(a,l),l},set(a,l){a in n?n[a]=l:r(a,l)}}},SN="!",gT=":",NG=[],xT=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),kG=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const a=[];let l=0,u=0,f=0,d;const p=r.length;for(let v=0;v<p;v++){const w=r[v];if(l===0&&u===0){if(w===gT){a.push(r.slice(f,v)),f=v+1;continue}if(w==="/"){d=v;continue}}w==="["?l++:w==="]"?l--:w==="("?u++:w===")"&&u--}const m=a.length===0?r:r.slice(f);let x=m,y=!1;m.endsWith(SN)?(x=m.slice(0,-1),y=!0):m.startsWith(SN)&&(x=m.slice(1),y=!0);const b=d&&d>f?d-f:void 0;return xT(a,y,x,b)};if(t){const r=t+gT,a=s;s=l=>l.startsWith(r)?a(l.slice(r.length)):xT(NG,!1,l,void 0,!0)}if(n){const r=s;s=a=>n({className:a,parseClassName:r})}return s},_G=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",f=t.has(l);u||f?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(l)):r.push(l)}return r.length>0&&(r.sort(),s.push(...r)),s}},CG=e=>({cache:SG(e.cacheSize),parseClassName:kG(e),sortModifiers:_G(e),...pG(e)}),EG=/\s+/,RG=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:a}=t,l=[],u=e.trim().split(EG);let f="";for(let d=u.length-1;d>=0;d-=1){const p=u[d],{isExternal:m,modifiers:x,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:v}=n(p);if(m){f=p+(f.length>0?" "+f:f);continue}let w=!!v,S=s(w?b.substring(0,v):b);if(!S){if(!w){f=p+(f.length>0?" "+f:f);continue}if(S=s(b),!S){f=p+(f.length>0?" "+f:f);continue}w=!1}const C=x.length===0?"":x.length===1?x[0]:a(x).join(":"),k=y?C+SN:C,_=k+S;if(l.indexOf(_)>-1)continue;l.push(_);const R=r(S,w);for(let T=0;T<R.length;++T){const A=R[T];l.push(k+A)}f=p+(f.length>0?" "+f:f)}return f},AG=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=H$(n))&&(r&&(r+=" "),r+=s);return r},H$=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=H$(e[s]))&&(n&&(n+=" "),n+=t);return n},TG=(e,...t)=>{let n,s,r,a;const l=f=>{const d=t.reduce((p,m)=>m(p),e());return n=CG(d),s=n.cache.get,r=n.cache.set,a=u,u(f)},u=f=>{const d=s(f);if(d)return d;const p=RG(f,n);return r(f,p),p};return a=l,(...f)=>a(AG(...f))},IG=[],Jt=e=>{const t=n=>n[e]||IG;return t.isThemeGetter=!0,t},U$=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,V$=/^\((?:(\w[\w-]*):)?(.+)\)$/i,MG=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,OG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,PG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$G=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mi=e=>MG.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),Oi=e=>!!e&&Number.isInteger(Number(e)),By=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),Pr=e=>OG.test(e),G$=()=>!0,qG=e=>LG.test(e)&&!PG.test(e),R2=()=>!1,zG=e=>$G.test(e),BG=e=>DG.test(e),FG=e=>!Ne(e)&&!ke(e),HG=e=>va(e,Y$,R2),Ne=e=>U$.test(e),Ua=e=>va(e,Q$,qG),yT=e=>va(e,XG,Ge),UG=e=>va(e,Z$,G$),VG=e=>va(e,X$,R2),vT=e=>va(e,K$,R2),GG=e=>va(e,W$,BG),sp=e=>va(e,J$,zG),ke=e=>V$.test(e),zu=e=>Ao(e,Q$),KG=e=>Ao(e,X$),bT=e=>Ao(e,K$),WG=e=>Ao(e,Y$),YG=e=>Ao(e,W$),rp=e=>Ao(e,J$,!0),QG=e=>Ao(e,Z$,!0),va=(e,t,n)=>{const s=U$.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Ao=(e,t,n=!1)=>{const s=V$.exec(e);return s?s[1]?t(s[1]):n:!1},K$=e=>e==="position"||e==="percentage",W$=e=>e==="image"||e==="url",Y$=e=>e==="length"||e==="size"||e==="bg-size",Q$=e=>e==="length",XG=e=>e==="number",X$=e=>e==="family-name",Z$=e=>e==="number"||e==="weight",J$=e=>e==="shadow",ZG=()=>{const e=Jt("color"),t=Jt("font"),n=Jt("text"),s=Jt("font-weight"),r=Jt("tracking"),a=Jt("leading"),l=Jt("breakpoint"),u=Jt("container"),f=Jt("spacing"),d=Jt("radius"),p=Jt("shadow"),m=Jt("inset-shadow"),x=Jt("text-shadow"),y=Jt("drop-shadow"),b=Jt("blur"),v=Jt("perspective"),w=Jt("aspect"),S=Jt("ease"),C=Jt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[..._(),ke,Ne],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],I=()=>[ke,Ne,f],L=()=>[Mi,"full","auto",...I()],$=()=>[Oi,"none","subgrid",ke,Ne],O=()=>["auto",{span:["full",Oi,ke,Ne]},Oi,ke,Ne],B=()=>[Oi,"auto",ke,Ne],H=()=>["auto","min","max","fr",ke,Ne],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...I()],V=()=>[Mi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],K=()=>[Mi,"screen","full","dvw","lvw","svw","min","max","fit",...I()],Y=()=>[Mi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],J=()=>[e,ke,Ne],D=()=>[..._(),bT,vT,{position:[ke,Ne]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",WG,HG,{size:[ke,Ne]}],U=()=>[By,zu,Ua],Q=()=>["","none","full",d,ke,Ne],X=()=>["",Ge,zu,Ua],se=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[Ge,By,bT,vT],me=()=>["","none",b,ke,Ne],ge=()=>["none",Ge,ke,Ne],ve=()=>["none",Ge,ke,Ne],xe=()=>[Ge,ke,Ne],je=()=>[Mi,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pr],breakpoint:[Pr],color:[G$],container:[Pr],"drop-shadow":[Pr],ease:["in","out","in-out"],font:[FG],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pr],shadow:[Pr],spacing:["px",Ge],text:[Pr],"text-shadow":[Pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mi,Ne,ke,w]}],container:["container"],columns:[{columns:[Ge,Ne,ke,u]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Oi,"auto",ke,Ne]}],basis:[{basis:[Mi,"full","auto",u,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Mi,"auto","initial","none",Ne]}],grow:[{grow:["",Ge,ke,Ne]}],shrink:[{shrink:["",Ge,ke,Ne]}],order:[{order:[Oi,"first","last","none",ke,Ne]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...Y()]}],"min-block-size":[{"min-block":["auto",...Y()]}],"max-block-size":[{"max-block":["none",...Y()]}],w:[{w:[u,"screen",...V()]}],"min-w":[{"min-w":[u,"screen","none",...V()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,zu,Ua]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,QG,UG]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",By,Ne]}],"font-family":[{font:[KG,VG,t]}],"font-features":[{"font-features":[Ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Ne]}],"line-clamp":[{"line-clamp":[Ge,"none",ke,yT]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",ke,Ua]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Ge,"auto",ke,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Oi,ke,Ne],radial:["",ke,Ne],conic:[Oi,ke,Ne]},YG,GG]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-bs":[{"border-bs":J()}],"border-color-be":[{"border-be":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,ke,Ne]}],"outline-w":[{outline:["",Ge,zu,Ua]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",p,rp,sp]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,rp,sp]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Ge,Ua]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",x,rp,sp]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Ge,ke,Ne]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[ke,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Ne]}],filter:[{filter:["","none",ke,Ne]}],blur:[{blur:me()}],brightness:[{brightness:[Ge,ke,Ne]}],contrast:[{contrast:[Ge,ke,Ne]}],"drop-shadow":[{"drop-shadow":["","none",y,rp,sp]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Ge,ke,Ne]}],"hue-rotate":[{"hue-rotate":[Ge,ke,Ne]}],invert:[{invert:["",Ge,ke,Ne]}],saturate:[{saturate:[Ge,ke,Ne]}],sepia:[{sepia:["",Ge,ke,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Ne]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,ke,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,ke,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,ke,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,ke,Ne]}],"backdrop-invert":[{"backdrop-invert":["",Ge,ke,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,ke,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,ke,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,ke,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",ke,Ne]}],ease:[{ease:["linear","initial",S,ke,Ne]}],delay:[{delay:[Ge,ke,Ne]}],animate:[{animate:["none",C,ke,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,ke,Ne]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[ke,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Ne]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Ge,zu,Ua,yT]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},JG=TG(ZG);function he(...e){return JG(q$(e))}const eK={running:"running",needs_input:"needs input",idle:"idle",unknown:"unknown"},tK={running:"bg-emerald-500",needs_input:"bg-amber-500",idle:"bg-slate-400",unknown:"bg-stone-300"};function A2(e){return e?e.state:"unknown"}function T2(e){return eK[e]}function eD(e){return tK[e]}function tD(e){return e==="running"?"activity-pulse-running":""}const wT=30;function nD(e){if(!e)return!1;if(typeof e.staleness=="number")return e.staleness>wT;if(!e.sampledAt)return!1;const t=Date.parse(e.sampledAt);return Number.isNaN(t)?!1:(Date.now()-t)/1e3>wT}function nK(e){return e.length<=8?e:e.slice(-8)}async function sK(e,t){const n=new URLSearchParams({filter:e,refresh:"1"});t&&n.set("boundToWorkflow",`${t.specName}:${t.specVersion}`);const s=await fetch(`/api/slices?${n.toString()}`);if(s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,error:r.error??"slices_indexer_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function Ym(e,t=null){return De({queryKey:["slices","list",e,t?`${t.specName}:${t.specVersion}`:"all"],queryFn:()=>sK(e,t),staleTime:3e4,refetchOnWindowFocus:"always"})}function rK(){const e=Mt();return sn({mutationFn:async()=>{const t=await fetch("/api/slices/refresh",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["slices"]}),e.invalidateQueries({queryKey:["files"]})}})}async function sD(e){const t=await fetch(`/api/slices/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function iK(e){return De({queryKey:["slices","detail",e],queryFn:()=>sD(e),enabled:!!e,staleTime:3e4})}function rD(e){const t=E.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=ef({queries:t.map(s=>({queryKey:["slices","detail",s],queryFn:()=>sD(s),staleTime:3e4}))});return E.useMemo(()=>{const s=new Map,r=[];return t.forEach((a,l)=>{var f,d;const u=(f=n[l])==null?void 0:f.data;u?s.set(a,u):(d=n[l])!=null&&d.isError&&r.push(a)}),{itemsByName:s,isFetching:n.some(a=>a.isFetching),missingNames:r}},[n,t])}async function aK(e,t){const n=await fetch(`/api/slices/${encodeURIComponent(e)}/doc/${encodeURI(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function oK(e,t){return De({queryKey:["slices","doc",e,t],queryFn:()=>aK(e,t),enabled:!!e&&!!t,staleTime:6e4})}function cd(e,t){return`/api/slices/${encodeURIComponent(e)}/proof-asset/${encodeURI(t)}`}async function lK(e){const t=await fetch(`/api/queue/${encodeURIComponent(e)}`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function I2(e){const t=E.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=ef({queries:t.map(s=>({queryKey:["queue","item",s],queryFn:()=>lK(s),staleTime:3e4}))});return E.useMemo(()=>{const s=new Map,r=[];return t.forEach((a,l)=>{var f,d;const u=(f=n[l])==null?void 0:f.data;u?s.set(a,u):((d=n[l])==null?void 0:d.status)==="success"&&r.push(a)}),{itemsById:s,isFetching:n.some(a=>a.isFetching),missingIds:r}},[n,t])}async function cK(){const e=await fetch("/api/config");if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error??`HTTP ${e.status}`)}return e.json()}function ba(){return De({queryKey:["settings","all"],queryFn:cK,staleTime:0})}function M2(){const e=Mt();return sn({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t.key)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t.value})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function uK(){const e=Mt();return sn({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function dK(){const e=Mt();return sn({mutationFn:async t=>{const n=await fetch("/api/config/init-workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function fK(e){if(!e)return"";const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function O2(){const{data:e,isLoading:t,error:n}=ba();if(n||!e||!e.settings||typeof e.settings!="object")return{name:null,root:null,settingsAvailable:!1,isLoading:t};const s=e.settings["workspace.root"],r=s==null?void 0:s.value,a=typeof r=="string"&&r.length>0?r:null;return{name:a?fK(a):null,root:a,settingsAvailable:!0,isLoading:t}}async function hK(){const e=await fetch("/api/files/roots");if(e.status===503){const t=await e.json().catch(()=>({}));return{unavailable:!0,error:t.error??"files_routes_unavailable",hint:t.hint}}if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}function Qm(){return De({queryKey:["files","roots"],queryFn:hK,staleTime:6e4})}async function pK(e,t){const n=await fetch(`/api/files/list?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function iD(e,t){return De({queryKey:["files","list",e,t],queryFn:()=>pK(e,t??""),enabled:!!e,staleTime:15e3,refetchOnWindowFocus:"always"})}async function mK(e,t){const n=await fetch(`/api/files/read?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function Xm(e,t){return De({queryKey:["files","read",e,t],queryFn:()=>mK(e,t),enabled:!!e&&!!t,staleTime:0})}async function gK(e){const t=await fetch("/api/files/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const n=await t.json();return{conflict:!0,currentMtime:n.currentMtime,currentContentHash:n.currentContentHash,message:n.message??"file changed externally"}}if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message??n.error??`HTTP ${t.status}`)}return await t.json()}function xK(){const e=Mt();return sn({mutationFn:gK,onSuccess:(t,n)=>{"conflict"in t||(e.invalidateQueries({queryKey:["files","read",n.root,n.path]}),e.invalidateQueries({queryKey:["files","list",n.root]}))}})}function NN(e,t){return`/api/files/asset?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function yK(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?!0:s.startsWith(n+"/")}function vK(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?"":s.startsWith(n+"/")?s.slice(n.length+1):s}function aD(){var d;const e=O2(),t=Qm(),n=t.data;let s=null;if(e.root&&n&&"roots"in n){const p=n.roots.find(m=>m.path===e.root);if(p)s=p;else{const x=n.roots.filter(y=>e.root&&yK(y.path,e.root)).sort((y,b)=>b.path.length-y.path.length)[0];x&&(s=x)}}const r=s&&e.root?(()=>{const p=vK(s.path,e.root);return p?`${p}/missions`:"missions"})():null,a=iD(s?s.name:null,r),l=e.isLoading||t.isLoading||s!==null&&a.isLoading;return!e.settingsAvailable&&!e.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:"Daemon does not expose /api/config (likely v0.2.0). Upgrade to v0.3.0+ for live mission discovery."}:!e.root&&!e.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:"Configure a workspace root: rig config set workspace.root <path>"}:!s&&!t.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:`No allowlist root contains workspace.root (${e.root}). Set OPENRIG_FILES_ALLOWLIST=<name>:<path> to register.`}:a.isError?{missions:[],unavailable:!0,isLoading:l,hint:`Could not list ${r} under ${s==null?void 0:s.name}.`}:{missions:(((d=a.data)==null?void 0:d.entries)??[]).filter(p=>p.type==="dir").map(p=>({name:p.name,root:s.name,path:r?`${r}/${p.name}`:p.name})).sort((p,m)=>p.name.localeCompare(m.name)),unavailable:!1,isLoading:l,hint:null}}const bK={active:"border-success text-success",paused:"border-stone-400 text-stone-500",shipped:"border-secondary text-secondary",blocked:"border-warning text-warning",unknown:"border-stone-300 text-stone-400"},wK={active:"bg-success",paused:"bg-stone-400",shipped:"bg-secondary",blocked:"bg-warning",unknown:"bg-stone-300"};function jK({status:e,label:t,className:n,testId:s}){return i.jsxs("span",{"data-testid":s??`mission-status-${e}`,role:"status","aria-label":t??e,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",bK[e],n),children:[i.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",wK[e]),"aria-hidden":"true"}),t??e]})}function SK(e){var a;if(!e)return"unknown";const t=e.match(/^---\s*\n([\s\S]*?)\n---/),s=((t==null?void 0:t[1])??e).match(/^\s*status:\s*([a-z_-]+)\s*$/im),r=((a=s==null?void 0:s[1])==null?void 0:a.toLowerCase())??"";return r==="active"||r==="in_progress"||r==="in-progress"?"active":r==="paused"||r==="on_hold"||r==="on-hold"?"paused":r==="shipped"||r==="complete"||r==="completed"||r==="done"?"shipped":r==="blocked"||r==="stalled"?"blocked":"unknown"}function NK(e,t){const n=e&&t?`${t}/PROGRESS.md`:null,s=Xm(e,n);return!e||!t?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:s.isLoading?{status:"unknown",isLoading:!0,unavailable:!1,mtime:null}:s.isError||!s.data?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:{status:SK(s.data.content),isLoading:!1,unavailable:!1,mtime:s.data.mtime??null}}const kK={"claude-code":{id:"claude-code",label:"Claude",shortLabel:"Claude",tone:"sand"},codex:{id:"codex",label:"Codex",shortLabel:"Codex",tone:"green"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",tone:"slate"},unknown:{id:"unknown",label:"Unknown",shortLabel:"Unknown",tone:"neutral"}};function Zm(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="claude"||t==="claude-code"||t.includes("claude")?"claude-code":t==="codex"||t.includes("codex")||t.includes("openai")?"codex":t==="terminal"||t==="tmux"||t==="shell"?"terminal":"unknown"}function L2(e){return kK[Zm(e)]}function oD(e,t){const n=L2(e);return n.id==="unknown"?t??"Runtime unknown":t?`${n.label} / ${t}`:n.label}const _K={cmux:{id:"cmux",label:"CMUX",shortLabel:"CMUX",actionLabel:"Open in CMUX",tone:"cyan"},tmux:{id:"tmux",label:"tmux",shortLabel:"tmux",actionLabel:"Attach tmux",tone:"green"},vscode:{id:"vscode",label:"VS Code",shortLabel:"VS Code",actionLabel:"Open in VS Code",tone:"blue"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",actionLabel:"Preview terminal",tone:"slate"},file:{id:"file",label:"File",shortLabel:"File",actionLabel:"Open file",tone:"neutral"},markdown:{id:"markdown",label:"Markdown",shortLabel:"MD",actionLabel:"Open markdown",tone:"neutral"},config:{id:"config",label:"Config",shortLabel:"YAML",actionLabel:"Open config",tone:"blue"},code:{id:"code",label:"Code",shortLabel:"Code",actionLabel:"Open code",tone:"slate"},screenshot:{id:"screenshot",label:"Screenshot",shortLabel:"Shot",actionLabel:"Open screenshot",tone:"amber"},proof:{id:"proof",label:"Proof",shortLabel:"Proof",actionLabel:"Open proof packet",tone:"green"},transcript:{id:"transcript",label:"Transcript",shortLabel:"Log",actionLabel:"Open transcript",tone:"slate"},commit:{id:"commit",label:"Commit",shortLabel:"Git",actionLabel:"Open commit",tone:"green"},folder:{id:"folder",label:"Folder",shortLabel:"Dir",actionLabel:"Open folder",tone:"neutral"},skill:{id:"skill",label:"Skill",shortLabel:"Skill",actionLabel:"Open skill",tone:"amber"},video:{id:"video",label:"Video",shortLabel:"Video",actionLabel:"Open video",tone:"blue"},trace:{id:"trace",label:"Trace",shortLabel:"Trace",actionLabel:"Open trace",tone:"neutral"},unknown:{id:"unknown",label:"Unknown tool",shortLabel:"Unknown",actionLabel:"Open",tone:"neutral"}};function lD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="cmux"||t.includes("cmux")?"cmux":t==="tmux"||t.includes("tmux")?"tmux":t==="vscode"||t==="vs-code"||t==="vs code"||t.includes("visual studio code")?"vscode":t==="terminal"||t==="tty"||t==="shell"?"terminal":t==="screenshot"||t==="image"||t==="proof-image"||t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")||t.includes("screenshot")?"screenshot":t==="proof"||t==="proof-packet"||t.includes("proof packet")||t.endsWith("proof.md")?"proof":t==="skill"||t==="skill-folder"||t==="skill.md"||t.endsWith("/skill.md")?"skill":t==="folder"||t==="directory"||t==="dir"?"folder":t==="commit"||t==="git"||t.includes("commit")||/^[a-f0-9]{7,40}$/.test(t)?"commit":t==="transcript"||t.includes("transcript")||t.endsWith(".log")?"transcript":t==="video"||t.endsWith(".mp4")||t.endsWith(".webm")||t.endsWith(".mov")?"video":t==="trace"||t.endsWith(".zip")||t.endsWith(".har")||t.endsWith(".trace")?"trace":t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")||t.endsWith(".json")||t.endsWith(".jsonl")||t.endsWith(".toml")?"config":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".py")||t.endsWith(".rs")||t.endsWith(".go")||t.endsWith(".sh")?"code":t==="file"||t==="path"||t.includes("artifact")||t.endsWith(".txt")?"file":"unknown"}function cD(e){return _K[lD(e)]}const P2={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-9 w-9"},CK={xs:"gap-1 px-1 py-0.5 text-[8px]",sm:"gap-1.5 px-1.5 py-0.5 text-[9px]",md:"gap-2 px-2 py-1 text-[10px]",lg:"gap-2.5 px-2.5 py-1.5 text-[11px]"},EK={xs:"gap-1 text-[8px]",sm:"gap-1.5 text-[9px]",md:"gap-2 text-[10px]",lg:"gap-2.5 text-[11px]"},RK={"claude-code":"border-[#9f5f4e]/40 bg-[#b06a57]/12 text-[#62392f]",codex:"border-stone-400/50 bg-white/75 text-stone-950",terminal:"border-stone-400/45 bg-stone-900/8 text-stone-800",unknown:"border-stone-300 bg-white/55 text-stone-600"},AK={"claude-code":"text-[#62392f]",codex:"text-stone-950",terminal:"text-stone-800",unknown:"text-stone-600"},jT="/graphics/operator-climber-monochrome.png";function Gt(e,t){return t?{"aria-hidden":!0}:{"aria-label":e,role:"img"}}function TK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,shapeRendering:"crispEdges",children:[i.jsx("rect",{x:"3",y:"2",width:"10",height:"8",fill:"#ad6755"}),i.jsx("rect",{x:"1",y:"5",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"13",y:"5",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"4",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"7",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"10",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"5",y:"4",width:"1",height:"2",fill:"#181818"}),i.jsx("rect",{x:"10",y:"4",width:"1",height:"2",fill:"#181818"})]})}function IK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("circle",{cx:"8",cy:"8",r:"5.7",fill:"#fafaf9",stroke:"#0c0a09",strokeWidth:"1.25"}),i.jsx("path",{d:"M5.8 6.35 7.25 8 5.8 9.65",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M8.65 9.65h2.25",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round"})]})}function $2({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#1c1917"}),i.jsx("path",{d:"M4 6 6 8 4 10",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M7.5 10h4",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square"})]})}function MK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"cmux-preview-mark",x1:"3",x2:"13",y1:"3",y2:"13",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#20d5f4"}),i.jsx("stop",{offset:"1",stopColor:"#4357ff"})]})}),i.jsx("path",{d:"M4.1 2.7 12.3 8l-8.2 5.3V9.9L7.8 8 4.1 6.1z",fill:"url(#cmux-preview-mark)"})]})}function OK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M2.1 3.5c0-.8.6-1.4 1.4-1.4h9c.8 0 1.4.6 1.4 1.4v9c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#3a3a39"}),i.jsx("path",{d:"M7.5 2.1v8.7M7.5 6.3h6.4",stroke:"#f8fafc",strokeWidth:"0.7"}),i.jsx("path",{d:"M2.1 11.1h11.8v1.4c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#14c21a"})]})}function LK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M12.5 2.4 6.8 6.7 3.9 4.5 2.4 5.7 5.2 8l-2.8 2.3 1.5 1.2 2.9-2.2 5.7 4.3 1.1-.5V2.9z",fill:"#007acc"}),i.jsx("path",{d:"M12.3 5.3 8.4 8l3.9 2.7z",fill:"#35a9ff",opacity:"0.9"})]})}function PK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M4 2.5h5.2L12 5.3v8.2H4z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M9.2 2.5v3h2.8",fill:"none",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M5.8 8h4.4M5.8 10.1h3.5",fill:"none",stroke:"#57534e",strokeWidth:"0.8",strokeLinecap:"square"})]})}function $K({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),i.jsx("path",{d:"M5 6v4M5 6l1.7 2.2L8.4 6v4M10 6v4M9.1 9.1 10 10l.9-.9",fill:"none",stroke:"#292524",strokeWidth:"0.85",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M4.6 4.2h6.8",stroke:"#a8a29e",strokeWidth:"0.65"})]})}function DK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),i.jsx("path",{d:"M5.1 5.3h5.8M5.1 8h5.8M5.1 10.7h5.8",stroke:"#075985",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("circle",{cx:"4.2",cy:"5.3",r:"0.45",fill:"#0284c7"}),i.jsx("circle",{cx:"4.2",cy:"8",r:"0.45",fill:"#0284c7"}),i.jsx("circle",{cx:"4.2",cy:"10.7",r:"0.45",fill:"#0284c7"})]})}function qK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#fafaf9",stroke:"#292524",strokeWidth:"0.9"}),i.jsx("path",{d:"M6.2 6.2 4.6 8l1.6 1.8M9.8 6.2 11.4 8 9.8 9.8",fill:"none",stroke:"#292524",strokeWidth:"0.9",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M8.7 5.4 7.3 10.6",stroke:"#57534e",strokeWidth:"0.75",strokeLinecap:"square"})]})}function zK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#fff7ed",stroke:"#9a3412",strokeWidth:"0.9"}),i.jsx("path",{d:"M2.4 5.2h11.2",stroke:"#9a3412",strokeWidth:"0.9"}),i.jsx("rect",{x:"3.8",y:"6.7",width:"3.1",height:"2.3",fill:"#fdba74"}),i.jsx("rect",{x:"7.7",y:"6.7",width:"4.5",height:"0.8",fill:"#fed7aa"}),i.jsx("rect",{x:"7.7",y:"8.4",width:"3.5",height:"0.8",fill:"#fed7aa"}),i.jsx("path",{d:"M4 11.5h7.8",stroke:"#ea580c",strokeWidth:"0.9",strokeLinecap:"square"}),i.jsx("circle",{cx:"4",cy:"4.1",r:"0.35",fill:"#9a3412"}),i.jsx("circle",{cx:"5.1",cy:"4.1",r:"0.35",fill:"#9a3412"})]})}function BK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M3 2.8h10v10.4H3z",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"0.9"}),i.jsx("path",{d:"M5.1 8.1 7 10l4-4.3",fill:"none",stroke:"#059669",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M4.7 4.7h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"}),i.jsx("path",{d:"M4.7 11.6h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"})]})}function FK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#1c1917"}),i.jsx("path",{d:"M4.3 5.5h3.8M4.3 7.6h6.8M4.3 9.7h5.2",stroke:"#fafaf9",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("rect",{x:"11.1",y:"5.1",width:"1",height:"5.6",fill:"#a8a29e"})]})}function HK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M2.4 8h11.2",stroke:"#064e3b",strokeWidth:"1",strokeLinecap:"square"}),i.jsx("circle",{cx:"8",cy:"8",r:"2.6",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"1"}),i.jsx("circle",{cx:"8",cy:"8",r:"0.8",fill:"#10b981"})]})}function UK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M2.3 5.1h4l1-1.5h6.4v8.8H2.3z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"0.9"}),i.jsx("path",{d:"M2.3 6.3h11.4",stroke:"#a8a29e",strokeWidth:"0.75"})]})}function VK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("path",{d:"M3.2 2.8h7.1L13 5.5v7.7H3.2z",fill:"#fffbeb",stroke:"#92400e",strokeWidth:"0.9"}),i.jsx("path",{d:"M10.3 2.8v2.8H13",fill:"none",stroke:"#92400e",strokeWidth:"0.8"}),i.jsx("path",{d:"M5.1 6.7h5.1M5.1 8.7h4.1",stroke:"#b45309",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("path",{d:"M5.1 11.1h2.2",stroke:"#f59e0b",strokeWidth:"1",strokeLinecap:"square"})]})}function GK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3.6",width:"8.4",height:"8.8",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),i.jsx("path",{d:"M10.9 6.3 13.7 4.9v6.2l-2.8-1.4z",fill:"#38bdf8",stroke:"#0369a1",strokeWidth:"0.75"}),i.jsx("path",{d:"M5.7 6.3v3.4L8.5 8z",fill:"#0284c7"})]})}function KK({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2.7",y:"2.7",width:"10.6",height:"10.6",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),i.jsx("path",{d:"M4.7 10.2c1.1-4.8 2.3-4.8 3.4-.1s2.2 4.7 3.2-.2",fill:"none",stroke:"#44403c",strokeWidth:"0.9",strokeLinecap:"square"}),i.jsx("path",{d:"M4.4 5.2h2M9.6 5.2h2",stroke:"#a8a29e",strokeWidth:"0.7"})]})}function WK({className:e,title:t,decorative:n}){return i.jsx("span",{...Gt(t,n),title:t,className:he(e,"inline-block bg-current"),style:{WebkitMaskImage:`url(${jT})`,WebkitMaskPosition:"center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",maskImage:`url(${jT})`,maskPosition:"center",maskRepeat:"no-repeat",maskSize:"contain"}})}function uD({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Gt(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"2",width:"12",height:"12",fill:"#e7e5e4",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M6.2 6.2c.2-1 1-1.7 2-1.7 1.2 0 2 .7 2 1.8 0 .7-.3 1.1-.9 1.5-.6.4-.8.7-.8 1.4",fill:"none",stroke:"#57534e",strokeWidth:"1.1"}),i.jsx("rect",{x:"7.6",y:"11",width:"1",height:"1",fill:"#57534e"})]})}function D2({runtime:e,size:t="sm",className:n,title:s,decorative:r}){const a=Zm(e),l=s??L2(e).label,u=he(P2[t],"shrink-0",n);return a==="claude-code"?i.jsx(TK,{className:u,title:l,decorative:r}):a==="codex"?i.jsx(IK,{className:u,title:l,decorative:r}):a==="terminal"?i.jsx($2,{className:u,title:l,decorative:r}):i.jsx(uD,{className:u,title:l,decorative:r})}function Kn({runtime:e,model:t,size:n="sm",className:s,compact:r=!1,variant:a="badge"}){const l=Zm(e),u=L2(e),f=a==="inline";return i.jsxs("span",{className:he("inline-flex min-w-0 items-center font-mono uppercase tracking-[0.10em]",f?EK[n??"sm"]:CK[n??"sm"],f?AK[l]:he("border",RK[l]),s),title:t?`${u.label} / ${t}`:u.label,children:[i.jsx(D2,{runtime:e,size:n}),i.jsx("span",{className:"truncate",children:r?u.shortLabel:u.label}),t&&!r?i.jsx("span",{className:"truncate text-current/60",children:t}):null]})}function Pe({tool:e,size:t="sm",className:n,title:s,decorative:r}){const a=lD(e),l=s??cD(e).label,u=he(P2[t],"shrink-0",n);return a==="cmux"?i.jsx(MK,{className:u,title:l,decorative:r}):a==="tmux"?i.jsx(OK,{className:u,title:l,decorative:r}):a==="vscode"?i.jsx(LK,{className:u,title:l,decorative:r}):a==="terminal"?i.jsx($2,{className:u,title:l,decorative:r}):a==="file"?i.jsx(PK,{className:u,title:l,decorative:r}):a==="markdown"?i.jsx($K,{className:u,title:l,decorative:r}):a==="config"?i.jsx(DK,{className:u,title:l,decorative:r}):a==="code"?i.jsx(qK,{className:u,title:l,decorative:r}):a==="screenshot"?i.jsx(zK,{className:u,title:l,decorative:r}):a==="proof"?i.jsx(BK,{className:u,title:l,decorative:r}):a==="transcript"?i.jsx(FK,{className:u,title:l,decorative:r}):a==="commit"?i.jsx(HK,{className:u,title:l,decorative:r}):a==="folder"?i.jsx(UK,{className:u,title:l,decorative:r}):a==="skill"?i.jsx(VK,{className:u,title:l,decorative:r}):a==="video"?i.jsx(GK,{className:u,title:l,decorative:r}):a==="trace"?i.jsx(KK,{className:u,title:l,decorative:r}):i.jsx(uD,{className:u,title:l,decorative:r})}function dD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="human"||t.includes("human@")||t.includes("human-")||t.includes("operator")||t.includes("host")}function ym({actor:e,size:t="sm",className:n,title:s,decorative:r}){const a=s??(e||"Operator"),l=he(P2[t],"shrink-0",n);return dD(e)?i.jsx(WK,{className:l,title:a,decorative:r}):Zm(e)!=="unknown"?i.jsx(D2,{runtime:e,size:t,className:n,title:s,decorative:r}):i.jsx($2,{className:l,title:a,decorative:r})}const YK={neutral:"border-stone-300 bg-white/55 text-stone-700",info:"border-sky-300 bg-sky-50/75 text-sky-800",success:"border-emerald-300 bg-emerald-50/75 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/80 text-rose-800"},fD={neutral:"border-stone-400 bg-stone-300",info:"border-sky-400 bg-sky-200",success:"border-emerald-500 bg-emerald-400",warning:"border-amber-400 bg-amber-300",danger:"border-rose-400 bg-rose-300"};function q2(e){const t=e.toLowerCase();return t.includes("mission_control.action_executed")?{label:"Human decision",tone:"success",icon:jN}:t.includes("closure_overdue")||t.includes("overdue")?{label:"Overdue",tone:"danger",icon:ha}:t.includes("approval")?{label:"Needs approval",tone:"warning",icon:jN}:t.includes("human-gate")||t.includes("human")?{label:"Human action",tone:"danger",icon:ha}:t.includes("inbox.denied")?{label:"Inbox denied",tone:"danger",icon:T$}:t.includes("inbox.absorbed")?{label:"Inbox absorbed",tone:"success",icon:L$}:t.includes("shipped")?{label:"Shipped",tone:"success",icon:k2}:t.includes("transition.done")||t.includes("transition.complete")?{label:"Marked done",tone:"success",icon:kd}:t.includes("transition.in-progress")||t.includes("transition.claim")?{label:"In progress",tone:"info",icon:_d}:t.includes("transition.pending")?{label:"Pending",tone:"warning",icon:_d}:t.includes("transition")?{label:"State change",tone:"neutral",icon:Yl}:t.includes("ship")||t.includes("done")||t.includes("complete")?{label:"Completed",tone:"success",icon:kd}:t.includes("unclaim")?{label:"Released",tone:"neutral",icon:VV}:t.includes("claim")?{label:"Claimed",tone:"info",icon:$$}:t.includes("handoff")||t.includes("handed_off")||t.includes("routed")?{label:"Handoff",tone:"info",icon:Km}:t.includes("created")?{label:"Created",tone:"info",icon:I$}:t.includes("queue.updated")||t.includes("queue.item.updated")?{label:"Queue update",tone:"neutral",icon:Yl}:t.includes("progress")?{label:"Progress",tone:"info",icon:Yl}:{label:Qp(e),tone:"neutral",icon:Gm}}function hD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t?t.includes("closeout-pending-ratify")?{label:"Awaiting approval",tone:"warning",icon:jN}:t.includes("human-gate")||t.includes("pending-approval")?{label:"Needs human",tone:"danger",icon:ha}:t.includes("blocked")||t.includes("failed")||t.includes("error")||t.includes("denied")?{label:Qp(e??""),tone:"danger",icon:ha}:t.includes("handed-off")||t.includes("routed")?{label:"Routed",tone:"info",icon:Km}:t.includes("done")||t.includes("complete")||t.includes("closed")||t.includes("shipped")?{label:"Done",tone:"success",icon:kd}:t.includes("in-progress")||t.includes("running")||t.includes("claimed")?{label:"In progress",tone:"info",icon:$$}:t.includes("pending")||t.includes("open")||t.includes("queued")?{label:"Pending",tone:"warning",icon:_d}:t.includes("canceled")||t.includes("cancelled")||t.includes("stopped")?{label:Qp(e??""),tone:"neutral",icon:T$}:{label:Qp(e??""),tone:"neutral",icon:Yl}:{label:"Unknown state",tone:"neutral",icon:Gm}}function z2(e){return{label:"Slice",tone:"success",icon:Gm}}function Jm(e){const t=(e==null?void 0:e.toLowerCase())??"";return t.includes("done")||t.includes("complete")||t.includes("closed")?"success":t.includes("fail")||t.includes("blocked")||t.includes("overdue")?"danger":t.includes("pending")||t.includes("human")||t.includes("approval")?"warning":t.includes("progress")||t.includes("claim")?"info":"neutral"}function tf(e){const t=(e==null?void 0:e.toLowerCase())??"";return t==="active"||t==="in-flight"?"info":Jm(e)}function Qp(e){return e.replace(/[_./-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function pD(e){if(!e)return"unknown";if(e==="human@host")return"human@host";const[t,n]=e.split("@");return n?`${t}@${n}`:e}function B2(e){if(!e)return"unknown";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=new Date,s=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(n.getDate()-1);const a=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(t);return s?`Today ${a}`:t.toDateString()===r.toDateString()?`Yesterday ${a}`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}function Un({token:e,compact:t=!1,testId:n,className:s}){const r=e.icon;return i.jsxs("span",{"data-testid":n,className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",YK[e.tone],s),children:[r?i.jsx(r,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function F2({kind:e,compact:t,testId:n}){return i.jsx(Un,{token:q2(e),compact:t,testId:n})}function H2({state:e,compact:t,testId:n}){return i.jsx(Un,{token:hD(e),compact:t,testId:n})}function U2({count:e,testId:t}){const n=`${e} qitem${e===1?"":"s"}`;return i.jsxs("span",{"data-testid":t,title:n,"aria-label":n,className:"inline-flex shrink-0 items-center gap-1 border border-stone-200 bg-white/45 px-1.5 py-0.5 font-mono text-[9px] tabular-nums text-stone-600",children:[i.jsx(L$,{className:"h-3 w-3",strokeWidth:1.5,"aria-hidden":"true"}),i.jsx("span",{children:e})]})}function V2({tone:e,label:t,testId:n}){return i.jsx("span",{"data-testid":n,"data-tone":e,title:t,"aria-label":t,role:"img",className:he("inline-block h-2.5 w-2.5 shrink-0 rounded-full border",fD[e])})}function pa({tag:e,compact:t=!0}){const n=/urgent|blocked|human/i.test(e)?"danger":/proof|pass|done|ship/i.test(e)?"success":/cycle|phase|qa|review/i.test(e)?"info":"neutral";return i.jsx(Un,{token:{label:e,tone:n},compact:t})}function vm({session:e,muted:t}){return i.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",t?"border-stone-200 bg-white/35 text-stone-500":"border-stone-300 bg-white/55 text-stone-800"),children:[i.jsx(ym,{actor:e,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:pD(e)})]})}function Rc({value:e}){return i.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 border border-stone-200 bg-white/45 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[i.jsx(j2,{className:"h-3 w-3",strokeWidth:1.5}),B2(e)]})}function eg({source:e,destination:t,muted:n}){return!e&&!t?null:i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(vm,{session:e??"unknown source",muted:n}),i.jsx(gm,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(vm,{session:t??"unresolved target",muted:n})]})}function mD({sliceName:e,screenshots:t,onSelect:n,max:s=4,testIdPrefix:r}){return t.length===0?null:i.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.slice(0,s).map(a=>{const l=i.jsx("img",{"data-testid":r?`${r}-${a}`:void 0,src:cd(e,a),alt:a,className:"h-24 w-full border border-stone-200 bg-stone-100 object-cover",loading:"lazy"});return n?i.jsxs("button",{type:"button",onClick:()=>n(a),className:"group relative block w-full text-left focus:outline-none focus:ring-2 focus:ring-stone-900/20",children:[l,i.jsxs("span",{className:"absolute left-1.5 top-1.5 inline-flex items-center gap-1 border border-amber-400/45 bg-white/80 px-1.5 py-0.5 font-mono text-[8px] uppercase tracking-[0.10em] text-amber-950 backdrop-blur-sm",children:[i.jsx(Pe,{tool:a,size:"xs",decorative:!0}),"Proof image"]})]},a):i.jsx("div",{children:l},a)})})}function tg({title:e,badge:t}){return i.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:[i.jsxs("span",{className:"truncate inline-flex items-center gap-1",children:[i.jsx(Pe,{tool:"proof",size:"xs"}),e]}),i.jsx(Un,{token:{label:t,tone:Jm(t)},compact:!0})]})}const QK=2160*60*1e3;function gD(e){return{name:e.name,displayName:e.displayName,status:e.status,rawStatus:e.rawStatus,qitemCount:e.qitemCount,hasProofPacket:e.hasProofPacket,lastActivityAt:e.lastActivityAt,missionId:e.missionId,railItem:e.railItem}}function XK(e,t=Date.now()){if(!e)return!1;const n=Date.parse(e);return Number.isNaN(n)?!1:t-n<=QK}function Cd(e,t=Date.now()){return e.qitemCount>0||e.status==="blocked"?!0:e.status==="active"||e.status==="draft"?!e.lastActivityAt||XK(e.lastActivityAt,t):!1}function Xp(e){if(e.length===0)return"unknown";const t=Date.now();return e.some(n=>n.status==="blocked"&&Cd(n,t))?"blocked":e.some(n=>Cd(n,t))?"active":e.every(n=>n.status==="done")?"shipped":"unknown"}function ZK(e){return e.slices.some(t=>Cd(t))||e.slices.length===0&&e.status!=="shipped"?"current":"archive"}function kN(e){return e.slices.reduce((t,n)=>{if(!n.lastActivityAt)return t;const s=Date.parse(n.lastActivityAt);return Number.isNaN(s)?t:Math.max(t,s)},0)}function ST(e,t){const n=kN(t)-kN(e);return n!==0?n:e.label.localeCompare(t.label)}function xD(e){const t=[],n=[];for(const s of e)ZK(s)==="current"?t.push(s):n.push(s);return{current:t.sort(ST),archive:n.sort(ST)}}function G2(e){const t=[];e.qitemCount>0&&t.push(`${e.qitemCount} qitem${e.qitemCount===1?"":"s"}`);const n=(e.status==="active"||e.status==="draft")&&!Cd(e)?`stale ${e.status}`:e.status;return e.rawStatus&&e.rawStatus!==e.status?t.push(`${n} from ${e.rawStatus}`):t.push(n),e.hasProofPacket&&t.push("proof"),t.join(" · ")}function JK(){const e=rK();return i.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 border-b border-stone-200",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:"Project"}),i.jsxs("button",{type:"button","data-testid":"project-tree-refresh",title:"Refresh slice + file caches",onClick:()=>e.mutate(),disabled:e.isPending,className:"flex items-center gap-1 px-1 py-0.5 text-on-surface-variant hover:text-stone-900 disabled:opacity-50",children:[i.jsx(HV,{className:`h-3 w-3 ${e.isPending?"animate-spin":""}`,"aria-hidden":"true"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide",children:"refresh"})]})]})}function eW({mission:e}){const t=NK(e.fsRoot??null,e.fsPath??null),n=e.fsRoot&&!t.unavailable&&!t.isLoading?t.status:e.status;return i.jsx(jK,{status:n,testId:`project-mission-${e.id}-badge`})}function tW(){const{data:e}=Ym("all"),t=O2(),n=aD(),[s,r]=E.useState({workspace:!0}),a=y=>r(b=>({...b,[y]:!b[y]})),l=e&&"slices"in e?e.slices:[],u=E.useMemo(()=>{const y=new Map;for(const b of l){const v=b.missionId??b.railItem??"unsorted";y.has(v)||y.set(v,[]),y.get(v).push(gD(b))}return y},[l]),f=E.useMemo(()=>{if(!n.unavailable&&n.missions.length>0){const y=new Set,b=n.missions.map(v=>{const w=u.get(v.name)??[];return w.length>0&&y.add(v.name),{id:v.name,label:v.name,status:Xp(w),slices:w,fsRoot:v.root,fsPath:v.path}});for(const[v,w]of u.entries())y.has(v)||b.push({id:v,label:v==="unsorted"?"Unsorted":v,status:Xp(w),slices:w});return b}return Array.from(u.entries()).map(([y,b])=>({id:y,label:y==="unsorted"?"Unsorted":y,status:Xp(b),slices:b}))},[n.unavailable,n.missions,u]),d=E.useMemo(()=>xD(f),[f]);if(!t.isLoading&&t.name===null)return i.jsx("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-3 px-3",children:i.jsxs("div",{"data-testid":"project-no-workspace",className:"border border-outline-variant bg-surface-low px-3 py-3 font-mono text-[10px]",children:[i.jsx("div",{className:"text-stone-900 uppercase tracking-wide font-bold mb-1",children:"No workspace connected"}),i.jsx("p",{className:"text-on-surface-variant mb-2",children:"Configure a workspace root to browse missions and slices."}),i.jsx(Ue,{to:"/settings","data-testid":"project-no-workspace-cta",className:"inline-flex items-center text-stone-900 hover:underline uppercase",children:"Open settings →"})]})});const p=t.name??"loading…",m=(y,b=!1)=>s[y]??b,x=(y,b)=>{const v=b==="current",w=m(`mission-${y.id}`,v);return i.jsxs("li",{"data-testid":`project-mission-${y.id}`,"data-mission-bucket":b,children:[i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button","aria-label":`${w?"Collapse":"Expand"} ${y.label}`,onClick:()=>r(S=>({...S,[`mission-${y.id}`]:!w})),className:"flex h-4 w-4 items-center justify-center","data-testid":`project-mission-toggle-${y.id}`,children:w?i.jsx(fa,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(lr,{className:"h-3 w-3 text-on-surface-variant"})}),i.jsx(Ue,{to:"/project/mission/$missionId",params:{missionId:y.id},"data-testid":`project-mission-link-${y.id}`,className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:y.label}),i.jsx(eW,{mission:y})]}),w?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:y.slices.length===0?i.jsx("li",{className:"px-2 py-0.5 font-mono text-[10px] text-on-surface-variant italic",children:"No slices."}):y.slices.map(S=>{const C=Cd(S)?"current":"archive",k=G2(S);return i.jsx("li",{"data-slice-bucket":C,children:i.jsxs(Ue,{to:"/project/slice/$sliceId",params:{sliceId:S.name},"data-testid":`project-slice-${S.name}`,title:`${S.displayName} — ${k}`,"aria-label":`${S.displayName} (${k})`,className:"flex items-start gap-2 px-2 py-1 font-mono text-xs text-on-surface hover:text-stone-900 hover:bg-surface-low",children:[i.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words leading-snug",children:S.displayName}),i.jsxs("span",{"data-testid":`project-slice-${S.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(U2,{count:S.qitemCount,testId:`project-slice-${S.name}-qitems`}),i.jsx(V2,{tone:tf(S.status),label:S.status,testId:`project-slice-${S.name}-status`})]})]})},S.name)})}):null]},y.id)};return i.jsxs("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-2",children:[i.jsx(JK,{}),i.jsx("ul",{children:i.jsxs("li",{"data-testid":"project-workspace-node",children:[i.jsxs("button",{type:"button",onClick:()=>a("workspace"),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left","data-testid":"project-workspace-toggle",children:[s.workspace?i.jsx(fa,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(lr,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{"data-testid":"project-workspace-label",className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:p}),i.jsx(Ue,{to:"/project","data-testid":"project-workspace-link",onClick:y=>y.stopPropagation(),className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant hover:text-stone-900",children:"open"})]}),m("workspace")?i.jsxs("ul",{className:"ml-4 border-l border-stone-200",children:[n.unavailable&&n.hint?i.jsx("li",{"data-testid":"project-discovery-degraded",className:"px-2 py-1 font-mono text-[9px] text-on-surface-variant italic",title:n.hint,children:"Workspace missions folder unavailable; showing indexed slice grouping. Expected workspace/missions/<mission>/slices/<slice>."}):null,f.length===0?i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No missions yet."}):i.jsxs(i.Fragment,{children:[i.jsxs("li",{"data-testid":"project-mission-section-current",className:"px-2 pt-2 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Current Work · ",d.current.length]}),d.current.length>0?d.current.map(y=>x(y,"current")):i.jsx("li",{"data-testid":"project-mission-section-current-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No current work."}),i.jsxs("li",{"data-testid":"project-mission-section-archive",className:"px-2 pt-3 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Archive · ",d.archive.length]}),d.archive.length>0?d.archive.map(y=>x(y,"archive")):i.jsx("li",{"data-testid":"project-mission-section-archive-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No archived work."})]})]}):null]})})]})}async function nW(e){const t=e?`/api/specs/library?kind=${e}`:"/api/specs/library",n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function sW(e){const t=await fetch(`/api/specs/library/${encodeURIComponent(e)}/review`);if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error??`HTTP ${t.status}`)}return t.json()}function Ac(e){return De({queryKey:["spec-library",e??"all"],queryFn:()=>nW(e)})}function K2(e){return De({queryKey:["spec-library","review",e],queryFn:()=>sW(e),enabled:!!e})}async function rW(){const e=await fetch("/api/specs/library/active-lens");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).activeLens??null}function iW(){return De({queryKey:["spec-library","active-lens"],queryFn:rW,staleTime:0})}async function aW(e,t){const n=await fetch("/api/specs/library/active-lens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({specName:e,specVersion:t})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).activeLens??null}async function oW(){const e=await fetch("/api/specs/library/active-lens",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`)}async function lW(){const e=await fetch("/api/context-packs/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function W2(){return De({queryKey:["context-packs","library"],queryFn:lW,staleTime:3e4})}async function cW(e){const t=await fetch(`/api/context-packs/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function uW(e){return De({queryKey:["context-packs","preview",e],queryFn:()=>cW(e),enabled:!!e,staleTime:3e4})}function dW(){const e=Mt();return sn({mutationFn:async t=>{const n=await fetch(`/api/context-packs/library/${encodeURIComponent(t.id)}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationSession:t.destinationSession,dryRun:t.dryRun??!1})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["context-packs"]})}})}async function fW(){const e=await fetch("/api/agent-images/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function Y2(){return De({queryKey:["agent-images","library"],queryFn:fW,staleTime:3e4})}async function hW(e){const t=await fetch(`/api/agent-images/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function pW(e){return De({queryKey:["agent-images","preview",e],queryFn:()=>hW(e),enabled:!!e,staleTime:3e4})}function mW(){const e=Mt();return sn({mutationFn:async t=>{const n=t.pin?"pin":"unpin",s=await fetch(`/api/agent-images/library/${encodeURIComponent(t.id)}/${n}`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-images"]})}})}async function gW(){const e=await fetch("/api/skills/library");if(e.status===503)return[];if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}function ng(){return De({queryKey:["skills","library"],queryFn:gW,staleTime:3e4})}function xW(e){const t=new URLSearchParams;e!=null&&e.runtime&&t.append("runtime",e.runtime),e!=null&&e.source&&t.append("source",e.source);const n=t.toString();return n.length===0?"/api/plugins":`/api/plugins?${n}`}async function yW(e){const t=await fetch(xW(e));if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function vW(e){const t=await fetch(`/api/plugins/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function bW(e){const t=await fetch(`/api/plugins/${encodeURIComponent(e)}/used-by`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function sg(e={}){return De({queryKey:["plugins","list",e.runtime??"all",e.source??"all"],queryFn:()=>yW(e),staleTime:3e4})}function wW(e){return De({queryKey:["plugins","detail",e],queryFn:()=>vW(e),enabled:e!==null,staleTime:3e4})}function jW(e){return De({queryKey:["plugins","used-by",e],queryFn:()=>bW(e),enabled:e!==null,staleTime:3e4})}function SW(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function yD(e){try{const t=e.replaceAll("-","+").replaceAll("_","/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=atob(n),r=Uint8Array.from(s,a=>a.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function rg(e){return SW(e)}function vD(e){return yD(e)}function bD(e){return yD(e)}function NW(e){return`/specs/skills/${rg(e)}`}function kW(e){const t=e.match(/^\/specs\/skills\/([^/]+)(?:\/file\/([^/]+))?$/);if(!t)return null;const n=t[1];if(!n)return null;const s=vD(n);if(!s)return null;const r=t[2]?bD(t[2]):null;return{skillId:s,filePath:r}}function ip(e){return{id:e.id,name:e.name,entryId:e.id,meta:e.version}}function Li(e){return e.meta?`${e.name} · ${e.meta}`:e.name}function ap({entry:e}){return i.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name})}function _W({def:e,expanded:t,onToggle:n,navigateTo:s,onNavigate:r}){const a=t?fa:lr;return i.jsxs("li",{"data-testid":`specs-section-${e.id}`,children:[s?i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button",onClick:n,"data-testid":`specs-section-toggle-${e.id}`,"aria-label":`${t?"Collapse":"Expand"} ${e.label}`,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-stone-500 hover:text-stone-900",children:i.jsx(a,{className:"h-3 w-3"})}),i.jsx(Ue,{to:s,"data-testid":`specs-section-link-${e.id}`,onClick:r,className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1 hover:underline",children:e.label}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:e.loading?"...":e.entries.length})]}):i.jsxs("button",{type:"button",onClick:n,"data-testid":`specs-section-toggle-${e.id}`,className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx(a,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:e.label}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:e.loading?"...":e.entries.length})]}),t?i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:e.entries.length>0?e.entries.map(l=>i.jsx("li",{className:"px-2 py-0.5",children:l.entryId?i.jsx(Ue,{to:"/specs/library/$entryId",params:{entryId:l.entryId},"data-testid":`specs-leaf-${l.id}`,title:Li(l),"aria-label":Li(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):l.skillId?i.jsx(Ue,{to:"/specs/skills/$skillToken",params:{skillToken:rg(l.skillId)},"data-testid":`specs-leaf-${l.id}`,title:Li(l),"aria-label":Li(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):l.pluginId?i.jsx(Ue,{to:"/plugins/$pluginId",params:{pluginId:l.pluginId},"data-testid":`specs-leaf-${l.id}`,title:Li(l),"aria-label":Li(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):i.jsx("div",{"data-testid":`specs-leaf-${l.id}`,title:Li(l),"aria-label":Li(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface",children:i.jsx(ap,{entry:l})})},l.id)):i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:e.loading?"Loading...":`No ${e.label.toLowerCase()} yet.`})}):null]})}function CW(){const e=ya(),{data:t=[],isLoading:n}=Ac(),{data:s=[],isLoading:r}=W2(),{data:a=[],isLoading:l}=Y2(),{data:u=[],isLoading:f}=ng(),{data:d=[],isLoading:p}=sg(),m=kW(e.location.pathname),[x,y]=E.useState({"rig-specs":!0,"workspace-specs":!1,"workflow-specs":!1,"context-packs":!1,"agent-specs":!1,"agent-images":!1,applications:!1,skills:!1,plugins:!1}),[b,v]=E.useState({}),w=k=>y(_=>({..._,[k]:!_[k]})),S=k=>v(_=>({..._,[k]:!_[k]})),C=E.useMemo(()=>{const k=t.filter(A=>A.kind==="rig"&&!A.hasServices).map(ip),_=t.filter(A=>A.kind==="workflow").map(ip),R=t.filter(A=>A.kind==="agent").map(ip),T=t.filter(A=>A.kind==="rig"&&A.hasServices).map(ip);return[{id:"rig-specs",label:"Rig Specs",entries:k,loading:n},{id:"workspace-specs",label:"Workspace Specs",entries:[]},{id:"workflow-specs",label:"Workflow Specs",entries:_,loading:n},{id:"context-packs",label:"Context Packs",entries:s.map(A=>({id:A.id,name:A.name,entryId:A.id,meta:`${A.version} · ${A.sourceType}`})),loading:r},{id:"agent-specs",label:"Agent Specs",entries:R,loading:n},{id:"agent-images",label:"Agent Images",entries:a.map(A=>({id:A.id,name:A.name,entryId:A.id,meta:A.version,metaNode:i.jsx(Kn,{runtime:A.runtime,size:"xs",compact:!0,variant:"inline"})})),loading:l},{id:"applications",label:"Applications",entries:T,loading:n},{id:"plugins",label:"Plugins",entries:d.map(A=>({id:A.id,name:A.name,pluginId:A.id,meta:A.version})),loading:p},{id:"skills",label:"Skills",entries:u.map(A=>({id:A.id,name:A.name,skillId:A.id})),loading:f}]},[a,l,s,r,t,d,p,u,f,n]);return i.jsxs("div",{"data-testid":"specs-tree-view",className:"flex-1 overflow-y-auto py-2",children:[i.jsx("div",{className:"px-2 mb-2",children:i.jsxs(Ue,{to:"/specs","data-testid":"specs-tree-overview-link",className:"block font-mono text-[11px] uppercase tracking-wide text-stone-900 px-2 py-1 hover:bg-surface-low",children:["> ","Library"]})}),i.jsx("ul",{children:C.map(k=>{if(k.id!=="skills"){const T=k.id==="plugins"?"/specs/plugins":void 0;return i.jsx(_W,{def:k,expanded:!!x[k.id],onToggle:()=>w(k.id),navigateTo:T,onNavigate:T?()=>y(A=>({...A,[k.id]:!0})):void 0},k.id)}const _=x.skills||!!m,R=_?fa:lr;return i.jsxs("li",{"data-testid":"specs-section-skills",children:[i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button",onClick:()=>w("skills"),"data-testid":"specs-section-toggle-skills","aria-label":`${_?"Collapse":"Expand"} Skills`,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-stone-500 hover:text-stone-900",children:i.jsx(R,{className:"h-3 w-3"})}),i.jsx(Ue,{to:"/specs/skills","data-testid":"specs-section-link-skills",onClick:()=>y(T=>({...T,skills:!0})),className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1 hover:underline",children:"Skills"}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:f?"...":u.length})]}),_?i.jsx(RW,{skills:u,loading:f,activeSkillId:(m==null?void 0:m.skillId)??null,expandedCategories:b,onToggleCategory:S}):null]},k.id)})})]})}function EW(e){const t=e.replace(/^[^:]+:/,"");if(t.startsWith("workspace:")||e.startsWith("workspace:"))return"workspace";const n=t.indexOf("/");return n===-1?"(uncategorized)":t.slice(0,n)}function RW({skills:e,loading:t,activeSkillId:n,expandedCategories:s,onToggleCategory:r}){if(t&&e.length===0)return i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"Loading..."})});if(e.length===0)return i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No skills yet."})});const a=new Map;for(const u of e){const f=EW(u.id),d=a.get(f)??[];d.push(u),a.set(f,d)}const l=Array.from(a.entries()).sort(([u],[f])=>u.localeCompare(f));return i.jsx("ul",{className:"ml-5 border-l border-stone-200","data-testid":"skills-category-tree",children:l.map(([u,f])=>{const d=`category:${u}`,p=!!s[d]||f.some(x=>x.id===n),m=p?fa:lr;return i.jsxs("li",{"data-testid":`skills-category-${u}`,children:[i.jsxs("button",{type:"button",onClick:()=>r(d),"data-testid":`skills-category-toggle-${u}`,className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[i.jsx(m,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 flex-1",children:u}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:f.length})]}),p&&i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:f.map(x=>i.jsx("li",{className:"px-2 py-0.5",children:i.jsxs(Ue,{to:"/specs/skills/$skillToken",params:{skillToken:rg(x.id)},"data-testid":`specs-leaf-${x.id}`,className:"flex min-w-0 items-center gap-1.5 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:[i.jsx(Pe,{tool:"skill",size:"xs",title:`${x.name} skill`,decorative:!0}),i.jsx("span",{className:"truncate",children:x.name})]})},x.id))})]},u)})})}const AW=[{id:"settings",label:"Settings",href:"/settings",isActive:e=>e==="/settings"},{id:"policies",label:"Policies",href:"/settings/policies",isActive:e=>e.startsWith("/settings/policies")},{id:"log",label:"Log",href:"/settings/log",isActive:e=>e.startsWith("/settings/log")},{id:"status",label:"Status",href:"/settings/status",isActive:e=>e.startsWith("/settings/status")}];function TW(){const t=ya().location.pathname;return i.jsxs("div",{"data-testid":"settings-explorer",className:"flex-1 overflow-y-auto py-2",children:[i.jsx("div",{className:"px-2 mb-2",children:i.jsxs("span",{"data-testid":"settings-explorer-heading",className:"block font-mono text-[11px] uppercase tracking-wide text-stone-900 px-2 py-1",children:["> ","Settings"]})}),i.jsx("ul",{className:"px-2 space-y-0.5",children:AW.map(n=>{const s=n.isActive(t);return i.jsx("li",{children:i.jsx(Ue,{to:n.href,"data-testid":`settings-explorer-item-${n.id}`,"data-active":s,className:he("block font-mono text-[11px] uppercase tracking-wide px-2 py-1",s?"bg-stone-900 text-stone-50":"text-stone-700 hover:text-stone-900 hover:bg-surface-low"),children:n.label})},n.id)})})]})}async function IW(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Q2(e){return De({queryKey:["rig",e,"nodes"],queryFn:()=>IW(e),enabled:!!e,refetchInterval:3e4})}function ir(e){if(!e)return null;const t=e.split(".");return t.length<=1?e:t[0]??e}function Ql(e){return e&&e.length>0?e:"ungrouped"}function ig(e){if(!e)return"unknown";const t=e.split(".");return t.length<=1?e:t.at(-1)??e}function MW(){const e=ya({select:r=>r.location.pathname}),t=e.match(/^\/topology\/seat\/([^/]+)\/(.+)$/);if(t){const r=decodeURIComponent(t[1]),a=decodeURIComponent(t[2]),l=ir(a)??"default";return{rigId:r,podName:l,logicalId:a}}const n=e.match(/^\/topology\/pod\/([^/]+)\/([^/]+)$/);if(n)return{rigId:decodeURIComponent(n[1]),podName:decodeURIComponent(n[2]),logicalId:null};const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?{rigId:decodeURIComponent(s[1]),podName:null,logicalId:null}:{rigId:null,podName:null,logicalId:null}}function OW({rigId:e,logicalId:t,label:n,runtime:s,isActive:r}){return i.jsx("li",{className:"px-2 py-0.5 hover:bg-surface-low",children:i.jsxs(Ue,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(t)},"data-testid":`topology-seat-${e}-${t}`,"data-active":r,className:he("flex w-full min-w-0 items-center gap-1.5 font-mono text-xs",r?"text-stone-900 font-bold":"text-on-surface hover:text-stone-900"),children:[i.jsx(D2,{runtime:s,size:"xs"}),i.jsx("span",{className:"truncate",children:n})]})})}function LW({rigId:e,podName:t,seats:n,activeRigId:s,activePodName:r,activeLogicalId:a}){const[l,u]=E.useState(!1),f=s===e&&r===t;return E.useEffect(()=>{f&&!l&&u(!0)},[f,l]),i.jsxs("li",{"data-testid":`topology-pod-${e}-${t}`,children:[i.jsxs("button",{type:"button",onClick:()=>u(d=>!d),className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[l?i.jsx(fa,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(lr,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ue,{to:"/topology/pod/$rigId/$podName",params:{rigId:e,podName:t},onClick:d=>d.stopPropagation(),className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:Ql(t)}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:n.length})]}),l?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:n.map(d=>i.jsx(OW,{rigId:e,logicalId:d.logicalId,label:d.label,runtime:d.runtime,isActive:s===e&&a===d.logicalId},d.logicalId))}):null]})}function PW({rigId:e,rigName:t,activeRigId:n,activePodName:s,activeLogicalId:r}){const a=n===e,[l,u]=E.useState(!1);E.useEffect(()=>{a&&!l&&u(!0)},[a,l]);const f=l||a,{data:d}=Q2(f?e:null),p=new Map;for(const x of d??[]){const y=ir(x.logicalId)??"default";p.has(y)||p.set(y,[]),p.get(y).push({logicalId:x.logicalId,label:x.canonicalSessionName??x.logicalId,runtime:x.runtime})}const m=Array.from(p.entries());return i.jsxs("li",{"data-testid":`topology-rig-${e}`,children:[i.jsxs("button",{type:"button",onClick:()=>u(x=>!x),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[l?i.jsx(fa,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(lr,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ue,{to:"/topology/rig/$rigId",params:{rigId:e},onClick:x=>x.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 truncate hover:underline",children:t})]}),l?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:m.length===0?i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"Loading…"}):m.map(([x,y])=>i.jsx(LW,{rigId:e,podName:x,seats:y,activeRigId:n,activePodName:s,activeLogicalId:r},x))}):null]})}function $W(){const{data:e}=dr(),[t,n]=E.useState(!0),{rigId:s,podName:r,logicalId:a}=MW();return i.jsx("div",{"data-testid":"topology-tree-view",className:"flex-1 overflow-y-auto py-2",children:i.jsx("ul",{children:i.jsxs("li",{"data-testid":"topology-host-localhost",children:[i.jsxs("button",{type:"button",onClick:()=>n(l=>!l),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[t?i.jsx(fa,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(lr,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(EV,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ue,{to:"/topology",onClick:l=>l.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 hover:underline",children:"localhost"}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:(e==null?void 0:e.length)??0})]}),t?i.jsx("ul",{className:"ml-5",children:e&&e.length>0?e.map(l=>i.jsx(PW,{rigId:l.id,rigName:l.name,activeRigId:s,activePodName:r,activeLogicalId:a},l.id)):i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No rigs."})}):null]})})})}const DW={approvals:"feed.subscriptions.approvals",shipped:"feed.subscriptions.shipped",progress:"feed.subscriptions.progress",auditLog:"feed.subscriptions.audit_log"},_l={actionRequired:!0,approvals:!0,shipped:!0,progress:!0,auditLog:!1};function Bu(e,t){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}return t}function wD(){var u,f,d,p,m;const{data:e,error:t}=ba(),n=M2(),s=e==null?void 0:e.settings,r=!!t||!s,a=r?_l:{actionRequired:Bu((u=s==null?void 0:s["feed.subscriptions.action_required"])==null?void 0:u.value,_l.actionRequired),approvals:Bu((f=s==null?void 0:s["feed.subscriptions.approvals"])==null?void 0:f.value,_l.approvals),shipped:Bu((d=s==null?void 0:s["feed.subscriptions.shipped"])==null?void 0:d.value,_l.shipped),progress:Bu((p=s==null?void 0:s["feed.subscriptions.progress"])==null?void 0:p.value,_l.progress),auditLog:Bu((m=s==null?void 0:s["feed.subscriptions.audit_log"])==null?void 0:m.value,_l.auditLog)};return{state:a,toggle:x=>{const y=DW[x],b=a[x];n.mutate({key:y,value:b?"false":"true"})},isMutating:n.isPending,unavailable:r}}function qW(e,t){switch(e){case"action-required":return t.actionRequired;case"approval":return t.approvals;case"shipped":return t.shipped;case"progress":return t.progress;case"observation":return t.auditLog}}const zW=[{toggleKey:null,label:"Action required",description:"Items the human must act on",forced:!0,testId:"subscription-toggle-action-required"},{toggleKey:"approvals",label:"Approvals",description:"Closeout-pending-ratify items",testId:"subscription-toggle-approvals"},{toggleKey:"shipped",label:"Feature ships",description:"Slice / mission deliveries + git tag landings",testId:"subscription-toggle-shipped"},{toggleKey:"progress",label:"Slice progress",description:"Compact progress rollups",testId:"subscription-toggle-progress"},{toggleKey:"auditLog",label:"Audit log",description:"Verbose stream + watchdog observations",testId:"subscription-toggle-audit-log"}];function BW(){const{state:e,toggle:t,isMutating:n,unavailable:s}=wD();return i.jsxs("div",{"data-testid":"subscription-toggle-list",className:"font-mono text-xs",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant mb-2",children:"Subscriptions"}),i.jsx("ul",{className:"space-y-1",children:zW.map(r=>{const a=r.toggleKey===null?e.actionRequired:e[r.toggleKey],l=!r.forced&&!s;return i.jsxs("li",{"data-testid":r.testId,"data-on":a?"true":"false",className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900 truncate",children:r.label}),i.jsx("div",{className:"font-mono text-[9px] text-on-surface-variant truncate",children:r.description})]}),r.forced?i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant shrink-0",children:"forced ON"}):i.jsx("button",{type:"button",role:"switch","aria-checked":a,disabled:!l||n,"data-testid":`${r.testId}-button`,onClick:()=>r.toggleKey&&t(r.toggleKey),className:"shrink-0 px-2 py-0.5 border font-mono text-[9px] uppercase tracking-wide "+(a?"border-success text-success":"border-stone-300 text-on-surface-variant")+(l?" hover:bg-stone-100/60":" opacity-60 cursor-not-allowed"),children:a?"on":"off"})]},r.testId)})}),s?i.jsxs("p",{"data-testid":"subscription-toggle-unavailable",className:"mt-3 font-mono text-[9px] text-on-surface-variant italic",children:["Settings endpoint unreachable (legacy daemon < v0.3.0). Toggles render the canonical defaults; configure via CLI:",i.jsx("code",{className:"ml-1 text-stone-700",children:"rig config set feed.subscriptions.<kind> true|false"})]}):null]})}function NT(e,t){return e==="topology"&&!t}function FW(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function HW({surface:e,rigs:t,psMap:n,selection:s,onSelect:r,onClose:a,currentRigId:l}){return e==="topology"?i.jsx($W,{}):e==="project"?i.jsx(tW,{}):e==="specs"?i.jsx(CW,{}):e==="settings"?i.jsx(TW,{}):e==="for-you"?i.jsx("div",{"data-testid":"explorer-for-you-subscriptions",className:"flex-1 overflow-y-auto py-3 px-3",children:i.jsx(BW,{})}):null}function UW({open:e,onClose:t,selection:n,onSelect:s,desktopMode:r="full",surface:a="topology",onDesktopToggle:l=()=>{},overlayMode:u="opaque"}){const d=ya().location.pathname,p=FW(d),{data:m}=dr(),{data:x}=Wm(),y=new Map((x??[]).map(w=>[w.rigId,w]));if(a==="none")return null;const b=u==="overlay";return r==="hidden"?i.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","data-explorer-collapsed":"true","aria-label":"Expand explorer",onClick:l,className:he("hidden lg:flex fixed top-[5.5rem] left-[3.5rem] z-30 h-8 w-8 items-center justify-center","rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors","hover:bg-stone-100 hover:text-stone-900"),children:i.jsx(lr,{className:"h-4 w-4",strokeWidth:1.5})}):i.jsx("aside",{"data-testid":"explorer","data-surface":a,"data-explorer-mode":u,"data-explorer-collapsed":"false",className:he("border-r border-outline-variant flex overflow-hidden",b?"vellum z-30 shadow-[6px_0_14px_rgba(46,52,46,0.06)]":"z-40 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[6px_0_14px_rgba(46,52,46,0.04)]","fixed top-14 bottom-0 left-0 transition-transform duration-200 ease-tactical w-72 max-w-[80vw]",e?"translate-x-0":"-translate-x-full","lg:absolute lg:top-0 lg:bottom-0 lg:left-12 lg:w-72 lg:max-w-none lg:translate-x-0"),children:i.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[i.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","aria-label":"Collapse explorer",onClick:l,className:he("hidden lg:flex absolute z-10 h-8 w-8 items-center justify-center rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors hover:bg-stone-100 hover:text-stone-900","right-2 top-3"),children:i.jsx(cV,{className:"h-4 w-4",strokeWidth:1.5})}),i.jsx(HW,{surface:a,rigs:m,psMap:y,selection:n,onSelect:s,onClose:t,currentRigId:p})]})})}const VW="/api/events";class GW{constructor(){ns(this,"eventSource",null);ns(this,"eventListeners",new Set);ns(this,"statusListeners",new Set);ns(this,"replayEvents",[]);ns(this,"connected",!1);ns(this,"reconnecting",!1)}subscribe(t){this.eventListeners.add(t),this.ensureConnected();for(const n of this.replayEvents)t(n.event,n.rawData);return()=>{this.eventListeners.delete(t),this.closeIfIdle()}}subscribeStatus(t){return this.statusListeners.add(t),t(this.snapshot()),this.ensureConnected(),()=>{this.statusListeners.delete(t),this.closeIfIdle()}}snapshot(){return{connected:this.connected,reconnecting:this.reconnecting}}ensureConnected(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(VW);this.eventSource=t,t.addEventListener("open",()=>{this.connected=!0,this.reconnecting=!1,this.emitStatus()}),t.addEventListener("error",()=>{this.connected=!1,this.reconnecting=!0,this.emitStatus()}),t.addEventListener("message",n=>{const s=n.data;if(typeof s!="string")return;let r=null;try{r=JSON.parse(s)}catch{return}if(!r||typeof r!="object")return;const a=r;this.replayEvents=[...this.replayEvents,{event:a,rawData:s}].slice(-100);for(const l of[...this.eventListeners])l(a,s)})}closeIfIdle(){this.eventListeners.size>0||this.statusListeners.size>0||(this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.replayEvents=[],this.connected=!1,this.reconnecting=!1)}emitStatus(){const t=this.snapshot();for(const n of[...this.statusListeners])n(t)}}const jD=new GW;function ag(e){return jD.subscribe(e)}function SD(e){return jD.subscribeStatus(e)}const _N=100;function X2(){const e=Mt(),[t,n]=E.useState([]),[s,r]=E.useState(!1),[a,l]=E.useState(!1),u=E.useCallback(f=>{const d={seq:typeof f.seq=="number"?f.seq:Date.now(),type:f.type??"unknown",payload:f,createdAt:f.createdAt??new Date().toISOString(),receivedAt:Date.now()};if(n(p=>[d,...p].slice(0,_N)),(d.type==="package.installed"||d.type==="package.rolledback")&&e.invalidateQueries({queryKey:["packages"]}),(d.type==="bootstrap.completed"||d.type==="bootstrap.partial")&&e.invalidateQueries({queryKey:["rigs","summary"]}),(d.type==="session.discovered"||d.type==="session.vanished")&&e.invalidateQueries({queryKey:["discovery"]}),d.type==="mission_control.action_executed"){e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["slices"]});const p=d.payload.qitemId;p&&e.invalidateQueries({queryKey:["queue","item",p]})}if(d.type==="node.claimed"){e.invalidateQueries({queryKey:["discovery"]});const p=d.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]}),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]}))}if(d.type==="session.detached"&&e.invalidateQueries({queryKey:["discovery"]}),d.type==="session.detached"||d.type==="node.removed"||d.type==="pod.deleted"||d.type==="rig.expanded"||d.type==="restore.completed"||d.type==="rig.deleted"){const p=d.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]})),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]})}},[e]);return E.useEffect(()=>{const f=ag(p=>u(p)),d=SD(p=>{r(p.connected)});return()=>{f(),d()}},[u]),{events:t,connected:s,feedOpen:a,setFeedOpen:l}}function Fy(e){return String(e).padStart(2,"0")}function op(e,t=6){return typeof e!="string"||e.length===0?null:e.slice(-t)}function lp(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g," ").trim();return t.length>0?t:null}function KW(e){const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"??:??:??":`${Fy(t.getHours())}:${Fy(t.getMinutes())}:${Fy(t.getSeconds())}`}function WW(e){return e==="bundle.created"||e.startsWith("bootstrap.")?"bg-accent":e.startsWith("package.")?"bg-primary":e.startsWith("rig.")?"bg-accent":e.startsWith("snapshot.")?"bg-primary":e.startsWith("restore.")?"bg-warning":e==="chat.message"?"bg-primary":e==="node.startup_ready"?"bg-green-500":e==="node.startup_pending"?"bg-amber-400":e==="node.startup_failed"||e==="session.detached"?"bg-destructive":e==="session.discovered"?"bg-accent":e==="session.vanished"?"bg-destructive":e==="node.claimed"||e==="node.launched"?"bg-primary":"bg-foreground-muted-on-dark"}function YW(e){var d;const t=e.payload,n=op(t.rigId),s=op(t.snapshotId),r=op(t.installId),a=op(t.nodeId),l=lp(t.logicalId),u=lp(t.sender),f=lp(t.body);switch(e.type){case"bootstrap.planned":return`bootstrap planned ${t.sourceRef}`;case"bootstrap.started":return`bootstrap started ${t.sourceRef}`;case"bootstrap.completed":return n?`bootstrap rig#${n} completed`:"bootstrap completed";case"bootstrap.partial":return`bootstrap partial ${t.completed} ok ${t.failed} failed`;case"bootstrap.failed":return`error bootstrap ${t.error}`;case"package.validated":return`package ${t.packageName} validated`;case"package.planned":return`package ${t.packageName} planned ${t.actionable} actionable ${t.deferred} deferred`;case"package.installed":return`package ${t.packageName}@${t.packageVersion} ${t.applied} applied ${t.deferred} deferred`;case"package.rolledback":return r?`rollback install#${r} restored ${t.restored}`:`rollback restored ${t.restored}`;case"package.install_failed":return`error package ${t.packageName} ${t.message}`;case"rig.created":return n?`rig rig#${n} created`:"rig created";case"rig.deleted":return n?`rig rig#${n} deleted`:"rig deleted";case"rig.imported":return n?`import ${t.specName} rig#${n} created`:`import ${t.specName} created`;case"snapshot.created":return n&&s?`snapshot rig#${n} ${t.kind} snap#${s}`:`snapshot ${t.kind}`;case"restore.started":return n?`restore rig#${n} started`:"restore started";case"restore.completed":{const p=Array.isArray(t.result)?t.result:((d=t.result)==null?void 0:d.nodes)??[];return n?`restore rig#${n} ${p.length} nodes restored`:`restore ${p.length} nodes restored`}case"node.launched":return`startup ${l??lp(t.nodeId)??"unknown"} launched`;case"node.startup_pending":return a?`startup node#${a} pending`:"startup pending";case"node.startup_ready":return a?`startup node#${a} ready`:"startup ready";case"node.startup_failed":return a?`error startup node#${a} ${t.error}`:`error startup ${t.error}`;case"session.detached":return`error session ${t.sessionName} lost`;case"bundle.created":return`bundle ${t.bundleName} v${t.bundleVersion} bundled`;case"session.discovered":return`discover ${t.tmuxSession}:${t.tmuxPane} ${t.runtimeHint}`;case"session.vanished":return`error ${t.tmuxSession}:${t.tmuxPane} vanished`;case"node.claimed":return n?`claim ${t.logicalId} rig#${n}`:`claim ${t.logicalId}`;case"chat.message":return`chat ${u??"unknown"}: ${f??""}`.trim();default:return e.type}}function QW(e){const n=e.payload.rigId;if(e.type==="session.discovered"||e.type==="session.vanished")return"/discovery";if(e.type==="node.claimed"){const s=e.payload.rigId;return s?`/rigs/${s}`:"/discovery"}return e.type.startsWith("bootstrap.")||e.type.startsWith("package.")?"/bootstrap":n?`/rigs/${n}`:null}function XW({events:e}){const t=zt(),n=e.length>=_N;return i.jsxs("div",{"data-testid":"feed-scroll-region",className:"relative z-10 overflow-y-auto flex-1 min-h-0",children:[i.jsxs("div",{"data-testid":"feed-disclosure",className:"px-spacing-3 py-2 border-b border-stone-300/20 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-500",children:["Showing last ",_N," live events in this panel."]}),e.length===0?i.jsx("div",{"data-testid":"feed-empty",className:"px-spacing-3 py-spacing-4 font-mono text-[10px] text-stone-500 text-center",children:"No recent log entries"}):i.jsxs(i.Fragment,{children:[e.map(s=>{const r=QW(s),a=r!==null;return i.jsxs("div",{"data-testid":"feed-entry","data-event-type":s.type,role:a?"link":void 0,tabIndex:a?0:void 0,onClick:a?()=>t({to:r}):void 0,onKeyDown:a?l=>{l.key==="Enter"&&t({to:r})}:void 0,className:he("flex items-center gap-2 px-spacing-3 py-1.5 border-b border-stone-300/20 transition-colors duration-150 ease-tactical font-mono text-[10px] leading-4",a&&"cursor-pointer hover:bg-white/24"),children:[i.jsx("span",{"data-testid":"feed-dot",className:he("inline-block h-[6px] w-[6px] shrink-0",WW(s.type))}),i.jsx("span",{"data-testid":"feed-time",className:"shrink-0 text-[9px] text-stone-500 tabular-nums",children:KW(s.createdAt)}),i.jsx("span",{"data-testid":"feed-summary",className:"min-w-0 flex-1 truncate text-stone-900",children:YW(s)})]},s.seq)}),n?i.jsx("div",{"data-testid":"feed-end-of-history",className:"px-spacing-3 py-2 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-400 text-center",children:"Older events are not loaded in this panel yet."}):null]})]})}function xs({label:e,settingKey:t,resolved:n,testIdPrefix:s}){const[r,a]=E.useState(!1),[l,u]=E.useState(String(n.value??"")),[f,d]=E.useState(null),p=M2(),m=uK(),x=n.source!=="default",y=async()=>{d(null);try{await p.mutateAsync({key:t,value:l}),a(!1)}catch(v){d(v.message)}},b=async()=>{d(null);try{await m.mutateAsync(t)}catch(v){d(v.message)}};return i.jsxs("div",{"data-testid":`${s}-${t}`,className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:e}),i.jsxs("span",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500 shrink-0",children:["source: ",n.source]})]}),r?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{"data-testid":`${s}-${t}-input`,value:l,onChange:v=>u(v.target.value),className:"w-full border border-stone-300 bg-white/80 px-2 py-1 font-mono text-[10px]"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{"data-testid":`${s}-${t}-save`,onClick:()=>void y(),disabled:p.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Save"}),i.jsx("button",{onClick:()=>{a(!1),u(String(n.value??"")),d(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}):i.jsxs("div",{className:"space-y-0.5",children:[i.jsx("div",{className:"font-mono text-[10px] text-stone-800 break-all",children:String(n.value??"")}),i.jsxs("div",{className:"font-mono text-[8px] text-stone-500 break-all",children:["default: ",String(n.defaultValue??"")]}),i.jsxs("div",{className:"flex gap-1 pt-1",children:[i.jsx("button",{"data-testid":`${s}-${t}-edit`,onClick:()=>{a(!0),d(null)},className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Edit"}),x&&i.jsx("button",{"data-testid":`${s}-${t}-reset`,onClick:()=>void b(),disabled:m.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Reset"})]})]}),f&&i.jsx("div",{"data-testid":`${s}-${t}-error`,className:"font-mono text-[9px] text-red-600",children:f})]})}function Fu({title:e,children:t}){return i.jsxs("section",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),i.jsx("div",{className:"space-y-1",children:t})]})}function ND(){const{data:e,isLoading:t,error:n}=ba(),s=dK(),[r,a]=E.useState(null),[l,u]=E.useState(null),f=async()=>{u(null),a(null);try{const p=await s.mutateAsync({});a(`Initialized at ${p.root} — created ${p.subdirs.filter(m=>m.created).length} subdir(s).`)}catch(p){u(p.message)}};if(t)return i.jsx("div",{"data-testid":"settings-loading",className:"px-4 py-3 font-mono text-[10px] text-stone-400",children:"Loading settings…"});if(n||!e){const p=(n==null?void 0:n.message)??"",m=p.includes("404");return i.jsx("div",{"data-testid":"settings-error",className:"px-4 py-6 font-mono text-xs text-on-surface-variant border border-outline-variant bg-surface-low",children:m?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings UI requires daemon ≥ v0.3.0"}),i.jsx("p",{className:"mb-2",children:"The shipped daemon doesn't expose the settings HTTP route yet. Until that lands, configure via the CLI:"}),i.jsx("pre",{className:"font-mono text-[10px] bg-stone-50 border border-outline-variant px-2 py-1 inline-block",children:"rig config get / set / reset"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings unavailable"}),i.jsx("p",{children:p||"Daemon is unreachable."})]})})}const d=e.settings;return i.jsxs("div",{"data-testid":"settings-tab",className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[i.jsxs(Fu,{title:"Workspace",children:[i.jsx(xs,{label:"Workspace root",settingKey:"workspace.root",resolved:d["workspace.root"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Mission/slice root",settingKey:"workspace.slices_root",resolved:d["workspace.slices_root"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Steering path",settingKey:"workspace.steering_path",resolved:d["workspace.steering_path"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Field notes root",settingKey:"workspace.field_notes_root",resolved:d["workspace.field_notes_root"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Specs root",settingKey:"workspace.specs_root",resolved:d["workspace.specs_root"],testIdPrefix:"setting"}),i.jsx("button",{"data-testid":"settings-init-workspace",onClick:()=>void f(),disabled:s.isPending,className:"mt-2 font-mono text-[9px] uppercase border border-stone-400 px-2 py-1 hover:bg-stone-200 disabled:opacity-50",children:s.isPending?"Initializing…":"Init Workspace"}),r&&i.jsx("div",{"data-testid":"settings-init-result",className:"font-mono text-[9px] text-stone-600",children:r}),l&&i.jsx("div",{"data-testid":"settings-init-error",className:"font-mono text-[9px] text-red-600",children:l})]}),i.jsx(Fu,{title:"Files (browser allowlist)",children:i.jsx(xs,{label:"Allowlist (name:/abs/path,...)",settingKey:"files.allowlist",resolved:d["files.allowlist"],testIdPrefix:"setting"})}),i.jsx(Fu,{title:"Progress",children:i.jsx(xs,{label:"Scan roots (name:/abs/path,...)",settingKey:"progress.scan_roots",resolved:d["progress.scan_roots"],testIdPrefix:"setting"})}),i.jsxs(Fu,{title:"Daemon (legacy)",children:[i.jsx(xs,{label:"Port",settingKey:"daemon.port",resolved:d["daemon.port"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Host",settingKey:"daemon.host",resolved:d["daemon.host"],testIdPrefix:"setting"})]}),i.jsxs(Fu,{title:"Database / Transcripts (legacy)",children:[i.jsx(xs,{label:"DB path",settingKey:"db.path",resolved:d["db.path"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Transcripts enabled",settingKey:"transcripts.enabled",resolved:d["transcripts.enabled"],testIdPrefix:"setting"}),i.jsx(xs,{label:"Transcripts path",settingKey:"transcripts.path",resolved:d["transcripts.path"],testIdPrefix:"setting"})]})]})}async function ZW(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function JW(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function cp(e){return e===null?"text-stone-500":e?"text-green-600":"text-amber-600"}function kT(e,t,n,s="unknown"){return e===null?s:e?t:n}function eY({onClose:e,events:t,initialTab:n="log"}){var d;const[s,r]=E.useState(n);E.useEffect(()=>{r(n)},[n]);const a=De({queryKey:["daemon","health"],queryFn:ZW,refetchInterval:1e4,retry:!1}),l=De({queryKey:["daemon","cmux"],queryFn:JW,refetchInterval:3e4,retry:!1}),u=a.isSuccess,f=u?((d=l.data)==null?void 0:d.available)??null:null;return i.jsxs("aside",{"data-testid":"system-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[i.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"system"}),i.jsx("button",{"data-testid":"system-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),i.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"system-tabs",children:[i.jsx("button",{"data-testid":"system-tab-log",onClick:()=>r("log"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="log"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Recent Log"}),i.jsx("button",{"data-testid":"system-tab-status",onClick:()=>r("status"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="status"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Status"}),i.jsx("button",{"data-testid":"system-tab-settings",onClick:()=>r("settings"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="settings"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Settings"})]}),s==="log"&&i.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden","data-testid":"system-log-tab",children:i.jsx(XW,{events:t})}),s==="status"&&i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4","data-testid":"system-status-tab",children:i.jsxs("section",{className:"border border-stone-300/28 bg-white/12 px-3 py-3",children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:"Runtime"}),i.jsxs("div",{className:"space-y-3 font-mono text-[10px]",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(XV,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${cp(u)}`}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900",children:"Daemon"}),i.jsx("div",{"data-testid":"system-daemon-status",className:cp(u),children:kT(u,"connected","unavailable")}),i.jsx("div",{className:"text-stone-500",children:"Controls the local OpenRig daemon connection."})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Pe,{tool:"cmux",size:"sm",className:`mt-[1px] ${cp(f)}`}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900",children:"cmux control"}),i.jsx("div",{"data-testid":"system-cmux-status",className:cp(f),children:kT(f,"available","unavailable")}),i.jsx("div",{className:"text-stone-500",children:"OpenRig can control cmux surfaces for node open-or-focus."})]})]})]})]})}),s==="settings"&&i.jsx(ND,{})]})}function _T(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Z2(...e){return t=>{let n=!1;const s=e.map(r=>{const a=_T(r,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let r=0;r<s.length;r++){const a=s[r];typeof a=="function"?a():_T(e[r],null)}}}}function To(...e){return E.useCallback(Z2(...e),e)}var tY=Symbol.for("react.lazy"),bm=c2[" use ".trim().toString()];function nY(e){return typeof e=="object"&&e!==null&&"then"in e}function kD(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===tY&&"_payload"in e&&nY(e._payload)}function sY(e){const t=iY(e),n=E.forwardRef((s,r)=>{let{children:a,...l}=s;kD(a)&&typeof bm=="function"&&(a=bm(a._payload));const u=E.Children.toArray(a),f=u.find(oY);if(f){const d=f.props.children,p=u.map(m=>m===f?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:m);return i.jsx(t,{...l,ref:r,children:E.isValidElement(d)?E.cloneElement(d,void 0,p):null})}return i.jsx(t,{...l,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}var rY=sY("Slot");function iY(e){const t=E.forwardRef((n,s)=>{let{children:r,...a}=n;if(kD(r)&&typeof bm=="function"&&(r=bm(r._payload)),E.isValidElement(r)){const l=cY(r),u=lY(a,r.props);return r.type!==E.Fragment&&(u.ref=s?Z2(s,l):l),E.cloneElement(r,u)}return E.Children.count(r)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var aY=Symbol("radix.slottable");function oY(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===aY}function lY(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...u)=>{const f=a(...u);return r(...u),f}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function cY(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const CT=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ET=q$,_D=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return ET(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:a}=t,l=Object.keys(r).map(d=>{const p=n==null?void 0:n[d],m=a==null?void 0:a[d];if(p===null)return null;const x=CT(p)||CT(m);return r[d][x]}),u=n&&Object.entries(n).reduce((d,p)=>{let[m,x]=p;return x===void 0||(d[m]=x),d},{}),f=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,p)=>{let{class:m,className:x,...y}=p;return Object.entries(y).every(b=>{let[v,w]=b;return Array.isArray(w)?w.includes({...a,...u}[v]):{...a,...u}[v]===w})?[...d,m,x]:d},[]);return ET(e,l,f,n==null?void 0:n.class,n==null?void 0:n.className)},uY=_D("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors duration-150 ease-tactical focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-stone-900 text-white font-headline font-bold uppercase tracking-widest hover:bg-stone-800",destructive:"bg-tertiary text-white font-bold hover:bg-tertiary/90",outline:"border border-outline bg-transparent hover:bg-stone-100 text-on-surface",secondary:"border border-stone-900 bg-transparent text-stone-900 font-mono text-[10px] uppercase hover:bg-stone-900 hover:text-white",ghost:"text-on-surface-variant hover:bg-stone-100 hover:text-on-surface",link:"text-secondary underline-offset-4 hover:underline",tactical:"border border-outline font-mono text-[10px] text-secondary uppercase tracking-widest hover:border-stone-900 hover:text-stone-900"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),_e=E.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,children:r,...a},l)=>{const u=s?rY:"button";return i.jsx(u,{className:he(uY({variant:t,size:n,className:e})),ref:l,...a,children:r})});_e.displayName="Button";async function Xr(e){var n,s;try{if((s=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),!0}catch{}if(!globalThis.document)return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch{return!1}finally{t.remove()}}function J2(e,t=6){return e.length<=t?e:e.slice(-t)}function CD(){const e=Mt();return sn({mutationFn:async()=>{const t=await fetch("/api/discovery/scan",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["discovery"]})}})}function dY(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.runtimeHint&&e.runtimeHint.length>0&&t.set("runtimeHint",e.runtimeHint.join(",")),e!=null&&e.minConfidence&&t.set("minConfidence",e.minConfidence);const n=t.toString();return n?`/api/discovery?${n}`:"/api/discovery"}function ek(e,t=!0){var r;const n=dY(e),s=["discovery",(e==null?void 0:e.status)??"all",((r=e==null?void 0:e.runtimeHint)==null?void 0:r.join(","))??"any",(e==null?void 0:e.minConfidence)??"any"];return De({queryKey:s,queryFn:async()=>{const a=await fetch(n);if(!a.ok)throw new Error(`HTTP ${a.status}`);const l=await a.json();return Array.isArray(l)?l:[]},enabled:t})}function fY(e){const{data:t}=ek({status:"active"},e);return t??[]}function hY(){const e=Mt();return sn({mutationFn:async({discoveredId:t,rigId:n,logicalId:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/bind`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,logicalId:s})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function pY(){const e=Mt();return sn({mutationFn:async({discoveredId:t,rigId:n,target:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/adopt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,target:s})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function mY(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function gY(e){return`'${e.replace(/'/g,"'\\''")}'`}function xY(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${gY(t)}`}function yY(e){const t=e.split(/[@:]/)[0]??e;return(t.split(/[-_.]/).filter(Boolean).at(-1)??t).toLowerCase().replace(/[^a-z0-9_-]/g,"")||"member"}function RT(e){return e.includes(".")?ig(e):e.length>12?J2(e):e}function AT(e){return e.podLabel??e.podNamespace??J2(e.podId)}function TT({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[a,l]=E.useState(!1),u=E.useRef(null);E.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const f=async()=>{await n()&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),u.current=null},900))};return i.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{f()},className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors",a?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?i.jsx(Pe,{tool:r,size:"xs"}):null,i.jsx("span",{children:a?t:e})]})}function vY({onClose:e,selectedDiscoveredId:t,onSelectDiscoveredId:n,placementTarget:s,onClearPlacement:r}){const a=ya({select:v=>v.location.pathname}),l=mY(a),{data:u=[]}=ek({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),f=CD(),d=pY(),p=u.find(v=>v.id===t)??null,[m,x]=E.useState("");E.useEffect(()=>{if(p&&(s==null?void 0:s.kind)==="pod"){x(v=>v||yY(p.tmuxSession));return}(!p||!s||s.kind!=="pod")&&x("")},[p,s]);const y=E.useMemo(()=>p?l?s?s.eligible?s.kind==="node"?`Bind ${p.tmuxSession} to ${RT(s.logicalId)}.`:`Add ${p.tmuxSession} to ${AT(s)} pod.`:s.reason??"That target cannot receive the selected session.":`Selected ${p.tmuxSession}. Click an available node to bind it, or click a pod to add it there.`:"Select a rig in the explorer to place the selected session.":null,[l,s,p]),b=()=>{if(!p||!l||!s||!s.eligible)return;let v;if(s.kind==="node")v={kind:"node",logicalId:s.logicalId};else{if(!s.podNamespace)return;v={kind:"pod",podId:s.podId,podNamespace:s.podNamespace,memberName:m.trim()}}d.mutate({discoveredId:p.id,rigId:l,target:v},{onSuccess:()=>{n(null),r()}})};return i.jsxs("aside",{"data-testid":"discovery-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[i.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"discovery"}),i.jsx("button",{"data-testid":"discovery-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),i.jsxs("div",{className:"border-b border-stone-300/35 px-4 py-3 shrink-0 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Inventory"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"discovery-scan-now",disabled:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"SCANNING...":"SCAN NOW"})]}),i.jsx(Ue,{to:"/discovery/inventory","data-testid":"discovery-open-inventory",onClick:e,className:"inline-flex items-center border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-700 transition-colors hover:bg-stone-100 hover:text-stone-900",children:"Legacy Inventory Page"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:u.length===0?i.jsx("div",{"data-testid":"discovery-empty",className:"font-mono text-[10px] text-stone-500",children:"No running Claude or Codex sessions are currently visible."}):u.map(v=>{const w=v.id===t;return i.jsxs("div",{"data-testid":`discovery-session-${v.id}`,className:he("border border-stone-200 bg-white/60 px-3 py-3",w&&"border-emerald-500 shadow-[0_10px_24px_rgba(34,197,94,0.16)]"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx(Kn,{runtime:v.runtimeHint,size:"xs",compact:!0,className:"bg-white/45"}),i.jsx("div",{className:"font-mono text-[10px] text-stone-900 truncate",title:v.tmuxSession,children:v.tmuxSession})]}),v.cwd?i.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500 truncate",title:v.cwd,children:v.cwd}):null]}),i.jsx(_e,{variant:w?"tactical":"ghost",size:"sm","data-testid":`discovery-select-${v.id}`,onClick:()=>n(w?null:v.id),children:w?"SELECTED":"SELECT"})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[i.jsx(TT,{label:"copy tmux",activeLabel:"copied",testId:`discovery-copy-tmux-${v.id}`,tool:"tmux",onClick:async()=>Xr(xY(v))}),v.cwd?i.jsx(TT,{label:"copy cwd",activeLabel:"copied",testId:`discovery-copy-cwd-${v.id}`,onClick:async()=>Xr(v.cwd??"")}):null]}),w?i.jsxs("div",{className:"mt-3 space-y-2 border-t border-emerald-200/80 pt-3",children:[y?i.jsx("div",{"data-testid":"discovery-selected-session-status",className:"border border-emerald-300/80 bg-white/70 px-2.5 py-2 font-mono text-[10px] leading-5 text-stone-900",children:y}):null,s&&!s.eligible?i.jsx("div",{"data-testid":"discovery-target-error",className:"border border-red-200 bg-red-50/80 px-2.5 py-2 font-mono text-[9px] text-red-700",children:s.reason??"That destination is not available."}):null,s!=null&&s.eligible?i.jsxs("div",{className:"space-y-2 border border-emerald-300/80 bg-white/70 px-3 py-2","data-testid":"discovery-target-card",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",children:"Target"}),i.jsx("div",{"data-testid":"discovery-target-summary",className:"font-mono text-[10px] text-stone-900",children:s.kind==="node"?`${RT(s.logicalId)} selected`:`${AT(s)} pod selected`}),s.kind==="pod"?i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",htmlFor:"discovery-member-name",children:"Member name"}),i.jsx("input",{id:"discovery-member-name","data-testid":"discovery-member-name-input",value:m,onChange:S=>x(S.target.value),className:"w-full bg-transparent border-b border-emerald-300 py-1 font-mono text-[10px] text-stone-900 focus:outline-none focus:border-emerald-700"})]}):null,d.isError?i.jsx("div",{"data-testid":"discovery-adopt-error",className:"font-mono text-[9px] text-red-600",children:d.error.message}):null,i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"discovery-confirm-adopt",disabled:d.isPending||s.kind==="pod"&&!m.trim(),onClick:b,children:d.isPending?"ADOPTING...":"ADOPT"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"discovery-clear-target",onClick:r,children:"CLEAR"})]})]}):null]}):null]},v.id)})})]})}function og({testIdPrefix:e,className:t}){const n=s=>e?`${e}-reg-${s}`:void 0;return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:he("reg-tl",t),"data-testid":n("tl"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-tr",t),"data-testid":n("tr"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-bl",t),"data-testid":n("bl"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-br",t),"data-testid":n("br"),"aria-hidden":"true"})]})}const bY={wide:"w-full lg:w-[38rem] lg:max-w-[80vw]",narrow:"w-full lg:w-[22rem] lg:max-w-[60vw]"},wY={left:"border-r border-outline-variant",right:"border-l border-outline-variant"};function jY({children:e,edge:t="right",width:n="wide",onClose:s,className:r,testId:a,...l}){return i.jsxs("div",{className:he("vellum-heavy relative flex flex-col h-full shadow-[0_0_24px_rgba(0,0,0,0.08)]",bY[n],wY[t],r),"data-testid":a,role:"dialog","aria-modal":"false",...l,children:[s?i.jsx("button",{type:"button",onClick:s,"aria-label":"Close sheet",className:"absolute top-2 right-2 z-10 px-2 py-0.5 border border-stone-900 bg-white font-mono text-[10px] hover:bg-stone-100","data-testid":a?`${a}-close`:void 0,children:"×"}):null,i.jsx("div",{className:"flex-1 overflow-auto",children:e}),i.jsx(og,{testIdPrefix:a})]})}const SY={default:"text-stone-900",muted:"text-on-surface-variant",strong:"text-stone-900 font-bold",alert:"text-tertiary"};function it({children:e,right:t,tone:n="default",as:s="header",className:r,...a}){const l=he("font-mono text-[10px] uppercase tracking-[0.18em] flex items-baseline justify-between gap-2",SY[n],r),u=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"flex-1",children:e}),t?i.jsx("span",{className:"ml-auto flex items-center gap-2",children:t}):null]});return s==="div"?i.jsx("div",{className:l,...a,children:u}):s==="section"?i.jsx("section",{className:l,...a,children:u}):i.jsx("header",{className:l,...a,children:u})}const NY={primary:"bg-white border border-stone-900",ghost:"bg-transparent border border-stone-300"},kY={elevated:"hard-shadow",flat:""};function wm({children:e,header:t,registrationMarks:n=!0,elevation:s="elevated",variant:r="primary",accentClass:a,href:l,as:u="div",className:f,testId:d,onClick:p,...m}){const x=!!(l||p),y=he(NY[r],kY[s],"flex flex-col relative",x&&"focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",a,f),b=i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:"bg-stone-900 text-white px-4 py-1.5 font-mono text-[10px]",children:t}):null,i.jsx("div",{className:"flex flex-col flex-1",children:e}),n?i.jsx(og,{testIdPrefix:d}):null]});return l?i.jsx("a",{href:l,className:y,"data-testid":d,onClick:p,...m,children:b}):u==="article"?i.jsx("article",{className:y,"data-testid":d,onClick:p,...m,children:b}):u==="section"?i.jsx("section",{className:y,"data-testid":d,onClick:p,...m,children:b}):i.jsx("div",{className:y,"data-testid":d,onClick:p,...m,children:b})}function _Y({action:e,testId:t}){const n="inline-flex items-center px-3 py-1 border border-stone-900 bg-white font-mono text-[10px] uppercase hover:bg-stone-100";return e.href?i.jsx("a",{href:e.href,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label}):i.jsx("button",{type:"button",onClick:e.onClick,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label})}function Ve({icon:e,label:t,description:n,action:s,variant:r="minimal",className:a,testId:l}){const u=i.jsxs("div",{className:he("flex flex-col items-center justify-center text-center p-6 gap-2",a),"data-testid":l,children:[e?i.jsx("div",{className:"text-on-surface-variant","aria-hidden":"true",children:typeof e=="string"?i.jsx("span",{className:"text-2xl",children:e}):e}):null,i.jsx("div",{className:"font-headline font-bold uppercase text-stone-900 text-sm tracking-tight",children:t}),n?i.jsx("div",{className:"text-xs text-on-surface-variant max-w-prose",children:n}):null,s?i.jsx("div",{className:"pt-2",children:i.jsx(_Y,{action:s,testId:l})}):null]});return r==="card"?i.jsx(wm,{variant:"ghost",elevation:"flat",registrationMarks:!1,children:u}):u}const IT=30;function CY({qitemId:e,source:t,destination:n,state:s,tags:r,createdAt:a,body:l,related:u}){const[f,d]=E.useState(!1),p=l?l.split(`
|
|
321
|
-
`):[],m=f?p:p.slice(0,IT);return e?i.jsxs("div",{"data-testid":"queue-item-viewer",className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsx(it,{tone:"muted",children:"Queue item"}),i.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e})]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-2 font-mono text-xs",children:[t||n?i.jsx(Cl,{label:"Route",children:i.jsx(eg,{source:t,destination:n,muted:!0})}):null,t?i.jsx(Cl,{label:"Source",children:i.jsx(vm,{session:t,muted:!0})}):null,n?i.jsx(Cl,{label:"Dest",children:i.jsx(vm,{session:n,muted:!0})}):null,s?i.jsx(Cl,{label:"State",children:i.jsx(H2,{state:s,testId:"qitem-state"})}):null,r&&r.length>0?i.jsx(Cl,{label:"Tags",children:i.jsx("span",{className:"flex min-w-0 flex-wrap justify-end gap-1",children:r.map(x=>i.jsx(pa,{tag:x},x))})}):null,a?i.jsx(Cl,{label:"Created",children:i.jsx(Rc,{value:a})}):null]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant flex-1 min-h-0 overflow-y-auto",children:[i.jsx(it,{tone:"muted",children:"Body"}),l?i.jsx("pre",{"data-testid":"qitem-body",className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:m.join(`
|
|
322
|
-
`)}):i.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No body."}),l&&p.length>IT?i.jsx("button",{type:"button",onClick:()=>d(x=>!x),"data-testid":"qitem-body-toggle",className:"mt-2 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:f?"Show less":`Show full body (${p.length} lines)`}):null]}),u&&u.length>0?i.jsxs("div",{className:"px-4 py-3",children:[i.jsx(it,{tone:"muted",children:"Related"}),i.jsx("ul",{className:"mt-2 space-y-1 font-mono text-xs",children:u.map((x,y)=>i.jsxs("li",{className:"flex items-baseline gap-2",children:[i.jsxs("span",{className:"inline-flex w-12 shrink-0 items-center gap-1 text-on-surface-variant text-[10px] uppercase tracking-wide",children:[i.jsx(EY,{kind:x.kind,label:x.label}),x.kind]}),x.href?i.jsx("a",{href:x.href,className:"text-stone-900 hover:underline truncate",children:x.label}):i.jsx("span",{className:"text-stone-900 truncate",children:x.label})]},`${x.kind}-${y}`))})]}):null]}):i.jsx(Ve,{label:"NO QITEM",description:"No queue item selected.",variant:"card",testId:"queue-item-viewer-empty"})}function EY({kind:e,label:t}){return e==="file"?i.jsx(Pe,{tool:t,size:"xs"}):e==="commit"?i.jsx(Pe,{tool:"commit",size:"xs",decorative:!0}):e==="slice"?i.jsx(Pe,{tool:"folder",size:"xs",decorative:!0}):i.jsx(Pe,{tool:"terminal",size:"xs",decorative:!0})}function Cl({label:e,children:t}){return i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsx("span",{className:"shrink-0 text-on-surface-variant",children:e}),i.jsx("span",{className:"min-w-0 text-stone-900",children:t})]})}function lg({code:e,language:t}){const n=AY(t),s=E.useMemo(()=>IY(e,n),[e,n]);return i.jsx("pre",{"data-testid":"syntax-highlight-block","data-language":n,className:"overflow-x-auto bg-stone-900 p-3 font-mono text-[10px] leading-relaxed text-stone-100",children:i.jsx("code",{children:s.map((r,a)=>i.jsx("span",{className:r.className,"data-token-kind":r.kind,children:r.text},a))})})}const RY={plain:"",keyword:"text-violet-300",string:"text-emerald-300",comment:"text-stone-500 italic",number:"text-amber-300",tag:"text-sky-300",punctuation:"text-stone-400"};function mt(e,t){return{kind:e,text:t,className:RY[e]}}function AY(e){if(!e)return"";const t=e.toLowerCase().trim();return t==="javascript"?"js":t==="typescript"?"ts":t==="shell"?"sh":t}const TY={ts:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),tsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),js:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),jsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),py:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),python:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),bash:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sh:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sql:new Set(["select","from","where","and","or","not","null","is","in","like","between","join","left","right","inner","outer","on","group","by","order","having","limit","offset","insert","into","values","update","set","delete","create","table","drop","alter","index","primary","key","foreign","references","constraint","unique","default","as","case","when","then","else","end"])};function IY(e,t){return t===""||t==="text"||t==="plain"?[mt("plain",e)]:t==="json"?OY(e):t==="yaml"||t==="yml"?MY(e):t==="md"||t==="markdown"?LY(e):t==="py"||t==="python"||t==="sh"||t==="bash"?up(e,t,"#"):t==="ts"||t==="tsx"||t==="js"||t==="jsx"?up(e,t,"//","/*","*/"):t==="sql"?up(e,t,"--"):[mt("plain",e)]}function up(e,t,n,s,r){const a=TY[t]??new Set,l=[];let u=0;for(;u<e.length;){const f=e.slice(u);if(s&&f.startsWith(s)){const x=r?f.indexOf(r,s.length):-1,y=x===-1?f.length:x+((r==null?void 0:r.length)??0);l.push(mt("comment",f.slice(0,y))),u+=y;continue}if(f.startsWith(n)){const x=f.indexOf(`
|
|
323
|
-
`),y=x===-1?f.length:x;l.push(mt("comment",f.slice(0,y))),u+=y;continue}const d=f[0];if(d==='"'||d==="'"||d==="`"){let x=1;for(;x<f.length&&f[x]!==d;)f[x]==="\\"&&x+1<f.length?x+=2:x++;const y=x<f.length?x+1:x;l.push(mt("string",f.slice(0,y))),u+=y;continue}const p=f.match(/^-?\d+(\.\d+)?/);if(p&&(u===0||!/[a-zA-Z_]/.test(e[u-1]??""))){l.push(mt("number",p[0])),u+=p[0].length;continue}const m=f.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(m){a.has(m[0])?l.push(mt("keyword",m[0])):l.push(mt("plain",m[0])),u+=m[0].length;continue}l.push(mt("plain",e[u]??"")),u++}return tk(l)}function MY(e){const t=[];for(const n of e.split(/(\n)/)){if(n===`
|
|
324
|
-
`){t.push(mt("plain",`
|
|
325
|
-
`));continue}const s=n.indexOf("#");if(s!==-1){const r=n.slice(0,s);t.push(...MT(r)),t.push(mt("comment",n.slice(s)))}else t.push(...MT(n))}return tk(t)}function MT(e){const t=e.match(/^(\s*)([\w.-]+)(:)(\s*)(.*)$/);if(t){const n=[];n.push(mt("plain",t[1])),n.push(mt("tag",t[2])),n.push(mt("punctuation",t[3])),n.push(mt("plain",t[4]));const s=t[5];return s.startsWith('"')||s.startsWith("'")?n.push(mt("string",s)):/^\d+(\.\d+)?$/.test(s)?n.push(mt("number",s)):n.push(mt("plain",s)),n}return[mt("plain",e)]}function OY(e){const t=[];let n=0;for(;n<e.length;){const s=e[n];if(s==='"'){let l=1;for(;l<e.length-n&&e[n+l]!=='"';)e[n+l]==="\\"?l+=2:l++;t.push(mt("string",e.slice(n,n+l+1))),n+=l+1;continue}if(s==="{"||s==="}"||s==="["||s==="]"||s===","||s===":"){t.push(mt("punctuation",s)),n++;continue}const r=e.slice(n).match(/^-?\d+(\.\d+)?/);if(r){t.push(mt("number",r[0])),n+=r[0].length;continue}const a=e.slice(n).match(/^(true|false|null)\b/);if(a){t.push(mt("keyword",a[0])),n+=a[0].length;continue}t.push(mt("plain",s??"")),n++}return tk(t)}function LY(e){return[mt("plain",e)]}function tk(e){const t=[];for(const n of e){const s=t[t.length-1];s&&s.kind==="plain"&&n.kind==="plain"?t[t.length-1]=mt("plain",s.text+n.text):t.push(n)}return t}const nk=Symbol.for("yaml.alias"),CN=Symbol.for("yaml.document"),la=Symbol.for("yaml.map"),ED=Symbol.for("yaml.pair"),cr=Symbol.for("yaml.scalar"),Tc=Symbol.for("yaml.seq"),Ns=Symbol.for("yaml.node.type"),Io=e=>!!e&&typeof e=="object"&&e[Ns]===nk,cg=e=>!!e&&typeof e=="object"&&e[Ns]===CN,nf=e=>!!e&&typeof e=="object"&&e[Ns]===la,qt=e=>!!e&&typeof e=="object"&&e[Ns]===ED,gt=e=>!!e&&typeof e=="object"&&e[Ns]===cr,sf=e=>!!e&&typeof e=="object"&&e[Ns]===Tc;function $t(e){if(e&&typeof e=="object")switch(e[Ns]){case la:case Tc:return!0}return!1}function Dt(e){if(e&&typeof e=="object")switch(e[Ns]){case nk:case la:case cr:case Tc:return!0}return!1}const RD=e=>(gt(e)||$t(e))&&!!e.anchor,Ga=Symbol("break visit"),PY=Symbol("skip children"),ud=Symbol("remove node");function Ic(e,t){const n=$Y(t);cg(e)?Fl(null,e.contents,n,Object.freeze([e]))===ud&&(e.contents=null):Fl(null,e,n,Object.freeze([]))}Ic.BREAK=Ga;Ic.SKIP=PY;Ic.REMOVE=ud;function Fl(e,t,n,s){const r=DY(e,t,n,s);if(Dt(r)||qt(r))return qY(e,s,r),Fl(e,r,n,s);if(typeof r!="symbol"){if($t(t)){s=Object.freeze(s.concat(t));for(let a=0;a<t.items.length;++a){const l=Fl(a,t.items[a],n,s);if(typeof l=="number")a=l-1;else{if(l===Ga)return Ga;l===ud&&(t.items.splice(a,1),a-=1)}}}else if(qt(t)){s=Object.freeze(s.concat(t));const a=Fl("key",t.key,n,s);if(a===Ga)return Ga;a===ud&&(t.key=null);const l=Fl("value",t.value,n,s);if(l===Ga)return Ga;l===ud&&(t.value=null)}}return r}function $Y(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function DY(e,t,n,s){var r,a,l,u,f;if(typeof n=="function")return n(e,t,s);if(nf(t))return(r=n.Map)==null?void 0:r.call(n,e,t,s);if(sf(t))return(a=n.Seq)==null?void 0:a.call(n,e,t,s);if(qt(t))return(l=n.Pair)==null?void 0:l.call(n,e,t,s);if(gt(t))return(u=n.Scalar)==null?void 0:u.call(n,e,t,s);if(Io(t))return(f=n.Alias)==null?void 0:f.call(n,e,t,s)}function qY(e,t,n){const s=t[t.length-1];if($t(s))s.items[e]=n;else if(qt(s))e==="key"?s.key=n:s.value=n;else if(cg(s))s.contents=n;else{const r=Io(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const zY={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},BY=e=>e.replace(/[!,[\]{}]/g,t=>zY[t]);class Rn{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Rn.defaultYaml,t),this.tags=Object.assign({},Rn.defaultTags,n)}clone(){const t=new Rn(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Rn(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Rn.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Rn.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Rn.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Rn.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[a,l]=s;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[a]=s;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const l=t.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}const[,s,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);const a=this.tags[s];if(a)try{return a+decodeURIComponent(r)}catch(l){return n(String(l)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+BY(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let r;if(t&&s.length>0&&Dt(t.contents)){const a={};Ic(t.contents,(l,u)=>{Dt(u)&&u.tag&&(a[u.tag]=!0)}),r=Object.keys(a)}else r=[];for(const[a,l]of s)a==="!!"&&l==="tag:yaml.org,2002:"||(!t||r.some(u=>u.startsWith(l)))&&n.push(`%TAG ${a} ${l}`);return n.join(`
|
|
326
|
-
`)}}Rn.defaultYaml={explicit:!1,version:"1.2"};Rn.defaultTags={"!!":"tag:yaml.org,2002:"};function AD(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function TD(e){const t=new Set;return Ic(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function ID(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function FY(e,t){const n=[],s=new Map;let r=null;return{onAnchor:a=>{n.push(a),r??(r=TD(e));const l=ID(t,r);return r.add(l),l},setAnchors:()=>{for(const a of n){const l=s.get(a);if(typeof l=="object"&&l.anchor&&(gt(l.node)||$t(l.node)))l.node.anchor=l.anchor;else{const u=new Error("Failed to resolve repeated object (this should not happen)");throw u.source=a,u}}},sourceObjects:s}}function Hl(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,a=s.length;r<a;++r){const l=s[r],u=Hl(e,s,String(r),l);u===void 0?delete s[r]:u!==l&&(s[r]=u)}else if(s instanceof Map)for(const r of Array.from(s.keys())){const a=s.get(r),l=Hl(e,s,r,a);l===void 0?s.delete(r):l!==a&&s.set(r,l)}else if(s instanceof Set)for(const r of Array.from(s)){const a=Hl(e,s,r,r);a===void 0?s.delete(r):a!==r&&(s.delete(r),s.add(a))}else for(const[r,a]of Object.entries(s)){const l=Hl(e,s,r,a);l===void 0?delete s[r]:l!==a&&(s[r]=l)}return e.call(t,n,s)}function Ss(e,t,n){if(Array.isArray(e))return e.map((s,r)=>Ss(s,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!RD(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=a=>{s.res=a,delete n.onCreate};const r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class sk{constructor(t){Object.defineProperty(this,Ns,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:r,reviver:a}={}){if(!cg(t))throw new TypeError("A document argument is required");const l={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},u=Ss(this,"",l);if(typeof r=="function")for(const{count:f,res:d}of l.anchors.values())r(d,f);return typeof a=="function"?Hl(a,{"":u},"",u):u}}class rk extends sk{constructor(t){super(nk),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],Ic(t,{Node:(a,l)=>{(Io(l)||RD(l))&&s.push(l)}}),n&&(n.aliasResolveCache=s));let r;for(const a of s){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:r,maxAliasCount:a}=n,l=this.resolve(r,n);if(!l){const f=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(f)}let u=s.get(l);if(u||(Ss(l,null,n),u=s.get(l)),(u==null?void 0:u.res)===void 0){const f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(a>=0&&(u.count+=1,u.aliasCount===0&&(u.aliasCount=Zp(r,l,s)),u.count*u.aliasCount>a)){const f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}return u.res}toString(t,n,s){const r=`*${this.source}`;if(t){if(AD(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${r} `}return r}}function Zp(e,t,n){if(Io(t)){const s=t.resolve(e),r=n&&s&&n.get(s);return r?r.count*r.aliasCount:0}else if($t(t)){let s=0;for(const r of t.items){const a=Zp(e,r,n);a>s&&(s=a)}return s}else if(qt(t)){const s=Zp(e,t.key,n),r=Zp(e,t.value,n);return Math.max(s,r)}return 1}const MD=e=>!e||typeof e!="function"&&typeof e!="object";class Be extends sk{constructor(t){super(cr),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ss(this.value,t,n)}toString(){return String(this.value)}}Be.BLOCK_FOLDED="BLOCK_FOLDED";Be.BLOCK_LITERAL="BLOCK_LITERAL";Be.PLAIN="PLAIN";Be.QUOTE_DOUBLE="QUOTE_DOUBLE";Be.QUOTE_SINGLE="QUOTE_SINGLE";const HY="tag:yaml.org,2002:";function UY(e,t,n){if(t){const s=n.filter(a=>a.tag===t),r=s.find(a=>!a.format)??s[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(s=>{var r;return((r=s.identify)==null?void 0:r.call(s,e))&&!s.format})}function Ed(e,t,n){var m,x,y;if(cg(e)&&(e=e.contents),Dt(e))return e;if(qt(e)){const b=(x=(m=n.schema[la]).createNode)==null?void 0:x.call(m,n.schema,null,n);return b.items.push(e),b}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:r,onTagObj:a,schema:l,sourceObjects:u}=n;let f;if(s&&e&&typeof e=="object"){if(f=u.get(e),f)return f.anchor??(f.anchor=r(e)),new rk(f.anchor);f={anchor:null,node:null},u.set(e,f)}t!=null&&t.startsWith("!!")&&(t=HY+t.slice(2));let d=UY(e,t,l.tags);if(!d){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const b=new Be(e);return f&&(f.node=b),b}d=e instanceof Map?l[la]:Symbol.iterator in Object(e)?l[Tc]:l[la]}a&&(a(d),delete n.onTagObj);const p=d!=null&&d.createNode?d.createNode(n.schema,e,n):typeof((y=d==null?void 0:d.nodeClass)==null?void 0:y.from)=="function"?d.nodeClass.from(n.schema,e,n):new Be(e);return t?p.tag=t:d.default||(p.tag=d.tag),f&&(f.node=p),p}function jm(e,t,n){let s=n;for(let r=t.length-1;r>=0;--r){const a=t[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const l=[];l[a]=s,s=l}else s=new Map([[a,s]])}return Ed(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const nd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class OD extends sk{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>Dt(s)||qt(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(nd(t))this.add(n);else{const[s,...r]=t,a=this.get(s,!0);if($t(a))a.addIn(r,n);else if(a===void 0&&this.schema)this.set(s,jm(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const r=this.get(n,!0);if($t(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...r]=t,a=this.get(s,!0);return r.length===0?!n&>(a)?a.value:a:$t(a)?a.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!qt(n))return!1;const s=n.value;return s==null||t&>(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const r=this.get(n,!0);return $t(r)?r.hasIn(s):!1}setIn(t,n){const[s,...r]=t;if(r.length===0)this.set(s,n);else{const a=this.get(s,!0);if($t(a))a.setIn(r,n);else if(a===void 0&&this.schema)this.set(s,jm(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}}const VY=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Gr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Qa=(e,t,n)=>e.endsWith(`
|
|
327
|
-
`)?Gr(n,t):n.includes(`
|
|
328
|
-
`)?`
|
|
329
|
-
`+Gr(n,t):(e.endsWith(" ")?"":" ")+n,LD="flow",EN="block",Jp="quoted";function ug(e,t,n="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:a=20,onFold:l,onOverflow:u}={}){if(!r||r<0)return e;r<a&&(a=0);const f=Math.max(1+a,1+r-t.length);if(e.length<=f)return e;const d=[],p={};let m=r-t.length;typeof s=="number"&&(s>r-Math.max(2,a)?d.push(0):m=r-s);let x,y,b=!1,v=-1,w=-1,S=-1;n===EN&&(v=OT(e,v,t.length),v!==-1&&(m=v+f));for(let k;k=e[v+=1];){if(n===Jp&&k==="\\"){switch(w=v,e[v+1]){case"x":v+=3;break;case"u":v+=5;break;case"U":v+=9;break;default:v+=1}S=v}if(k===`
|
|
330
|
-
`)n===EN&&(v=OT(e,v,t.length)),m=v+t.length+f,x=void 0;else{if(k===" "&&y&&y!==" "&&y!==`
|
|
331
|
-
`&&y!==" "){const _=e[v+1];_&&_!==" "&&_!==`
|
|
332
|
-
`&&_!==" "&&(x=v)}if(v>=m)if(x)d.push(x),m=x+f,x=void 0;else if(n===Jp){for(;y===" "||y===" ";)y=k,k=e[v+=1],b=!0;const _=v>S+1?v-2:w-1;if(p[_])return e;d.push(_),p[_]=!0,m=_+f,x=void 0}else b=!0}y=k}if(b&&u&&u(),d.length===0)return e;l&&l();let C=e.slice(0,d[0]);for(let k=0;k<d.length;++k){const _=d[k],R=d[k+1]||e.length;_===0?C=`
|
|
333
|
-
${t}${e.slice(0,R)}`:(n===Jp&&p[_]&&(C+=`${e[_]}\\`),C+=`
|
|
334
|
-
${t}${e.slice(_+1,R)}`)}return C}function OT(e,t,n){let s=t,r=t+1,a=e[r];for(;a===" "||a===" ";)if(t<r+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
335
|
-
`);s=t,r=t+1,a=e[r]}return s}const dg=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),fg=e=>/^(%|---|\.\.\.)/m.test(e);function GY(e,t,n){if(!t||t<0)return!1;const s=t-n,r=e.length;if(r<=s)return!1;for(let a=0,l=0;a<r;++a)if(e[a]===`
|
|
336
|
-
`){if(a-l>s)return!0;if(l=a+1,r-l<=s)return!1}return!0}function dd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,r=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(fg(e)?" ":"");let l="",u=0;for(let f=0,d=n[f];d;d=n[++f])if(d===" "&&n[f+1]==="\\"&&n[f+2]==="n"&&(l+=n.slice(u,f)+"\\ ",f+=1,u=f,d="\\"),d==="\\")switch(n[f+1]){case"u":{l+=n.slice(u,f);const p=n.substr(f+2,4);switch(p){case"0000":l+="\\0";break;case"0007":l+="\\a";break;case"000b":l+="\\v";break;case"001b":l+="\\e";break;case"0085":l+="\\N";break;case"00a0":l+="\\_";break;case"2028":l+="\\L";break;case"2029":l+="\\P";break;default:p.substr(0,2)==="00"?l+="\\x"+p.substr(2):l+=n.substr(f,6)}f+=5,u=f+1}break;case"n":if(s||n[f+2]==='"'||n.length<r)f+=1;else{for(l+=n.slice(u,f)+`
|
|
337
|
-
|
|
338
|
-
`;n[f+2]==="\\"&&n[f+3]==="n"&&n[f+4]!=='"';)l+=`
|
|
339
|
-
`,f+=2;l+=a,n[f+2]===" "&&(l+="\\"),f+=1,u=f+1}break;default:f+=1}return l=u?l+n.slice(u):n,s?l:ug(l,a,Jp,dg(t,!1))}function RN(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
340
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return dd(e,t);const n=t.indent||(fg(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
341
|
-
${n}`)+"'";return t.implicitKey?s:ug(s,n,LD,dg(t,!1))}function Ul(e,t){const{singleQuote:n}=t.options;let s;if(n===!1)s=dd;else{const r=e.includes('"'),a=e.includes("'");r&&!a?s=RN:a&&!r?s=dd:s=n?RN:dd}return s(e,t)}let AN;try{AN=new RegExp(`(^|(?<!
|
|
342
|
-
))
|
|
343
|
-
+(?!
|
|
344
|
-
|$)`,"g")}catch{AN=/\n+(?!\n|$)/g}function em({comment:e,type:t,value:n},s,r,a){const{blockQuote:l,commentString:u,lineWidth:f}=s.options;if(!l||/\n[\t ]+$/.test(n))return Ul(n,s);const d=s.indent||(s.forceBlockIndent||fg(n)?" ":""),p=l==="literal"?!0:l==="folded"||t===Be.BLOCK_FOLDED?!1:t===Be.BLOCK_LITERAL?!0:!GY(n,f,d.length);if(!n)return p?`|
|
|
345
|
-
`:`>
|
|
346
|
-
`;let m,x;for(x=n.length;x>0;--x){const R=n[x-1];if(R!==`
|
|
347
|
-
`&&R!==" "&&R!==" ")break}let y=n.substring(x);const b=y.indexOf(`
|
|
348
|
-
`);b===-1?m="-":n===y||b!==y.length-1?(m="+",a&&a()):m="",y&&(n=n.slice(0,-y.length),y[y.length-1]===`
|
|
349
|
-
`&&(y=y.slice(0,-1)),y=y.replace(AN,`$&${d}`));let v=!1,w,S=-1;for(w=0;w<n.length;++w){const R=n[w];if(R===" ")v=!0;else if(R===`
|
|
350
|
-
`)S=w;else break}let C=n.substring(0,S<w?S+1:w);C&&(n=n.substring(C.length),C=C.replace(/\n+/g,`$&${d}`));let _=(v?d?"2":"1":"")+m;if(e&&(_+=" "+u(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!p){const R=n.replace(/\n+/g,`
|
|
351
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`);let T=!1;const A=dg(s,!0);l!=="folded"&&t!==Be.BLOCK_FOLDED&&(A.onOverflow=()=>{T=!0});const I=ug(`${C}${R}${y}`,d,EN,A);if(!T)return`>${_}
|
|
352
|
-
${d}${I}`}return n=n.replace(/\n+/g,`$&${d}`),`|${_}
|
|
353
|
-
${d}${C}${n}${y}`}function KY(e,t,n,s){const{type:r,value:a}=e,{actualString:l,implicitKey:u,indent:f,indentStep:d,inFlow:p}=t;if(u&&a.includes(`
|
|
354
|
-
`)||p&&/[[\]{},]/.test(a))return Ul(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return u||p||!a.includes(`
|
|
355
|
-
`)?Ul(a,t):em(e,t,n,s);if(!u&&!p&&r!==Be.PLAIN&&a.includes(`
|
|
356
|
-
`))return em(e,t,n,s);if(fg(a)){if(f==="")return t.forceBlockIndent=!0,em(e,t,n,s);if(u&&f===d)return Ul(a,t)}const m=a.replace(/\n+/g,`$&
|
|
357
|
-
${f}`);if(l){const x=v=>{var w;return v.default&&v.tag!=="tag:yaml.org,2002:str"&&((w=v.test)==null?void 0:w.test(m))},{compat:y,tags:b}=t.doc.schema;if(b.some(x)||y!=null&&y.some(x))return Ul(a,t)}return u?m:ug(m,f,LD,dg(t,!1))}function ik(e,t,n,s){const{implicitKey:r,inFlow:a}=t,l=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:u}=e;u!==Be.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(l.value)&&(u=Be.QUOTE_DOUBLE);const f=p=>{switch(p){case Be.BLOCK_FOLDED:case Be.BLOCK_LITERAL:return r||a?Ul(l.value,t):em(l,t,n,s);case Be.QUOTE_DOUBLE:return dd(l.value,t);case Be.QUOTE_SINGLE:return RN(l.value,t);case Be.PLAIN:return KY(l,t,n,s);default:return null}};let d=f(u);if(d===null){const{defaultKeyType:p,defaultStringType:m}=t.options,x=r&&p||m;if(d=f(x),d===null)throw new Error(`Unsupported default string type ${x}`)}return d}function PD(e,t){const n=Object.assign({blockQuote:!0,commentString:VY,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function WY(e,t){var r;if(t.tag){const a=e.filter(l=>l.tag===t.tag);if(a.length>0)return a.find(l=>l.format===t.format)??a[0]}let n,s;if(gt(t)){s=t.value;let a=e.filter(l=>{var u;return(u=l.identify)==null?void 0:u.call(l,s)});if(a.length>1){const l=a.filter(u=>u.test);l.length>0&&(a=l)}n=a.find(l=>l.format===t.format)??a.find(l=>!l.format)}else s=t,n=e.find(a=>a.nodeClass&&s instanceof a.nodeClass);if(!n){const a=((r=s==null?void 0:s.constructor)==null?void 0:r.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${a} value`)}return n}function YY(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const r=[],a=(gt(e)||$t(e))&&e.anchor;a&&AD(a)&&(n.add(a),r.push(`&${a}`));const l=e.tag??(t.default?null:t.tag);return l&&r.push(s.directives.tagString(l)),r.join(" ")}function vc(e,t,n,s){var f;if(qt(e))return e.toString(t,n,s);if(Io(e)){if(t.doc.directives)return e.toString(t);if((f=t.resolvedAliases)!=null&&f.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r;const a=Dt(e)?e:t.doc.createNode(e,{onTagObj:d=>r=d});r??(r=WY(t.doc.schema.tags,a));const l=YY(a,r,t);l.length>0&&(t.indentAtStart=(t.indentAtStart??0)+l.length+1);const u=typeof r.stringify=="function"?r.stringify(a,t,n,s):gt(a)?ik(a,t,n,s):a.toString(t,n,s);return l?gt(a)||u[0]==="{"||u[0]==="["?`${l} ${u}`:`${l}
|
|
358
|
-
${t.indent}${u}`:u}function QY({key:e,value:t},n,s,r){const{allNullValues:a,doc:l,indent:u,indentStep:f,options:{commentString:d,indentSeq:p,simpleKeys:m}}=n;let x=Dt(e)&&e.comment||null;if(m){if(x)throw new Error("With simple keys, key nodes cannot have comments");if($t(e)||!Dt(e)&&typeof e=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let y=!m&&(!e||x&&t==null&&!n.inFlow||$t(e)||(gt(e)?e.type===Be.BLOCK_FOLDED||e.type===Be.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!y&&(m||!a),indent:u+f});let b=!1,v=!1,w=vc(e,n,()=>b=!0,()=>v=!0);if(!y&&!n.inFlow&&w.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(n.inFlow){if(a||t==null)return b&&s&&s(),w===""?"?":y?`? ${w}`:w}else if(a&&!m||t==null&&y)return w=`? ${w}`,x&&!b?w+=Qa(w,n.indent,d(x)):v&&r&&r(),w;b&&(x=null),y?(x&&(w+=Qa(w,n.indent,d(x))),w=`? ${w}
|
|
359
|
-
${u}:`):(w=`${w}:`,x&&(w+=Qa(w,n.indent,d(x))));let S,C,k;Dt(t)?(S=!!t.spaceBefore,C=t.commentBefore,k=t.comment):(S=!1,C=null,k=null,t&&typeof t=="object"&&(t=l.createNode(t))),n.implicitKey=!1,!y&&!x&>(t)&&(n.indentAtStart=w.length+1),v=!1,!p&&f.length>=2&&!n.inFlow&&!y&&sf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const R=vc(t,n,()=>_=!0,()=>v=!0);let T=" ";if(x||S||C){if(T=S?`
|
|
360
|
-
`:"",C){const A=d(C);T+=`
|
|
361
|
-
${Gr(A,n.indent)}`}R===""&&!n.inFlow?T===`
|
|
362
|
-
`&&k&&(T=`
|
|
363
|
-
|
|
364
|
-
`):T+=`
|
|
365
|
-
${n.indent}`}else if(!y&&$t(t)){const A=R[0],I=R.indexOf(`
|
|
366
|
-
`),L=I!==-1,$=n.inFlow??t.flow??t.items.length===0;if(L||!$){let O=!1;if(L&&(A==="&"||A==="!")){let B=R.indexOf(" ");A==="&"&&B!==-1&&B<I&&R[B+1]==="!"&&(B=R.indexOf(" ",B+1)),(B===-1||I<B)&&(O=!0)}O||(T=`
|
|
367
|
-
${n.indent}`)}}else(R===""||R[0]===`
|
|
368
|
-
`)&&(T="");return w+=T+R,n.inFlow?_&&s&&s():k&&!_?w+=Qa(w,n.indent,d(k)):v&&r&&r(),w}function $D(e,t){(e==="debug"||e==="warn")&&console.warn(t)}const dp="<<",Yr={identify:e=>e===dp||typeof e=="symbol"&&e.description===dp,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Be(Symbol(dp)),{addToJSMap:DD}),stringify:()=>dp},XY=(e,t)=>(Yr.identify(t)||gt(t)&&(!t.type||t.type===Be.PLAIN)&&Yr.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Yr.tag&&n.default));function DD(e,t,n){if(n=e&&Io(n)?n.resolve(e.doc):n,sf(n))for(const s of n.items)Hy(e,t,s);else if(Array.isArray(n))for(const s of n)Hy(e,t,s);else Hy(e,t,n)}function Hy(e,t,n){const s=e&&Io(n)?n.resolve(e.doc):n;if(!nf(s))throw new Error("Merge sources must be maps or map aliases");const r=s.toJSON(null,e,Map);for(const[a,l]of r)t instanceof Map?t.has(a)||t.set(a,l):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:l,writable:!0,enumerable:!0,configurable:!0});return t}function qD(e,t,{key:n,value:s}){if(Dt(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(XY(e,n))DD(e,t,s);else{const r=Ss(n,"",e);if(t instanceof Map)t.set(r,Ss(s,r,e));else if(t instanceof Set)t.add(r);else{const a=ZY(n,r,e),l=Ss(s,a,e);a in t?Object.defineProperty(t,a,{value:l,writable:!0,enumerable:!0,configurable:!0}):t[a]=l}}return t}function ZY(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Dt(e)&&(n!=null&&n.doc)){const s=PD(n.doc,{});s.anchors=new Set;for(const a of n.anchors.keys())s.anchors.add(a.anchor);s.inFlow=!0,s.inStringifyKey=!0;const r=e.toString(s);if(!n.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),$D(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function ak(e,t,n){const s=Ed(e,void 0,n),r=Ed(t,void 0,n);return new An(s,r)}class An{constructor(t,n=null){Object.defineProperty(this,Ns,{value:ED}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return Dt(n)&&(n=n.clone(t)),Dt(s)&&(s=s.clone(t)),new An(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return qD(n,s,this)}toString(t,n,s){return t!=null&&t.doc?QY(this,t,n,s):JSON.stringify(this)}}function zD(e,t,n){return(t.inFlow??e.flow?eQ:JY)(e,t,n)}function JY({comment:e,items:t},n,{blockItemPrefix:s,flowChars:r,itemIndent:a,onChompKeep:l,onComment:u}){const{indent:f,options:{commentString:d}}=n,p=Object.assign({},n,{indent:a,type:null});let m=!1;const x=[];for(let b=0;b<t.length;++b){const v=t[b];let w=null;if(Dt(v))!m&&v.spaceBefore&&x.push(""),Sm(n,x,v.commentBefore,m),v.comment&&(w=v.comment);else if(qt(v)){const C=Dt(v.key)?v.key:null;C&&(!m&&C.spaceBefore&&x.push(""),Sm(n,x,C.commentBefore,m))}m=!1;let S=vc(v,p,()=>w=null,()=>m=!0);w&&(S+=Qa(S,a,d(w))),m&&w&&(m=!1),x.push(s+S)}let y;if(x.length===0)y=r.start+r.end;else{y=x[0];for(let b=1;b<x.length;++b){const v=x[b];y+=v?`
|
|
369
|
-
${f}${v}`:`
|
|
370
|
-
`}}return e?(y+=`
|
|
371
|
-
`+Gr(d(e),f),u&&u()):m&&l&&l(),y}function eQ({items:e},t,{flowChars:n,itemIndent:s}){const{indent:r,indentStep:a,flowCollectionPadding:l,options:{commentString:u}}=t;s+=a;const f=Object.assign({},t,{indent:s,inFlow:!0,type:null});let d=!1,p=0;const m=[];for(let b=0;b<e.length;++b){const v=e[b];let w=null;if(Dt(v))v.spaceBefore&&m.push(""),Sm(t,m,v.commentBefore,!1),v.comment&&(w=v.comment);else if(qt(v)){const C=Dt(v.key)?v.key:null;C&&(C.spaceBefore&&m.push(""),Sm(t,m,C.commentBefore,!1),C.comment&&(d=!0));const k=Dt(v.value)?v.value:null;k?(k.comment&&(w=k.comment),k.commentBefore&&(d=!0)):v.value==null&&(C!=null&&C.comment)&&(w=C.comment)}w&&(d=!0);let S=vc(v,f,()=>w=null);d||(d=m.length>p||S.includes(`
|
|
372
|
-
`)),b<e.length-1?S+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(d||(d=m.reduce((C,k)=>C+k.length+2,2)+(S.length+2)>t.options.lineWidth)),d&&(S+=",")),w&&(S+=Qa(S,s,u(w))),m.push(S),p=m.length}const{start:x,end:y}=n;if(m.length===0)return x+y;if(!d){const b=m.reduce((v,w)=>v+w.length+2,2);d=t.options.lineWidth>0&&b>t.options.lineWidth}if(d){let b=x;for(const v of m)b+=v?`
|
|
373
|
-
${a}${r}${v}`:`
|
|
374
|
-
`;return`${b}
|
|
375
|
-
${r}${y}`}else return`${x}${l}${m.join(" ")}${l}${y}`}function Sm({indent:e,options:{commentString:t}},n,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){const a=Gr(t(s),e);n.push(a.trimStart())}}function Xa(e,t){const n=gt(t)?t.value:t;for(const s of e)if(qt(s)&&(s.key===t||s.key===n||gt(s.key)&&s.key.value===n))return s}class vs extends OD{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(la,t),this.items=[]}static from(t,n,s){const{keepUndefined:r,replacer:a}=s,l=new this(t),u=(f,d)=>{if(typeof a=="function")d=a.call(n,f,d);else if(Array.isArray(a)&&!a.includes(f))return;(d!==void 0||r)&&l.items.push(ak(f,d,s))};if(n instanceof Map)for(const[f,d]of n)u(f,d);else if(n&&typeof n=="object")for(const f of Object.keys(n))u(f,n[f]);return typeof t.sortMapEntries=="function"&&l.items.sort(t.sortMapEntries),l}add(t,n){var l;let s;qt(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new An(t,t==null?void 0:t.value):s=new An(t.key,t.value);const r=Xa(this.items,s.key),a=(l=this.schema)==null?void 0:l.sortMapEntries;if(r){if(!n)throw new Error(`Key ${s.key} already set`);gt(r.value)&&MD(s.value)?r.value.value=s.value:r.value=s.value}else if(a){const u=this.items.findIndex(f=>a(s,f)<0);u===-1?this.items.push(s):this.items.splice(u,0,s)}else this.items.push(s)}delete(t){const n=Xa(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=Xa(this.items,t),r=s==null?void 0:s.value;return(!n&>(r)?r.value:r)??void 0}has(t){return!!Xa(this.items,t)}set(t,n){this.add(new An(t,n),!0)}toJSON(t,n,s){const r=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(r);for(const a of this.items)qD(n,r,a);return r}toString(t,n,s){if(!t)return JSON.stringify(this);for(const r of this.items)if(!qt(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),zD(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const Mc={collection:"map",default:!0,nodeClass:vs,tag:"tag:yaml.org,2002:map",resolve(e,t){return nf(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>vs.from(e,t,n)};class wo extends OD{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Tc,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=fp(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=fp(t);if(typeof s!="number")return;const r=this.items[s];return!n&>(r)?r.value:r}has(t){const n=fp(t);return typeof n=="number"&&n<this.items.length}set(t,n){const s=fp(t);if(typeof s!="number")throw new Error(`Expected a valid index, not ${t}.`);const r=this.items[s];gt(r)&&MD(n)?r.value=n:this.items[s]=n}toJSON(t,n){const s=[];n!=null&&n.onCreate&&n.onCreate(s);let r=0;for(const a of this.items)s.push(Ss(a,String(r++),n));return s}toString(t,n,s){return t?zD(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){const{replacer:r}=s,a=new this(t);if(n&&Symbol.iterator in Object(n)){let l=0;for(let u of n){if(typeof r=="function"){const f=n instanceof Set?u:String(l++);u=r.call(n,f,u)}a.items.push(Ed(u,void 0,s))}}return a}}function fp(e){let t=gt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}const Oc={collection:"seq",default:!0,nodeClass:wo,tag:"tag:yaml.org,2002:seq",resolve(e,t){return sf(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>wo.from(e,t,n)},hg={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),ik(e,t,n,s)}},pg={identify:e=>e==null,createNode:()=>new Be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Be(null),stringify:({source:e},t)=>typeof e=="string"&&pg.test.test(e)?e:t.options.nullStr},ok={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Be(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&ok.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function Fs({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(a)){let l=a.indexOf(".");l<0&&(l=a.length,a+=".");let u=t-(a.length-l-1);for(;u-- >0;)a+="0"}return a}const BD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fs},FD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Fs(e)}},HD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Be(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Fs},mg=e=>typeof e=="bigint"||Number.isInteger(e),lk=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function UD(e,t,n){const{value:s}=e;return mg(s)&&s>=0?n+s.toString(t):Fs(e)}const VD={identify:e=>mg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>lk(e,2,8,n),stringify:e=>UD(e,8,"0o")},GD={identify:mg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>lk(e,0,10,n),stringify:Fs},KD={identify:e=>mg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>lk(e,2,16,n),stringify:e=>UD(e,16,"0x")},tQ=[Mc,Oc,hg,pg,ok,VD,GD,KD,BD,FD,HD];function LT(e){return typeof e=="bigint"||Number.isInteger(e)}const hp=({value:e})=>JSON.stringify(e),nQ=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:hp},{identify:e=>e==null,createNode:()=>new Be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:hp},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:hp},{identify:LT,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>LT(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:hp}],sQ={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},rQ=[Mc,Oc].concat(nQ,sQ),ck={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let r=0;r<n.length;++r)s[r]=n.charCodeAt(r);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,r,a){if(!n)return"";const l=n;let u;if(typeof btoa=="function"){let f="";for(let d=0;d<l.length;++d)f+=String.fromCharCode(l[d]);u=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Be.BLOCK_LITERAL),t!==Be.QUOTE_DOUBLE){const f=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),d=Math.ceil(u.length/f),p=new Array(d);for(let m=0,x=0;m<d;++m,x+=f)p[m]=u.substr(x,f);u=p.join(t===Be.BLOCK_LITERAL?`
|
|
376
|
-
`:" ")}return ik({comment:e,type:t,value:u},s,r,a)}};function WD(e,t){if(sf(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!qt(s)){if(nf(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");const r=s.items[0]||new An(new Be(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
|
|
377
|
-
${r.key.commentBefore}`:s.commentBefore),s.comment){const a=r.value??r.key;a.comment=a.comment?`${s.comment}
|
|
378
|
-
${a.comment}`:s.comment}s=r}e.items[n]=qt(s)?s:new An(s)}}else t("Expected a sequence for this tag");return e}function YD(e,t,n){const{replacer:s}=n,r=new wo(e);r.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let l of t){typeof s=="function"&&(l=s.call(t,String(a++),l));let u,f;if(Array.isArray(l))if(l.length===2)u=l[0],f=l[1];else throw new TypeError(`Expected [key, value] tuple: ${l}`);else if(l&&l instanceof Object){const d=Object.keys(l);if(d.length===1)u=d[0],f=l[u];else throw new TypeError(`Expected tuple with one key, not ${d.length} keys`)}else u=l;r.items.push(ak(u,f,n))}return r}const uk={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:WD,createNode:YD};class Xl extends wo{constructor(){super(),this.add=vs.prototype.add.bind(this),this.delete=vs.prototype.delete.bind(this),this.get=vs.prototype.get.bind(this),this.has=vs.prototype.has.bind(this),this.set=vs.prototype.set.bind(this),this.tag=Xl.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const r of this.items){let a,l;if(qt(r)?(a=Ss(r.key,"",n),l=Ss(r.value,a,n)):a=Ss(r,"",n),s.has(a))throw new Error("Ordered maps must not include duplicate keys");s.set(a,l)}return s}static from(t,n,s){const r=YD(t,n,s),a=new this;return a.items=r.items,a}}Xl.tag="tag:yaml.org,2002:omap";const dk={collection:"seq",identify:e=>e instanceof Map,nodeClass:Xl,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=WD(e,t),s=[];for(const{key:r}of n.items)gt(r)&&(s.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new Xl,n)},createNode:(e,t,n)=>Xl.from(e,t,n)};function QD({value:e,source:t},n){return t&&(e?XD:ZD).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const XD={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Be(!0),stringify:QD},ZD={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Be(!1),stringify:QD},iQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Fs},aQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Fs(e)}},oQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Be(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Fs},rf=e=>typeof e=="bigint"||Number.isInteger(e);function gg(e,t,n,{intAsBigInt:s}){const r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const l=BigInt(e);return r==="-"?BigInt(-1)*l:l}const a=parseInt(e,n);return r==="-"?-1*a:a}function fk(e,t,n){const{value:s}=e;if(rf(s)){const r=s.toString(t);return s<0?"-"+n+r.substr(1):n+r}return Fs(e)}const lQ={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>gg(e,2,2,n),stringify:e=>fk(e,2,"0b")},cQ={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>gg(e,1,8,n),stringify:e=>fk(e,8,"0")},uQ={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>gg(e,0,10,n),stringify:Fs},dQ={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>gg(e,2,16,n),stringify:e=>fk(e,16,"0x")};class Zl extends vs{constructor(t){super(t),this.tag=Zl.tag}add(t){let n;qt(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new An(t.key,null):n=new An(t,null),Xa(this.items,n.key)||this.items.push(n)}get(t,n){const s=Xa(this.items,t);return!n&&qt(s)?gt(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const s=Xa(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new An(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:r}=s,a=new this(t);if(n&&Symbol.iterator in Object(n))for(let l of n)typeof r=="function"&&(l=r.call(n,l,l)),a.items.push(ak(l,null,s));return a}}Zl.tag="tag:yaml.org,2002:set";const hk={collection:"map",identify:e=>e instanceof Set,nodeClass:Zl,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Zl.from(e,t,n),resolve(e,t){if(nf(e)){if(e.hasAllNullValues(!0))return Object.assign(new Zl,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function pk(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,r=l=>t?BigInt(l):Number(l),a=s.replace(/_/g,"").split(":").reduce((l,u)=>l*r(60)+r(u),r(0));return n==="-"?r(-1)*a:a}function JD(e){let{value:t}=e,n=l=>l;if(typeof t=="bigint")n=l=>BigInt(l);else if(isNaN(t)||!isFinite(t))return Fs(e);let s="";t<0&&(s="-",t*=n(-1));const r=n(60),a=[t%r];return t<60?a.unshift(0):(t=(t-a[0])/r,a.unshift(t%r),t>=60&&(t=(t-a[0])/r,a.unshift(t))),s+a.map(l=>String(l).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const e6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>pk(e,n),stringify:JD},t6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>pk(e,!1),stringify:JD},xg={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(xg.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,r,a,l,u]=t.map(Number),f=t[7]?Number((t[7]+"00").substr(1,3)):0;let d=Date.UTC(n,s-1,r,a||0,l||0,u||0,f);const p=t[8];if(p&&p!=="Z"){let m=pk(p,!1);Math.abs(m)<30&&(m*=60),d-=6e4*m}return new Date(d)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},PT=[Mc,Oc,hg,pg,XD,ZD,lQ,cQ,uQ,dQ,iQ,aQ,oQ,ck,Yr,dk,uk,hk,e6,t6,xg],$T=new Map([["core",tQ],["failsafe",[Mc,Oc,hg]],["json",rQ],["yaml11",PT],["yaml-1.1",PT]]),DT={binary:ck,bool:ok,float:HD,floatExp:FD,floatNaN:BD,floatTime:t6,int:GD,intHex:KD,intOct:VD,intTime:e6,map:Mc,merge:Yr,null:pg,omap:dk,pairs:uk,seq:Oc,set:hk,timestamp:xg},fQ={"tag:yaml.org,2002:binary":ck,"tag:yaml.org,2002:merge":Yr,"tag:yaml.org,2002:omap":dk,"tag:yaml.org,2002:pairs":uk,"tag:yaml.org,2002:set":hk,"tag:yaml.org,2002:timestamp":xg};function Uy(e,t,n){const s=$T.get(t);if(s&&!e)return n&&!s.includes(Yr)?s.concat(Yr):s.slice();let r=s;if(!r)if(Array.isArray(e))r=[];else{const a=Array.from($T.keys()).filter(l=>l!=="yaml11").map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(const a of e)r=r.concat(a);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Yr)),r.reduce((a,l)=>{const u=typeof l=="string"?DT[l]:l;if(!u){const f=JSON.stringify(l),d=Object.keys(DT).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${d}`)}return a.includes(u)||a.push(u),a},[])}const hQ=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class mk{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:r,schema:a,sortMapEntries:l,toStringDefaults:u}){this.compat=Array.isArray(t)?Uy(t,"compat"):t?Uy(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?fQ:{},this.tags=Uy(n,this.name,s),this.toStringOptions=u??null,Object.defineProperty(this,la,{value:Mc}),Object.defineProperty(this,cr,{value:hg}),Object.defineProperty(this,Tc,{value:Oc}),this.sortMapEntries=typeof l=="function"?l:l===!0?hQ:null}clone(){const t=Object.create(mk.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function pQ(e,t){var f;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const d=e.directives.toString(e);d?(n.push(d),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const r=PD(e,t),{commentString:a}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");const d=a(e.commentBefore);n.unshift(Gr(d,""))}let l=!1,u=null;if(e.contents){if(Dt(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const m=a(e.contents.commentBefore);n.push(Gr(m,""))}r.forceBlockIndent=!!e.comment,u=e.contents.comment}const d=u?void 0:()=>l=!0;let p=vc(e.contents,r,()=>u=null,d);u&&(p+=Qa(p,"",a(u))),(p[0]==="|"||p[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${p}`:n.push(p)}else n.push(vc(e.contents,r));if((f=e.directives)!=null&&f.docEnd)if(e.comment){const d=a(e.comment);d.includes(`
|
|
379
|
-
`)?(n.push("..."),n.push(Gr(d,""))):n.push(`... ${d}`)}else n.push("...");else{let d=e.comment;d&&l&&(d=d.replace(/^\n+/,"")),d&&((!l||u)&&n[n.length-1]!==""&&n.push(""),n.push(Gr(a(d),"")))}return n.join(`
|
|
380
|
-
`)+`
|
|
381
|
-
`}class yg{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ns,{value:CN});let r=null;typeof n=="function"||Array.isArray(n)?r=n:s===void 0&&n&&(s=n,n=void 0);const a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=a;let{version:l}=a;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(l=this.directives.yaml.version)):this.directives=new Rn({version:l}),this.setSchema(l,s),this.contents=t===void 0?null:this.createNode(t,r,s)}clone(){const t=Object.create(yg.prototype,{[Ns]:{value:CN}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Dt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){El(this.contents)&&this.contents.add(t)}addIn(t,n){El(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=TD(this);t.anchor=!n||s.has(n)?ID(n||"a",s):n}return new rk(t.anchor)}createNode(t,n,s){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){const w=C=>typeof C=="number"||C instanceof String||C instanceof Number,S=n.filter(w).map(String);S.length>0&&(n=n.concat(S)),r=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:a,anchorPrefix:l,flow:u,keepUndefined:f,onTagObj:d,tag:p}=s??{},{onAnchor:m,setAnchors:x,sourceObjects:y}=FY(this,l||"a"),b={aliasDuplicateObjects:a??!0,keepUndefined:f??!1,onAnchor:m,onTagObj:d,replacer:r,schema:this.schema,sourceObjects:y},v=Ed(t,p,b);return u&&$t(v)&&(v.flow=!0),x(),v}createPair(t,n,s={}){const r=this.createNode(t,null,s),a=this.createNode(n,null,s);return new An(r,a)}delete(t){return El(this.contents)?this.contents.delete(t):!1}deleteIn(t){return nd(t)?this.contents==null?!1:(this.contents=null,!0):El(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return $t(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return nd(t)?!n&>(this.contents)?this.contents.value:this.contents:$t(this.contents)?this.contents.getIn(t,n):void 0}has(t){return $t(this.contents)?this.contents.has(t):!1}hasIn(t){return nd(t)?this.contents!==void 0:$t(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=jm(this.schema,[t],n):El(this.contents)&&this.contents.set(t,n)}setIn(t,n){nd(t)?this.contents=n:this.contents==null?this.contents=jm(this.schema,Array.from(t),n):El(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Rn({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Rn({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new mk(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:r,onAnchor:a,reviver:l}={}){const u={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},f=Ss(this.contents,n??"",u);if(typeof a=="function")for(const{count:d,res:p}of u.anchors.values())a(p,d);return typeof l=="function"?Hl(l,{"":f},"",f):f}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return pQ(this,t)}}function El(e){if($t(e))return!0;throw new Error("Expected a YAML collection as document contents")}class n6 extends Error{constructor(t,n,s,r){super(),this.name=t,this.code=s,this.message=r,this.pos=n}}class sd extends n6{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class mQ extends n6{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const qT=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(u=>t.linePos(u));const{line:s,col:r}=n.linePos[0];n.message+=` at line ${s}, column ${r}`;let a=r-1,l=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(a>=60&&l.length>80){const u=Math.min(a-39,l.length-79);l="…"+l.substring(u),a-=u-1}if(l.length>80&&(l=l.substring(0,79)+"…"),s>1&&/^ *$/.test(l.substring(0,a))){let u=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);u.length>80&&(u=u.substring(0,79)+`…
|
|
382
|
-
`),l=u+l}if(/[^ ]/.test(l)){let u=1;const f=n.linePos[1];(f==null?void 0:f.line)===s&&f.col>r&&(u=Math.max(1,Math.min(f.col-r,80-a)));const d=" ".repeat(a)+"^".repeat(u);n.message+=`:
|
|
383
|
-
|
|
384
|
-
${l}
|
|
385
|
-
${d}
|
|
386
|
-
`}};function bc(e,{flow:t,indicator:n,next:s,offset:r,onError:a,parentIndent:l,startOnNewline:u}){let f=!1,d=u,p=u,m="",x="",y=!1,b=!1,v=null,w=null,S=null,C=null,k=null,_=null,R=null;for(const I of e)switch(b&&(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma"&&a(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),v&&(d&&I.type!=="comment"&&I.type!=="newline"&&a(v,"TAB_AS_INDENT","Tabs are not allowed as indentation"),v=null),I.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&I.source.includes(" ")&&(v=I),p=!0;break;case"comment":{p||a(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const L=I.source.substring(1)||" ";m?m+=x+L:m=L,x="",d=!1;break}case"newline":d?m?m+=I.source:(!_||n!=="seq-item-ind")&&(f=!0):x+=I.source,d=!0,y=!0,(w||S)&&(C=I),p=!0;break;case"anchor":w&&a(I,"MULTIPLE_ANCHORS","A node can have at most one anchor"),I.source.endsWith(":")&&a(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=I,R??(R=I.offset),d=!1,p=!1,b=!0;break;case"tag":{S&&a(I,"MULTIPLE_TAGS","A node can have at most one tag"),S=I,R??(R=I.offset),d=!1,p=!1,b=!0;break}case n:(w||S)&&a(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`),_&&a(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${t??"collection"}`),_=I,d=n==="seq-item-ind"||n==="explicit-key-ind",p=!1;break;case"comma":if(t){k&&a(I,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=I,d=!1,p=!1;break}default:a(I,"UNEXPECTED_TOKEN",`Unexpected ${I.type} token`),d=!1,p=!1}const T=e[e.length-1],A=T?T.offset+T.source.length:r;return b&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&a(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v&&(d&&v.indent<=l||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&a(v,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:_,spaceBefore:f,comment:m,hasNewline:y,anchor:w,tag:S,newlineAfterProp:C,end:A,start:R??A}}function Rd(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
387
|
-
`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Rd(t.key)||Rd(t.value))return!0}return!1;default:return!0}}function TN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&Rd(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function s6(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const r=typeof s=="function"?s:(a,l)=>a===l||gt(a)&>(l)&&a.value===l.value;return t.some(a=>r(a.key,n))}const zT="All mapping items must start at the same column";function gQ({composeNode:e,composeEmptyNode:t},n,s,r,a){var p;const l=(a==null?void 0:a.nodeClass)??vs,u=new l(n.schema);n.atRoot&&(n.atRoot=!1);let f=s.offset,d=null;for(const m of s.items){const{start:x,key:y,sep:b,value:v}=m,w=bc(x,{indicator:"explicit-key-ind",next:y??(b==null?void 0:b[0]),offset:f,onError:r,parentIndent:s.indent,startOnNewline:!0}),S=!w.found;if(S){if(y&&(y.type==="block-seq"?r(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==s.indent&&r(f,"BAD_INDENT",zT)),!w.anchor&&!w.tag&&!b){d=w.end,w.comment&&(u.comment?u.comment+=`
|
|
388
|
-
`+w.comment:u.comment=w.comment);continue}(w.newlineAfterProp||Rd(y))&&r(y??x[x.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((p=w.found)==null?void 0:p.indent)!==s.indent&&r(f,"BAD_INDENT",zT);n.atKey=!0;const C=w.end,k=y?e(n,y,w,r):t(n,C,x,null,w,r);n.schema.compat&&TN(s.indent,y,r),n.atKey=!1,s6(n,u.items,k)&&r(C,"DUPLICATE_KEY","Map keys must be unique");const _=bc(b??[],{indicator:"map-value-ind",next:v,offset:k.range[2],onError:r,parentIndent:s.indent,startOnNewline:!y||y.type==="block-scalar"});if(f=_.end,_.found){S&&((v==null?void 0:v.type)==="block-map"&&!_.hasNewline&&r(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.start<_.found.offset-1024&&r(k.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const R=v?e(n,v,_,r):t(n,f,b,null,_,r);n.schema.compat&&TN(s.indent,v,r),f=R.range[2];const T=new An(k,R);n.options.keepSourceTokens&&(T.srcToken=m),u.items.push(T)}else{S&&r(k.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(k.comment?k.comment+=`
|
|
389
|
-
`+_.comment:k.comment=_.comment);const R=new An(k);n.options.keepSourceTokens&&(R.srcToken=m),u.items.push(R)}}return d&&d<f&&r(d,"IMPOSSIBLE","Map comment with trailing content"),u.range=[s.offset,f,d??f],u}function xQ({composeNode:e,composeEmptyNode:t},n,s,r,a){const l=(a==null?void 0:a.nodeClass)??wo,u=new l(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset,d=null;for(const{start:p,value:m}of s.items){const x=bc(p,{indicator:"seq-item-ind",next:m,offset:f,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!x.found)if(x.anchor||x.tag||m)(m==null?void 0:m.type)==="block-seq"?r(x.end,"BAD_INDENT","All sequence items must start at the same column"):r(f,"MISSING_CHAR","Sequence item without - indicator");else{d=x.end,x.comment&&(u.comment=x.comment);continue}const y=m?e(n,m,x,r):t(n,x.end,p,null,x,r);n.schema.compat&&TN(s.indent,m,r),f=y.range[2],u.items.push(y)}return u.range=[s.offset,f,d??f],u}function af(e,t,n,s){let r="";if(e){let a=!1,l="";for(const u of e){const{source:f,type:d}=u;switch(d){case"space":a=!0;break;case"comment":{n&&!a&&s(u,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const p=f.substring(1)||" ";r?r+=l+p:r=p,l="";break}case"newline":r&&(l+=f),a=!0;break;default:s(u,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}t+=f.length}}return{comment:r,offset:t}}const Vy="Block collections are not allowed within flow collections",Gy=e=>e&&(e.type==="block-map"||e.type==="block-seq");function yQ({composeNode:e,composeEmptyNode:t},n,s,r,a){var w;const l=s.start.source==="{",u=l?"flow map":"flow sequence",f=(a==null?void 0:a.nodeClass)??(l?vs:wo),d=new f(n.schema);d.flow=!0;const p=n.atRoot;p&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=s.offset+s.start.source.length;for(let S=0;S<s.items.length;++S){const C=s.items[S],{start:k,key:_,sep:R,value:T}=C,A=bc(k,{flow:u,indicator:"explicit-key-ind",next:_??(R==null?void 0:R[0]),offset:m,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!R&&!T){S===0&&A.comma?r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`):S<s.items.length-1&&r(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${u}`),A.comment&&(d.comment?d.comment+=`
|
|
390
|
-
`+A.comment:d.comment=A.comment),m=A.end;continue}!l&&n.options.strict&&Rd(_)&&r(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(S===0)A.comma&&r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`);else if(A.comma||r(A.start,"MISSING_CHAR",`Missing , between ${u} items`),A.comment){let I="";e:for(const L of k)switch(L.type){case"comma":case"space":break;case"comment":I=L.source.substring(1);break e;default:break e}if(I){let L=d.items[d.items.length-1];qt(L)&&(L=L.value??L.key),L.comment?L.comment+=`
|
|
391
|
-
`+I:L.comment=I,A.comment=A.comment.substring(I.length+1)}}if(!l&&!R&&!A.found){const I=T?e(n,T,A,r):t(n,A.end,R,null,A,r);d.items.push(I),m=I.range[2],Gy(T)&&r(I.range,"BLOCK_IN_FLOW",Vy)}else{n.atKey=!0;const I=A.end,L=_?e(n,_,A,r):t(n,I,k,null,A,r);Gy(_)&&r(L.range,"BLOCK_IN_FLOW",Vy),n.atKey=!1;const $=bc(R??[],{flow:u,indicator:"map-value-ind",next:T,offset:L.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if($.found){if(!l&&!A.found&&n.options.strict){if(R)for(const H of R){if(H===$.found)break;if(H.type==="newline"){r(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<$.found.offset-1024&&r($.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else T&&("source"in T&&((w=T.source)==null?void 0:w[0])===":"?r(T,"MISSING_CHAR",`Missing space after : in ${u}`):r($.start,"MISSING_CHAR",`Missing , or : between ${u} items`));const O=T?e(n,T,$,r):$.found?t(n,$.end,R,null,$,r):null;O?Gy(T)&&r(O.range,"BLOCK_IN_FLOW",Vy):$.comment&&(L.comment?L.comment+=`
|
|
392
|
-
`+$.comment:L.comment=$.comment);const B=new An(L,O);if(n.options.keepSourceTokens&&(B.srcToken=C),l){const H=d;s6(n,H.items,L)&&r(I,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(B)}else{const H=new vs(n.schema);H.flow=!0,H.items.push(B);const P=(O??L).range;H.range=[L.range[0],P[1],P[2]],d.items.push(H)}m=O?O.range[2]:$.end}}const x=l?"}":"]",[y,...b]=s.end;let v=m;if((y==null?void 0:y.source)===x)v=y.offset+y.source.length;else{const S=u[0].toUpperCase()+u.substring(1),C=p?`${S} must end with a ${x}`:`${S} in block collection must be sufficiently indented and end with a ${x}`;r(m,p?"MISSING_CHAR":"BAD_INDENT",C),y&&y.source.length!==1&&b.unshift(y)}if(b.length>0){const S=af(b,v,n.options.strict,r);S.comment&&(d.comment?d.comment+=`
|
|
393
|
-
`+S.comment:d.comment=S.comment),d.range=[s.offset,v,S.offset]}else d.range=[s.offset,v,v];return d}function Ky(e,t,n,s,r,a){const l=n.type==="block-map"?gQ(e,t,n,s,a):n.type==="block-seq"?xQ(e,t,n,s,a):yQ(e,t,n,s,a),u=l.constructor;return r==="!"||r===u.tagName?(l.tag=u.tagName,l):(r&&(l.tag=r),l)}function vQ(e,t,n,s,r){var x;const a=s.tag,l=a?t.directives.tagName(a.source,y=>r(a,"TAG_RESOLVE_FAILED",y)):null;if(n.type==="block-seq"){const{anchor:y,newlineAfterProp:b}=s,v=y&&a?y.offset>a.offset?y:a:y??a;v&&(!b||b.offset<v.offset)&&r(v,"MISSING_CHAR","Missing newline after block sequence props")}const u=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!a||!l||l==="!"||l===vs.tagName&&u==="map"||l===wo.tagName&&u==="seq")return Ky(e,t,n,r,l);let f=t.schema.tags.find(y=>y.tag===l&&y.collection===u);if(!f){const y=t.schema.knownTags[l];if((y==null?void 0:y.collection)===u)t.schema.tags.push(Object.assign({},y,{default:!1})),f=y;else return y?r(a,"BAD_COLLECTION_TYPE",`${y.tag} used for ${u} collection, but expects ${y.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${l}`,!0),Ky(e,t,n,r,l)}const d=Ky(e,t,n,r,l,f),p=((x=f.resolve)==null?void 0:x.call(f,d,y=>r(a,"TAG_RESOLVE_FAILED",y),t.options))??d,m=Dt(p)?p:new Be(p);return m.range=d.range,m.tag=l,f!=null&&f.format&&(m.format=f.format),m}function bQ(e,t,n){const s=t.offset,r=wQ(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};const a=r.mode===">"?Be.BLOCK_FOLDED:Be.BLOCK_LITERAL,l=t.source?jQ(t.source):[];let u=l.length;for(let v=l.length-1;v>=0;--v){const w=l[v][1];if(w===""||w==="\r")u=v;else break}if(u===0){const v=r.chomp==="+"&&l.length>0?`
|
|
394
|
-
`.repeat(Math.max(1,l.length-1)):"";let w=s+r.length;return t.source&&(w+=t.source.length),{value:v,type:a,comment:r.comment,range:[s,w,w]}}let f=t.indent+r.indent,d=t.offset+r.length,p=0;for(let v=0;v<u;++v){const[w,S]=l[v];if(S===""||S==="\r")r.indent===0&&w.length>f&&(f=w.length);else{w.length<f&&n(d+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(f=w.length),p=v,f===0&&!e.atRoot&&n(d,"BAD_INDENT","Block scalar values in collections must be indented");break}d+=w.length+S.length+1}for(let v=l.length-1;v>=u;--v)l[v][0].length>f&&(u=v+1);let m="",x="",y=!1;for(let v=0;v<p;++v)m+=l[v][0].slice(f)+`
|
|
395
|
-
`;for(let v=p;v<u;++v){let[w,S]=l[v];d+=w.length+S.length+1;const C=S[S.length-1]==="\r";if(C&&(S=S.slice(0,-1)),S&&w.length<f){const _=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(d-S.length-(C?2:1),"BAD_INDENT",_),w=""}a===Be.BLOCK_LITERAL?(m+=x+w.slice(f)+S,x=`
|
|
396
|
-
`):w.length>f||S[0]===" "?(x===" "?x=`
|
|
397
|
-
`:!y&&x===`
|
|
398
|
-
`&&(x=`
|
|
399
|
-
|
|
400
|
-
`),m+=x+w.slice(f)+S,x=`
|
|
401
|
-
`,y=!0):S===""?x===`
|
|
402
|
-
`?m+=`
|
|
403
|
-
`:x=`
|
|
404
|
-
`:(m+=x+S,x=" ",y=!1)}switch(r.chomp){case"-":break;case"+":for(let v=u;v<l.length;++v)m+=`
|
|
405
|
-
`+l[v][0].slice(f);m[m.length-1]!==`
|
|
406
|
-
`&&(m+=`
|
|
407
|
-
`);break;default:m+=`
|
|
408
|
-
`}const b=s+r.length+t.source.length;return{value:m,type:a,comment:r.comment,range:[s,b,b]}}function wQ({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=t[0],a=r[0];let l=0,u="",f=-1;for(let x=1;x<r.length;++x){const y=r[x];if(!u&&(y==="-"||y==="+"))u=y;else{const b=Number(y);!l&&b?l=b:f===-1&&(f=e+x)}}f!==-1&&s(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let d=!1,p="",m=r.length;for(let x=1;x<t.length;++x){const y=t[x];switch(y.type){case"space":d=!0;case"newline":m+=y.source.length;break;case"comment":n&&!d&&s(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=y.source.length,p=y.source.substring(1);break;case"error":s(y,"UNEXPECTED_TOKEN",y.message),m+=y.source.length;break;default:{const b=`Unexpected token in block scalar header: ${y.type}`;s(y,"UNEXPECTED_TOKEN",b);const v=y.source;v&&typeof v=="string"&&(m+=v.length)}}}return{mode:a,indent:l,chomp:u,comment:p,length:m}}function jQ(e){const t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),a=[s!=null&&s[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let l=1;l<t.length;l+=2)a.push([t[l],t[l+1]]);return a}function SQ(e,t,n){const{offset:s,type:r,source:a,end:l}=e;let u,f;const d=(x,y,b)=>n(s+x,y,b);switch(r){case"scalar":u=Be.PLAIN,f=NQ(a,d);break;case"single-quoted-scalar":u=Be.QUOTE_SINGLE,f=kQ(a,d);break;case"double-quoted-scalar":u=Be.QUOTE_DOUBLE,f=_Q(a,d);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+a.length,s+a.length]}}const p=s+a.length,m=af(l,p,t,n);return{value:f,type:u,comment:m.comment,range:[s,p,m.offset]}}function NQ(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),r6(e)}function kQ(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),r6(e.slice(1,-1)).replace(/''/g,"'")}function r6(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
409
|
-
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
410
|
-
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=t.exec(e);if(!s)return e;let r=s[1],a=" ",l=t.lastIndex;for(n.lastIndex=l;s=n.exec(e);)s[1]===""?a===`
|
|
411
|
-
`?r+=a:a=`
|
|
412
|
-
`:(r+=a+s[1],a=" "),l=n.lastIndex;const u=/[ \t]*(.*)/sy;return u.lastIndex=l,s=u.exec(e),r+a+((s==null?void 0:s[1])??"")}function _Q(e,t){let n="";for(let s=1;s<e.length-1;++s){const r=e[s];if(!(r==="\r"&&e[s+1]===`
|
|
413
|
-
`))if(r===`
|
|
414
|
-
`){const{fold:a,offset:l}=CQ(e,s);n+=a,s=l}else if(r==="\\"){let a=e[++s];const l=EQ[a];if(l)n+=l;else if(a===`
|
|
415
|
-
`)for(a=e[s+1];a===" "||a===" ";)a=e[++s+1];else if(a==="\r"&&e[s+1]===`
|
|
416
|
-
`)for(a=e[++s+1];a===" "||a===" ";)a=e[++s+1];else if(a==="x"||a==="u"||a==="U"){const u={x:2,u:4,U:8}[a];n+=RQ(e,s+1,u,t),s+=u}else{const u=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),n+=u}}else if(r===" "||r===" "){const a=s;let l=e[s+1];for(;l===" "||l===" ";)l=e[++s+1];l!==`
|
|
417
|
-
`&&!(l==="\r"&&e[s+2]===`
|
|
418
|
-
`)&&(n+=s>a?e.slice(a,s+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function CQ(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
|
|
419
|
-
`||s==="\r")&&!(s==="\r"&&e[t+2]!==`
|
|
420
|
-
`);)s===`
|
|
421
|
-
`&&(n+=`
|
|
422
|
-
`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}const EQ={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
423
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function RQ(e,t,n,s){const r=e.substr(t,n),l=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(l)){const u=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),u}return String.fromCodePoint(l)}function i6(e,t,n,s){const{value:r,type:a,comment:l,range:u}=t.type==="block-scalar"?bQ(e,t,s):SQ(t,e.options.strict,s),f=n?e.directives.tagName(n.source,m=>s(n,"TAG_RESOLVE_FAILED",m)):null;let d;e.options.stringKeys&&e.atKey?d=e.schema[cr]:f?d=AQ(e.schema,r,f,n,s):t.type==="scalar"?d=TQ(e,r,t,s):d=e.schema[cr];let p;try{const m=d.resolve(r,x=>s(n??t,"TAG_RESOLVE_FAILED",x),e.options);p=gt(m)?m:new Be(m)}catch(m){const x=m instanceof Error?m.message:String(m);s(n??t,"TAG_RESOLVE_FAILED",x),p=new Be(r)}return p.range=u,p.source=r,a&&(p.type=a),f&&(p.tag=f),d.format&&(p.format=d.format),l&&(p.comment=l),p}function AQ(e,t,n,s,r){var u;if(n==="!")return e[cr];const a=[];for(const f of e.tags)if(!f.collection&&f.tag===n)if(f.default&&f.test)a.push(f);else return f;for(const f of a)if((u=f.test)!=null&&u.test(t))return f;const l=e.knownTags[n];return l&&!l.collection?(e.tags.push(Object.assign({},l,{default:!1,test:void 0})),l):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[cr])}function TQ({atKey:e,directives:t,schema:n},s,r,a){const l=n.tags.find(u=>{var f;return(u.default===!0||e&&u.default==="key")&&((f=u.test)==null?void 0:f.test(s))})||n[cr];if(n.compat){const u=n.compat.find(f=>{var d;return f.default&&((d=f.test)==null?void 0:d.test(s))})??n[cr];if(l.tag!==u.tag){const f=t.tagString(l.tag),d=t.tagString(u.tag),p=`Value may be parsed as either ${f} or ${d}`;a(r,"TAG_RESOLVE_FAILED",p,!0)}}return l}function IQ(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let r=t[s];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++s];(r==null?void 0:r.type)==="space";)e+=r.source.length,r=t[++s];break}}return e}const MQ={composeNode:a6,composeEmptyNode:gk};function a6(e,t,n,s){const r=e.atKey,{spaceBefore:a,comment:l,anchor:u,tag:f}=n;let d,p=!0;switch(t.type){case"alias":d=OQ(e,t,s),(u||f)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":d=i6(e,t,f,s),u&&(d.anchor=u.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{d=vQ(MQ,e,t,n,s),u&&(d.anchor=u.source.substring(1))}catch(m){const x=m instanceof Error?m.message:String(m);s(t,"RESOURCE_EXHAUSTION",x)}break;default:{const m=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",m),p=!1}}return d??(d=gk(e,t.offset,void 0,null,n,s)),u&&d.anchor===""&&s(u,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!gt(d)||typeof d.value!="string"||d.tag&&d.tag!=="tag:yaml.org,2002:str")&&s(f??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(d.spaceBefore=!0),l&&(t.type==="scalar"&&t.source===""?d.comment=l:d.commentBefore=l),e.options.keepSourceTokens&&p&&(d.srcToken=t),d}function gk(e,t,n,s,{spaceBefore:r,comment:a,anchor:l,tag:u,end:f},d){const p={type:"scalar",offset:IQ(t,n,s),indent:-1,source:""},m=i6(e,p,u,d);return l&&(m.anchor=l.source.substring(1),m.anchor===""&&d(l,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(m.spaceBefore=!0),a&&(m.comment=a,m.range[2]=f),m}function OQ({options:e},{offset:t,source:n,end:s},r){const a=new rk(n.substring(1));a.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const l=t+n.length,u=af(s,l,e.strict,r);return a.range=[t,l,u.offset],u.comment&&(a.comment=u.comment),a}function LQ(e,t,{offset:n,start:s,value:r,end:a},l){const u=Object.assign({_directives:t},e),f=new yg(void 0,u),d={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},p=bc(s,{indicator:"doc-start",next:r??(a==null?void 0:a[0]),offset:n,onError:l,parentIndent:0,startOnNewline:!0});p.found&&(f.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!p.hasNewline&&l(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=r?a6(d,r,p,l):gk(d,p.end,s,null,p,l);const m=f.contents.range[2],x=af(a,m,!1,l);return x.comment&&(f.comment=x.comment),f.range=[n,m,x.offset],f}function Hu(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function BT(e){var r;let t="",n=!1,s=!1;for(let a=0;a<e.length;++a){const l=e[a];switch(l[0]){case"#":t+=(t===""?"":s?`
|
|
424
|
-
|
|
425
|
-
`:`
|
|
426
|
-
`)+(l.substring(1)||" "),n=!0,s=!1;break;case"%":((r=e[a+1])==null?void 0:r[0])!=="#"&&(a+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}class PQ{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,r,a)=>{const l=Hu(n);a?this.warnings.push(new mQ(l,s,r)):this.errors.push(new sd(l,s,r))},this.directives=new Rn({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:r}=BT(this.prelude);if(s){const a=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
427
|
-
${s}`:s;else if(r||t.directives.docStart||!a)t.commentBefore=s;else if($t(a)&&!a.flow&&a.items.length>0){let l=a.items[0];qt(l)&&(l=l.key);const u=l.commentBefore;l.commentBefore=u?`${s}
|
|
428
|
-
${u}`:s}else{const l=a.commentBefore;a.commentBefore=l?`${s}
|
|
429
|
-
${l}`:s}}n?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:BT(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,s=-1){for(const r of t)yield*this.next(r);yield*this.end(n,s)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,s,r)=>{const a=Hu(t);a[0]+=n,this.onError(a,"BAD_DIRECTIVE",s,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=LQ(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new sd(Hu(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new sd(Hu(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=af(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s}
|
|
430
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new sd(Hu(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const s=Object.assign({_directives:this.directives},this.options),r=new yg(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}}const o6="\uFEFF",l6="",c6="",IN="";function $Q(e){switch(e){case o6:return"byte-order-mark";case l6:return"doc-mode";case c6:return"flow-error-end";case IN:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
431
|
-
`:case`\r
|
|
432
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Ts(e){switch(e){case void 0:case" ":case`
|
|
433
|
-
`:case"\r":case" ":return!0;default:return!1}}const FT=new Set("0123456789ABCDEFabcdef"),DQ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),pp=new Set(",[]{}"),qQ=new Set(` ,[]{}
|
|
434
|
-
\r `),Wy=e=>!e||qQ.has(e);class zQ{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
435
|
-
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
436
|
-
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){const r=this.buffer[s+t+1];if(r===`
|
|
437
|
-
`||!r&&!this.atEnd)return t+s+1}return n===`
|
|
438
|
-
`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&Ts(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
439
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===o6&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){const a=t[s-1];if(a===" "||a===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){const a=t[n-1];if(a===" "||a===" ")n-=1;else break}const r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield l6,yield*this.parseLineStart()}*parseLineStart(){const t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&Ts(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ts(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ts(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Wy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&Ts(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield c6,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Wy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const l=this.charAt(1);if(this.flowKey||Ts(l)||l===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const t=this.charAt(0);let n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let a=0;for(;this.buffer[n-1-a]==="\\";)a+=1;if(a%2===0)break;n=this.buffer.indexOf('"',n+1)}const s=this.buffer.substring(0,n);let r=s.indexOf(`
|
|
440
|
-
`,this.pos);if(r!==-1){for(;r!==-1;){const a=this.continueScalar(r+1);if(a===-1)break;r=s.indexOf(`
|
|
441
|
-
`,a)}r!==-1&&(n=r-(s[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ts(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let a=this.pos;s=this.buffer[a];++a)switch(s){case" ":n+=1;break;case`
|
|
442
|
-
`:t=a,n=0;break;case"\r":{const l=this.buffer[a+1];if(!l&&!this.atEnd)return this.setNext("block-scalar");if(l===`
|
|
443
|
-
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
|
|
444
|
-
`,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
445
|
-
`;)s=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let a=t-1,l=this.buffer[a];l==="\r"&&(l=this.buffer[--a]);const u=a;for(;l===" ";)l=this.buffer[--a];if(l===`
|
|
446
|
-
`&&a>=this.pos&&a+1+n>u)t=a;else break}while(!0);return yield IN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){const a=this.buffer[s+1];if(Ts(a)||t&&pp.has(a))break;n=s}else if(Ts(r)){let a=this.buffer[s+1];if(r==="\r"&&(a===`
|
|
447
|
-
`?(s+=1,r=`
|
|
448
|
-
`,a=this.buffer[s+1]):n=s),a==="#"||t&&pp.has(a))break;if(r===`
|
|
449
|
-
`){const l=this.continueScalar(s+1);if(l===-1)break;s=Math.max(s,l-2)}}else{if(t&&pp.has(r))break;n=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield IN,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Wy))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(Ts(n)||t&&pp.has(n))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Ts(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(DQ.has(n))n=this.buffer[++t];else if(n==="%"&&FT.has(this.buffer[t+1])&&FT.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===`
|
|
450
|
-
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
451
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");const r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class BQ{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n<s;){const a=n+s>>1;this.lineStarts[a]<t?n=a+1:s=a}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};const r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}}function Hi(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function HT(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function u6(e){switch(e==null?void 0:e.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function mp(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Rl(e){var n;if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function UT(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!Hi(t.start,"explicit-key-ind")&&!Hi(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,u6(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class FQ{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new zQ,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(t,n))yield*this.next(s);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}const n=$Q(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&UT(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{const r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&HT(r.start)===-1&&(n.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<n.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{HT(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){const n=mp(this.peek(2)),s=Rl(n);let r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];const a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
452
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
453
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const r="end"in n.value?n.value.end:void 0,a=Array.isArray(r)?r[r.length-1]:void 0;(a==null?void 0:a.type)==="comment"?r==null||r.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const r=t.items[t.items.length-2],a=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const r=!this.onKeyLine&&this.indent===t.indent,a=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let l=[];if(a&&n.sep&&!n.value){const u=[];for(let f=0;f<n.sep.length;++f){const d=n.sep[f];switch(d.type){case"newline":u.push(f);break;case"space":break;case"comment":d.indent>t.indent&&(u.length=0);break;default:u.length=0}}u.length>=2&&(l=n.sep.splice(u[1]))}switch(this.type){case"anchor":case"tag":a||n.value?(l.push(this.sourceToken),t.items.push({start:l}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):a||n.value?(l.push(this.sourceToken),t.items.push({start:l,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Hi(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]});else if(u6(n.key)&&!Hi(n.sep,"newline")){const u=Rl(n.start),f=n.key,d=n.sep;d.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:f,sep:d}]})}else l.length>0?n.sep=n.sep.concat(l,this.sourceToken):n.sep.push(this.sourceToken);else if(Hi(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const u=Rl(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||a?t.items.push({start:l,key:null,sep:[this.sourceToken]}):Hi(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const u=this.flowScalar(this.type);a||n.value?(t.items.push({start:l,key:u,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(u):(Object.assign(n,{key:u,sep:[]}),this.onKeyLine=!0);return}default:{const u=this.startBlockValue(t);if(u){if(u.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Hi(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:l});this.stack.push(u);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0,a=Array.isArray(r)?r[r.length-1]:void 0;(a==null?void 0:a.type)==="comment"?r==null||r.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const r=t.items[t.items.length-2],a=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Hi(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const r=mp(s),a=Rl(r);UT(t);const l=t.end.splice(1,t.end.length);l.push(this.sourceToken);const u={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=u}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
454
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
455
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=mp(t),s=Rl(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=mp(t),s=Rl(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function HQ(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new BQ||null,prettyErrors:t}}function UQ(e,t={}){const{lineCounter:n,prettyErrors:s}=HQ(t),r=new FQ(n==null?void 0:n.addNewLine),a=new PQ(t);let l=null;for(const u of a.compose(r.parse(e),!0,e.length))if(!l)l=u;else if(l.options.logLevel!=="silent"){l.errors.push(new sd(u.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(l.errors.forEach(qT(e,n)),l.warnings.forEach(qT(e,n))),l}function vg(e,t,n){let s;const r=UQ(e,n);if(!r)return null;if(r.warnings.forEach(a=>$D(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},n))}const VQ=["incident-timeline","progress","feature-shipped","implementation-plan","concept-explainer","pr-writeup","post-mortem"],GQ=new Set(VQ);function KQ(e){if(!e)return null;const t=e.kind;return t&&GQ.has(t)?t:null}const WQ=["timeline","stats","risk-table","compare","slate"],YQ=new Set(WQ);function QQ(e){return typeof e=="string"&&YQ.has(e)}const XQ=new Set(["success","warning","danger","info","muted"]);function ZQ(e){let t;try{t=vg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s;n.push({time:ar(r.time),status:XQ.has(r.status)?r.status:"info",title:ar(r.title),body:ar(r.body)})}return{ok:!0,entries:n}}const JQ=new Set(["up","flat","down"]);function eX(e){let t;try{t=vg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s,a=r.trend;n.push({label:ar(r.label),value:ar(r.value),...JQ.has(a)?{trend:a}:{}})}return{ok:!0,entries:n}}const VT=new Set(["low","med","high"]);function tX(e){let t;try{t=vg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s;n.push({risk:ar(r.risk),probability:VT.has(r.probability)?r.probability:"med",impact:VT.has(r.impact)?r.impact:"med",mitigation:ar(r.mitigation)})}return{ok:!0,entries:n}}function nX(e){let t;try{t=vg(e)}catch(l){return{ok:!1,reason:`YAML parse error: ${l instanceof Error?l.message:String(l)}`}}if(!t||typeof t!="object"||Array.isArray(t))return{ok:!1,reason:"expected a YAML mapping with columns + rows"};const n=t;if(!Array.isArray(n.columns))return{ok:!1,reason:"missing columns array"};const s=n.columns.map(ar),r=Array.isArray(n.rows)?n.rows:[],a=[];for(const l of r){if(!l||typeof l!="object"||Array.isArray(l))continue;const u=l;a.push({label:ar(u.label),values:Array.isArray(u.values)?u.values.map(ar):[]})}return{ok:!0,columns:s,rows:a}}function sX(e){const t=e.trim();return t.length===0?{ok:!1,reason:"empty slate body"}:{ok:!0,text:t}}function ar(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}const rX={success:{dot:"bg-emerald-600",ink:"text-emerald-800",label:"SUCCESS"},warning:{dot:"bg-amber-500",ink:"text-amber-800",label:"WARNING"},danger:{dot:"bg-red-600",ink:"text-red-800",label:"DANGER"},info:{dot:"bg-sky-600",ink:"text-sky-800",label:"INFO"},muted:{dot:"bg-stone-500",ink:"text-stone-700",label:"MUTED"}},GT={low:{ink:"text-emerald-800",label:"LOW"},med:{ink:"text-amber-800",label:"MED"},high:{ink:"text-red-800",label:"HIGH"}};function d6({children:e,testId:t="primitive-tldr-slate"}){return i.jsxs("div",{"data-testid":t,className:"my-4 border border-stone-900 bg-stone-900 px-4 py-3 text-[12px] leading-relaxed text-stone-50 hard-shadow",children:[i.jsx("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-400",children:"TL;DR"}),i.jsx("div",{children:e})]})}function iX({entries:e,testId:t="primitive-dot-timeline"}){return e.length===0?null:i.jsx("ol",{"data-testid":t,className:"my-4 list-none space-y-0 border-l border-outline-variant pl-0",children:e.map((n,s)=>{const r=rX[n.status],a=s===e.length-1;return i.jsxs("li",{className:"relative pl-9 pb-4","data-testid":`primitive-dot-timeline-entry-${s}`,children:[!a&&i.jsx("div",{className:"absolute left-[13px] top-6 bottom-0 w-px bg-outline-variant","aria-hidden":"true"}),i.jsx("div",{className:`absolute left-[7px] top-2 h-3 w-3 rounded-full border border-outline-variant ${r.dot}`,"data-status":n.status,"aria-hidden":"true"}),i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:n.time}),i.jsx("span",{className:`font-mono text-[8px] uppercase tracking-[0.12em] ${r.ink}`,children:r.label})]}),i.jsx("div",{className:"mt-1 text-[12px] font-semibold text-stone-900",children:n.title}),n.body&&i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-stone-700",children:n.body})]},s)})})}const aX={up:"↑",flat:"—",down:"↓"},oX={up:"text-emerald-700",flat:"text-stone-500",down:"text-red-700"};function lX({entries:e,testId:t="primitive-stat-card-band"}){return e.length===0?null:i.jsx("div",{"data-testid":t,className:"my-4 grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:e.map((n,s)=>i.jsxs("div",{"data-testid":`primitive-stat-card-${s}`,className:"border border-outline-variant bg-white/45 px-3 py-2 hard-shadow",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:n.label}),i.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[i.jsx("span",{className:"text-[18px] font-bold text-stone-900",children:n.value}),n.trend&&i.jsx("span",{className:`font-mono text-[10px] ${oX[n.trend]}`,"data-trend":n.trend,children:aX[n.trend]})]})]},s))})}function cX({entries:e,testId:t="primitive-risk-table-grid"}){return e.length===0?null:i.jsx("div",{"data-testid":t,className:"my-4 overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-outline-variant text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Risk"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Prob"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Impact"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Mitigation"})]})}),i.jsx("tbody",{children:e.map((n,s)=>{const r=GT[n.probability],a=GT[n.impact];return i.jsxs("tr",{"data-testid":`primitive-risk-row-${s}`,children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-900",children:n.risk}),i.jsx("td",{className:`border border-outline-variant px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] ${r.ink}`,children:r.label}),i.jsx("td",{className:`border border-outline-variant px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] ${a.ink}`,children:a.label}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-700",children:n.mitigation})]},s)})})]})})}function uX({columns:e,rows:t,testId:n="primitive-compare-table"}){return e.length===0?null:i.jsx("div",{"data-testid":n,className:"my-4 overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-outline-variant text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600"}),e.map((s,r)=>i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:s},r))]})}),i.jsx("tbody",{children:t.map((s,r)=>i.jsxs("tr",{"data-testid":`primitive-compare-row-${r}`,children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 font-mono text-[10px] font-semibold text-stone-700",children:s.label}),e.map((a,l)=>i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-800",children:s.values[l]??""},l))]},r))})]})})}function dX({label:e,body:t,testId:n="primitive-summary-strip"}){return i.jsxs("div",{"data-testid":n,className:"my-3 border-l-4 border-emerald-600 bg-emerald-50/60 px-3 py-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-emerald-800",children:e}),i.jsx("div",{className:"mt-1 text-[12px] text-stone-900",children:t})]})}function fX({language:e,text:t}){if(e==="timeline"){const n=ZQ(t);return n.ok?i.jsx(iX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Uu,{language:e,text:t,reason:n.reason})}if(e==="stats"){const n=eX(t);return n.ok?i.jsx(lX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Uu,{language:e,text:t,reason:n.reason})}if(e==="risk-table"){const n=tX(t);return n.ok?i.jsx(cX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Uu,{language:e,text:t,reason:n.reason})}if(e==="compare"){const n=nX(t);return n.ok?i.jsx(uX,{columns:n.columns,rows:n.rows,testId:`fenced-block-${e}`}):i.jsx(Uu,{language:e,text:t,reason:n.reason})}if(e==="slate"){const n=sX(t);return n.ok?i.jsx(d6,{testId:`fenced-block-${e}`,children:n.text}):i.jsx(Uu,{language:e,text:t,reason:n.reason})}return null}function Uu({language:e,text:t,reason:n}){return i.jsxs("div",{"data-testid":`fenced-block-${e}-fallback`,className:"my-3 border border-amber-300 bg-amber-50/60 p-3",children:[i.jsxs("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-amber-700",children:[e," block (fallback: ",n,")"]}),i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:t})]})}const hX={"incident-timeline":{ink:"text-red-800",pill:"bg-red-50 border-red-300",label:"INCIDENT TIMELINE"},progress:{ink:"text-sky-800",pill:"bg-sky-50 border-sky-300",label:"PROGRESS"},"feature-shipped":{ink:"text-emerald-800",pill:"bg-emerald-50 border-emerald-300",label:"FEATURE SHIPPED"},"implementation-plan":{ink:"text-violet-800",pill:"bg-violet-50 border-violet-300",label:"IMPLEMENTATION PLAN"},"concept-explainer":{ink:"text-amber-800",pill:"bg-amber-50 border-amber-300",label:"CONCEPT EXPLAINER"},"pr-writeup":{ink:"text-stone-800",pill:"bg-stone-50 border-stone-300",label:"PR WRITEUP"},"post-mortem":{ink:"text-stone-900",pill:"bg-stone-100 border-stone-400",label:"POST-MORTEM"}};function pX({kind:e,frontmatter:t,children:n}){const s=hX[e],r=t.title,a=t.status,l=t.author,u=t.authored||t.date,f=t.tldr,d=t.summary;return i.jsxs("section",{"data-testid":`kind-frame-${e}`,"data-kind":e,className:"my-2",children:[i.jsxs("header",{className:"mb-3 border-b border-outline-variant pb-2",children:[i.jsx("div",{"data-testid":`kind-badge-${e}`,className:`inline-block border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.18em] ${s.pill} ${s.ink}`,children:s.label}),r&&i.jsx("h1",{"data-testid":"kind-frame-title",className:"mt-2 text-[16px] font-bold text-stone-900",children:r}),(a||l||u)&&i.jsxs("div",{"data-testid":"kind-frame-meta",className:"mt-1 flex flex-wrap items-center gap-3 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:[a&&i.jsxs("span",{"data-testid":"kind-frame-meta-status",children:["status: ",a]}),l&&i.jsx("span",{"data-testid":"kind-frame-meta-author",children:l}),u&&i.jsx("span",{"data-testid":"kind-frame-meta-date",children:u})]})]}),f&&i.jsx(d6,{testId:"kind-frame-tldr",children:f}),e==="feature-shipped"&&d&&i.jsx(dX,{label:"SHIPPED",body:d,testId:"kind-frame-summary"}),i.jsx("div",{"data-testid":"kind-frame-body",children:n})]})}function Zr({content:e,assetBasePath:t,hideFrontmatter:n=!1,hideRawToggle:s=!1}){const r=E.useMemo(()=>gX(e),[e]),[a,l]=E.useState("rendered");return i.jsxs("article",{"data-testid":"markdown-viewer","data-mode":a,className:"prose-tactical max-w-none",children:[!s&&i.jsxs("div",{"data-testid":"markdown-viewer-mode-toggle",className:"mb-2 flex items-center gap-1",children:[i.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-rendered","data-active":a==="rendered",onClick:()=>l("rendered"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${a==="rendered"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"rendered"}),i.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-raw","data-active":a==="raw",onClick:()=>l("raw"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${a==="raw"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"raw"})]}),!n&&r.frontmatter&&i.jsx(yX,{frontmatter:r.frontmatter}),a==="raw"?i.jsx("pre",{"data-testid":"markdown-viewer-raw",className:"overflow-x-auto whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:e}):i.jsx(mX,{parsed:r,assetBasePath:t})]})}function mX({parsed:e,assetBasePath:t}){const n=KQ(e.frontmatter),s=i.jsx("div",{className:"space-y-3","data-testid":"markdown-viewer-rendered",children:e.blocks.map((r,a)=>i.jsx(vX,{block:r,assetBasePath:t},a))});return n&&e.frontmatter?i.jsx(pX,{kind:n,frontmatter:e.frontmatter,children:s}):s}function gX(e){var l;const{frontmatter:t,body:n}=xX(e),s=n.split(`
|
|
456
|
-
`),r=[];let a=0;for(;a<s.length;){const u=s[a],f=u.match(/^```([\w-]*)\s*$/);if(f){const m=f[1]||null,x=(m==null?void 0:m.toLowerCase())==="mermaid",y=a+1;let b=y;for(;b<s.length&&!s[b].match(/^```\s*$/);)b++;const v=s.slice(y,b).join(`
|
|
457
|
-
`);r.push({type:"code",language:m,text:v,isMermaid:x}),a=b+1;continue}const d=u.match(/^(#{1,4})\s+(.+?)\s*$/);if(d){r.push({type:"heading",level:d[1].length,text:d[2]}),a++;continue}if(u.match(/^\s*([-*]|\d+\.)\s+/)){const m=[],x=!!u.match(/^\s*\d+\./);for(;a<s.length&&s[a].match(/^\s*([-*]|\d+\.)\s+/);){const y=s[a].match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(!y)break;const b=Math.floor((((l=y[1])==null?void 0:l.length)??0)/2);m.push({depth:b,text:y[3]}),a++}r.push({type:"list",ordered:x,items:m});continue}if(u.match(/^\s*\|.*\|\s*$/)&&a+1<s.length&&s[a+1].match(/^\s*\|[\s\-:|]+\|\s*$/)){const m=KT(u);a+=2;const x=[];for(;a<s.length&&s[a].match(/^\s*\|.*\|\s*$/);)x.push(KT(s[a])),a++;r.push({type:"table",headers:m,rows:x});continue}if(u.trim()===""){r.push({type:"blank"}),a++;continue}const p=[u];for(a++;a<s.length;){const m=s[a];if(m.trim()===""||m.match(/^```/)||m.match(/^#{1,4}\s/)||m.match(/^\s*([-*]|\d+\.)\s/)||m.match(/^\s*\|.*\|\s*$/))break;p.push(m),a++}r.push({type:"paragraph",text:p.join(" ")})}return{frontmatter:t,blocks:r}}function xX(e){if(!e.startsWith(`---
|
|
458
|
-
`)&&!e.startsWith(`---\r
|
|
459
|
-
`))return{frontmatter:null,body:e};const t=e.slice(e.indexOf(`
|
|
460
|
-
`)+1),n=t.match(/(^|\n)---(\n|$)/);if(!n||n.index===void 0)return{frontmatter:null,body:e};const s=t.slice(0,n.index),r=t.slice(n.index+n[0].length),a={};for(const l of s.split(`
|
|
461
|
-
`)){const u=l.match(/^([\w.-]+):\s*(.+?)\s*$/);if(u){let f=u[2];(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))&&(f=f.slice(1,-1)),a[u[1]]=f}}return{frontmatter:a,body:r}}function KT(e){return e.trim().replace(/^\||\|$/g,"").split("|").map(t=>t.trim())}function yX({frontmatter:e}){const t=Object.entries(e);return t.length===0?null:i.jsxs("section",{"data-testid":"markdown-frontmatter",className:"mb-4 border border-stone-300 bg-stone-50 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Frontmatter"}),i.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:t.map(([n,s])=>i.jsxs(E.Fragment,{children:[i.jsx("dt",{className:"font-mono text-[10px] font-bold text-stone-700",children:n}),i.jsx("dd",{className:"font-mono text-[10px] text-stone-800 break-all",children:s})]},n))})]})}function vX({block:e,assetBasePath:t}){if(e.type==="blank")return null;if(e.type==="heading"){const n={1:"text-lg font-bold",2:"text-base font-bold",3:"text-sm font-bold",4:"text-xs font-bold"},s=`h${e.level}`;return i.jsx(s,{"data-testid":`md-heading-${e.level}`,className:`${n[e.level]} mt-4 text-stone-900`,children:Vu(e.text,t)})}if(e.type==="paragraph")return i.jsx("p",{"data-testid":"md-paragraph",className:"text-[12px] leading-relaxed text-stone-800",children:Vu(e.text,t)});if(e.type==="code")return QQ(e.language)?i.jsx(fX,{language:e.language,text:e.text}):e.isMermaid?i.jsxs("div",{"data-testid":"md-mermaid-placeholder",className:"border border-amber-300 bg-amber-50 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-amber-700",children:"mermaid diagram (v0+1 trigger: render-on-click flow)"}),i.jsx("pre",{className:"overflow-x-auto bg-stone-900 p-2 font-mono text-[10px] text-stone-100",children:i.jsx("code",{children:e.text})}),i.jsx("button",{type:"button","data-testid":"md-mermaid-render-btn",disabled:!0,title:"Mermaid rendering not bundled at v0 (named v0+1 trigger). Inspect the source above.",className:"mt-2 cursor-not-allowed border border-amber-400 bg-amber-100 px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] text-amber-800",children:"[render mermaid] (v0+1)"})]}):i.jsx(lg,{code:e.text,language:e.language});if(e.type==="list"){const n=e.ordered?"ol":"ul";return i.jsx(n,{"data-testid":`md-list-${e.ordered?"ol":"ul"}`,className:`${e.ordered?"list-decimal":"list-disc"} ml-5 space-y-1 text-[12px] text-stone-800`,children:e.items.map((s,r)=>i.jsx("li",{style:{marginLeft:`${s.depth*1}rem`},children:Vu(s.text,t)},r))})}return e.type==="table"?i.jsx("div",{"data-testid":"md-table-wrapper",className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-stone-300 text-[10px]",children:[i.jsx("thead",{className:"bg-stone-100",children:i.jsx("tr",{children:e.headers.map((n,s)=>i.jsx("th",{className:"border border-stone-300 px-2 py-1 text-left font-bold text-stone-900",children:Vu(n,t)},s))})}),i.jsx("tbody",{children:e.rows.map((n,s)=>i.jsx("tr",{className:s%2===0?"bg-white":"bg-stone-50",children:n.map((r,a)=>i.jsx("td",{className:"border border-stone-300 px-2 py-1 text-stone-800",children:Vu(r,t)},a))},s))})]})}):null}function Vu(e,t){const n=[];let s=0,r=0;const a=(u,f)=>{f>u&&n.push(e.slice(u,f))};let l=0;for(;s<e.length;){const u=e.slice(s),f=u.match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(f){a(l,s);const p=bX(f[2],t);n.push(i.jsx("img",{"data-testid":"md-inline-image",src:p,alt:f[1]??"",loading:"lazy",className:"my-2 inline-block max-w-full border border-stone-200"},r++)),s+=f[0].length,l=s;continue}const d=u.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(d){a(l,s),n.push(i.jsx("a",{"data-testid":"md-inline-link",href:d[2],target:"_blank",rel:"noopener noreferrer",className:"text-blue-700 underline hover:text-blue-900",children:d[1]},r++)),s+=d[0].length,l=s;continue}if(u.startsWith("`")){const p=u.indexOf("`",1);if(p!==-1){a(l,s),n.push(i.jsx("code",{"data-testid":"md-inline-code",className:"bg-stone-100 px-1 font-mono text-[10px] text-stone-900",children:u.slice(1,p)},r++)),s+=p+1,l=s;continue}}if(u.startsWith("**")){const p=u.indexOf("**",2);if(p!==-1){a(l,s),n.push(i.jsx("strong",{className:"font-bold",children:u.slice(2,p)},r++)),s+=p+2,l=s;continue}}if(u.startsWith("*")&&!u.startsWith("**")){const p=u.indexOf("*",1);if(p!==-1&&p>1){a(l,s),n.push(i.jsx("em",{className:"italic",children:u.slice(1,p)},r++)),s+=p+1,l=s;continue}}s++}return a(l,e.length),n}function bX(e,t){if(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/")||!t)return e;const n=t.endsWith("/")?"":"/";return`${t}${n}${e}`}function f6(e){const t=e.toLowerCase();return t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".json")?"json":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")?"image":(t.endsWith(".log")||t.endsWith(".txt"),"text")}function WT(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function wX(e,t){if(!e||!t)return null;const n=WT(t),s=[...e].sort((r,a)=>a.path.length-r.path.length);for(const r of s){const a=WT(r.path);if(n===a)return null;const l=`${a}/`;if(!n.startsWith(l))continue;const u=n.slice(l.length);return!u||u.includes("../")?null:{root:r.name,path:u}}return null}function jX(e){const t=e.root?{root:e.root,path:e.readPath??e.path}:null,n=!t&&!!e.absolutePath,s=Qm(),r=E.useMemo(()=>{if(!n)return null;const a=s.data;return!a||"unavailable"in a?null:wX(a.roots,e.absolutePath)},[e.absolutePath,n,s.data]);return{rootsLoading:n&&s.isLoading,target:t??r,hasFetchIntent:!!t||!!e.absolutePath}}function h6({path:e,resolvedKind:t,content:n,imageUrl:s,target:r}){return!n&&!s&&t!=="binary"?i.jsx(Ve,{label:"NO CONTENT",description:`Loading ${e}...`,variant:"card",testId:"file-viewer-empty"}):i.jsxs("div",{"data-testid":"file-viewer","data-file-kind":t,className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[i.jsx(Pe,{tool:e,size:"sm",decorative:!0}),i.jsx(it,{tone:"muted",children:cD(e).label})]}),i.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e}),r&&i.jsxs("div",{"data-testid":"file-viewer-root-path",className:"mt-1 font-mono text-[9px] text-stone-500 break-all",children:[r.root,"/",r.path]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[t==="markdown"&&n?i.jsx("div",{className:"px-4 py-3",children:i.jsx(Zr,{content:n})}):null,t==="yaml"||t==="json"?i.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre-wrap",children:n}):null,t==="text"?i.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre",children:n}):null,t==="image"&&s?i.jsx("div",{className:"px-4 py-3 flex justify-center",children:i.jsx("img",{src:s,alt:e,className:"max-w-full h-auto"})}):null,t==="binary"?i.jsx("div",{className:"px-4 py-6",children:i.jsx(Ve,{label:"BINARY",description:"Cannot preview; download instead.",variant:"card",testId:"file-viewer-binary"})}):null]})]})}function SX(e){var b,v;const{path:t,kind:n,content:s,imageUrl:r}=e,a=n??f6(t),{rootsLoading:l,target:u,hasFetchIntent:f}=jX(e),d=Xm((u==null?void 0:u.root)??null,(u==null?void 0:u.path)??null),p=(b=d.data)==null?void 0:b.content,m=u&&a==="image"?NN(u.root,u.path):void 0,x=s??p,y=r??m;return!s&&!r&&f&&(l||d.isLoading)?i.jsx(Ve,{label:"LOADING",description:`Loading ${t}...`,variant:"card",testId:"file-viewer-empty"}):!s&&!r&&f&&!u?i.jsx(Ve,{label:"FILE UNAVAILABLE",description:`No configured file root contains ${t}.`,variant:"card",testId:"file-viewer-error"}):!s&&!r&&d.isError?i.jsx(Ve,{label:"FILE UNAVAILABLE",description:((v=d.error)==null?void 0:v.message)??`Could not load ${t}.`,variant:"card",testId:"file-viewer-error"}):i.jsx(h6,{path:t,resolvedKind:a,content:x,imageUrl:y,target:u})}function NX(e){return!e.root&&!e.absolutePath?i.jsx(h6,{path:e.path,resolvedKind:e.kind??f6(e.path),content:e.content,imageUrl:e.imageUrl}):i.jsx(SX,{...e})}function kX({specKind:e,specName:t,version:n,source:s,manifestExcerpt:r,entryId:a}){return i.jsxs("div",{"data-testid":"sub-spec-preview",className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsx(it,{tone:"muted",children:"Referenced spec"}),i.jsxs("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:[e,": ",t]})]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-1.5 font-mono text-xs",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Kind"}),i.jsx("span",{className:"text-stone-900",children:e})]}),n?i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Version"}),i.jsx("span",{className:"text-stone-900",children:n})]}):null,s?i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Source"}),i.jsx("span",{className:"text-stone-900 uppercase",children:s.replace("_"," ")})]}):null]}),i.jsxs("div",{className:"px-4 py-3 flex-1 min-h-0 overflow-y-auto",children:[i.jsx(it,{tone:"muted",children:"Manifest excerpt"}),r?i.jsx("pre",{className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:r}):i.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No excerpt available."})]}),a?i.jsx("div",{className:"px-4 py-3 border-t border-outline-variant",children:i.jsx(Ue,{to:"/specs/library/$entryId",params:{entryId:a},"data-testid":"sub-spec-open-center",className:"inline-flex items-center px-3 py-1 border border-outline-variant bg-white font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100",children:"Open in center →"})}):null]})}function _X({selection:e,onClose:t,events:n,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:a,onClearPlacement:l}){if(!e)return null;const u=e.type==="system"?i.jsx(eY,{onClose:t,events:n,initialTab:e.tab??"log"}):e.type==="discovery"?i.jsx(vY,{onClose:t,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:a,onClearPlacement:l}):e.type==="qitem"?i.jsx(CY,{...e.data}):e.type==="file"?i.jsx(NX,{...e.data}):e.type==="sub-spec"?i.jsx(kX,{...e.data}):null;return i.jsxs("div",{"data-testid":"shared-detail-drawer-layer",className:"fixed top-14 right-0 bottom-0 left-0 z-30 pointer-events-none",children:[i.jsx("button",{type:"button","aria-label":"Close drawer","data-testid":"shared-detail-drawer-outside",className:"absolute inset-0 cursor-default pointer-events-auto",onPointerDown:t}),i.jsx(jY,{edge:"right",width:"wide",onClose:t,testId:"shared-detail-drawer",className:"absolute top-0 right-0 bottom-0 z-10 pointer-events-auto",children:u})]})}async function CX(e,t,n){const s=`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/preview?lines=${n}`,r=await fetch(s);if(r.status===404)return{unavailable:!0,reason:(await r.json().catch(()=>({}))).error??"preview_unavailable"};if(r.status===409){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"session_unbound",hint:a.hint}}if(r.status===502){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"capture_failed",hint:a.hint}}if(r.status===503){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"preview_unavailable",hint:a.hint}}if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}function EX(e){var l,u,f,d;const{data:t}=ba(),n=(u=(l=t==null?void 0:t.settings)==null?void 0:l["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(d=(f=t==null?void 0:t.settings)==null?void 0:f["ui.preview.default_lines"])==null?void 0:d.value,r=e.lines??s??50,a=e.paused?!1:(n??3)*1e3;return De({queryKey:["node-preview",e.rigId,e.logicalId,r],queryFn:()=>CX(e.rigId,e.logicalId,r),enabled:!!e.rigId&&!!e.logicalId&&!e.paused,refetchInterval:a,refetchIntervalInBackground:!1,staleTime:0})}function Za(e){return!!(e&&"unavailable"in e)}async function RX(e,t){const n=`/api/sessions/${encodeURIComponent(e)}/preview?lines=${t}`,s=await fetch(n);if(s.status===404)return{unavailable:!0,reason:(await s.json().catch(()=>({}))).error??"preview_unavailable"};if(s.status===502||s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,reason:r.error??"preview_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function AX(e){var l,u,f,d;const{data:t}=ba(),n=(u=(l=t==null?void 0:t.settings)==null?void 0:l["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(d=(f=t==null?void 0:t.settings)==null?void 0:f["ui.preview.default_lines"])==null?void 0:d.value,r=e.lines??s??50,a=e.paused?!1:(n??3)*1e3;return De({queryKey:["session-preview",e.sessionName,r],queryFn:()=>RX(e.sessionName,r),enabled:!!e.sessionName&&!e.paused,refetchInterval:a,refetchIntervalInBackground:!1,staleTime:0})}class TX{constructor(){ns(this,"pins",[]);ns(this,"listeners",new Set);ns(this,"maxPins",4)}setMaxPins(t){this.maxPins=Math.max(1,Math.floor(t)),this.pins.length>this.maxPins&&(this.pins=this.pins.slice(0,this.maxPins),this.notify())}getMaxPins(){return this.maxPins}list(){return this.pins}isPinned(t,n){return this.pins.some(s=>s.rigId===t&&s.logicalId===n)}pin(t){return this.isPinned(t.rigId,t.logicalId)?!0:this.pins.length>=this.maxPins?!1:(this.pins=[...this.pins,t],this.notify(),!0)}unpin(t,n){const s=this.pins.filter(r=>!(r.rigId===t&&r.logicalId===n));s.length!==this.pins.length&&(this.pins=s,this.notify())}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t(this.pins)}}const Pi=new TX;function p6(){var s,r;const{data:e}=ba(),t=(r=(s=e==null?void 0:e.settings)==null?void 0:s["ui.preview.max_pins"])==null?void 0:r.value;return E.useEffect(()=>{typeof t=="number"&&Pi.setMaxPins(t)},[t]),{pins:E.useSyncExternalStore(a=>Pi.subscribe(a),()=>Pi.list(),()=>Pi.list()),maxPins:Pi.getMaxPins(),pin:a=>Pi.pin(a),unpin:(a,l)=>Pi.unpin(a,l),isPinned:(a,l)=>Pi.isPinned(a,l)}}function IX({rigId:e,rigName:t,logicalId:n,lines:s,paused:r,hidePinButton:a,compact:l,testIdPrefix:u="preview"}){var v;const f=EX({rigId:e,logicalId:n,lines:s,paused:r}),{isPinned:d,pin:p,unpin:m}=p6(),x=d(e,n),y=()=>{var w;if(x)m(e,n);else{const S=Za(f.data)?"":((w=f.data)==null?void 0:w.sessionName)??"";p({rigId:e,rigName:t??e,logicalId:n,sessionName:S})}},b=l?"max-h-32":"max-h-64";return i.jsxs("div",{"data-testid":`${u}-pane`,"data-rig-id":e,"data-logical-id":n,"data-paused":r?"true":"false",className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",n]}),!a&&i.jsx("button",{type:"button","data-testid":`${u}-pin-toggle`,"data-pinned":x?"true":"false",onClick:y,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 shrink-0",children:x?"Unpin":"Pin"})]}),f.isLoading&&i.jsx("div",{"data-testid":`${u}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),f.isError&&i.jsx("div",{"data-testid":`${u}-error`,className:"font-mono text-[9px] text-red-600",children:((v=f.error)==null?void 0:v.message)??"Preview failed."}),Za(f.data)&&i.jsxs("div",{"data-testid":`${u}-unavailable`,className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[i.jsxs("div",{children:["Preview unavailable: ",f.data.reason,"."]}),f.data.hint&&i.jsx("div",{className:"text-stone-400",children:f.data.hint}),i.jsxs("div",{className:"text-stone-400",children:["Use ",i.jsxs("code",{children:["rig capture ",n]})," from terminal as a fallback."]})]}),!Za(f.data)&&f.data&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{"data-testid":`${u}-content`,className:`font-mono text-[9px] text-stone-800 bg-stone-50 px-2 py-1 ${b} overflow-y-auto whitespace-pre-wrap break-all`,children:f.data.content||"(empty pane)"}),i.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[i.jsxs("span",{children:["captured ",new Date(f.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),i.jsxs("span",{children:[f.data.lines," lines"]})]})]})]})}function MX({testIdPrefix:e="preview-stack"}){const{pins:t}=p6();return t.length===0?null:i.jsxs("aside",{"data-testid":e,className:"absolute inset-y-0 right-0 z-10 w-72 border-l border-stone-300/25 bg-[rgba(250,249,245,0.04)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.02)] backdrop-blur-[12px] shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-y-auto pointer-events-auto",children:[i.jsxs("header",{className:"px-3 py-2 border-b border-stone-300/35 shrink-0",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-700",children:"Pinned previews"}),i.jsxs("span",{className:"ml-2 font-mono text-[9px] text-stone-500",children:[t.length," pinned"]})]}),i.jsx("div",{className:"flex-1 px-2 py-2 space-y-2",children:t.map(n=>i.jsx(IX,{rigId:n.rigId,rigName:n.rigName,logicalId:n.logicalId,compact:!0,testIdPrefix:`pinned-preview-${n.logicalId}`},`${n.rigId}:${n.logicalId}`))})]})}const Ms={currentRigDraft:"openrig.specs.current-rig-draft",currentAgentDraft:"openrig.specs.current-agent-draft",recentRigDrafts:"openrig.specs.recent-rig-drafts",recentAgentDrafts:"openrig.specs.recent-agent-drafts",bootstrapSourceRef:"openrig.specs.bootstrap-source-ref"},OX={currentRigDraft:"rigged.specs.current-rig-draft",currentAgentDraft:"rigged.specs.current-agent-draft",recentRigDrafts:"rigged.specs.recent-rig-drafts",recentAgentDrafts:"rigged.specs.recent-agent-drafts",bootstrapSourceRef:"rigged.specs.bootstrap-source-ref"},LX={activeTask:null,currentRigDraft:null,currentAgentDraft:null,recentRigDrafts:[],recentAgentDrafts:[],selectedRigDraft:null,selectedAgentDraft:null,bootstrapSourceRef:"",saveRigDraft:()=>{},rememberRigDraft:()=>{},selectRigDraft:()=>{},clearSelectedRigDraft:()=>{},saveAgentDraft:()=>{},rememberAgentDraft:()=>{},selectAgentDraft:()=>{},clearSelectedAgentDraft:()=>{},setBootstrapSourceRef:()=>{}},m6=E.createContext(LX);function Gu(e,t){var n;if(typeof window>"u")return t;try{const s=window.localStorage.getItem(e);if(s)return JSON.parse(s);const r=((n=Object.entries(Ms).find(([,f])=>f===e))==null?void 0:n[0])??null;if(!r)return t;const a=OX[r];if(!a)return t;const l=window.localStorage.getItem(a);if(!l)return t;const u=JSON.parse(l);return window.localStorage.setItem(e,JSON.stringify(u)),window.localStorage.removeItem(a),u}catch{return t}}function Ku(e,t){if(!(typeof window>"u"))try{if(t===""||t===null){window.localStorage.removeItem(e);return}window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function gp(e,t,n){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,kind:e,label:n??(e==="rig"?"Untitled RigSpec":"Untitled AgentSpec"),yaml:t,updatedAt:Date.now()}}function xp(e,t){var s;const n=e.match(/^\s*name:\s*["']?([^"'\n#]+)["']?/m);return((s=n==null?void 0:n[1])==null?void 0:s.trim())||t}function YT(e,t){return[t,...e.filter(n=>n.id!==t.id&&n.yaml!==t.yaml)].slice(0,5)}function PX(e,t,n,s){if(e==="/import")return t?{id:"import",label:"Import RigSpec",route:"/import",summary:t.label}:null;if(e==="/bootstrap"){const r=s.trim();return r?{id:"bootstrap",label:"Bootstrap",route:"/bootstrap",summary:r}:null}return e==="/agents/validate"&&n?{id:"validate-agent",label:"Validate AgentSpec",route:"/agents/validate",summary:n.label}:null}function $X({children:e}){const t=ya({select:L=>L.location.pathname}),[n,s]=E.useState(()=>Gu(Ms.currentRigDraft,null)),[r,a]=E.useState(()=>Gu(Ms.currentAgentDraft,null)),[l,u]=E.useState(()=>Gu(Ms.recentRigDrafts,[])),[f,d]=E.useState(()=>Gu(Ms.recentAgentDrafts,[])),[p,m]=E.useState(null),[x,y]=E.useState(null),[b,v]=E.useState(()=>Gu(Ms.bootstrapSourceRef,""));E.useEffect(()=>{Ku(Ms.currentRigDraft,n)},[n]),E.useEffect(()=>{Ku(Ms.currentAgentDraft,r)},[r]),E.useEffect(()=>{Ku(Ms.recentRigDrafts,l)},[l]),E.useEffect(()=>{Ku(Ms.recentAgentDrafts,f)},[f]),E.useEffect(()=>{Ku(Ms.bootstrapSourceRef,b.trim())},[b]);const w=E.useMemo(()=>l.find(L=>L.id===p)??((n==null?void 0:n.id)===p?n:null),[n,l,p]),S=E.useMemo(()=>f.find(L=>L.id===x)??((r==null?void 0:r.id)===x?r:null),[r,f,x]),C=E.useCallback((L,$)=>{if(!L.trim()){s(null);return}s(O=>({id:(O==null?void 0:O.id)??gp("rig",L,$).id,kind:"rig",label:$??xp(L,(O==null?void 0:O.label)??"Untitled RigSpec"),yaml:L,updatedAt:Date.now()}))},[]),k=E.useCallback((L,$)=>{if(!L.trim())return;const O=gp("rig",L,$??xp(L,"Untitled RigSpec"));s(O),u(B=>YT(B,O)),m(O.id)},[]),_=E.useCallback((L,$)=>{if(!L.trim()){a(null);return}a(O=>({id:(O==null?void 0:O.id)??gp("agent",L,$).id,kind:"agent",label:$??xp(L,(O==null?void 0:O.label)??"Untitled AgentSpec"),yaml:L,updatedAt:Date.now()}))},[]),R=E.useCallback((L,$)=>{if(!L.trim())return;const O=gp("agent",L,$??xp(L,"Untitled AgentSpec"));a(O),d(B=>YT(B,O)),y(O.id)},[]),T=E.useCallback(L=>{m(L);const $=l.find(O=>O.id===L)??((n==null?void 0:n.id)===L?n:null);$&&s($)},[n,l]),A=E.useCallback(L=>{y(L);const $=f.find(O=>O.id===L)??((r==null?void 0:r.id)===L?r:null);$&&a($)},[r,f]),I=E.useMemo(()=>({activeTask:PX(t,n,r,b),currentRigDraft:n,currentAgentDraft:r,recentRigDrafts:l,recentAgentDrafts:f,selectedRigDraft:w,selectedAgentDraft:S,bootstrapSourceRef:b,saveRigDraft:C,rememberRigDraft:k,selectRigDraft:T,clearSelectedRigDraft:()=>m(null),saveAgentDraft:_,rememberAgentDraft:R,selectAgentDraft:A,clearSelectedAgentDraft:()=>y(null),setBootstrapSourceRef:v}),[t,n,r,l,f,w,S,b,C,k,T,_,R,A]);return i.jsx(m6.Provider,{value:I,children:e})}function of(){return E.useContext(m6)}const g6=E.createContext({mode:"opaque",setMode:()=>{},expandedRigs:new Map,setRigExpanded:()=>{},toggleRig:()=>{}});function DX(e){const t=e.match(/^\/topology\/seat\/([^/]+)\//);if(t)return decodeURIComponent(t[1]);const n=e.match(/^\/topology\/pod\/([^/]+)\//);if(n)return decodeURIComponent(n[1]);const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?decodeURIComponent(s[1]):null}function qX({children:e}){const[t,n]=E.useState("opaque"),s=E.useCallback(p=>{n(p)},[]),[r,a]=E.useState(()=>new Map),l=E.useCallback((p,m)=>{a(x=>{if(x.has(p)&&x.get(p)===m)return x;const y=new Map(x);return y.set(p,m),y})},[]),u=E.useCallback(p=>{a(m=>{const x=new Map(m);return x.set(p,!(m.get(p)??!1)),x})},[]),f=ya({select:p=>p.location.pathname});E.useEffect(()=>{const p=DX(f);p&&l(p,!0)},[f,l]);const d=E.useMemo(()=>({mode:t,setMode:s,expandedRigs:r,setRigExpanded:l,toggleRig:u}),[t,s,r,l,u]);return i.jsx(g6.Provider,{value:d,children:e})}function xk(){return E.useContext(g6)}function zX(){const e=Mt(),t=E.useRef(null);E.useEffect(()=>{const n=new Set,s=ag(r=>{const{type:a,rigId:l}=r;a&&(a.startsWith("node.startup_")&&l&&n.add(`rig:${l}:nodes`),(a==="rig.created"||a==="rig.deleted"||a==="rig.stopped"||a==="rig.imported"||a==="bootstrap.completed"||a==="bootstrap.partial")&&(n.add("rigs:summary"),n.add("ps")),a==="restore.completed"&&l&&(n.add("rigs:summary"),n.add("ps"),n.add(`rig:${l}:nodes`)),!t.current&&(t.current=setTimeout(()=>{t.current=null;for(const u of n)if(u==="rigs:summary")e.invalidateQueries({queryKey:["rigs","summary"]});else if(u==="ps")e.invalidateQueries({queryKey:["ps"]});else if(u.startsWith("rig:")){const f=u.split(":");e.invalidateQueries({queryKey:["rig",f[1],f[2]]})}n.clear()},150)))});return()=>{s(),t.current&&(clearTimeout(t.current),t.current=null)}},[e])}const x6=E.createContext({selection:null,setSelection:()=>{}}),y6=E.createContext({selectedDiscoveredId:null,setSelectedDiscoveredId:()=>{},placementTarget:null,setPlacementTarget:()=>{},clearPlacement:()=>{}});function bg(){return E.useContext(x6)}function BX(){return E.useContext(y6)}const QT=[{id:"dashboard",label:"Dashboard",to:"/",icon:IV,activeWhen:e=>e==="/",testId:"rail-dashboard",group:"destination"},{id:"topology",label:"Topology",to:"/topology",icon:N2,activeWhen:e=>e.startsWith("/topology")||e.startsWith("/rigs/"),testId:"rail-topology",group:"destination"},{id:"for-you",label:"For You",to:"/for-you",icon:_2,activeWhen:e=>e.startsWith("/for-you"),testId:"rail-for-you",group:"destination"},{id:"project",label:"Project",to:"/project",icon:S2,activeWhen:e=>e.startsWith("/project"),testId:"rail-project",group:"destination"},{id:"specs",label:"Library",to:"/specs",icon:O$,activeWhen:e=>e.startsWith("/specs")||e.startsWith("/plugins"),testId:"rail-specs",group:"destination"},{id:"settings",label:"Settings",to:"/settings",icon:M$,activeWhen:e=>e.startsWith("/settings"),testId:"rail-settings",group:"destination"},{id:"advisor",label:"Advisor",to:"/settings#agents-advisor-session",icon:iV,activeWhen:()=>!1,testId:"rail-advisor",group:"chat"},{id:"operator",label:"Operator",to:"/settings#agents-operator-session",icon:oG,activeWhen:()=>!1,testId:"rail-operator",group:"chat"}];function XT(e,t){var s;if(!e||!e.settings)return"";const n=(s=e.settings[t])==null?void 0:s.value;return typeof n=="string"?n:""}function ZT(e,t){if(!e)return`/settings#agents-${t}-session`;const n=e.indexOf("@");if(n===-1)return`/settings#agents-${t}-session`;const s=e.slice(0,n),r=e.slice(n+1);return!r||!s?`/settings#agents-${t}-session`:`/topology/seat/${encodeURIComponent(r)}/${encodeURIComponent(s)}`}function FX(e){return e.startsWith("/topology")||e.startsWith("/rigs/")?"topology":e.startsWith("/project")?"project":e.startsWith("/specs")||e.startsWith("/plugins")?"specs":e.startsWith("/for-you")?"for-you":e.startsWith("/settings")?"settings":"none"}function JT({pathname:e,onMobileClose:t,vertical:n}){const s=QT.filter(d=>d.group==="destination"),{data:r}=ba(),a=XT(r,"agents.advisor_session"),l=XT(r,"agents.operator_session"),u=QT.filter(d=>d.group==="chat").map(d=>d.id==="advisor"?{...d,to:ZT(a,"advisor")}:d.id==="operator"?{...d,to:ZT(l,"operator")}:d),f=d=>{const p=d.icon,m=d.activeWhen(e);return i.jsxs(Ue,{to:d.to,"data-testid":d.testId,"data-active":m,"aria-label":d.label,title:d.label,onClick:t,className:he("relative flex h-11 w-11 items-center justify-center transition-colors lg:h-10 lg:w-10","focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",m?"bg-stone-900 text-stone-50":"text-stone-700 hover:bg-stone-200/60 hover:text-stone-900"),children:[i.jsx(p,{className:"h-5 w-5",strokeWidth:1.25}),m&&i.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1 bottom-1 w-[2px] bg-tertiary"})]},d.id)};return i.jsxs("nav",{"data-testid":"app-rail","aria-label":"Primary navigation",className:he("vellum border-outline-variant flex shrink-0",n?"w-12 flex-col items-center border-r py-2 gap-1":"w-full flex-row items-center border-b px-2 gap-1 overflow-x-auto"),children:[i.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center":"flex-row gap-1 items-center"),children:s.map(f)}),i.jsx("div",{className:he(n?"flex-1":"flex-1 hidden lg:block")}),i.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center pb-1":"flex-row gap-1 items-center"),children:u.map(f)})]})}const eI=1024;function HX({children:e}){return i.jsx($X,{children:i.jsx(qX,{children:i.jsx(UX,{children:e})})})}function UX({children:e}){const n=ya().location.pathname,s=FX(n),{mode:r}=xk(),[a,l]=E.useState(!1),[u,f]=E.useState(!0),[d,p]=E.useState(()=>typeof window>"u"?!0:window.innerWidth>=eI),[m,x]=E.useState(null),[y,b]=E.useState(null),[v,w]=E.useState(null),{events:S}=X2(),C=E.useCallback(P=>{x(P),!d&&P&&l(!1)},[d]),k=E.useCallback(()=>{b(null),w(null)},[]),_=E.useCallback(P=>{b(P),w(null)},[]);E.useEffect(()=>{const P=()=>{p(window.innerWidth>=eI)};return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]),E.useEffect(()=>{(m==null?void 0:m.type)!=="discovery"&&k()},[m,k]),E.useEffect(()=>{d||(x(null),l(!1))},[d,n]),zX();const R=s!=="none",T=R&&!NT(s,d),A=!!m,I=r==="overlay"&&s==="topology",L=d&&R&&u?"21rem":"3rem",H={"--workspace-left-offset":d?I?"0rem":L:"0rem","--workspace-right-offset":d&&A?"38rem":"0rem","--explorer-anchor-left":L,"--header-anchor-offset":d&&I?L:"0rem"};return i.jsx(x6.Provider,{value:{selection:m,setSelection:C},children:i.jsx(y6.Provider,{value:{selectedDiscoveredId:y,setSelectedDiscoveredId:_,placementTarget:v,setPlacementTarget:w,clearPlacement:k},children:i.jsxs("div",{className:"h-screen flex flex-col",children:[i.jsxs("header",{"data-testid":"app-topbar",className:"h-14 flex items-center justify-between px-4 bg-background border-b border-outline-variant shrink-0 relative z-30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[!NT(s,d)&&i.jsxs("button",{type:"button","data-testid":"mobile-menu-toggle",onClick:()=>l(P=>!P),"aria-label":"Toggle navigation",className:"flex flex-col gap-[3px] p-2 lg:hidden",children:[i.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),i.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),i.jsx("span",{className:"block w-3 h-[1.5px] bg-stone-900"})]}),i.jsx(Ue,{to:"/","data-testid":"brand-home-link",className:"inline-flex items-center bg-stone-950 px-3 py-1 font-mono text-sm font-bold uppercase tracking-[0.08em] text-stone-50 hover:bg-stone-800",children:"OPENRIG"})]}),i.jsx("div",{"data-testid":"topbar-right-slot",className:"hidden sm:flex items-center gap-2",children:i.jsx("span",{"data-testid":"topbar-env-indicator",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant",children:"localhost"})})]}),i.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[i.jsx("div",{className:"hidden lg:flex",children:i.jsx(JT,{pathname:n,vertical:!0})}),!d&&i.jsxs(i.Fragment,{children:[a&&i.jsx("div",{className:"fixed inset-0 bg-black/20 z-20 lg:hidden",onClick:()=>l(!1)}),i.jsx("div",{"data-testid":"mobile-rail-tray",className:he("fixed top-14 left-0 bottom-0 z-30 bg-background border-r border-outline-variant transition-transform duration-200 ease-tactical lg:hidden","w-72 max-w-[85vw] flex flex-col",a?"translate-x-0":"-translate-x-full"),children:i.jsx(JT,{pathname:n,vertical:!0,onMobileClose:()=>l(!1)})})]}),T&&i.jsx(UW,{open:a,onClose:()=>l(!1),selection:m,onSelect:C,desktopMode:u?"full":"hidden",surface:s,onDesktopToggle:()=>f(P=>!P),overlayMode:I?"overlay":"opaque"}),i.jsx("main",{"data-testid":"content-area","data-explorer-mode":I?"overlay":"opaque",className:"flex-1 flex flex-col overflow-auto relative",style:{...H,paddingLeft:"var(--workspace-left-offset, 0px)"},children:i.jsx("div",{className:"relative z-10 route-enter flex-1 flex flex-col pb-14 lg:pb-0",style:{"--workspace-left-offset":"0px","--workspace-right-offset":"0px"},children:e},n)}),i.jsx(_X,{selection:m,onClose:()=>C(null),events:S,selectedDiscoveredId:y,onSelectDiscoveredId:_,placementTarget:v,onClearPlacement:k}),i.jsx(MX,{}),i.jsx(VX,{pathname:n})]})]})})})}function VX({pathname:e}){const t=[{id:"for-you",label:"For You",to:"/for-you",activeWhen:n=>n.startsWith("/for-you"),icon:_2},{id:"project",label:"Project",to:"/project",activeWhen:n=>n.startsWith("/project"),icon:S2},{id:"topology",label:"Topology",to:"/topology",activeWhen:n=>n.startsWith("/topology")||n.startsWith("/rigs/"),icon:N2}];return i.jsx("nav",{"data-testid":"mobile-bottom-nav","aria-label":"Mobile bottom navigation",className:"fixed bottom-0 left-0 right-0 z-40 lg:hidden vellum border-t border-outline-variant flex",children:t.map(n=>{const s=n.activeWhen(e);return i.jsxs(Ue,{to:n.to,"data-testid":`mobile-nav-${n.id}`,"data-active":s,className:he("flex-1 flex flex-col items-center justify-center gap-0.5 py-2 font-mono text-[9px] uppercase tracking-wide",s?"text-stone-900":"text-on-surface-variant hover:text-stone-900"),children:[i.jsx(n.icon,{className:"h-5 w-5",strokeWidth:1.25,"aria-hidden":"true"}),i.jsx("span",{children:n.label})]},n.id)})})}function Kt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Kt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var GX={value:()=>{}};function wg(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new tm(n)}function tm(e){this._=e}function KX(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",r=n.indexOf(".");if(r>=0&&(s=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}tm.prototype=wg.prototype={constructor:tm,on:function(e,t){var n=this._,s=KX(e+"",n),r,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((r=(e=s[a]).type)&&(r=WX(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(r=(e=s[a]).type)n[r]=tI(n[r],e.name,t);else if(t==null)for(r in n)n[r]=tI(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new tm(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),s=0,r,a;s<r;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,r=a.length;s<r;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],r=0,a=s.length;r<a;++r)s[r].value.apply(t,n)}};function WX(e,t){for(var n=0,s=e.length,r;n<s;++n)if((r=e[n]).name===t)return r.value}function tI(e,t,n){for(var s=0,r=e.length;s<r;++s)if(e[s].name===t){e[s]=GX,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var MN="http://www.w3.org/1999/xhtml";const nI={svg:"http://www.w3.org/2000/svg",xhtml:MN,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jg(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),nI.hasOwnProperty(t)?{space:nI[t],local:e}:e}function YX(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===MN&&t.documentElement.namespaceURI===MN?t.createElement(e):t.createElementNS(n,e)}}function QX(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function v6(e){var t=jg(e);return(t.local?QX:YX)(t)}function XX(){}function yk(e){return e==null?XX:function(){return this.querySelector(e)}}function ZX(e){typeof e!="function"&&(e=yk(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=new Array(l),f,d,p=0;p<l;++p)(f=a[p])&&(d=e.call(f,f.__data__,p,a))&&("__data__"in f&&(d.__data__=f.__data__),u[p]=d);return new os(s,this._parents)}function JX(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function eZ(){return[]}function b6(e){return e==null?eZ:function(){return this.querySelectorAll(e)}}function tZ(e){return function(){return JX(e.apply(this,arguments))}}function nZ(e){typeof e=="function"?e=tZ(e):e=b6(e);for(var t=this._groups,n=t.length,s=[],r=[],a=0;a<n;++a)for(var l=t[a],u=l.length,f,d=0;d<u;++d)(f=l[d])&&(s.push(e.call(f,f.__data__,d,l)),r.push(f));return new os(s,r)}function w6(e){return function(){return this.matches(e)}}function j6(e){return function(t){return t.matches(e)}}var sZ=Array.prototype.find;function rZ(e){return function(){return sZ.call(this.children,e)}}function iZ(){return this.firstElementChild}function aZ(e){return this.select(e==null?iZ:rZ(typeof e=="function"?e:j6(e)))}var oZ=Array.prototype.filter;function lZ(){return Array.from(this.children)}function cZ(e){return function(){return oZ.call(this.children,e)}}function uZ(e){return this.selectAll(e==null?lZ:cZ(typeof e=="function"?e:j6(e)))}function dZ(e){typeof e!="function"&&(e=w6(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=[],f,d=0;d<l;++d)(f=a[d])&&e.call(f,f.__data__,d,a)&&u.push(f);return new os(s,this._parents)}function S6(e){return new Array(e.length)}function fZ(){return new os(this._enter||this._groups.map(S6),this._parents)}function Nm(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nm.prototype={constructor:Nm,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function hZ(e){return function(){return e}}function pZ(e,t,n,s,r,a){for(var l=0,u,f=t.length,d=a.length;l<d;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new Nm(e,a[l]);for(;l<f;++l)(u=t[l])&&(r[l]=u)}function mZ(e,t,n,s,r,a,l){var u,f,d=new Map,p=t.length,m=a.length,x=new Array(p),y;for(u=0;u<p;++u)(f=t[u])&&(x[u]=y=l.call(f,f.__data__,u,t)+"",d.has(y)?r[u]=f:d.set(y,f));for(u=0;u<m;++u)y=l.call(e,a[u],u,a)+"",(f=d.get(y))?(s[u]=f,f.__data__=a[u],d.delete(y)):n[u]=new Nm(e,a[u]);for(u=0;u<p;++u)(f=t[u])&&d.get(x[u])===f&&(r[u]=f)}function gZ(e){return e.__data__}function xZ(e,t){if(!arguments.length)return Array.from(this,gZ);var n=t?mZ:pZ,s=this._parents,r=this._groups;typeof e!="function"&&(e=hZ(e));for(var a=r.length,l=new Array(a),u=new Array(a),f=new Array(a),d=0;d<a;++d){var p=s[d],m=r[d],x=m.length,y=yZ(e.call(p,p&&p.__data__,d,s)),b=y.length,v=u[d]=new Array(b),w=l[d]=new Array(b),S=f[d]=new Array(x);n(p,m,v,w,S,y,t);for(var C=0,k=0,_,R;C<b;++C)if(_=v[C]){for(C>=k&&(k=C+1);!(R=w[k])&&++k<b;);_._next=R||null}}return l=new os(l,s),l._enter=u,l._exit=f,l}function yZ(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vZ(){return new os(this._exit||this._groups.map(S6),this._parents)}function bZ(e,t,n){var s=this.enter(),r=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?a.remove():n(a),s&&r?s.merge(r).order():r}function wZ(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,r=n.length,a=s.length,l=Math.min(r,a),u=new Array(r),f=0;f<l;++f)for(var d=n[f],p=s[f],m=d.length,x=u[f]=new Array(m),y,b=0;b<m;++b)(y=d[b]||p[b])&&(x[b]=y);for(;f<r;++f)u[f]=n[f];return new os(u,this._parents)}function jZ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],r=s.length-1,a=s[r],l;--r>=0;)(l=s[r])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function SZ(e){e||(e=NZ);function t(m,x){return m&&x?e(m.__data__,x.__data__):!m-!x}for(var n=this._groups,s=n.length,r=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,f=r[a]=new Array(u),d,p=0;p<u;++p)(d=l[p])&&(f[p]=d);f.sort(t)}return new os(r,this._parents).order()}function NZ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kZ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _Z(){return Array.from(this)}function CZ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,a=s.length;r<a;++r){var l=s[r];if(l)return l}return null}function EZ(){let e=0;for(const t of this)++e;return e}function RZ(){return!this.node()}function AZ(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var r=t[n],a=0,l=r.length,u;a<l;++a)(u=r[a])&&e.call(u,u.__data__,a,r);return this}function TZ(e){return function(){this.removeAttribute(e)}}function IZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MZ(e,t){return function(){this.setAttribute(e,t)}}function OZ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function LZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function PZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function $Z(e,t){var n=jg(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?IZ:TZ:typeof t=="function"?n.local?PZ:LZ:n.local?OZ:MZ)(n,t))}function N6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function DZ(e){return function(){this.style.removeProperty(e)}}function qZ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zZ(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function BZ(e,t,n){return arguments.length>1?this.each((t==null?DZ:typeof t=="function"?zZ:qZ)(e,t,n??"")):wc(this.node(),e)}function wc(e,t){return e.style.getPropertyValue(t)||N6(e).getComputedStyle(e,null).getPropertyValue(t)}function FZ(e){return function(){delete this[e]}}function HZ(e,t){return function(){this[e]=t}}function UZ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function VZ(e,t){return arguments.length>1?this.each((t==null?FZ:typeof t=="function"?UZ:HZ)(e,t)):this.node()[e]}function k6(e){return e.trim().split(/^|\s+/)}function vk(e){return e.classList||new _6(e)}function _6(e){this._node=e,this._names=k6(e.getAttribute("class")||"")}_6.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function C6(e,t){for(var n=vk(e),s=-1,r=t.length;++s<r;)n.add(t[s])}function E6(e,t){for(var n=vk(e),s=-1,r=t.length;++s<r;)n.remove(t[s])}function GZ(e){return function(){C6(this,e)}}function KZ(e){return function(){E6(this,e)}}function WZ(e,t){return function(){(t.apply(this,arguments)?C6:E6)(this,e)}}function YZ(e,t){var n=k6(e+"");if(arguments.length<2){for(var s=vk(this.node()),r=-1,a=n.length;++r<a;)if(!s.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?WZ:t?GZ:KZ)(n,t))}function QZ(){this.textContent=""}function XZ(e){return function(){this.textContent=e}}function ZZ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function JZ(e){return arguments.length?this.each(e==null?QZ:(typeof e=="function"?ZZ:XZ)(e)):this.node().textContent}function eJ(){this.innerHTML=""}function tJ(e){return function(){this.innerHTML=e}}function nJ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function sJ(e){return arguments.length?this.each(e==null?eJ:(typeof e=="function"?nJ:tJ)(e)):this.node().innerHTML}function rJ(){this.nextSibling&&this.parentNode.appendChild(this)}function iJ(){return this.each(rJ)}function aJ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oJ(){return this.each(aJ)}function lJ(e){var t=typeof e=="function"?e:v6(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cJ(){return null}function uJ(e,t){var n=typeof e=="function"?e:v6(e),s=t==null?cJ:typeof t=="function"?t:yk(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function dJ(){var e=this.parentNode;e&&e.removeChild(this)}function fJ(){return this.each(dJ)}function hJ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pJ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mJ(e){return this.select(e?pJ:hJ)}function gJ(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xJ(e){return function(t){e.call(this,t,this.__data__)}}function yJ(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function vJ(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,r=t.length,a;n<r;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function bJ(e,t,n){return function(){var s=this.__on,r,a=xJ(t);if(s){for(var l=0,u=s.length;l<u;++l)if((r=s[l]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),r.value=t;return}}this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(r):this.__on=[r]}}function wJ(e,t,n){var s=yJ(e+""),r,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,d=u.length,p;f<d;++f)for(r=0,p=u[f];r<a;++r)if((l=s[r]).type===p.type&&l.name===p.name)return p.value}return}for(u=t?bJ:vJ,r=0;r<a;++r)this.each(u(s[r],t,n));return this}function R6(e,t,n){var s=N6(e),r=s.CustomEvent;typeof r=="function"?r=new r(t,n):(r=s.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function jJ(e,t){return function(){return R6(this,e,t)}}function SJ(e,t){return function(){return R6(this,e,t.apply(this,arguments))}}function NJ(e,t){return this.each((typeof t=="function"?SJ:jJ)(e,t))}function*kJ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,a=s.length,l;r<a;++r)(l=s[r])&&(yield l)}var A6=[null];function os(e,t){this._groups=e,this._parents=t}function lf(){return new os([[document.documentElement]],A6)}function _J(){return this}os.prototype=lf.prototype={constructor:os,select:ZX,selectAll:nZ,selectChild:aZ,selectChildren:uZ,filter:dZ,data:xZ,enter:fZ,exit:vZ,join:bZ,merge:wZ,selection:_J,order:jZ,sort:SZ,call:kZ,nodes:_Z,node:CZ,size:EZ,empty:RZ,each:AZ,attr:$Z,style:BZ,property:VZ,classed:YZ,text:JZ,html:sJ,raise:iJ,lower:oJ,append:lJ,insert:uJ,remove:fJ,clone:mJ,datum:gJ,on:wJ,dispatch:NJ,[Symbol.iterator]:kJ};function as(e){return typeof e=="string"?new os([[document.querySelector(e)]],[document.documentElement]):new os([[e]],A6)}function CJ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ls(e,t){if(e=CJ(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const EJ={passive:!1},Ad={capture:!0,passive:!1};function Yy(e){e.stopImmediatePropagation()}function Jl(e){e.preventDefault(),e.stopImmediatePropagation()}function T6(e){var t=e.document.documentElement,n=as(e).on("dragstart.drag",Jl,Ad);"onselectstart"in t?n.on("selectstart.drag",Jl,Ad):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function I6(e,t){var n=e.document.documentElement,s=as(e).on("dragstart.drag",null);t&&(s.on("click.drag",Jl,Ad),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const yp=e=>()=>e;function ON(e,{sourceEvent:t,subject:n,target:s,identifier:r,active:a,x:l,y:u,dx:f,dy:d,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}ON.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function RJ(e){return!e.ctrlKey&&!e.button}function AJ(){return this.parentNode}function TJ(e,t){return t??{x:e.x,y:e.y}}function IJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function M6(){var e=RJ,t=AJ,n=TJ,s=IJ,r={},a=wg("start","drag","end"),l=0,u,f,d,p,m=0;function x(_){_.on("mousedown.drag",y).filter(s).on("touchstart.drag",w).on("touchmove.drag",S,EJ).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(_,R){if(!(p||!e.call(this,_,R))){var T=k(this,t.call(this,_,R),_,R,"mouse");T&&(as(_.view).on("mousemove.drag",b,Ad).on("mouseup.drag",v,Ad),T6(_.view),Yy(_),d=!1,u=_.clientX,f=_.clientY,T("start",_))}}function b(_){if(Jl(_),!d){var R=_.clientX-u,T=_.clientY-f;d=R*R+T*T>m}r.mouse("drag",_)}function v(_){as(_.view).on("mousemove.drag mouseup.drag",null),I6(_.view,d),Jl(_),r.mouse("end",_)}function w(_,R){if(e.call(this,_,R)){var T=_.changedTouches,A=t.call(this,_,R),I=T.length,L,$;for(L=0;L<I;++L)($=k(this,A,_,R,T[L].identifier,T[L]))&&(Yy(_),$("start",_,T[L]))}}function S(_){var R=_.changedTouches,T=R.length,A,I;for(A=0;A<T;++A)(I=r[R[A].identifier])&&(Jl(_),I("drag",_,R[A]))}function C(_){var R=_.changedTouches,T=R.length,A,I;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),A=0;A<T;++A)(I=r[R[A].identifier])&&(Yy(_),I("end",_,R[A]))}function k(_,R,T,A,I,L){var $=a.copy(),O=Ls(L||T,R),B,H,P;if((P=n.call(_,new ON("beforestart",{sourceEvent:T,target:x,identifier:I,active:l,x:O[0],y:O[1],dx:0,dy:0,dispatch:$}),A))!=null)return B=P.x-O[0]||0,H=P.y-O[1]||0,function G(q,V,K){var Y=O,J;switch(q){case"start":r[I]=G,J=l++;break;case"end":delete r[I],--l;case"drag":O=Ls(K||V,R),J=l;break}$.call(q,_,new ON(q,{sourceEvent:V,subject:P,target:x,identifier:I,active:J,x:O[0]+B,y:O[1]+H,dx:O[0]-Y[0],dy:O[1]-Y[1],dispatch:$}),A)}}return x.filter=function(_){return arguments.length?(e=typeof _=="function"?_:yp(!!_),x):e},x.container=function(_){return arguments.length?(t=typeof _=="function"?_:yp(_),x):t},x.subject=function(_){return arguments.length?(n=typeof _=="function"?_:yp(_),x):n},x.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:yp(!!_),x):s},x.on=function(){var _=a.on.apply(a,arguments);return _===a?x:_},x.clickDistance=function(_){return arguments.length?(m=(_=+_)*_,x):Math.sqrt(m)},x}function bk(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function O6(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function cf(){}var Td=.7,km=1/Td,ec="\\s*([+-]?\\d+)\\s*",Id="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",or="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",MJ=/^#([0-9a-f]{3,8})$/,OJ=new RegExp(`^rgb\\(${ec},${ec},${ec}\\)$`),LJ=new RegExp(`^rgb\\(${or},${or},${or}\\)$`),PJ=new RegExp(`^rgba\\(${ec},${ec},${ec},${Id}\\)$`),$J=new RegExp(`^rgba\\(${or},${or},${or},${Id}\\)$`),DJ=new RegExp(`^hsl\\(${Id},${or},${or}\\)$`),qJ=new RegExp(`^hsla\\(${Id},${or},${or},${Id}\\)$`),sI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};bk(cf,jo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rI,formatHex:rI,formatHex8:zJ,formatHsl:BJ,formatRgb:iI,toString:iI});function rI(){return this.rgb().formatHex()}function zJ(){return this.rgb().formatHex8()}function BJ(){return L6(this).formatHsl()}function iI(){return this.rgb().formatRgb()}function jo(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=MJ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?aI(t):n===3?new Hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=OJ.exec(e))?new Hn(t[1],t[2],t[3],1):(t=LJ.exec(e))?new Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PJ.exec(e))?vp(t[1],t[2],t[3],t[4]):(t=$J.exec(e))?vp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DJ.exec(e))?cI(t[1],t[2]/100,t[3]/100,1):(t=qJ.exec(e))?cI(t[1],t[2]/100,t[3]/100,t[4]):sI.hasOwnProperty(e)?aI(sI[e]):e==="transparent"?new Hn(NaN,NaN,NaN,0):null}function aI(e){return new Hn(e>>16&255,e>>8&255,e&255,1)}function vp(e,t,n,s){return s<=0&&(e=t=n=NaN),new Hn(e,t,n,s)}function FJ(e){return e instanceof cf||(e=jo(e)),e?(e=e.rgb(),new Hn(e.r,e.g,e.b,e.opacity)):new Hn}function LN(e,t,n,s){return arguments.length===1?FJ(e):new Hn(e,t,n,s??1)}function Hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}bk(Hn,LN,O6(cf,{brighter(e){return e=e==null?km:Math.pow(km,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Td:Math.pow(Td,e),new Hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Hn(go(this.r),go(this.g),go(this.b),_m(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oI,formatHex:oI,formatHex8:HJ,formatRgb:lI,toString:lI}));function oI(){return`#${Ja(this.r)}${Ja(this.g)}${Ja(this.b)}`}function HJ(){return`#${Ja(this.r)}${Ja(this.g)}${Ja(this.b)}${Ja((isNaN(this.opacity)?1:this.opacity)*255)}`}function lI(){const e=_m(this.opacity);return`${e===1?"rgb(":"rgba("}${go(this.r)}, ${go(this.g)}, ${go(this.b)}${e===1?")":`, ${e})`}`}function _m(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function go(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ja(e){return e=go(e),(e<16?"0":"")+e.toString(16)}function cI(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $s(e,t,n,s)}function L6(e){if(e instanceof $s)return new $s(e.h,e.s,e.l,e.opacity);if(e instanceof cf||(e=jo(e)),!e)return new $s;if(e instanceof $s)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,r=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-r,f=(a+r)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=f<.5?a+r:2-a-r,l*=60):u=f>0&&f<1?0:l,new $s(l,u,f,e.opacity)}function UJ(e,t,n,s){return arguments.length===1?L6(e):new $s(e,t,n,s??1)}function $s(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}bk($s,UJ,O6(cf,{brighter(e){return e=e==null?km:Math.pow(km,e),new $s(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Td:Math.pow(Td,e),new $s(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,r=2*n-s;return new Hn(Qy(e>=240?e-240:e+120,r,s),Qy(e,r,s),Qy(e<120?e+240:e-120,r,s),this.opacity)},clamp(){return new $s(uI(this.h),bp(this.s),bp(this.l),_m(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_m(this.opacity);return`${e===1?"hsl(":"hsla("}${uI(this.h)}, ${bp(this.s)*100}%, ${bp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function uI(e){return e=(e||0)%360,e<0?e+360:e}function bp(e){return Math.max(0,Math.min(1,e||0))}function Qy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const wk=e=>()=>e;function VJ(e,t){return function(n){return e+n*t}}function GJ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function KJ(e){return(e=+e)==1?P6:function(t,n){return n-t?GJ(t,n,e):wk(isNaN(t)?n:t)}}function P6(e,t){var n=t-e;return n?VJ(e,n):wk(isNaN(e)?t:e)}const Cm=(function e(t){var n=KJ(t);function s(r,a){var l=n((r=LN(r)).r,(a=LN(a)).r),u=n(r.g,a.g),f=n(r.b,a.b),d=P6(r.opacity,a.opacity);return function(p){return r.r=l(p),r.g=u(p),r.b=f(p),r.opacity=d(p),r+""}}return s.gamma=e,s})(1);function WJ(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),r;return function(a){for(r=0;r<n;++r)s[r]=e[r]*(1-a)+t[r]*a;return s}}function YJ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function QJ(e,t){var n=t?t.length:0,s=e?Math.min(n,e.length):0,r=new Array(s),a=new Array(n),l;for(l=0;l<s;++l)r[l]=fd(e[l],t[l]);for(;l<n;++l)a[l]=t[l];return function(u){for(l=0;l<s;++l)a[l]=r[l](u);return a}}function XJ(e,t){var n=new Date;return e=+e,t=+t,function(s){return n.setTime(e*(1-s)+t*s),n}}function nr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ZJ(e,t){var n={},s={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=fd(e[r],t[r]):s[r]=t[r];return function(a){for(r in n)s[r]=n[r](a);return s}}var PN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xy=new RegExp(PN.source,"g");function JJ(e){return function(){return e}}function eee(e){return function(t){return e(t)+""}}function $6(e,t){var n=PN.lastIndex=Xy.lastIndex=0,s,r,a,l=-1,u=[],f=[];for(e=e+"",t=t+"";(s=PN.exec(e))&&(r=Xy.exec(t));)(a=r.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(r=r[0])?u[l]?u[l]+=r:u[++l]=r:(u[++l]=null,f.push({i:l,x:nr(s,r)})),n=Xy.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?f[0]?eee(f[0].x):JJ(t):(t=f.length,function(d){for(var p=0,m;p<t;++p)u[(m=f[p]).i]=m.x(d);return u.join("")})}function fd(e,t){var n=typeof t,s;return t==null||n==="boolean"?wk(t):(n==="number"?nr:n==="string"?(s=jo(t))?(t=s,Cm):$6:t instanceof jo?Cm:t instanceof Date?XJ:YJ(t)?WJ:Array.isArray(t)?QJ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ZJ:nr)(e,t)}var dI=180/Math.PI,$N={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function D6(e,t,n,s,r,a){var l,u,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:r,translateY:a,rotate:Math.atan2(t,e)*dI,skewX:Math.atan(f)*dI,scaleX:l,scaleY:u}}var wp;function tee(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$N:D6(t.a,t.b,t.c,t.d,t.e,t.f)}function nee(e){return e==null||(wp||(wp=document.createElementNS("http://www.w3.org/2000/svg","g")),wp.setAttribute("transform",e),!(e=wp.transform.baseVal.consolidate()))?$N:(e=e.matrix,D6(e.a,e.b,e.c,e.d,e.e,e.f))}function q6(e,t,n,s){function r(d){return d.length?d.pop()+" ":""}function a(d,p,m,x,y,b){if(d!==m||p!==x){var v=y.push("translate(",null,t,null,n);b.push({i:v-4,x:nr(d,m)},{i:v-2,x:nr(p,x)})}else(m||x)&&y.push("translate("+m+t+x+n)}function l(d,p,m,x){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),x.push({i:m.push(r(m)+"rotate(",null,s)-2,x:nr(d,p)})):p&&m.push(r(m)+"rotate("+p+s)}function u(d,p,m,x){d!==p?x.push({i:m.push(r(m)+"skewX(",null,s)-2,x:nr(d,p)}):p&&m.push(r(m)+"skewX("+p+s)}function f(d,p,m,x,y,b){if(d!==m||p!==x){var v=y.push(r(y)+"scale(",null,",",null,")");b.push({i:v-4,x:nr(d,m)},{i:v-2,x:nr(p,x)})}else(m!==1||x!==1)&&y.push(r(y)+"scale("+m+","+x+")")}return function(d,p){var m=[],x=[];return d=e(d),p=e(p),a(d.translateX,d.translateY,p.translateX,p.translateY,m,x),l(d.rotate,p.rotate,m,x),u(d.skewX,p.skewX,m,x),f(d.scaleX,d.scaleY,p.scaleX,p.scaleY,m,x),d=p=null,function(y){for(var b=-1,v=x.length,w;++b<v;)m[(w=x[b]).i]=w.x(y);return m.join("")}}}var see=q6(tee,"px, ","px)","deg)"),ree=q6(nee,", ",")",")"),iee=1e-12;function fI(e){return((e=Math.exp(e))+1/e)/2}function aee(e){return((e=Math.exp(e))-1/e)/2}function oee(e){return((e=Math.exp(2*e))-1)/(e+1)}const nm=(function e(t,n,s){function r(a,l){var u=a[0],f=a[1],d=a[2],p=l[0],m=l[1],x=l[2],y=p-u,b=m-f,v=y*y+b*b,w,S;if(v<iee)S=Math.log(x/d)/t,w=function(A){return[u+A*y,f+A*b,d*Math.exp(t*A*S)]};else{var C=Math.sqrt(v),k=(x*x-d*d+s*v)/(2*d*n*C),_=(x*x-d*d-s*v)/(2*x*n*C),R=Math.log(Math.sqrt(k*k+1)-k),T=Math.log(Math.sqrt(_*_+1)-_);S=(T-R)/t,w=function(A){var I=A*S,L=fI(R),$=d/(n*C)*(L*oee(t*I+R)-aee(R));return[u+$*y,f+$*b,d*L/fI(t*I+R)]}}return w.duration=S*1e3*t/Math.SQRT2,w}return r.rho=function(a){var l=Math.max(.001,+a),u=l*l,f=u*u;return e(l,u,f)},r})(Math.SQRT2,2,4);var jc=0,rd=0,Wu=0,z6=1e3,Em,id,Rm=0,So=0,Sg=0,Md=typeof performance=="object"&&performance.now?performance:Date,B6=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jk(){return So||(B6(lee),So=Md.now()+Sg)}function lee(){So=0}function Am(){this._call=this._time=this._next=null}Am.prototype=F6.prototype={constructor:Am,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jk():+n)+(t==null?0:+t),!this._next&&id!==this&&(id?id._next=this:Em=this,id=this),this._call=e,this._time=n,DN()},stop:function(){this._call&&(this._call=null,this._time=1/0,DN())}};function F6(e,t,n){var s=new Am;return s.restart(e,t,n),s}function cee(){jk(),++jc;for(var e=Em,t;e;)(t=So-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jc}function hI(){So=(Rm=Md.now())+Sg,jc=rd=0;try{cee()}finally{jc=0,dee(),So=0}}function uee(){var e=Md.now(),t=e-Rm;t>z6&&(Sg-=t,Rm=e)}function dee(){for(var e,t=Em,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Em=n);id=e,DN(s)}function DN(e){if(!jc){rd&&(rd=clearTimeout(rd));var t=e-So;t>24?(e<1/0&&(rd=setTimeout(hI,e-Md.now()-Sg)),Wu&&(Wu=clearInterval(Wu))):(Wu||(Rm=Md.now(),Wu=setInterval(uee,z6)),jc=1,B6(hI))}}function pI(e,t,n){var s=new Am;return t=t==null?0:+t,s.restart(r=>{s.stop(),e(r+t)},t,n),s}var fee=wg("start","end","cancel","interrupt"),hee=[],H6=0,mI=1,qN=2,sm=3,gI=4,zN=5,rm=6;function Ng(e,t,n,s,r,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;pee(e,n,{name:t,index:s,group:r,on:fee,tween:hee,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:H6})}function Sk(e,t){var n=Hs(e,t);if(n.state>H6)throw new Error("too late; already scheduled");return n}function fr(e,t){var n=Hs(e,t);if(n.state>sm)throw new Error("too late; already running");return n}function Hs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function pee(e,t,n){var s=e.__transition,r;s[t]=n,n.timer=F6(a,0,n.time);function a(d){n.state=mI,n.timer.restart(l,n.delay,n.time),n.delay<=d&&l(d-n.delay)}function l(d){var p,m,x,y;if(n.state!==mI)return f();for(p in s)if(y=s[p],y.name===n.name){if(y.state===sm)return pI(l);y.state===gI?(y.state=rm,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete s[p]):+p<t&&(y.state=rm,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete s[p])}if(pI(function(){n.state===sm&&(n.state=gI,n.timer.restart(u,n.delay,n.time),u(d))}),n.state=qN,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qN){for(n.state=sm,r=new Array(x=n.tween.length),p=0,m=-1;p<x;++p)(y=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(r[++m]=y);r.length=m+1}}function u(d){for(var p=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(f),n.state=zN,1),m=-1,x=r.length;++m<x;)r[m].call(e,p);n.state===zN&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=rm,n.timer.stop(),delete s[t];for(var d in s)return;delete e.__transition}}function im(e,t){var n=e.__transition,s,r,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}r=s.state>qN&&s.state<zN,s.state=rm,s.timer.stop(),s.on.call(r?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function mee(e){return this.each(function(){im(this,e)})}function gee(e,t){var n,s;return function(){var r=fr(this,e),a=r.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}r.tween=s}}function xee(e,t,n){var s,r;if(typeof n!="function")throw new Error;return function(){var a=fr(this,e),l=a.tween;if(l!==s){r=(s=l).slice();for(var u={name:t,value:n},f=0,d=r.length;f<d;++f)if(r[f].name===t){r[f]=u;break}f===d&&r.push(u)}a.tween=r}}function yee(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Hs(this.node(),n).tween,r=0,a=s.length,l;r<a;++r)if((l=s[r]).name===e)return l.value;return null}return this.each((t==null?gee:xee)(n,e,t))}function Nk(e,t,n){var s=e._id;return e.each(function(){var r=fr(this,s);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Hs(r,s).value[t]}}function U6(e,t){var n;return(typeof t=="number"?nr:t instanceof jo?Cm:(n=jo(t))?(t=n,Cm):$6)(e,t)}function vee(e){return function(){this.removeAttribute(e)}}function bee(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wee(e,t,n){var s,r=n+"",a;return function(){var l=this.getAttribute(e);return l===r?null:l===s?a:a=t(s=l,n)}}function jee(e,t,n){var s,r=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===r?null:l===s?a:a=t(s=l,n)}}function See(e,t,n){var s,r,a;return function(){var l,u=n(this),f;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=u+"",l===f?null:l===s&&f===r?a:(r=f,a=t(s=l,u)))}}function Nee(e,t,n){var s,r,a;return function(){var l,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=u+"",l===f?null:l===s&&f===r?a:(r=f,a=t(s=l,u)))}}function kee(e,t){var n=jg(e),s=n==="transform"?ree:U6;return this.attrTween(e,typeof t=="function"?(n.local?Nee:See)(n,s,Nk(this,"attr."+e,t)):t==null?(n.local?bee:vee)(n):(n.local?jee:wee)(n,s,t))}function _ee(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Cee(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Eee(e,t){var n,s;function r(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&Cee(e,a)),n}return r._value=t,r}function Ree(e,t){var n,s;function r(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&_ee(e,a)),n}return r._value=t,r}function Aee(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=jg(e);return this.tween(n,(s.local?Eee:Ree)(s,t))}function Tee(e,t){return function(){Sk(this,e).delay=+t.apply(this,arguments)}}function Iee(e,t){return t=+t,function(){Sk(this,e).delay=t}}function Mee(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Tee:Iee)(t,e)):Hs(this.node(),t).delay}function Oee(e,t){return function(){fr(this,e).duration=+t.apply(this,arguments)}}function Lee(e,t){return t=+t,function(){fr(this,e).duration=t}}function Pee(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oee:Lee)(t,e)):Hs(this.node(),t).duration}function $ee(e,t){if(typeof t!="function")throw new Error;return function(){fr(this,e).ease=t}}function Dee(e){var t=this._id;return arguments.length?this.each($ee(t,e)):Hs(this.node(),t).ease}function qee(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fr(this,e).ease=n}}function zee(e){if(typeof e!="function")throw new Error;return this.each(qee(this._id,e))}function Bee(e){typeof e!="function"&&(e=w6(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=[],f,d=0;d<l;++d)(f=a[d])&&e.call(f,f.__data__,d,a)&&u.push(f);return new Jr(s,this._parents,this._name,this._id)}function Fee(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,r=n.length,a=Math.min(s,r),l=new Array(s),u=0;u<a;++u)for(var f=t[u],d=n[u],p=f.length,m=l[u]=new Array(p),x,y=0;y<p;++y)(x=f[y]||d[y])&&(m[y]=x);for(;u<s;++u)l[u]=t[u];return new Jr(l,this._parents,this._name,this._id)}function Hee(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Uee(e,t,n){var s,r,a=Hee(t)?Sk:fr;return function(){var l=a(this,e),u=l.on;u!==s&&(r=(s=u).copy()).on(t,n),l.on=r}}function Vee(e,t){var n=this._id;return arguments.length<2?Hs(this.node(),n).on.on(e):this.each(Uee(n,e,t))}function Gee(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Kee(){return this.on("end.remove",Gee(this._id))}function Wee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yk(e));for(var s=this._groups,r=s.length,a=new Array(r),l=0;l<r;++l)for(var u=s[l],f=u.length,d=a[l]=new Array(f),p,m,x=0;x<f;++x)(p=u[x])&&(m=e.call(p,p.__data__,x,u))&&("__data__"in p&&(m.__data__=p.__data__),d[x]=m,Ng(d[x],t,n,x,d,Hs(p,n)));return new Jr(a,this._parents,t,n)}function Yee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=b6(e));for(var s=this._groups,r=s.length,a=[],l=[],u=0;u<r;++u)for(var f=s[u],d=f.length,p,m=0;m<d;++m)if(p=f[m]){for(var x=e.call(p,p.__data__,m,f),y,b=Hs(p,n),v=0,w=x.length;v<w;++v)(y=x[v])&&Ng(y,t,n,v,x,b);a.push(x),l.push(p)}return new Jr(a,l,t,n)}var Qee=lf.prototype.constructor;function Xee(){return new Qee(this._groups,this._parents)}function Zee(e,t){var n,s,r;return function(){var a=wc(this,e),l=(this.style.removeProperty(e),wc(this,e));return a===l?null:a===n&&l===s?r:r=t(n=a,s=l)}}function V6(e){return function(){this.style.removeProperty(e)}}function Jee(e,t,n){var s,r=n+"",a;return function(){var l=wc(this,e);return l===r?null:l===s?a:a=t(s=l,n)}}function ete(e,t,n){var s,r,a;return function(){var l=wc(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),wc(this,e))),l===f?null:l===s&&f===r?a:(r=f,a=t(s=l,u))}}function tte(e,t){var n,s,r,a="style."+t,l="end."+a,u;return function(){var f=fr(this,e),d=f.on,p=f.value[a]==null?u||(u=V6(t)):void 0;(d!==n||r!==p)&&(s=(n=d).copy()).on(l,r=p),f.on=s}}function nte(e,t,n){var s=(e+="")=="transform"?see:U6;return t==null?this.styleTween(e,Zee(e,s)).on("end.style."+e,V6(e)):typeof t=="function"?this.styleTween(e,ete(e,s,Nk(this,"style."+e,t))).each(tte(this._id,e)):this.styleTween(e,Jee(e,s,t),n).on("end.style."+e,null)}function ste(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function rte(e,t,n){var s,r;function a(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&ste(e,l,n)),s}return a._value=t,a}function ite(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,rte(e,t,n??""))}function ate(e){return function(){this.textContent=e}}function ote(e){return function(){var t=e(this);this.textContent=t??""}}function lte(e){return this.tween("text",typeof e=="function"?ote(Nk(this,"text",e)):ate(e==null?"":e+""))}function cte(e){return function(t){this.textContent=e.call(this,t)}}function ute(e){var t,n;function s(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cte(r)),t}return s._value=e,s}function dte(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ute(e))}function fte(){for(var e=this._name,t=this._id,n=G6(),s=this._groups,r=s.length,a=0;a<r;++a)for(var l=s[a],u=l.length,f,d=0;d<u;++d)if(f=l[d]){var p=Hs(f,t);Ng(f,e,n,d,l,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Jr(s,this._parents,e,n)}function hte(){var e,t,n=this,s=n._id,r=n.size();return new Promise(function(a,l){var u={value:l},f={value:function(){--r===0&&a()}};n.each(function(){var d=fr(this,s),p=d.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),d.on=t}),r===0&&a()})}var pte=0;function Jr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function G6(){return++pte}var $r=lf.prototype;Jr.prototype={constructor:Jr,select:Wee,selectAll:Yee,selectChild:$r.selectChild,selectChildren:$r.selectChildren,filter:Bee,merge:Fee,selection:Xee,transition:fte,call:$r.call,nodes:$r.nodes,node:$r.node,size:$r.size,empty:$r.empty,each:$r.each,on:Vee,attr:kee,attrTween:Aee,style:nte,styleTween:ite,text:lte,textTween:dte,remove:Kee,tween:yee,delay:Mee,duration:Pee,ease:Dee,easeVarying:zee,end:hte,[Symbol.iterator]:$r[Symbol.iterator]};function mte(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gte={time:null,delay:0,duration:250,ease:mte};function xte(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function yte(e){var t,n;e instanceof Jr?(t=e._id,e=e._name):(t=G6(),(n=gte).time=jk(),e=e==null?null:e+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var l=s[a],u=l.length,f,d=0;d<u;++d)(f=l[d])&&Ng(f,e,t,d,l,n||xte(f,t));return new Jr(s,this._parents,e,t)}lf.prototype.interrupt=mee;lf.prototype.transition=yte;const jp=e=>()=>e;function vte(e,{sourceEvent:t,target:n,transform:s,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:r}})}function Kr(e,t,n){this.k=e,this.x=t,this.y=n}Kr.prototype={constructor:Kr,scale:function(e){return e===1?this:new Kr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Kr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var kg=new Kr(1,0,0);K6.prototype=Kr.prototype;function K6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return kg;return e.__zoom}function Zy(e){e.stopImmediatePropagation()}function Yu(e){e.preventDefault(),e.stopImmediatePropagation()}function bte(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wte(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function xI(){return this.__zoom||kg}function jte(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ste(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nte(e,t,n){var s=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(r>s?(s+r)/2:Math.min(0,s)||Math.max(0,r),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function W6(){var e=bte,t=wte,n=Nte,s=jte,r=Ste,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=nm,d=wg("start","zoom","end"),p,m,x,y=500,b=150,v=0,w=10;function S(P){P.property("__zoom",xI).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",$).filter(r).on("touchstart.zoom",O).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(P,G,q,V){var K=P.selection?P.selection():P;K.property("__zoom",xI),P!==K?R(P,G,q,V):K.interrupt().each(function(){T(this,arguments).event(V).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},S.scaleBy=function(P,G,q,V){S.scaleTo(P,function(){var K=this.__zoom.k,Y=typeof G=="function"?G.apply(this,arguments):G;return K*Y},q,V)},S.scaleTo=function(P,G,q,V){S.transform(P,function(){var K=t.apply(this,arguments),Y=this.__zoom,J=q==null?_(K):typeof q=="function"?q.apply(this,arguments):q,D=Y.invert(J),F=typeof G=="function"?G.apply(this,arguments):G;return n(k(C(Y,F),J,D),K,l)},q,V)},S.translateBy=function(P,G,q,V){S.transform(P,function(){return n(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof q=="function"?q.apply(this,arguments):q),t.apply(this,arguments),l)},null,V)},S.translateTo=function(P,G,q,V,K){S.transform(P,function(){var Y=t.apply(this,arguments),J=this.__zoom,D=V==null?_(Y):typeof V=="function"?V.apply(this,arguments):V;return n(kg.translate(D[0],D[1]).scale(J.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof q=="function"?-q.apply(this,arguments):-q),Y,l)},V,K)};function C(P,G){return G=Math.max(a[0],Math.min(a[1],G)),G===P.k?P:new Kr(G,P.x,P.y)}function k(P,G,q){var V=G[0]-q[0]*P.k,K=G[1]-q[1]*P.k;return V===P.x&&K===P.y?P:new Kr(P.k,V,K)}function _(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function R(P,G,q,V){P.on("start.zoom",function(){T(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(V).end()}).tween("zoom",function(){var K=this,Y=arguments,J=T(K,Y).event(V),D=t.apply(K,Y),F=q==null?_(D):typeof q=="function"?q.apply(K,Y):q,te=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),U=K.__zoom,Q=typeof G=="function"?G.apply(K,Y):G,X=f(U.invert(F).concat(te/U.k),Q.invert(F).concat(te/Q.k));return function(se){if(se===1)se=Q;else{var re=X(se),ce=te/re[2];se=new Kr(ce,F[0]-re[0]*ce,F[1]-re[1]*ce)}J.zoom(null,se)}})}function T(P,G,q){return!q&&P.__zooming||new A(P,G)}function A(P,G){this.that=P,this.args=G,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,G),this.taps=0}A.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,G){return this.mouse&&P!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var G=as(this.that).datum();d.call(P,this.that,new vte(P,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:d}),G)}};function I(P,...G){if(!e.apply(this,arguments))return;var q=T(this,G).event(P),V=this.__zoom,K=Math.max(a[0],Math.min(a[1],V.k*Math.pow(2,s.apply(this,arguments)))),Y=Ls(P);if(q.wheel)(q.mouse[0][0]!==Y[0]||q.mouse[0][1]!==Y[1])&&(q.mouse[1]=V.invert(q.mouse[0]=Y)),clearTimeout(q.wheel);else{if(V.k===K)return;q.mouse=[Y,V.invert(Y)],im(this),q.start()}Yu(P),q.wheel=setTimeout(J,b),q.zoom("mouse",n(k(C(V,K),q.mouse[0],q.mouse[1]),q.extent,l));function J(){q.wheel=null,q.end()}}function L(P,...G){if(x||!e.apply(this,arguments))return;var q=P.currentTarget,V=T(this,G,!0).event(P),K=as(P.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",te,!0),Y=Ls(P,q),J=P.clientX,D=P.clientY;T6(P.view),Zy(P),V.mouse=[Y,this.__zoom.invert(Y)],im(this),V.start();function F(U){if(Yu(U),!V.moved){var Q=U.clientX-J,X=U.clientY-D;V.moved=Q*Q+X*X>v}V.event(U).zoom("mouse",n(k(V.that.__zoom,V.mouse[0]=Ls(U,q),V.mouse[1]),V.extent,l))}function te(U){K.on("mousemove.zoom mouseup.zoom",null),I6(U.view,V.moved),Yu(U),V.event(U).end()}}function $(P,...G){if(e.apply(this,arguments)){var q=this.__zoom,V=Ls(P.changedTouches?P.changedTouches[0]:P,this),K=q.invert(V),Y=q.k*(P.shiftKey?.5:2),J=n(k(C(q,Y),V,K),t.apply(this,G),l);Yu(P),u>0?as(this).transition().duration(u).call(R,J,V,P):as(this).call(S.transform,J,V,P)}}function O(P,...G){if(e.apply(this,arguments)){var q=P.touches,V=q.length,K=T(this,G,P.changedTouches.length===V).event(P),Y,J,D,F;for(Zy(P),J=0;J<V;++J)D=q[J],F=Ls(D,this),F=[F,this.__zoom.invert(F),D.identifier],K.touch0?!K.touch1&&K.touch0[2]!==F[2]&&(K.touch1=F,K.taps=0):(K.touch0=F,Y=!0,K.taps=1+!!p);p&&(p=clearTimeout(p)),Y&&(K.taps<2&&(m=F[0],p=setTimeout(function(){p=null},y)),im(this),K.start())}}function B(P,...G){if(this.__zooming){var q=T(this,G).event(P),V=P.changedTouches,K=V.length,Y,J,D,F;for(Yu(P),Y=0;Y<K;++Y)J=V[Y],D=Ls(J,this),q.touch0&&q.touch0[2]===J.identifier?q.touch0[0]=D:q.touch1&&q.touch1[2]===J.identifier&&(q.touch1[0]=D);if(J=q.that.__zoom,q.touch1){var te=q.touch0[0],U=q.touch0[1],Q=q.touch1[0],X=q.touch1[1],se=(se=Q[0]-te[0])*se+(se=Q[1]-te[1])*se,re=(re=X[0]-U[0])*re+(re=X[1]-U[1])*re;J=C(J,Math.sqrt(se/re)),D=[(te[0]+Q[0])/2,(te[1]+Q[1])/2],F=[(U[0]+X[0])/2,(U[1]+X[1])/2]}else if(q.touch0)D=q.touch0[0],F=q.touch0[1];else return;q.zoom("touch",n(k(J,D,F),q.extent,l))}}function H(P,...G){if(this.__zooming){var q=T(this,G).event(P),V=P.changedTouches,K=V.length,Y,J;for(Zy(P),x&&clearTimeout(x),x=setTimeout(function(){x=null},y),Y=0;Y<K;++Y)J=V[Y],q.touch0&&q.touch0[2]===J.identifier?delete q.touch0:q.touch1&&q.touch1[2]===J.identifier&&delete q.touch1;if(q.touch1&&!q.touch0&&(q.touch0=q.touch1,delete q.touch1),q.touch0)q.touch0[1]=this.__zoom.invert(q.touch0[0]);else if(q.end(),q.taps===2&&(J=Ls(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<w)){var D=as(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return S.wheelDelta=function(P){return arguments.length?(s=typeof P=="function"?P:jp(+P),S):s},S.filter=function(P){return arguments.length?(e=typeof P=="function"?P:jp(!!P),S):e},S.touchable=function(P){return arguments.length?(r=typeof P=="function"?P:jp(!!P),S):r},S.extent=function(P){return arguments.length?(t=typeof P=="function"?P:jp([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),S):t},S.scaleExtent=function(P){return arguments.length?(a[0]=+P[0],a[1]=+P[1],S):[a[0],a[1]]},S.translateExtent=function(P){return arguments.length?(l[0][0]=+P[0][0],l[1][0]=+P[1][0],l[0][1]=+P[0][1],l[1][1]=+P[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(P){return arguments.length?(n=P,S):n},S.duration=function(P){return arguments.length?(u=+P,S):u},S.interpolate=function(P){return arguments.length?(f=P,S):f},S.on=function(){var P=d.on.apply(d,arguments);return P===d?S:P},S.clickDistance=function(P){return arguments.length?(v=(P=+P)*P,S):Math.sqrt(v)},S.tapDistance=function(P){return arguments.length?(w=+P,S):w},S}const ur={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Od=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Y6=["Enter"," ","Escape"],Q6={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Sc;(function(e){e.Strict="strict",e.Loose="loose"})(Sc||(Sc={}));var xo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xo||(xo={}));var Ld;(function(e){e.Partial="partial",e.Full="full"})(Ld||(Ld={}));const X6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ui;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ui||(Ui={}));var Nc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Nc||(Nc={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const yI={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function Z6(e){return e===null?null:e?"valid":"invalid"}const J6=e=>"id"in e&&"source"in e&&"target"in e,kte=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),kk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),uf=(e,t=[0,0])=>{const{width:n,height:s}=ei(e),r=e.origin??t,a=n*r[0],l=s*r[1];return{x:e.position.x-a,y:e.position.y-l}},_te=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,r)=>{const a=typeof r=="string";let l=!t.nodeLookup&&!a?r:void 0;t.nodeLookup&&(l=a?t.nodeLookup.get(r):kk(r)?r:t.nodeLookup.get(r.id));const u=l?Tm(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return _g(s,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Cg(n)},df=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=_g(n,Tm(r)),s=!0)}),s?Cg(n):{x:0,y:0,width:0,height:0}},_k=(e,t,[n,s,r]=[0,0,1],a=!1,l=!1)=>{const u={...hf(t,[n,s,r]),width:t.width/r,height:t.height/r},f=[];for(const d of e.values()){const{measured:p,selectable:m=!0,hidden:x=!1}=d;if(l&&!m||x)continue;const y=p.width??d.width??d.initialWidth??null,b=p.height??d.height??d.initialHeight??null,v=Pd(u,_c(d)),w=(y??0)*(b??0),S=a&&v>0;(!d.internals.handleBounds||S||v>=w||d.dragging)&&f.push(d)}return f},Cte=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function Ete(e,t){const n=new Map,s=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!s||s.has(r.id))&&n.set(r.id,r)}),n}async function Rte({nodes:e,width:t,height:n,panZoom:s,minZoom:r,maxZoom:a},l){if(e.size===0)return Promise.resolve(!0);const u=Ete(e,l),f=df(u),d=Ck(f,t,n,(l==null?void 0:l.minZoom)??r,(l==null?void 0:l.maxZoom)??a,(l==null?void 0:l.padding)??.1);return await s.setViewport(d,{duration:l==null?void 0:l.duration,ease:l==null?void 0:l.ease,interpolate:l==null?void 0:l.interpolate}),Promise.resolve(!0)}function e8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:r,onError:a}){const l=n.get(e),u=l.parentId?n.get(l.parentId):void 0,{x:f,y:d}=u?u.internals.positionAbsolute:{x:0,y:0},p=l.origin??s;let m=l.extent||r;if(l.extent==="parent"&&!l.expandParent)if(!u)a==null||a("005",ur.error005());else{const y=u.measured.width,b=u.measured.height;y&&b&&(m=[[f,d],[f+y,d+b]])}else u&&Cc(l.extent)&&(m=[[l.extent[0][0]+f,l.extent[0][1]+d],[l.extent[1][0]+f,l.extent[1][1]+d]]);const x=Cc(m)?No(t,m,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&(a==null||a("015",ur.error015())),{position:{x:x.x-f+(l.measured.width??0)*p[0],y:x.y-d+(l.measured.height??0)*p[1]},positionAbsolute:x}}async function Ate({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:r}){const a=new Set(e.map(x=>x.id)),l=[];for(const x of n){if(x.deletable===!1)continue;const y=a.has(x.id),b=!y&&x.parentId&&l.find(v=>v.id===x.parentId);(y||b)&&l.push(x)}const u=new Set(t.map(x=>x.id)),f=s.filter(x=>x.deletable!==!1),p=Cte(l,f);for(const x of f)u.has(x.id)&&!p.find(b=>b.id===x.id)&&p.push(x);if(!r)return{edges:p,nodes:l};const m=await r({nodes:l,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:l}:{edges:[],nodes:[]}:m}const kc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),No=(e={x:0,y:0},t,n)=>({x:kc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:kc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function t8(e,t,n){const{width:s,height:r}=ei(n),{x:a,y:l}=n.internals.positionAbsolute;return No(e,[[a,l],[a+s,l+r]],t)}const vI=(e,t,n)=>e<t?kc(Math.abs(e-t),1,t)/t:e>n?-kc(Math.abs(e-n),1,t)/t:0,n8=(e,t,n=15,s=40)=>{const r=vI(e.x,s,t.width-s)*n,a=vI(e.y,s,t.height-s)*n;return[r,a]},_g=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),BN=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Cg=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),_c=(e,t=[0,0])=>{var r,a;const{x:n,y:s}=kk(e)?e.internals.positionAbsolute:uf(e,t);return{x:n,y:s,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Tm=(e,t=[0,0])=>{var r,a;const{x:n,y:s}=kk(e)?e.internals.positionAbsolute:uf(e,t);return{x:n,y:s,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:s+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},s8=(e,t)=>Cg(_g(BN(e),BN(t))),Pd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},bI=e=>Ds(e.width)&&Ds(e.height)&&Ds(e.x)&&Ds(e.y),Ds=e=>!isNaN(e)&&isFinite(e),Tte=(e,t)=>{},ff=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),hf=({x:e,y:t},[n,s,r],a=!1,l=[1,1])=>{const u={x:(e-n)/r,y:(t-s)/r};return a?ff(u,l):u},Im=({x:e,y:t},[n,s,r])=>({x:e*r+n,y:t*r+s});function Al(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ite(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=Al(e,n),r=Al(e,t);return{top:s,right:r,bottom:s,left:r,x:r*2,y:s*2}}if(typeof e=="object"){const s=Al(e.top??e.y??0,n),r=Al(e.bottom??e.y??0,n),a=Al(e.left??e.x??0,t),l=Al(e.right??e.x??0,t);return{top:s,right:l,bottom:r,left:a,x:a+l,y:s+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Mte(e,t,n,s,r,a){const{x:l,y:u}=Im(e,[t,n,s]),{x:f,y:d}=Im({x:e.x+e.width,y:e.y+e.height},[t,n,s]),p=r-f,m=a-d;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const Ck=(e,t,n,s,r,a)=>{const l=Ite(a,t,n),u=(t-l.x)/e.width,f=(n-l.y)/e.height,d=Math.min(u,f),p=kc(d,s,r),m=e.x+e.width/2,x=e.y+e.height/2,y=t/2-m*p,b=n/2-x*p,v=Mte(e,y,b,p,t,n),w={left:Math.min(v.left-l.left,0),top:Math.min(v.top-l.top,0),right:Math.min(v.right-l.right,0),bottom:Math.min(v.bottom-l.bottom,0)};return{x:y-w.left+w.right,y:b-w.top+w.bottom,zoom:p}},$d=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Cc(e){return e!=null&&e!=="parent"}function ei(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function r8(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function i8(e,t={width:0,height:0},n,s,r){const a={...e},l=s.get(n);if(l){const u=l.origin||r;a.x+=l.internals.positionAbsolute.x-(t.width??0)*u[0],a.y+=l.internals.positionAbsolute.y-(t.height??0)*u[1]}return a}function wI(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ote(){let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}}function Lte(e){return{...Q6,...e||{}}}function hd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:r}){const{x:a,y:l}=qs(e),u=hf({x:a-((r==null?void 0:r.left)??0),y:l-((r==null?void 0:r.top)??0)},s),{x:f,y:d}=n?ff(u,t):u;return{xSnapped:f,ySnapped:d,...u}}const Ek=e=>({width:e.offsetWidth,height:e.offsetHeight}),a8=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Pte=["INPUT","SELECT","TEXTAREA"];function o8(e){var s,r;const t=((r=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Pte.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const l8=e=>"clientX"in e,qs=(e,t)=>{var a,l;const n=l8(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,r=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},jI=(e,t,n,s,r)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:r,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/s,y:(u.top-n.top)/s,...Ek(l)}})};function c8({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:r,sourceControlY:a,targetControlX:l,targetControlY:u}){const f=e*.125+r*.375+l*.375+n*.125,d=t*.125+a*.375+u*.375+s*.125,p=Math.abs(f-e),m=Math.abs(d-t);return[f,d,p,m]}function Sp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function SI({pos:e,x1:t,y1:n,x2:s,y2:r,c:a}){switch(e){case ye.Left:return[t-Sp(t-s,a),n];case ye.Right:return[t+Sp(s-t,a),n];case ye.Top:return[t,n-Sp(n-r,a)];case ye.Bottom:return[t,n+Sp(r-n,a)]}}function Rk({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top,curvature:l=.25}){const[u,f]=SI({pos:n,x1:e,y1:t,x2:s,y2:r,c:l}),[d,p]=SI({pos:a,x1:s,y1:r,x2:e,y2:t,c:l}),[m,x,y,b]=c8({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:u,sourceControlY:f,targetControlX:d,targetControlY:p});return[`M${e},${t} C${u},${f} ${d},${p} ${s},${r}`,m,x,y,b]}function u8({sourceX:e,sourceY:t,targetX:n,targetY:s}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,r,l]}function $te({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:r=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const l=r&&n?s+1e3:s,u=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return l+u}function Dte({sourceNode:e,targetNode:t,width:n,height:s,transform:r}){const a=_g(Tm(e),Tm(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const l={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:s/r[2]};return Pd(l,Cg(a))>0}const qte=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,zte=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Bte=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||qte;let r;return J6(e)?r={...e}:r={...e,id:s(e)},zte(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function d8({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[r,a,l,u]=u8({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,r,a,l,u]}const NI={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},Fte=({source:e,sourcePosition:t=ye.Bottom,target:n})=>t===ye.Left||t===ye.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},kI=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Hte({source:e,sourcePosition:t=ye.Bottom,target:n,targetPosition:s=ye.Top,center:r,offset:a,stepPosition:l}){const u=NI[t],f=NI[s],d={x:e.x+u.x*a,y:e.y+u.y*a},p={x:n.x+f.x*a,y:n.y+f.y*a},m=Fte({source:d,sourcePosition:t,target:p}),x=m.x!==0?"x":"y",y=m[x];let b=[],v,w;const S={x:0,y:0},C={x:0,y:0},[,,k,_]=u8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[x]*f[x]===-1){x==="x"?(v=r.x??d.x+(p.x-d.x)*l,w=r.y??(d.y+p.y)/2):(v=r.x??(d.x+p.x)/2,w=r.y??d.y+(p.y-d.y)*l);const I=[{x:v,y:d.y},{x:v,y:p.y}],L=[{x:d.x,y:w},{x:p.x,y:w}];u[x]===y?b=x==="x"?I:L:b=x==="x"?L:I}else{const I=[{x:d.x,y:p.y}],L=[{x:p.x,y:d.y}];if(x==="x"?b=u.x===y?L:I:b=u.y===y?I:L,t===s){const P=Math.abs(e[x]-n[x]);if(P<=a){const G=Math.min(a-1,a-P);u[x]===y?S[x]=(d[x]>e[x]?-1:1)*G:C[x]=(p[x]>n[x]?-1:1)*G}}if(t!==s){const P=x==="x"?"y":"x",G=u[x]===f[P],q=d[P]>p[P],V=d[P]<p[P];(u[x]===1&&(!G&&q||G&&V)||u[x]!==1&&(!G&&V||G&&q))&&(b=x==="x"?I:L)}const $={x:d.x+S.x,y:d.y+S.y},O={x:p.x+C.x,y:p.y+C.y},B=Math.max(Math.abs($.x-b[0].x),Math.abs(O.x-b[0].x)),H=Math.max(Math.abs($.y-b[0].y),Math.abs(O.y-b[0].y));B>=H?(v=($.x+O.x)/2,w=b[0].y):(v=b[0].x,w=($.y+O.y)/2)}const R={x:d.x+S.x,y:d.y+S.y},T={x:p.x+C.x,y:p.y+C.y};return[[e,...R.x!==b[0].x||R.y!==b[0].y?[R]:[],...b,...T.x!==b[b.length-1].x||T.y!==b[b.length-1].y?[T]:[],n],v,w,k,_]}function Ute(e,t,n,s){const r=Math.min(kI(e,t)/2,kI(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const d=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${a+r*d},${l}Q ${a},${l} ${a},${l+r*p}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${a},${l+r*f}Q ${a},${l} ${a+r*u},${l}`}function FN({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top,borderRadius:l=5,centerX:u,centerY:f,offset:d=20,stepPosition:p=.5}){const[m,x,y,b,v]=Hte({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:r},targetPosition:a,center:{x:u,y:f},offset:d,stepPosition:p});let w=`M${m[0].x} ${m[0].y}`;for(let S=1;S<m.length-1;S++)w+=Ute(m[S-1],m[S],m[S+1],l);return w+=`L${m[m.length-1].x} ${m[m.length-1].y}`,[w,x,y,b,v]}function _I(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Vte(e){var m;const{sourceNode:t,targetNode:n}=e;if(!_I(t)||!_I(n))return null;const s=t.internals.handleBounds||CI(t.handles),r=n.internals.handleBounds||CI(n.handles),a=EI((s==null?void 0:s.source)??[],e.sourceHandle),l=EI(e.connectionMode===Sc.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!a||!l)return(m=e.onError)==null||m.call(e,"008",ur.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=(a==null?void 0:a.position)||ye.Bottom,f=(l==null?void 0:l.position)||ye.Top,d=ko(t,a,u),p=ko(n,l,f);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:f}}function CI(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function ko(e,t,n=ye.Left,s=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:l,height:u}=t??ei(e);if(s)return{x:r+l/2,y:a+u/2};switch((t==null?void 0:t.position)??n){case ye.Top:return{x:r+l/2,y:a};case ye.Right:return{x:r+l,y:a+u/2};case ye.Bottom:return{x:r+l/2,y:a+u};case ye.Left:return{x:r,y:a+u/2}}}function EI(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function HN(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Gte(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:r}){const a=new Set;return e.reduce((l,u)=>([u.markerStart||s,u.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){const d=HN(f,t);a.has(d)||(l.push({id:d,color:f.color||n,...f}),a.add(d))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const f8=1e3,Kte=10,Ak={nodeOrigin:[0,0],nodeExtent:Od,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Wte={...Ak,checkEquality:!0};function Tk(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Yte(e,t,n){const s=Tk(Ak,n);for(const r of e.values())if(r.parentId)Mk(r,e,t,s);else{const a=uf(r,s.nodeOrigin),l=Cc(r.extent)?r.extent:s.nodeExtent,u=No(a,l,ei(r));r.internals.positionAbsolute=u}}function Qte(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const r of e.handles){const a={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(a):r.type==="target"&&s.push(a)}return{source:n,target:s}}function Ik(e){return e==="manual"}function UN(e,t,n,s={}){var p,m;const r=Tk(Wte,s),a={i:0},l=new Map(t),u=r!=null&&r.elevateNodesOnSelect&&!Ik(r.zIndexMode)?f8:0;let f=e.length>0,d=!1;t.clear(),n.clear();for(const x of e){let y=l.get(x.id);if(r.checkEquality&&x===(y==null?void 0:y.internals.userNode))t.set(x.id,y);else{const b=uf(x,r.nodeOrigin),v=Cc(x.extent)?x.extent:r.nodeExtent,w=No(b,v,ei(x));y={...r.defaults,...x,measured:{width:(p=x.measured)==null?void 0:p.width,height:(m=x.measured)==null?void 0:m.height},internals:{positionAbsolute:w,handleBounds:Qte(x,y),z:h8(x,u,r.zIndexMode),userNode:x}},t.set(x.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(f=!1),x.parentId&&Mk(y,t,n,s,a),d||(d=x.selected??!1)}return{nodesInitialized:f,hasSelectedNodes:d}}function Xte(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Mk(e,t,n,s,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u,zIndexMode:f}=Tk(Ak,s),d=e.parentId,p=t.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Xte(e,n),r&&!p.parentId&&p.internals.rootParentIndex===void 0&&f==="auto"&&(p.internals.rootParentIndex=++r.i,p.internals.z=p.internals.z+r.i*Kte),r&&p.internals.rootParentIndex!==void 0&&(r.i=p.internals.rootParentIndex);const m=a&&!Ik(f)?f8:0,{x,y,z:b}=Zte(e,p,l,u,m,f),{positionAbsolute:v}=e.internals,w=x!==v.x||y!==v.y;(w||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x,y}:v,z:b}})}function h8(e,t,n){const s=Ds(e.zIndex)?e.zIndex:0;return Ik(n)?s:s+(e.selected?t:0)}function Zte(e,t,n,s,r,a){const{x:l,y:u}=t.internals.positionAbsolute,f=ei(e),d=uf(e,n),p=Cc(e.extent)?No(d,e.extent,f):d;let m=No({x:l+p.x,y:u+p.y},s,f);e.extent==="parent"&&(m=t8(m,f,t));const x=h8(e,r,a),y=t.internals.z??0;return{x:m.x,y:m.y,z:y>=x?y+1:x}}function Ok(e,t,n,s=[0,0]){var l;const r=[],a=new Map;for(const u of e){const f=t.get(u.parentId);if(!f)continue;const d=((l=a.get(u.parentId))==null?void 0:l.expandedRect)??_c(f),p=s8(d,u.rect);a.set(u.parentId,{expandedRect:p,parent:f})}return a.size>0&&a.forEach(({expandedRect:u,parent:f},d)=>{var k;const p=f.internals.positionAbsolute,m=ei(f),x=f.origin??s,y=u.x<p.x?Math.round(Math.abs(p.x-u.x)):0,b=u.y<p.y?Math.round(Math.abs(p.y-u.y)):0,v=Math.max(m.width,Math.round(u.width)),w=Math.max(m.height,Math.round(u.height)),S=(v-m.width)*x[0],C=(w-m.height)*x[1];(y>0||b>0||S||C)&&(r.push({id:d,type:"position",position:{x:f.position.x-y+S,y:f.position.y-b+C}}),(k=n.get(d))==null||k.forEach(_=>{e.some(R=>R.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+y,y:_.position.y+b}})})),(m.width<u.width||m.height<u.height||y||b)&&r.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(y?x[0]*y-S:0),height:w+(b?x[1]*b-C:0)}})}),r}function Jte(e,t,n,s,r,a,l){const u=s==null?void 0:s.querySelector(".xyflow__viewport");let f=!1;if(!u)return{changes:[],updatedInternals:f};const d=[],p=window.getComputedStyle(u),{m22:m}=new window.DOMMatrixReadOnly(p.transform),x=[];for(const y of e.values()){const b=t.get(y.id);if(!b)continue;if(b.hidden){t.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),f=!0;continue}const v=Ek(y.nodeElement),w=b.measured.width!==v.width||b.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!b.internals.handleBounds||y.force))){const C=y.nodeElement.getBoundingClientRect(),k=Cc(b.extent)?b.extent:a;let{positionAbsolute:_}=b.internals;b.parentId&&b.extent==="parent"?_=t8(_,v,t.get(b.parentId)):k&&(_=No(_,k,v));const R={...b,measured:v,internals:{...b.internals,positionAbsolute:_,handleBounds:{source:jI("source",y.nodeElement,C,m,b.id),target:jI("target",y.nodeElement,C,m,b.id)}}};t.set(b.id,R),b.parentId&&Mk(R,t,n,{nodeOrigin:r,zIndexMode:l}),f=!0,w&&(d.push({id:b.id,type:"dimensions",dimensions:v}),b.expandParent&&b.parentId&&x.push({id:b.id,parentId:b.parentId,rect:_c(R,r)}))}}if(x.length>0){const y=Ok(x,t,n,r);d.push(...y)}return{changes:d,updatedInternals:f}}async function ene({delta:e,panZoom:t,transform:n,translateExtent:s,width:r,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,a]],s),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function RI(e,t,n,s,r,a){let l=r;const u=s.get(l)||new Map;s.set(l,u.set(n,t)),l=`${r}-${e}`;const f=s.get(l)||new Map;if(s.set(l,f.set(n,t)),a){l=`${r}-${e}-${a}`;const d=s.get(l)||new Map;s.set(l,d.set(n,t))}}function p8(e,t,n){e.clear(),t.clear();for(const s of n){const{source:r,target:a,sourceHandle:l=null,targetHandle:u=null}=s,f={edgeId:s.id,source:r,target:a,sourceHandle:l,targetHandle:u},d=`${r}-${l}--${a}-${u}`,p=`${a}-${u}--${r}-${l}`;RI("source",f,p,e,r,l),RI("target",f,d,e,a,u),t.set(s.id,s)}}function m8(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:m8(n,t):!1}function AI(e,t,n){var r;let s=e;do{if((r=s==null?void 0:s.matches)!=null&&r.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function tne(e,t,n,s){const r=new Map;for(const[a,l]of e)if((l.selected||l.id===s)&&(!l.parentId||!m8(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const u=e.get(a);u&&r.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return r}function Jy({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var l,u,f;const r=[];for(const[d,p]of t){const m=(l=n.get(d))==null?void 0:l.internals.userNode;m&&r.push({...m,position:p.position,dragging:s})}if(!e)return[r[0],r];const a=(u=n.get(e))==null?void 0:u.internals.userNode;return[a?{...a,position:((f=t.get(e))==null?void 0:f.position)||a.position,dragging:s}:r[0],r]}function nne({dragItems:e,snapGrid:t,x:n,y:s}){const r=e.values().next().value;if(!r)return null;const a={x:n-r.distance.x,y:s-r.distance.y},l=ff(a,t);return{x:l.x-a.x,y:l.y-a.y}}function sne({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:r}){let a={x:null,y:null},l=0,u=new Map,f=!1,d={x:0,y:0},p=null,m=!1,x=null,y=!1,b=!1,v=null;function w({noDragClassName:C,handleSelector:k,domNode:_,isSelectable:R,nodeId:T,nodeClickDistance:A=0}){x=as(_);function I({x:B,y:H}){const{nodeLookup:P,nodeExtent:G,snapGrid:q,snapToGrid:V,nodeOrigin:K,onNodeDrag:Y,onSelectionDrag:J,onError:D,updateNodePositions:F}=t();a={x:B,y:H};let te=!1;const U=u.size>1,Q=U&&G?BN(df(u)):null,X=U&&V?nne({dragItems:u,snapGrid:q,x:B,y:H}):null;for(const[se,re]of u){if(!P.has(se))continue;let ce={x:B-re.distance.x,y:H-re.distance.y};V&&(ce=X?{x:Math.round(ce.x+X.x),y:Math.round(ce.y+X.y)}:ff(ce,q));let me=null;if(U&&G&&!re.extent&&Q){const{positionAbsolute:xe}=re.internals,je=xe.x-Q.x+G[0][0],Se=xe.x+re.measured.width-Q.x2+G[1][0],$e=xe.y-Q.y+G[0][1],Re=xe.y+re.measured.height-Q.y2+G[1][1];me=[[je,$e],[Se,Re]]}const{position:ge,positionAbsolute:ve}=e8({nodeId:se,nextPosition:ce,nodeLookup:P,nodeExtent:me||G,nodeOrigin:K,onError:D});te=te||re.position.x!==ge.x||re.position.y!==ge.y,re.position=ge,re.internals.positionAbsolute=ve}if(b=b||te,!!te&&(F(u,!0),v&&(s||Y||!T&&J))){const[se,re]=Jy({nodeId:T,dragItems:u,nodeLookup:P});s==null||s(v,u,se,re),Y==null||Y(v,se,re),T||J==null||J(v,re)}}async function L(){if(!p)return;const{transform:B,panBy:H,autoPanSpeed:P,autoPanOnNodeDrag:G}=t();if(!G){f=!1,cancelAnimationFrame(l);return}const[q,V]=n8(d,p,P);(q!==0||V!==0)&&(a.x=(a.x??0)-q/B[2],a.y=(a.y??0)-V/B[2],await H({x:q,y:V})&&I(a)),l=requestAnimationFrame(L)}function $(B){var U;const{nodeLookup:H,multiSelectionActive:P,nodesDraggable:G,transform:q,snapGrid:V,snapToGrid:K,selectNodesOnDrag:Y,onNodeDragStart:J,onSelectionDragStart:D,unselectNodesAndEdges:F}=t();m=!0,(!Y||!R)&&!P&&T&&((U=H.get(T))!=null&&U.selected||F()),R&&Y&&T&&(e==null||e(T));const te=hd(B.sourceEvent,{transform:q,snapGrid:V,snapToGrid:K,containerBounds:p});if(a=te,u=tne(H,G,te,T),u.size>0&&(n||J||!T&&D)){const[Q,X]=Jy({nodeId:T,dragItems:u,nodeLookup:H});n==null||n(B.sourceEvent,u,Q,X),J==null||J(B.sourceEvent,Q,X),T||D==null||D(B.sourceEvent,X)}}const O=M6().clickDistance(A).on("start",B=>{const{domNode:H,nodeDragThreshold:P,transform:G,snapGrid:q,snapToGrid:V}=t();p=(H==null?void 0:H.getBoundingClientRect())||null,y=!1,b=!1,v=B.sourceEvent,P===0&&$(B),a=hd(B.sourceEvent,{transform:G,snapGrid:q,snapToGrid:V,containerBounds:p}),d=qs(B.sourceEvent,p)}).on("drag",B=>{const{autoPanOnNodeDrag:H,transform:P,snapGrid:G,snapToGrid:q,nodeDragThreshold:V,nodeLookup:K}=t(),Y=hd(B.sourceEvent,{transform:P,snapGrid:G,snapToGrid:q,containerBounds:p});if(v=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!K.has(T))&&(y=!0),!y){if(!f&&H&&m&&(f=!0,L()),!m){const J=qs(B.sourceEvent,p),D=J.x-d.x,F=J.y-d.y;Math.sqrt(D*D+F*F)>V&&$(B)}(a.x!==Y.xSnapped||a.y!==Y.ySnapped)&&u&&m&&(d=qs(B.sourceEvent,p),I(Y))}}).on("end",B=>{if(!(!m||y)&&(f=!1,m=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:H,updateNodePositions:P,onNodeDragStop:G,onSelectionDragStop:q}=t();if(b&&(P(u,!1),b=!1),r||G||!T&&q){const[V,K]=Jy({nodeId:T,dragItems:u,nodeLookup:H,dragging:!1});r==null||r(B.sourceEvent,u,V,K),G==null||G(B.sourceEvent,V,K),T||q==null||q(B.sourceEvent,K)}}}).filter(B=>{const H=B.target;return!B.button&&(!C||!AI(H,`.${C}`,_))&&(!k||AI(H,k,_))});x.call(O)}function S(){x==null||x.on(".drag",null)}return{update:w,destroy:S}}function rne(e,t,n){const s=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())Pd(r,_c(a))>0&&s.push(a);return s}const ine=250;function ane(e,t,n,s){var u,f;let r=[],a=1/0;const l=rne(e,n,t+ine);for(const d of l){const p=[...((u=d.internals.handleBounds)==null?void 0:u.source)??[],...((f=d.internals.handleBounds)==null?void 0:f.target)??[]];for(const m of p){if(s.nodeId===m.nodeId&&s.type===m.type&&s.id===m.id)continue;const{x,y}=ko(d,m,m.position,!0),b=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(y-e.y,2));b>t||(b<a?(r=[{...m,x,y}],a=b):b===a&&r.push({...m,x,y}))}}if(!r.length)return null;if(r.length>1){const d=s.type==="source"?"target":"source";return r.find(p=>p.type===d)??r[0]}return r[0]}function g8(e,t,n,s,r,a=!1){var d,p,m;const l=s.get(e);if(!l)return null;const u=r==="strict"?(d=l.internals.handleBounds)==null?void 0:d[t]:[...((p=l.internals.handleBounds)==null?void 0:p.source)??[],...((m=l.internals.handleBounds)==null?void 0:m.target)??[]],f=(n?u==null?void 0:u.find(x=>x.id===n):u==null?void 0:u[0])??null;return f&&a?{...f,...ko(l,f,f.position,!0)}:f}function x8(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function one(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const y8=()=>!0;function lne(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:r,edgeUpdaterType:a,isTarget:l,domNode:u,nodeLookup:f,lib:d,autoPanOnConnect:p,flowId:m,panBy:x,cancelConnection:y,onConnectStart:b,onConnect:v,onConnectEnd:w,isValidConnection:S=y8,onReconnectEnd:C,updateConnection:k,getTransform:_,getFromHandle:R,autoPanSpeed:T,dragThreshold:A=1,handleDomNode:I}){const L=a8(e.target);let $=0,O;const{x:B,y:H}=qs(e),P=x8(a,I),G=u==null?void 0:u.getBoundingClientRect();let q=!1;if(!G||!P)return;const V=g8(r,P,s,f,t);if(!V)return;let K=qs(e,G),Y=!1,J=null,D=!1,F=null;function te(){if(!p||!G)return;const[ge,ve]=n8(K,G,T);x({x:ge,y:ve}),$=requestAnimationFrame(te)}const U={...V,nodeId:r,type:P,position:V.position},Q=f.get(r);let se={inProgress:!0,isValid:null,from:ko(Q,U,ye.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:Q,to:K,toHandle:null,toPosition:yI[U.position],toNode:null,pointer:K};function re(){q=!0,k(se),b==null||b(e,{nodeId:r,handleId:s,handleType:P})}A===0&&re();function ce(ge){if(!q){const{x:Re,y:xt}=qs(ge),wt=Re-B,Ot=xt-H;if(!(wt*wt+Ot*Ot>A*A))return;re()}if(!R()||!U){me(ge);return}const ve=_();K=qs(ge,G),O=ane(hf(K,ve,!1,[1,1]),n,f,U),Y||(te(),Y=!0);const xe=v8(ge,{handle:O,connectionMode:t,fromNodeId:r,fromHandleId:s,fromType:l?"target":"source",isValidConnection:S,doc:L,lib:d,flowId:m,nodeLookup:f});F=xe.handleDomNode,J=xe.connection,D=one(!!O,xe.isValid);const je=f.get(r),Se=je?ko(je,U,ye.Left,!0):se.from,$e={...se,from:Se,isValid:D,to:xe.toHandle&&D?Im({x:xe.toHandle.x,y:xe.toHandle.y},ve):K,toHandle:xe.toHandle,toPosition:D&&xe.toHandle?xe.toHandle.position:yI[U.position],toNode:xe.toHandle?f.get(xe.toHandle.nodeId):null,pointer:K};k($e),se=$e}function me(ge){if(!("touches"in ge&&ge.touches.length>0)){if(q){(O||F)&&J&&D&&(v==null||v(J));const{inProgress:ve,...xe}=se,je={...xe,toPosition:se.toHandle?se.toPosition:null};w==null||w(ge,je),a&&(C==null||C(ge,je))}y(),cancelAnimationFrame($),Y=!1,D=!1,J=null,F=null,L.removeEventListener("mousemove",ce),L.removeEventListener("mouseup",me),L.removeEventListener("touchmove",ce),L.removeEventListener("touchend",me)}}L.addEventListener("mousemove",ce),L.addEventListener("mouseup",me),L.addEventListener("touchmove",ce),L.addEventListener("touchend",me)}function v8(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:r,fromType:a,doc:l,lib:u,flowId:f,isValidConnection:d=y8,nodeLookup:p}){const m=a==="target",x=t?l.querySelector(`.${u}-flow__handle[data-id="${f}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:b}=qs(e),v=l.elementFromPoint(y,b),w=v!=null&&v.classList.contains(`${u}-flow__handle`)?v:x,S={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const C=x8(void 0,w),k=w.getAttribute("data-nodeid"),_=w.getAttribute("data-handleid"),R=w.classList.contains("connectable"),T=w.classList.contains("connectableend");if(!k||!C)return S;const A={source:m?k:s,sourceHandle:m?_:r,target:m?s:k,targetHandle:m?r:_};S.connection=A;const L=R&&T&&(n===Sc.Strict?m&&C==="source"||!m&&C==="target":k!==s||_!==r);S.isValid=L&&d(A),S.toHandle=g8(k,C,_,p,n,!0)}return S}const VN={onPointerDown:lne,isValid:v8};function cne({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const r=as(e);function a({translateExtent:u,width:f,height:d,zoomStep:p=1,pannable:m=!0,zoomable:x=!0,inversePan:y=!1}){const b=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const _=n(),R=k.sourceEvent.ctrlKey&&$d()?10:1,T=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*p,A=_[2]*Math.pow(2,T*R);t.scaleTo(A)};let v=[0,0];const w=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(v=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},S=k=>{const _=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const R=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],T=[R[0]-v[0],R[1]-v[1]];v=R;const A=s()*Math.max(_[2],Math.log(_[2]))*(y?-1:1),I={x:_[0]-T[0]*A,y:_[1]-T[1]*A},L=[[0,0],[f,d]];t.setViewportConstrained({x:I.x,y:I.y,zoom:_[2]},L,u)},C=W6().on("start",w).on("zoom",m?S:null).on("zoom.wheel",x?b:null);r.call(C,{})}function l(){r.on("zoom",null)}return{update:a,destroy:l,pointer:Ls}}const Eg=e=>({x:e.x,y:e.y,zoom:e.k}),ev=({x:e,y:t,zoom:n})=>kg.translate(e,t).scale(n),Vl=(e,t)=>e.target.closest(`.${t}`),b8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),une=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,tv=(e,t=0,n=une,s=()=>{})=>{const r=typeof t=="number"&&t>0;return r||s(),r?e.transition().duration(t).ease(n).on("end",s):e},w8=e=>{const t=e.ctrlKey&&$d()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function dne({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:r,panOnScrollSpeed:a,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:f,onPanZoomEnd:d}){return p=>{if(Vl(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&l){const w=Ls(p),S=w8(p),C=m*Math.pow(2,S);s.scaleTo(n,C,w,p);return}const x=p.deltaMode===1?20:1;let y=r===xo.Vertical?0:p.deltaX*x,b=r===xo.Horizontal?0:p.deltaY*x;!$d()&&p.shiftKey&&r!==xo.Vertical&&(y=p.deltaY*x,b=0),s.translateBy(n,-(y/m)*a,-(b/m)*a,{internal:!0});const v=Eg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f==null||f(p,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,u==null||u(p,v))}}function fne({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,r){const a=s.type==="wheel",l=!t&&a&&!s.ctrlKey,u=Vl(s,e);if(s.ctrlKey&&a&&u&&s.preventDefault(),l||u)return null;s.preventDefault(),n.call(this,s,r)}}function hne({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var a,l,u;if((a=s.sourceEvent)!=null&&a.internal)return;const r=Eg(s.transform);e.mouseButton=((l=s.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((u=s.sourceEvent)==null?void 0:u.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,r))}}function pne({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:r}){return a=>{var l,u;e.usedRightMouseButton=!!(n&&b8(t,e.mouseButton??0)),(l=a.sourceEvent)!=null&&l.sync||s([a.transform.x,a.transform.y,a.transform.k]),r&&!((u=a.sourceEvent)!=null&&u.internal)&&(r==null||r(a.sourceEvent,Eg(a.transform)))}}function mne({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:r,onPaneContextMenu:a}){return l=>{var u;if(!((u=l.sourceEvent)!=null&&u.internal)&&(e.isZoomingOrPanning=!1,a&&b8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&a(l.sourceEvent),e.usedRightMouseButton=!1,s(!1),r)){const f=Eg(l.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(l.sourceEvent,f)},n?150:0)}}}function gne({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:r,zoomOnDoubleClick:a,userSelectionActive:l,noWheelClassName:u,noPanClassName:f,lib:d,connectionInProgress:p}){return m=>{var w;const x=e||t,y=n&&m.ctrlKey,b=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(Vl(m,`${d}-flow__node`)||Vl(m,`${d}-flow__edge`)))return!0;if(!s&&!x&&!r&&!a&&!n||l||p&&!b||Vl(m,u)&&b||Vl(m,f)&&(!b||r&&b&&!e)||!n&&m.ctrlKey&&b)return!1;if(!n&&m.type==="touchstart"&&((w=m.touches)==null?void 0:w.length)>1)return m.preventDefault(),!1;if(!x&&!r&&!y&&b||!s&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(s)&&!s.includes(m.button)&&m.type==="mousedown")return!1;const v=Array.isArray(s)&&s.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||b)&&v}}function xne({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:r,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:f}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),m=W6().scaleExtent([t,n]).translateExtent(s),x=as(e).call(m);C({x:r.x,y:r.y,zoom:kc(r.zoom,t,n)},[[0,0],[p.width,p.height]],s);const y=x.on("wheel.zoom"),b=x.on("dblclick.zoom");m.wheelDelta(w8);function v(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?fd:nm).transform(tv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function w({noWheelClassName:O,noPanClassName:B,onPaneContextMenu:H,userSelectionActive:P,panOnScroll:G,panOnDrag:q,panOnScrollMode:V,panOnScrollSpeed:K,preventScrolling:Y,zoomOnPinch:J,zoomOnScroll:D,zoomOnDoubleClick:F,zoomActivationKeyPressed:te,lib:U,onTransformChange:Q,connectionInProgress:X,paneClickDistance:se,selectionOnDrag:re}){P&&!d.isZoomingOrPanning&&S();const ce=G&&!te&&!P;m.clickDistance(re?1/0:!Ds(se)||se<0?0:se);const me=ce?dne({zoomPanValues:d,noWheelClassName:O,d3Selection:x,d3Zoom:m,panOnScrollMode:V,panOnScrollSpeed:K,zoomOnPinch:J,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}):fne({noWheelClassName:O,preventScrolling:Y,d3ZoomHandler:y});if(x.on("wheel.zoom",me,{passive:!1}),!P){const ve=hne({zoomPanValues:d,onDraggingChange:f,onPanZoomStart:l});m.on("start",ve);const xe=pne({zoomPanValues:d,panOnDrag:q,onPaneContextMenu:!!H,onPanZoom:a,onTransformChange:Q});m.on("zoom",xe);const je=mne({zoomPanValues:d,panOnDrag:q,panOnScroll:G,onPaneContextMenu:H,onPanZoomEnd:u,onDraggingChange:f});m.on("end",je)}const ge=gne({zoomActivationKeyPressed:te,panOnDrag:q,zoomOnScroll:D,panOnScroll:G,zoomOnDoubleClick:F,zoomOnPinch:J,userSelectionActive:P,noPanClassName:B,noWheelClassName:O,lib:U,connectionInProgress:X});m.filter(ge),F?x.on("dblclick.zoom",b):x.on("dblclick.zoom",null)}function S(){m.on("zoom",null)}async function C(O,B,H){const P=ev(O),G=m==null?void 0:m.constrain()(P,B,H);return G&&await v(G),new Promise(q=>q(G))}async function k(O,B){const H=ev(O);return await v(H,B),new Promise(P=>P(H))}function _(O){if(x){const B=ev(O),H=x.property("__zoom");(H.k!==O.zoom||H.x!==O.x||H.y!==O.y)&&(m==null||m.transform(x,B,null,{sync:!0}))}}function R(){const O=x?K6(x.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function T(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?fd:nm).scaleTo(tv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function A(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?fd:nm).scaleBy(tv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function I(O){m==null||m.scaleExtent(O)}function L(O){m==null||m.translateExtent(O)}function $(O){const B=!Ds(O)||O<0?0:O;m==null||m.clickDistance(B)}return{update:w,destroy:S,setViewport:k,setViewportConstrained:C,getViewport:R,scaleTo:T,scaleBy:A,setScaleExtent:I,setTranslateExtent:L,syncViewport:_,setClickDistance:$}}var Ec;(function(e){e.Line="line",e.Handle="handle"})(Ec||(Ec={}));function yne({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:r,affectsY:a}){const l=e-t,u=n-s,f=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&r&&(f[0]=f[0]*-1),u&&a&&(f[1]=f[1]*-1),f}function TI(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:r}}function $i(e,t){return Math.max(0,t-e)}function Di(e,t){return Math.max(0,e-t)}function Np(e,t,n){return Math.max(0,t-e,e-n)}function II(e,t){return e?!t:t}function vne(e,t,n,s,r,a,l,u){let{affectsX:f,affectsY:d}=t;const{isHorizontal:p,isVertical:m}=t,x=p&&m,{xSnapped:y,ySnapped:b}=n,{minWidth:v,maxWidth:w,minHeight:S,maxHeight:C}=s,{x:k,y:_,width:R,height:T,aspectRatio:A}=e;let I=Math.floor(p?y-e.pointerX:0),L=Math.floor(m?b-e.pointerY:0);const $=R+(f?-I:I),O=T+(d?-L:L),B=-a[0]*R,H=-a[1]*T;let P=Np($,v,w),G=Np(O,S,C);if(l){let K=0,Y=0;f&&I<0?K=$i(k+I+B,l[0][0]):!f&&I>0&&(K=Di(k+$+B,l[1][0])),d&&L<0?Y=$i(_+L+H,l[0][1]):!d&&L>0&&(Y=Di(_+O+H,l[1][1])),P=Math.max(P,K),G=Math.max(G,Y)}if(u){let K=0,Y=0;f&&I>0?K=Di(k+I,u[0][0]):!f&&I<0&&(K=$i(k+$,u[1][0])),d&&L>0?Y=Di(_+L,u[0][1]):!d&&L<0&&(Y=$i(_+O,u[1][1])),P=Math.max(P,K),G=Math.max(G,Y)}if(r){if(p){const K=Np($/A,S,C)*A;if(P=Math.max(P,K),l){let Y=0;!f&&!d||f&&!d&&x?Y=Di(_+H+$/A,l[1][1])*A:Y=$i(_+H+(f?I:-I)/A,l[0][1])*A,P=Math.max(P,Y)}if(u){let Y=0;!f&&!d||f&&!d&&x?Y=$i(_+$/A,u[1][1])*A:Y=Di(_+(f?I:-I)/A,u[0][1])*A,P=Math.max(P,Y)}}if(m){const K=Np(O*A,v,w)/A;if(G=Math.max(G,K),l){let Y=0;!f&&!d||d&&!f&&x?Y=Di(k+O*A+B,l[1][0])/A:Y=$i(k+(d?L:-L)*A+B,l[0][0])/A,G=Math.max(G,Y)}if(u){let Y=0;!f&&!d||d&&!f&&x?Y=$i(k+O*A,u[1][0])/A:Y=Di(k+(d?L:-L)*A,u[0][0])/A,G=Math.max(G,Y)}}}L=L+(L<0?G:-G),I=I+(I<0?P:-P),r&&(x?$>O*A?L=(II(f,d)?-I:I)/A:I=(II(f,d)?-L:L)*A:p?(L=I/A,d=f):(I=L*A,f=d));const q=f?k+I:k,V=d?_+L:_;return{width:R+(f?-I:I),height:T+(d?-L:L),x:a[0]*I*(f?-1:1)+q,y:a[1]*L*(d?-1:1)+V}}const j8={width:0,height:0,x:0,y:0},bne={...j8,pointerX:0,pointerY:0,aspectRatio:1};function wne(e){return[[0,0],[e.measured.width,e.measured.height]]}function jne(e,t,n){const s=t.position.x+e.position.x,r=t.position.y+e.position.y,a=e.measured.width??0,l=e.measured.height??0,u=n[0]*a,f=n[1]*l;return[[s-u,r-f],[s+a-u,r+l-f]]}function Sne({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:r}){const a=as(e);let l={controlDirection:TI("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:d,boundaries:p,keepAspectRatio:m,resizeDirection:x,onResizeStart:y,onResize:b,onResizeEnd:v,shouldResize:w}){let S={...j8},C={...bne};l={boundaries:p,resizeDirection:x,keepAspectRatio:m,controlDirection:TI(d)};let k,_=null,R=[],T,A,I,L=!1;const $=M6().on("start",O=>{const{nodeLookup:B,transform:H,snapGrid:P,snapToGrid:G,nodeOrigin:q,paneDomNode:V}=n();if(k=B.get(t),!k)return;_=(V==null?void 0:V.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:Y}=hd(O.sourceEvent,{transform:H,snapGrid:P,snapToGrid:G,containerBounds:_});S={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},C={...S,pointerX:K,pointerY:Y,aspectRatio:S.width/S.height},T=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(T=B.get(k.parentId),A=T&&k.extent==="parent"?wne(T):void 0),R=[],I=void 0;for(const[J,D]of B)if(D.parentId===t&&(R.push({id:J,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const F=jne(D,k,D.origin??q);I?I=[[Math.min(F[0][0],I[0][0]),Math.min(F[0][1],I[0][1])],[Math.max(F[1][0],I[1][0]),Math.max(F[1][1],I[1][1])]]:I=F}y==null||y(O,{...S})}).on("drag",O=>{const{transform:B,snapGrid:H,snapToGrid:P,nodeOrigin:G}=n(),q=hd(O.sourceEvent,{transform:B,snapGrid:H,snapToGrid:P,containerBounds:_}),V=[];if(!k)return;const{x:K,y:Y,width:J,height:D}=S,F={},te=k.origin??G,{width:U,height:Q,x:X,y:se}=vne(C,l.controlDirection,q,l.boundaries,l.keepAspectRatio,te,A,I),re=U!==J,ce=Q!==D,me=X!==K&&re,ge=se!==Y&&ce;if(!me&&!ge&&!re&&!ce)return;if((me||ge||te[0]===1||te[1]===1)&&(F.x=me?X:S.x,F.y=ge?se:S.y,S.x=F.x,S.y=F.y,R.length>0)){const Se=X-K,$e=se-Y;for(const Re of R)Re.position={x:Re.position.x-Se+te[0]*(U-J),y:Re.position.y-$e+te[1]*(Q-D)},V.push(Re)}if((re||ce)&&(F.width=re&&(!l.resizeDirection||l.resizeDirection==="horizontal")?U:S.width,F.height=ce&&(!l.resizeDirection||l.resizeDirection==="vertical")?Q:S.height,S.width=F.width,S.height=F.height),T&&k.expandParent){const Se=te[0]*(F.width??0);F.x&&F.x<Se&&(S.x=Se,C.x=C.x-(F.x-Se));const $e=te[1]*(F.height??0);F.y&&F.y<$e&&(S.y=$e,C.y=C.y-(F.y-$e))}const ve=yne({width:S.width,prevWidth:J,height:S.height,prevHeight:D,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),xe={...S,direction:ve};(w==null?void 0:w(O,xe))!==!1&&(L=!0,b==null||b(O,xe),s(F,V))}).on("end",O=>{L&&(v==null||v(O,{...S}),r==null||r({...S}),L=!1)});a.call($)}function f(){a.on(".drag",null)}return{update:u,destroy:f}}const Nne={},MI=e=>{let t;const n=new Set,s=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const y=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(b=>b(t,y))}},r=()=>t,f={setState:s,getState:r,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Nne?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,r,f);return f},kne=e=>e?MI(e):MI,{useDebugValue:_ne}=vo,{useSyncExternalStoreWithSelector:Cne}=$H,Ene=e=>e;function S8(e,t=Ene,n){const s=Cne(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _ne(s),s}const OI=(e,t)=>{const n=kne(e),s=(r,a=t)=>S8(n,r,a);return Object.assign(s,n),s},Rne=(e,t)=>e?OI(e,t):OI;function kt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,r]of e)if(!Object.is(r,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const Rg=E.createContext(null),Ane=Rg.Provider,N8=ur.error001();function et(e,t){const n=E.useContext(Rg);if(n===null)throw new Error(N8);return S8(n,e,t)}function _t(){const e=E.useContext(Rg);if(e===null)throw new Error(N8);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const LI={display:"none"},Tne={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},k8="react-flow__node-desc",_8="react-flow__edge-desc",Ine="react-flow__aria-live",Mne=e=>e.ariaLiveMessage,One=e=>e.ariaLabelConfig;function Lne({rfId:e}){const t=et(Mne);return i.jsx("div",{id:`${Ine}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Tne,children:t})}function Pne({rfId:e,disableKeyboardA11y:t}){const n=et(One);return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:`${k8}-${e}`,style:LI,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),i.jsx("div",{id:`${_8}-${e}`,style:LI,children:n["edge.a11yDescription.default"]}),!t&&i.jsx(Lne,{rfId:e})]})}const pf=E.forwardRef(({position:e="top-left",children:t,className:n,style:s,...r},a)=>{const l=`${e}`.split("-");return i.jsx("div",{className:Kt(["react-flow__panel",n,...l]),style:s,ref:a,...r,children:t})});pf.displayName="Panel";function $ne({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:i.jsx(pf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:i.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Dne=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},kp=e=>e.id;function qne(e,t){return kt(e.selectedNodes.map(kp),t.selectedNodes.map(kp))&&kt(e.selectedEdges.map(kp),t.selectedEdges.map(kp))}function zne({onSelectionChange:e}){const t=_t(),{selectedNodes:n,selectedEdges:s}=et(Dne,qne);return E.useEffect(()=>{const r={nodes:n,edges:s};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(a=>a(r))},[n,s,e]),null}const Bne=e=>!!e.onSelectionChangeHandlers;function Fne({onSelectionChange:e}){const t=et(Bne);return e||t?i.jsx(zne,{onSelectionChange:e}):null}const GN=typeof window<"u"?E.useLayoutEffect:E.useEffect,C8=[0,0],Hne={x:0,y:0,zoom:1},Une=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],PI=[...Une,"rfId"],Vne=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),$I={translateExtent:Od,nodeOrigin:C8,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Gne(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:r,setTranslateExtent:a,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:f}=et(Vne,kt),d=_t();GN(()=>(f(e.defaultNodes,e.defaultEdges),()=>{p.current=$I,u()}),[]);const p=E.useRef($I);return GN(()=>{for(const m of PI){const x=e[m],y=p.current[m];x!==y&&(typeof e[m]>"u"||(m==="nodes"?t(x):m==="edges"?n(x):m==="minZoom"?s(x):m==="maxZoom"?r(x):m==="translateExtent"?a(x):m==="nodeExtent"?l(x):m==="ariaLabelConfig"?d.setState({ariaLabelConfig:Lte(x)}):m==="fitView"?d.setState({fitViewQueued:x}):m==="fitViewOptions"?d.setState({fitViewOptions:x}):d.setState({[m]:x})))}p.current=e},PI.map(m=>e[m])),null}function DI(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Kne(e){var s;const[t,n]=E.useState(e==="system"?null:e);return E.useEffect(()=>{if(e!=="system"){n(e);return}const r=DI(),a=()=>n(r!=null&&r.matches?"dark":"light");return a(),r==null||r.addEventListener("change",a),()=>{r==null||r.removeEventListener("change",a)}},[e]),t!==null?t:(s=DI())!=null&&s.matches?"dark":"light"}const qI=typeof document<"u"?document:null;function Dd(e=null,t={target:qI,actInsideInputWithModifier:!0}){const[n,s]=E.useState(!1),r=E.useRef(!1),a=E.useRef(new Set([])),[l,u]=E.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
|
|
462
|
-
`).replace(`
|
|
463
|
-
|
|
464
|
-
`,`
|
|
465
|
-
+`).split(`
|
|
466
|
-
`)),p=d.reduce((m,x)=>m.concat(...x),[]);return[d,p]}return[[],[]]},[e]);return E.useEffect(()=>{const f=(t==null?void 0:t.target)??qI,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var w,S;if(r.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!r.current||r.current&&!d)&&o8(y))return!1;const v=BI(y.code,u);if(a.current.add(y[v]),zI(l,a.current,!1)){const C=((S=(w=y.composedPath)==null?void 0:w.call(y))==null?void 0:S[0])||y.target,k=(C==null?void 0:C.nodeName)==="BUTTON"||(C==null?void 0:C.nodeName)==="A";t.preventDefault!==!1&&(r.current||!k)&&y.preventDefault(),s(!0)}},m=y=>{const b=BI(y.code,u);zI(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(y[b]),y.key==="Meta"&&a.current.clear(),r.current=!1},x=()=>{a.current.clear(),s(!1)};return f==null||f.addEventListener("keydown",p),f==null||f.addEventListener("keyup",m),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{f==null||f.removeEventListener("keydown",p),f==null||f.removeEventListener("keyup",m),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,s]),n}function zI(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(r=>t.has(r)))}function BI(e,t){return t.includes(e)?"code":"key"}const Wne=()=>{const e=_t();return E.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,r,a],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??s,y:t.y??r,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:r,minZoom:a,maxZoom:l,panZoom:u}=e.getState(),f=Ck(t,s,r,a,l,(n==null?void 0:n.padding)??.1);return u?(await u.setViewport(f,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:s,snapGrid:r,snapToGrid:a,domNode:l}=e.getState();if(!l)return t;const{x:u,y:f}=l.getBoundingClientRect(),d={x:t.x-u,y:t.y-f},p=n.snapGrid??r,m=n.snapToGrid??a;return hf(d,s,m,p)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:r,y:a}=s.getBoundingClientRect(),l=Im(t,n);return{x:l.x+r,y:l.y+a}}}),[])};function E8(e,t){const n=[],s=new Map,r=[];for(const a of e)if(a.type==="add"){r.push(a);continue}else if(a.type==="remove"||a.type==="replace")s.set(a.id,[a]);else{const l=s.get(a.id);l?l.push(a):s.set(a.id,[a])}for(const a of t){const l=s.get(a.id);if(!l){n.push(a);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...a};for(const f of l)Yne(f,u);n.push(u)}return r.length&&r.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function Yne(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Qne(e,t){return E8(e,t)}function Xne(e,t){return E8(e,t)}function Ka(e,t){return{id:e,type:"select",selected:t}}function Gl(e,t=new Set,n=!1){const s=[];for(const[r,a]of e){const l=t.has(r);!(a.selected===void 0&&!l)&&a.selected!==l&&(n&&(a.selected=l),s.push(Ka(a.id,l)))}return s}function FI({items:e=[],lookup:t}){var r;const n=[],s=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),f=((r=u==null?void 0:u.internals)==null?void 0:r.userNode)??u;f!==void 0&&f!==l&&n.push({id:l.id,item:l,type:"replace"}),f===void 0&&n.push({item:l,type:"add",index:a})}for(const[a]of t)s.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function HI(e){return{id:e.id,type:"remove"}}const UI=e=>kte(e),Zne=e=>J6(e);function R8(e){return E.forwardRef(e)}function VI(e){const[t,n]=E.useState(BigInt(0)),[s]=E.useState(()=>Jne(()=>n(r=>r+BigInt(1))));return GN(()=>{const r=s.get();r.length&&(e(r),s.reset())},[t]),s}function Jne(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const A8=E.createContext(null);function ese({children:e}){const t=_t(),n=E.useCallback(u=>{const{nodes:f=[],setNodes:d,hasDefaultNodes:p,onNodesChange:m,nodeLookup:x,fitViewQueued:y,onNodesChangeMiddlewareMap:b}=t.getState();let v=f;for(const S of u)v=typeof S=="function"?S(v):S;let w=FI({items:v,lookup:x});for(const S of b.values())w=S(w);p&&d(v),w.length>0?m==null||m(w):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:C,setNodes:k}=t.getState();S&&k(C)})},[]),s=VI(n),r=E.useCallback(u=>{const{edges:f=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:x}=t.getState();let y=f;for(const b of u)y=typeof b=="function"?b(y):b;p?d(y):m&&m(FI({items:y,lookup:x}))},[]),a=VI(r),l=E.useMemo(()=>({nodeQueue:s,edgeQueue:a}),[]);return i.jsx(A8.Provider,{value:l,children:e})}function tse(){const e=E.useContext(A8);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const nse=e=>!!e.panZoom;function Ag(){const e=Wne(),t=_t(),n=tse(),s=et(nse),r=E.useMemo(()=>{const a=m=>t.getState().nodeLookup.get(m),l=m=>{n.nodeQueue.push(m)},u=m=>{n.edgeQueue.push(m)},f=m=>{var S,C;const{nodeLookup:x,nodeOrigin:y}=t.getState(),b=UI(m)?m:x.get(m.id),v=b.parentId?i8(b.position,b.measured,b.parentId,x,y):b.position,w={...b,position:v,width:((S=b.measured)==null?void 0:S.width)??b.width,height:((C=b.measured)==null?void 0:C.height)??b.height};return _c(w)},d=(m,x,y={replace:!1})=>{l(b=>b.map(v=>{if(v.id===m){const w=typeof x=="function"?x(v):x;return y.replace&&UI(w)?w:{...v,...w}}return v}))},p=(m,x,y={replace:!1})=>{u(b=>b.map(v=>{if(v.id===m){const w=typeof x=="function"?x(v):x;return y.replace&&Zne(w)?w:{...v,...w}}return v}))};return{getNodes:()=>t.getState().nodes.map(m=>({...m})),getNode:m=>{var x;return(x=a(m))==null?void 0:x.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:m=[]}=t.getState();return m.map(x=>({...x}))},getEdge:m=>t.getState().edgeLookup.get(m),setNodes:l,setEdges:u,addNodes:m=>{const x=Array.isArray(m)?m:[m];n.nodeQueue.push(y=>[...y,...x])},addEdges:m=>{const x=Array.isArray(m)?m:[m];n.edgeQueue.push(y=>[...y,...x])},toObject:()=>{const{nodes:m=[],edges:x=[],transform:y}=t.getState(),[b,v,w]=y;return{nodes:m.map(S=>({...S})),edges:x.map(S=>({...S})),viewport:{x:b,y:v,zoom:w}}},deleteElements:async({nodes:m=[],edges:x=[]})=>{const{nodes:y,edges:b,onNodesDelete:v,onEdgesDelete:w,triggerNodeChanges:S,triggerEdgeChanges:C,onDelete:k,onBeforeDelete:_}=t.getState(),{nodes:R,edges:T}=await Ate({nodesToRemove:m,edgesToRemove:x,nodes:y,edges:b,onBeforeDelete:_}),A=T.length>0,I=R.length>0;if(A){const L=T.map(HI);w==null||w(T),C(L)}if(I){const L=R.map(HI);v==null||v(R),S(L)}return(I||A)&&(k==null||k({nodes:R,edges:T})),{deletedNodes:R,deletedEdges:T}},getIntersectingNodes:(m,x=!0,y)=>{const b=bI(m),v=b?m:f(m),w=y!==void 0;return v?(y||t.getState().nodes).filter(S=>{const C=t.getState().nodeLookup.get(S.id);if(C&&!b&&(S.id===m.id||!C.internals.positionAbsolute))return!1;const k=_c(w?S:C),_=Pd(k,v);return x&&_>0||_>=k.width*k.height||_>=v.width*v.height}):[]},isNodeIntersecting:(m,x,y=!0)=>{const v=bI(m)?m:f(m);if(!v)return!1;const w=Pd(v,x);return y&&w>0||w>=x.width*x.height||w>=v.width*v.height},updateNode:d,updateNodeData:(m,x,y={replace:!1})=>{d(m,b=>{const v=typeof x=="function"?x(b):x;return y.replace?{...b,data:v}:{...b,data:{...b.data,...v}}},y)},updateEdge:p,updateEdgeData:(m,x,y={replace:!1})=>{p(m,b=>{const v=typeof x=="function"?x(b):x;return y.replace?{...b,data:v}:{...b,data:{...b.data,...v}}},y)},getNodesBounds:m=>{const{nodeLookup:x,nodeOrigin:y}=t.getState();return _te(m,{nodeLookup:x,nodeOrigin:y})},getHandleConnections:({type:m,id:x,nodeId:y})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${y}-${m}${x?`-${x}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:m,handleId:x,nodeId:y})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${y}${m?x?`-${m}-${x}`:`-${m}`:""}`))==null?void 0:b.values())??[])},fitView:async m=>{const x=t.getState().fitViewResolver??Ote();return t.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:x}),n.nodeQueue.push(y=>[...y]),x.promise}}},[]);return E.useMemo(()=>({...r,...e,viewportInitialized:s}),[s])}const GI=e=>e.selected,sse=typeof window<"u"?window:void 0;function rse({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=_t(),{deleteElements:s}=Ag(),r=Dd(e,{actInsideInputWithModifier:!1}),a=Dd(t,{target:sse});E.useEffect(()=>{if(r){const{edges:l,nodes:u}=n.getState();s({nodes:u.filter(GI),edges:l.filter(GI)}),n.setState({nodesSelectionActive:!1})}},[r]),E.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function ise(e){const t=_t();E.useEffect(()=>{const n=()=>{var r,a,l,u;if(!e.current||!(((a=(r=e.current).checkVisibility)==null?void 0:a.call(r))??!0))return!1;const s=Ek(e.current);(s.height===0||s.width===0)&&((u=(l=t.getState()).onError)==null||u.call(l,"004",ur.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const Tg={position:"absolute",width:"100%",height:"100%",top:0,left:0},ase=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ose({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:r=.5,panOnScrollMode:a=xo.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:f,translateExtent:d,minZoom:p,maxZoom:m,zoomActivationKeyCode:x,preventScrolling:y=!0,children:b,noWheelClassName:v,noPanClassName:w,onViewportChange:S,isControlledViewport:C,paneClickDistance:k,selectionOnDrag:_}){const R=_t(),T=E.useRef(null),{userSelectionActive:A,lib:I,connectionInProgress:L}=et(ase,kt),$=Dd(x),O=E.useRef();ise(T);const B=E.useCallback(H=>{S==null||S({x:H[0],y:H[1],zoom:H[2]}),C||R.setState({transform:H})},[S,C]);return E.useEffect(()=>{if(T.current){O.current=xne({domNode:T.current,minZoom:p,maxZoom:m,translateExtent:d,viewport:f,onDraggingChange:q=>R.setState(V=>V.paneDragging===q?V:{paneDragging:q}),onPanZoomStart:(q,V)=>{const{onViewportChangeStart:K,onMoveStart:Y}=R.getState();Y==null||Y(q,V),K==null||K(V)},onPanZoom:(q,V)=>{const{onViewportChange:K,onMove:Y}=R.getState();Y==null||Y(q,V),K==null||K(V)},onPanZoomEnd:(q,V)=>{const{onViewportChangeEnd:K,onMoveEnd:Y}=R.getState();Y==null||Y(q,V),K==null||K(V)}});const{x:H,y:P,zoom:G}=O.current.getViewport();return R.setState({panZoom:O.current,transform:[H,P,G],domNode:T.current.closest(".react-flow")}),()=>{var q;(q=O.current)==null||q.destroy()}}},[]),E.useEffect(()=>{var H;(H=O.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:r,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:$,preventScrolling:y,noPanClassName:w,userSelectionActive:A,noWheelClassName:v,lib:I,onTransformChange:B,connectionInProgress:L,selectionOnDrag:_,paneClickDistance:k})},[e,t,n,s,r,a,l,u,$,y,w,A,v,I,B,L,_,k]),i.jsx("div",{className:"react-flow__renderer",ref:T,style:Tg,children:b})}const lse=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function cse(){const{userSelectionActive:e,userSelectionRect:t}=et(lse,kt);return e&&t?i.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const nv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},use=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function dse({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ld.Full,panOnDrag:s,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:x,onPaneMouseLeave:y,children:b}){const v=_t(),{userSelectionActive:w,elementsSelectable:S,dragging:C,connectionInProgress:k}=et(use,kt),_=S&&(e||w),R=E.useRef(null),T=E.useRef(),A=E.useRef(new Set),I=E.useRef(new Set),L=E.useRef(!1),$=K=>{if(L.current||k){L.current=!1;return}f==null||f(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},O=K=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){K.preventDefault();return}d==null||d(K)},B=p?K=>p(K):void 0,H=K=>{L.current&&(K.stopPropagation(),L.current=!1)},P=K=>{var Q,X;const{domNode:Y}=v.getState();if(T.current=Y==null?void 0:Y.getBoundingClientRect(),!T.current)return;const J=K.target===R.current;if(!J&&!!K.target.closest(".nokey")||!e||!(a&&J||t)||K.button!==0||!K.isPrimary)return;(X=(Q=K.target)==null?void 0:Q.setPointerCapture)==null||X.call(Q,K.pointerId),L.current=!1;const{x:te,y:U}=qs(K.nativeEvent,T.current);v.setState({userSelectionRect:{width:0,height:0,startX:te,startY:U,x:te,y:U}}),J||(K.stopPropagation(),K.preventDefault())},G=K=>{const{userSelectionRect:Y,transform:J,nodeLookup:D,edgeLookup:F,connectionLookup:te,triggerNodeChanges:U,triggerEdgeChanges:Q,defaultEdgeOptions:X,resetSelectedElements:se}=v.getState();if(!T.current||!Y)return;const{x:re,y:ce}=qs(K.nativeEvent,T.current),{startX:me,startY:ge}=Y;if(!L.current){const $e=t?0:r;if(Math.hypot(re-me,ce-ge)<=$e)return;se(),l==null||l(K)}L.current=!0;const ve={startX:me,startY:ge,x:re<me?re:me,y:ce<ge?ce:ge,width:Math.abs(re-me),height:Math.abs(ce-ge)},xe=A.current,je=I.current;A.current=new Set(_k(D,ve,J,n===Ld.Partial,!0).map($e=>$e.id)),I.current=new Set;const Se=(X==null?void 0:X.selectable)??!0;for(const $e of A.current){const Re=te.get($e);if(Re)for(const{edgeId:xt}of Re.values()){const wt=F.get(xt);wt&&(wt.selectable??Se)&&I.current.add(xt)}}if(!wI(xe,A.current)){const $e=Gl(D,A.current,!0);U($e)}if(!wI(je,I.current)){const $e=Gl(F,I.current);Q($e)}v.setState({userSelectionRect:ve,userSelectionActive:!0,nodesSelectionActive:!1})},q=K=>{var Y,J;K.button===0&&((J=(Y=K.target)==null?void 0:Y.releasePointerCapture)==null||J.call(Y,K.pointerId),!w&&K.target===R.current&&v.getState().userSelectionRect&&($==null||$(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(u==null||u(K),v.setState({nodesSelectionActive:A.current.size>0})))},V=s===!0||Array.isArray(s)&&s.includes(0);return i.jsxs("div",{className:Kt(["react-flow__pane",{draggable:V,dragging:C,selection:e}]),onClick:_?void 0:nv($,R),onContextMenu:nv(O,R),onWheel:nv(B,R),onPointerEnter:_?void 0:m,onPointerMove:_?G:x,onPointerUp:_?q:void 0,onPointerDownCapture:_?P:void 0,onClickCapture:_?H:void 0,onPointerLeave:y,ref:R,style:Tg,children:[b,i.jsx(cse,{})]})}function KN({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:u,onError:f}=t.getState(),d=u.get(e);if(!d){f==null||f("012",ur.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&l)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var p;return(p=s==null?void 0:s.current)==null?void 0:p.blur()})):r([e])}function T8({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:r,isSelectable:a,nodeClickDistance:l}){const u=_t(),[f,d]=E.useState(!1),p=E.useRef();return E.useEffect(()=>{p.current=sne({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{KN({id:m,store:u,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),E.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:a,nodeId:r,nodeClickDistance:l}),()=>{var m;(m=p.current)==null||m.destroy()}},[n,s,t,a,e,r,l]),f}const fse=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function I8(){const e=_t();return E.useCallback(n=>{const{nodeExtent:s,snapToGrid:r,snapGrid:a,nodesDraggable:l,onError:u,updateNodePositions:f,nodeLookup:d,nodeOrigin:p}=e.getState(),m=new Map,x=fse(l),y=r?a[0]:5,b=r?a[1]:5,v=n.direction.x*y*n.factor,w=n.direction.y*b*n.factor;for(const[,S]of d){if(!x(S))continue;let C={x:S.internals.positionAbsolute.x+v,y:S.internals.positionAbsolute.y+w};r&&(C=ff(C,a));const{position:k,positionAbsolute:_}=e8({nodeId:S.id,nextPosition:C,nodeLookup:d,nodeExtent:s,nodeOrigin:p,onError:u});S.position=k,S.internals.positionAbsolute=_,m.set(S.id,S)}f(m)},[])}const Lk=E.createContext(null),hse=Lk.Provider;Lk.Consumer;const M8=()=>E.useContext(Lk),pse=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),mse=(e,t,n)=>s=>{const{connectionClickStartHandle:r,connectionMode:a,connection:l}=s,{fromHandle:u,toHandle:f,isValid:d}=l,p=(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===n;return{connectingFrom:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n,connectingTo:p,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:a===Sc.Strict?(u==null?void 0:u.type)!==n:e!==(u==null?void 0:u.nodeId)||t!==(u==null?void 0:u.id),connectionInProcess:!!u,clickConnectionInProcess:!!r,valid:p&&d}};function gse({type:e="source",position:t=ye.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:r=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:f,className:d,onMouseDown:p,onTouchStart:m,...x},y){var G,q;const b=l||null,v=e==="target",w=_t(),S=M8(),{connectOnClick:C,noPanClassName:k,rfId:_}=et(pse,kt),{connectingFrom:R,connectingTo:T,clickConnecting:A,isPossibleEndHandle:I,connectionInProcess:L,clickConnectionInProcess:$,valid:O}=et(mse(S,b,e),kt);S||(q=(G=w.getState()).onError)==null||q.call(G,"010",ur.error010());const B=V=>{const{defaultEdgeOptions:K,onConnect:Y,hasDefaultEdges:J}=w.getState(),D={...K,...V};if(J){const{edges:F,setEdges:te}=w.getState();te(Bte(D,F))}Y==null||Y(D),u==null||u(D)},H=V=>{if(!S)return;const K=l8(V.nativeEvent);if(r&&(K&&V.button===0||!K)){const Y=w.getState();VN.onPointerDown(V.nativeEvent,{handleDomNode:V.currentTarget,autoPanOnConnect:Y.autoPanOnConnect,connectionMode:Y.connectionMode,connectionRadius:Y.connectionRadius,domNode:Y.domNode,nodeLookup:Y.nodeLookup,lib:Y.lib,isTarget:v,handleId:b,nodeId:S,flowId:Y.rfId,panBy:Y.panBy,cancelConnection:Y.cancelConnection,onConnectStart:Y.onConnectStart,onConnectEnd:(...J)=>{var D,F;return(F=(D=w.getState()).onConnectEnd)==null?void 0:F.call(D,...J)},updateConnection:Y.updateConnection,onConnect:B,isValidConnection:n||((...J)=>{var D,F;return((F=(D=w.getState()).isValidConnection)==null?void 0:F.call(D,...J))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:Y.autoPanSpeed,dragThreshold:Y.connectionDragThreshold})}K?p==null||p(V):m==null||m(V)},P=V=>{const{onClickConnectStart:K,onClickConnectEnd:Y,connectionClickStartHandle:J,connectionMode:D,isValidConnection:F,lib:te,rfId:U,nodeLookup:Q,connection:X}=w.getState();if(!S||!J&&!r)return;if(!J){K==null||K(V.nativeEvent,{nodeId:S,handleId:b,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:S,type:e,id:b}});return}const se=a8(V.target),re=n||F,{connection:ce,isValid:me}=VN.isValid(V.nativeEvent,{handle:{nodeId:S,id:b,type:e},connectionMode:D,fromNodeId:J.nodeId,fromHandleId:J.id||null,fromType:J.type,isValidConnection:re,flowId:U,doc:se,lib:te,nodeLookup:Q});me&&ce&&B(ce);const ge=structuredClone(X);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,Y==null||Y(V,ge),w.setState({connectionClickStartHandle:null})};return i.jsx("div",{"data-handleid":b,"data-nodeid":S,"data-handlepos":t,"data-id":`${_}-${S}-${b}-${e}`,className:Kt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,d,{source:!v,target:v,connectable:s,connectablestart:r,connectableend:a,clickconnecting:A,connectingfrom:R,connectingto:T,valid:O,connectionindicator:s&&(!L||I)&&(L||$?a:r)}]),onMouseDown:H,onTouchStart:H,onClick:C?P:void 0,ref:y,...x,children:f})}const Sn=E.memo(R8(gse));function xse({data:e,isConnectable:t,sourcePosition:n=ye.Bottom}){return i.jsxs(i.Fragment,{children:[e==null?void 0:e.label,i.jsx(Sn,{type:"source",position:n,isConnectable:t})]})}function yse({data:e,isConnectable:t,targetPosition:n=ye.Top,sourcePosition:s=ye.Bottom}){return i.jsxs(i.Fragment,{children:[i.jsx(Sn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,i.jsx(Sn,{type:"source",position:s,isConnectable:t})]})}function vse(){return null}function bse({data:e,isConnectable:t,targetPosition:n=ye.Top}){return i.jsxs(i.Fragment,{children:[i.jsx(Sn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Mm={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},KI={input:xse,default:yse,output:bse,group:vse};function wse(e){var t,n,s,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const jse=e=>{const{width:t,height:n,x:s,y:r}=df(e.nodeLookup,{filter:a=>!!a.selected});return{width:Ds(t)?t:null,height:Ds(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${r}px)`}};function Sse({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=_t(),{width:r,height:a,transformString:l,userSelectionActive:u}=et(jse,kt),f=I8(),d=E.useRef(null);E.useEffect(()=>{var y;n||(y=d.current)==null||y.focus({preventScroll:!0})},[n]);const p=!u&&r!==null&&a!==null;if(T8({nodeRef:d,disabled:!p}),!p)return null;const m=e?y=>{const b=s.getState().nodes.filter(v=>v.selected);e(y,b)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(Mm,y.key)&&(y.preventDefault(),f({direction:Mm[y.key],factor:y.shiftKey?4:1}))};return i.jsx("div",{className:Kt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:i.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:r,height:a}})})}const WI=typeof window<"u"?window:void 0,Nse=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function O8({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:f,selectionKeyCode:d,selectionOnDrag:p,selectionMode:m,onSelectionStart:x,onSelectionEnd:y,multiSelectionKeyCode:b,panActivationKeyCode:v,zoomActivationKeyCode:w,elementsSelectable:S,zoomOnScroll:C,zoomOnPinch:k,panOnScroll:_,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:I,defaultViewport:L,translateExtent:$,minZoom:O,maxZoom:B,preventScrolling:H,onSelectionContextMenu:P,noWheelClassName:G,noPanClassName:q,disableKeyboardA11y:V,onViewportChange:K,isControlledViewport:Y}){const{nodesSelectionActive:J,userSelectionActive:D}=et(Nse,kt),F=Dd(d,{target:WI}),te=Dd(v,{target:WI}),U=te||I,Q=te||_,X=p&&U!==!0,se=F||D||X;return rse({deleteKeyCode:f,multiSelectionKeyCode:b}),i.jsx(ose,{onPaneContextMenu:a,elementsSelectable:S,zoomOnScroll:C,zoomOnPinch:k,panOnScroll:Q,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:!F&&U,defaultViewport:L,translateExtent:$,minZoom:O,maxZoom:B,zoomActivationKeyCode:w,preventScrolling:H,noWheelClassName:G,noPanClassName:q,onViewportChange:K,isControlledViewport:Y,paneClickDistance:u,selectionOnDrag:X,children:i.jsxs(dse,{onSelectionStart:x,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:U,isSelecting:!!se,selectionMode:m,selectionKeyPressed:F,paneClickDistance:u,selectionOnDrag:X,children:[e,J&&i.jsx(Sse,{onSelectionContextMenu:P,noPanClassName:q,disableKeyboardA11y:V})]})})}O8.displayName="FlowRenderer";const kse=E.memo(O8),_se=e=>t=>e?_k(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Cse(e){return et(E.useCallback(_se(e),[e]),kt)}const Ese=e=>e.updateNodeInternals;function Rse(){const e=et(Ese),[t]=E.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(r=>{const a=r.target.getAttribute("data-id");s.set(a,{id:a,nodeElement:r.target,force:!0})}),e(s)}));return E.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Ase({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const r=_t(),a=E.useRef(null),l=E.useRef(null),u=E.useRef(e.sourcePosition),f=E.useRef(e.targetPosition),d=E.useRef(t),p=n&&!!e.internals.handleBounds;return E.useEffect(()=>{a.current&&!e.hidden&&(!p||l.current!==a.current)&&(l.current&&(s==null||s.unobserve(l.current)),s==null||s.observe(a.current),l.current=a.current)},[p,e.hidden]),E.useEffect(()=>()=>{l.current&&(s==null||s.unobserve(l.current),l.current=null)},[]),E.useEffect(()=>{if(a.current){const m=d.current!==t,x=u.current!==e.sourcePosition,y=f.current!==e.targetPosition;(m||x||y)&&(d.current=t,u.current=e.sourcePosition,f.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Tse({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:r,onContextMenu:a,onDoubleClick:l,nodesDraggable:u,elementsSelectable:f,nodesConnectable:d,nodesFocusable:p,resizeObserver:m,noDragClassName:x,noPanClassName:y,disableKeyboardA11y:b,rfId:v,nodeTypes:w,nodeClickDistance:S,onError:C}){const{node:k,internals:_,isParent:R}=et(re=>{const ce=re.nodeLookup.get(e),me=re.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:me}},kt);let T=k.type||"default",A=(w==null?void 0:w[T])||KI[T];A===void 0&&(C==null||C("003",ur.error003(T)),T="default",A=(w==null?void 0:w.default)||KI.default);const I=!!(k.draggable||u&&typeof k.draggable>"u"),L=!!(k.selectable||f&&typeof k.selectable>"u"),$=!!(k.connectable||d&&typeof k.connectable>"u"),O=!!(k.focusable||p&&typeof k.focusable>"u"),B=_t(),H=r8(k),P=Ase({node:k,nodeType:T,hasDimensions:H,resizeObserver:m}),G=T8({nodeRef:P,disabled:k.hidden||!I,noDragClassName:x,handleSelector:k.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:S}),q=I8();if(k.hidden)return null;const V=ei(k),K=wse(k),Y=L||I||t||n||s||r,J=n?re=>n(re,{..._.userNode}):void 0,D=s?re=>s(re,{..._.userNode}):void 0,F=r?re=>r(re,{..._.userNode}):void 0,te=a?re=>a(re,{..._.userNode}):void 0,U=l?re=>l(re,{..._.userNode}):void 0,Q=re=>{const{selectNodesOnDrag:ce,nodeDragThreshold:me}=B.getState();L&&(!ce||!I||me>0)&&KN({id:e,store:B,nodeRef:P}),t&&t(re,{..._.userNode})},X=re=>{if(!(o8(re.nativeEvent)||b)){if(Y6.includes(re.key)&&L){const ce=re.key==="Escape";KN({id:e,store:B,unselect:ce,nodeRef:P})}else if(I&&k.selected&&Object.prototype.hasOwnProperty.call(Mm,re.key)){re.preventDefault();const{ariaLabelConfig:ce}=B.getState();B.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),q({direction:Mm[re.key],factor:re.shiftKey?4:1})}}},se=()=>{var je;if(b||!((je=P.current)!=null&&je.matches(":focus-visible")))return;const{transform:re,width:ce,height:me,autoPanOnNodeFocus:ge,setCenter:ve}=B.getState();if(!ge)return;_k(new Map([[e,k]]),{x:0,y:0,width:ce,height:me},re,!0).length>0||ve(k.position.x+V.width/2,k.position.y+V.height/2,{zoom:re[2]})};return i.jsx("div",{className:Kt(["react-flow__node",`react-flow__node-${T}`,{[y]:I},k.className,{selected:k.selected,selectable:L,parent:R,draggable:I,dragging:G}]),ref:P,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:Y?"all":"none",visibility:H?"visible":"hidden",...k.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:J,onMouseMove:D,onMouseLeave:F,onContextMenu:te,onClick:Q,onDoubleClick:U,onKeyDown:O?X:void 0,tabIndex:O?0:void 0,onFocus:O?se:void 0,role:k.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${k8}-${v}`,"aria-label":k.ariaLabel,...k.domAttributes,children:i.jsx(hse,{value:e,children:i.jsx(A,{id:e,data:k.data,type:T,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:k.selected??!1,selectable:L,draggable:I,deletable:k.deletable??!0,isConnectable:$,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:G,dragHandle:k.dragHandle,zIndex:_.z,parentId:k.parentId,...V})})})}var Ise=E.memo(Tse);const Mse=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function L8(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,onError:a}=et(Mse,kt),l=Cse(e.onlyRenderVisibleElements),u=Rse();return i.jsx("div",{className:"react-flow__nodes",style:Tg,children:l.map(f=>i.jsx(Ise,{id:f,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},f))})}L8.displayName="NodeRenderer";const Ose=E.memo(L8);function Lse(e){return et(E.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const s=[];if(n.width&&n.height)for(const r of n.edges){const a=n.nodeLookup.get(r.source),l=n.nodeLookup.get(r.target);a&&l&&Dte({sourceNode:a,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&s.push(r.id)}return s},[e]),kt)}const Pse=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return i.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},$se=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return i.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},YI={[Nc.Arrow]:Pse,[Nc.ArrowClosed]:$se};function Dse(e){const t=_t();return E.useMemo(()=>{var r,a;return Object.prototype.hasOwnProperty.call(YI,e)?YI[e]:((a=(r=t.getState()).onError)==null||a.call(r,"009",ur.error009(e)),null)},[e])}const qse=({id:e,type:t,color:n,width:s=12.5,height:r=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const f=Dse(t);return f?i.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:i.jsx(f,{color:n,strokeWidth:l})}):null},P8=({defaultColor:e,rfId:t})=>{const n=et(a=>a.edges),s=et(a=>a.defaultEdgeOptions),r=E.useMemo(()=>Gte(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return r.length?i.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:i.jsx("defs",{children:r.map(a=>i.jsx(qse,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};P8.displayName="MarkerDefinitions";var zse=E.memo(P8);function $8({x:e,y:t,label:n,labelStyle:s,labelShowBg:r=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:f,className:d,...p}){const[m,x]=E.useState({x:1,y:0,width:0,height:0}),y=Kt(["react-flow__edge-textwrapper",d]),b=E.useRef(null);return E.useEffect(()=>{if(b.current){const v=b.current.getBBox();x({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?i.jsxs("g",{transform:`translate(${e-m.width/2} ${t-m.height/2})`,className:y,visibility:m.width?"visible":"hidden",...p,children:[r&&i.jsx("rect",{width:m.width+2*l[0],x:-l[0],y:-l[1],height:m.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),i.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:b,style:s,children:n}),f]}):null}$8.displayName="EdgeText";const Bse=E.memo($8);function mf({path:e,labelX:t,labelY:n,label:s,labelStyle:r,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,interactionWidth:d=20,...p}){return i.jsxs(i.Fragment,{children:[i.jsx("path",{...p,d:e,fill:"none",className:Kt(["react-flow__edge-path",p.className])}),d?i.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,s&&Ds(t)&&Ds(n)?i.jsx(Bse,{x:t,y:n,label:s,labelStyle:r,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f}):null]})}function QI({pos:e,x1:t,y1:n,x2:s,y2:r}){return e===ye.Left||e===ye.Right?[.5*(t+s),n]:[t,.5*(n+r)]}function D8({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top}){const[l,u]=QI({pos:n,x1:e,y1:t,x2:s,y2:r}),[f,d]=QI({pos:a,x1:s,y1:r,x2:e,y2:t}),[p,m,x,y]=c8({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:d});return[`M${e},${t} C${l},${u} ${f},${d} ${s},${r}`,p,m,x,y]}function q8(e){return E.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:b,markerEnd:v,markerStart:w,interactionWidth:S})=>{const[C,k,_]=D8({sourceX:n,sourceY:s,sourcePosition:l,targetX:r,targetY:a,targetPosition:u}),R=e.isInternal?void 0:t;return i.jsx(mf,{id:R,path:C,labelX:k,labelY:_,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:b,markerEnd:v,markerStart:w,interactionWidth:S})})}const Fse=q8({isInternal:!1}),z8=q8({isInternal:!0});Fse.displayName="SimpleBezierEdge";z8.displayName="SimpleBezierEdgeInternal";function B8(e){return E.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,sourcePosition:y=ye.Bottom,targetPosition:b=ye.Top,markerEnd:v,markerStart:w,pathOptions:S,interactionWidth:C})=>{const[k,_,R]=FN({sourceX:n,sourceY:s,sourcePosition:y,targetX:r,targetY:a,targetPosition:b,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:t;return i.jsx(mf,{id:T,path:k,labelX:_,labelY:R,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:w,interactionWidth:C})})}const F8=B8({isInternal:!1}),H8=B8({isInternal:!0});F8.displayName="SmoothStepEdge";H8.displayName="SmoothStepEdgeInternal";function U8(e){return E.memo(({id:t,...n})=>{var r;const s=e.isInternal?void 0:t;return i.jsx(F8,{...n,id:s,pathOptions:E.useMemo(()=>{var a;return{borderRadius:0,offset:(a=n.pathOptions)==null?void 0:a.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const Hse=U8({isInternal:!1}),V8=U8({isInternal:!0});Hse.displayName="StepEdge";V8.displayName="StepEdgeInternal";function G8(e){return E.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:y,markerStart:b,interactionWidth:v})=>{const[w,S,C]=d8({sourceX:n,sourceY:s,targetX:r,targetY:a}),k=e.isInternal?void 0:t;return i.jsx(mf,{id:k,path:w,labelX:S,labelY:C,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:y,markerStart:b,interactionWidth:v})})}const Use=G8({isInternal:!1}),K8=G8({isInternal:!0});Use.displayName="StraightEdge";K8.displayName="StraightEdgeInternal";function W8(e){return E.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,sourcePosition:l=ye.Bottom,targetPosition:u=ye.Top,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:b,markerEnd:v,markerStart:w,pathOptions:S,interactionWidth:C})=>{const[k,_,R]=Rk({sourceX:n,sourceY:s,sourcePosition:l,targetX:r,targetY:a,targetPosition:u,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:t;return i.jsx(mf,{id:T,path:k,labelX:_,labelY:R,label:f,labelStyle:d,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:b,markerEnd:v,markerStart:w,interactionWidth:C})})}const Vse=W8({isInternal:!1}),Y8=W8({isInternal:!0});Vse.displayName="BezierEdge";Y8.displayName="BezierEdgeInternal";const XI={default:Y8,straight:K8,step:V8,smoothstep:H8,simplebezier:z8},ZI={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Gse=(e,t,n)=>n===ye.Left?e-t:n===ye.Right?e+t:e,Kse=(e,t,n)=>n===ye.Top?e-t:n===ye.Bottom?e+t:e,JI="react-flow__edgeupdater";function e3({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:r,onMouseEnter:a,onMouseOut:l,type:u}){return i.jsx("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:l,className:Kt([JI,`${JI}-${u}`]),cx:Gse(t,s,e),cy:Kse(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function Wse({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:f,onReconnect:d,onReconnectStart:p,onReconnectEnd:m,setReconnecting:x,setUpdateHover:y}){const b=_t(),v=(_,R)=>{if(_.button!==0)return;const{autoPanOnConnect:T,domNode:A,connectionMode:I,connectionRadius:L,lib:$,onConnectStart:O,cancelConnection:B,nodeLookup:H,rfId:P,panBy:G,updateConnection:q}=b.getState(),V=R.type==="target",K=(D,F)=>{x(!1),m==null||m(D,n,R.type,F)},Y=D=>d==null?void 0:d(n,D),J=(D,F)=>{x(!0),p==null||p(_,n,R.type),O==null||O(D,F)};VN.onPointerDown(_.nativeEvent,{autoPanOnConnect:T,connectionMode:I,connectionRadius:L,domNode:A,handleId:R.id,nodeId:R.nodeId,nodeLookup:H,isTarget:V,edgeUpdaterType:R.type,lib:$,flowId:P,cancelConnection:B,panBy:G,isValidConnection:(...D)=>{var F,te;return((te=(F=b.getState()).isValidConnection)==null?void 0:te.call(F,...D))??!0},onConnect:Y,onConnectStart:J,onConnectEnd:(...D)=>{var F,te;return(te=(F=b.getState()).onConnectEnd)==null?void 0:te.call(F,...D)},onReconnectEnd:K,updateConnection:q,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},w=_=>v(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=_=>v(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>y(!0),k=()=>y(!1);return i.jsxs(i.Fragment,{children:[(e===!0||e==="source")&&i.jsx(e3,{position:u,centerX:s,centerY:r,radius:t,onMouseDown:w,onMouseEnter:C,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&i.jsx(e3,{position:f,centerX:a,centerY:l,radius:t,onMouseDown:S,onMouseEnter:C,onMouseOut:k,type:"target"})]})}function Yse({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:r,onDoubleClick:a,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:d,reconnectRadius:p,onReconnect:m,onReconnectStart:x,onReconnectEnd:y,rfId:b,edgeTypes:v,noPanClassName:w,onError:S,disableKeyboardA11y:C}){let k=et(ve=>ve.edgeLookup.get(e));const _=et(ve=>ve.defaultEdgeOptions);k=_?{..._,...k}:k;let R=k.type||"default",T=(v==null?void 0:v[R])||XI[R];T===void 0&&(S==null||S("011",ur.error011(R)),R="default",T=(v==null?void 0:v.default)||XI.default);const A=!!(k.focusable||t&&typeof k.focusable>"u"),I=typeof m<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),L=!!(k.selectable||s&&typeof k.selectable>"u"),$=E.useRef(null),[O,B]=E.useState(!1),[H,P]=E.useState(!1),G=_t(),{zIndex:q,sourceX:V,sourceY:K,targetX:Y,targetY:J,sourcePosition:D,targetPosition:F}=et(E.useCallback(ve=>{const xe=ve.nodeLookup.get(k.source),je=ve.nodeLookup.get(k.target);if(!xe||!je)return{zIndex:k.zIndex,...ZI};const Se=Vte({id:e,sourceNode:xe,targetNode:je,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ve.connectionMode,onError:S});return{zIndex:$te({selected:k.selected,zIndex:k.zIndex,sourceNode:xe,targetNode:je,elevateOnSelect:ve.elevateEdgesOnSelect,zIndexMode:ve.zIndexMode}),...Se||ZI}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),kt),te=E.useMemo(()=>k.markerStart?`url('#${HN(k.markerStart,b)}')`:void 0,[k.markerStart,b]),U=E.useMemo(()=>k.markerEnd?`url('#${HN(k.markerEnd,b)}')`:void 0,[k.markerEnd,b]);if(k.hidden||V===null||K===null||Y===null||J===null)return null;const Q=ve=>{var $e;const{addSelectedEdges:xe,unselectNodesAndEdges:je,multiSelectionActive:Se}=G.getState();L&&(G.setState({nodesSelectionActive:!1}),k.selected&&Se?(je({nodes:[],edges:[k]}),($e=$.current)==null||$e.blur()):xe([e])),r&&r(ve,k)},X=a?ve=>{a(ve,{...k})}:void 0,se=l?ve=>{l(ve,{...k})}:void 0,re=u?ve=>{u(ve,{...k})}:void 0,ce=f?ve=>{f(ve,{...k})}:void 0,me=d?ve=>{d(ve,{...k})}:void 0,ge=ve=>{var xe;if(!C&&Y6.includes(ve.key)&&L){const{unselectNodesAndEdges:je,addSelectedEdges:Se}=G.getState();ve.key==="Escape"?((xe=$.current)==null||xe.blur(),je({edges:[k]})):Se([e])}};return i.jsx("svg",{style:{zIndex:q},children:i.jsxs("g",{className:Kt(["react-flow__edge",`react-flow__edge-${R}`,k.className,w,{selected:k.selected,animated:k.animated,inactive:!L&&!r,updating:O,selectable:L}]),onClick:Q,onDoubleClick:X,onContextMenu:se,onMouseEnter:re,onMouseMove:ce,onMouseLeave:me,onKeyDown:A?ge:void 0,tabIndex:A?0:void 0,role:k.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":A?`${_8}-${b}`:void 0,ref:$,...k.domAttributes,children:[!H&&i.jsx(T,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:L,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:V,sourceY:K,targetX:Y,targetY:J,sourcePosition:D,targetPosition:F,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:te,markerEnd:U,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),I&&i.jsx(Wse,{edge:k,isReconnectable:I,reconnectRadius:p,onReconnect:m,onReconnectStart:x,onReconnectEnd:y,sourceX:V,sourceY:K,targetX:Y,targetY:J,sourcePosition:D,targetPosition:F,setUpdateHover:B,setReconnecting:P})]})})}var Qse=E.memo(Yse);const Xse=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Q8({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:r,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:x,onReconnectStart:y,onReconnectEnd:b,disableKeyboardA11y:v}){const{edgesFocusable:w,edgesReconnectable:S,elementsSelectable:C,onError:k}=et(Xse,kt),_=Lse(t);return i.jsxs("div",{className:"react-flow__edges",children:[i.jsx(zse,{defaultColor:e,rfId:n}),_.map(R=>i.jsx(Qse,{id:R,edgesFocusable:w,edgesReconnectable:S,elementsSelectable:C,noPanClassName:r,onReconnect:a,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:d,onClick:p,reconnectRadius:m,onDoubleClick:x,onReconnectStart:y,onReconnectEnd:b,rfId:n,onError:k,edgeTypes:s,disableKeyboardA11y:v},R))]})}Q8.displayName="EdgeRenderer";const Zse=E.memo(Q8),Jse=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ere({children:e}){const t=et(Jse);return i.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function tre(e){const t=Ag(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const nre=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function sre(e){const t=et(nre),n=_t();return E.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function rre(e){return e.connection.inProgress?{...e.connection,to:hf(e.connection.to,e.transform)}:{...e.connection}}function ire(e){return rre}function are(e){const t=ire();return et(t,kt)}const ore=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lre({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:r,width:a,height:l,isValid:u,inProgress:f}=et(ore,kt);return!(a&&r&&f)?null:i.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:i.jsx("g",{className:Kt(["react-flow__connection",Z6(u)]),children:i.jsx(X8,{style:t,type:n,CustomComponent:s,isValid:u})})})}const X8=({style:e,type:t=Ui.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:r,from:a,fromNode:l,fromHandle:u,fromPosition:f,to:d,toNode:p,toHandle:m,toPosition:x,pointer:y}=are();if(!r)return;if(n)return i.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:u,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:f,toPosition:x,connectionStatus:Z6(s),toNode:p,toHandle:m,pointer:y});let b="";const v={sourceX:a.x,sourceY:a.y,sourcePosition:f,targetX:d.x,targetY:d.y,targetPosition:x};switch(t){case Ui.Bezier:[b]=Rk(v);break;case Ui.SimpleBezier:[b]=D8(v);break;case Ui.Step:[b]=FN({...v,borderRadius:0});break;case Ui.SmoothStep:[b]=FN(v);break;default:[b]=d8(v)}return i.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};X8.displayName="ConnectionLine";const cre={};function t3(e=cre){E.useRef(e),_t(),E.useEffect(()=>{},[e])}function ure(){_t(),E.useRef(!1),E.useEffect(()=>{},[])}function Z8({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:r,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:x,onSelectionEnd:y,connectionLineType:b,connectionLineStyle:v,connectionLineComponent:w,connectionLineContainerStyle:S,selectionKeyCode:C,selectionOnDrag:k,selectionMode:_,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:L,elementsSelectable:$,defaultViewport:O,translateExtent:B,minZoom:H,maxZoom:P,preventScrolling:G,defaultMarkerColor:q,zoomOnScroll:V,zoomOnPinch:K,panOnScroll:Y,panOnScrollSpeed:J,panOnScrollMode:D,zoomOnDoubleClick:F,panOnDrag:te,onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:X,onPaneMouseLeave:se,onPaneScroll:re,onPaneContextMenu:ce,paneClickDistance:me,nodeClickDistance:ge,onEdgeContextMenu:ve,onEdgeMouseEnter:xe,onEdgeMouseMove:je,onEdgeMouseLeave:Se,reconnectRadius:$e,onReconnect:Re,onReconnectStart:xt,onReconnectEnd:wt,noDragClassName:Ot,noWheelClassName:fn,noPanClassName:Yt,disableKeyboardA11y:jt,nodeExtent:yt,rfId:Ke,viewport:pt,onViewportChange:Qt}){return t3(e),t3(t),ure(),tre(n),sre(pt),i.jsx(kse,{onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:X,onPaneMouseLeave:se,onPaneContextMenu:ce,onPaneScroll:re,paneClickDistance:me,deleteKeyCode:I,selectionKeyCode:C,selectionOnDrag:k,selectionMode:_,onSelectionStart:x,onSelectionEnd:y,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,elementsSelectable:$,zoomOnScroll:V,zoomOnPinch:K,zoomOnDoubleClick:F,panOnScroll:Y,panOnScrollSpeed:J,panOnScrollMode:D,panOnDrag:te,defaultViewport:O,translateExtent:B,minZoom:H,maxZoom:P,onSelectionContextMenu:m,preventScrolling:G,noDragClassName:Ot,noWheelClassName:fn,noPanClassName:Yt,disableKeyboardA11y:jt,onViewportChange:Qt,isControlledViewport:!!pt,children:i.jsxs(ere,{children:[i.jsx(Zse,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:l,onReconnect:Re,onReconnectStart:xt,onReconnectEnd:wt,onlyRenderVisibleElements:L,onEdgeContextMenu:ve,onEdgeMouseEnter:xe,onEdgeMouseMove:je,onEdgeMouseLeave:Se,reconnectRadius:$e,defaultMarkerColor:q,noPanClassName:Yt,disableKeyboardA11y:jt,rfId:Ke}),i.jsx(lre,{style:v,type:b,component:w,containerStyle:S}),i.jsx("div",{className:"react-flow__edgelabel-renderer"}),i.jsx(Ose,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:ge,onlyRenderVisibleElements:L,noPanClassName:Yt,noDragClassName:Ot,disableKeyboardA11y:jt,nodeExtent:yt,rfId:Ke}),i.jsx("div",{className:"react-flow__viewport-portal"})]})})}Z8.displayName="GraphView";const dre=E.memo(Z8),n3=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:f=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:m,zIndexMode:x="basic"}={})=>{const y=new Map,b=new Map,v=new Map,w=new Map,S=s??t??[],C=n??e??[],k=p??[0,0],_=m??Od;p8(v,w,S);const{nodesInitialized:R}=UN(C,y,b,{nodeOrigin:k,nodeExtent:_,zIndexMode:x});let T=[0,0,1];if(l&&r&&a){const A=df(y,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:I,y:L,zoom:$}=Ck(A,r,a,f,d,(u==null?void 0:u.padding)??.1);T=[I,L,$]}return{rfId:"1",width:r??0,height:a??0,transform:T,nodes:C,nodesInitialized:R,nodeLookup:y,parentLookup:b,edges:S,edgeLookup:w,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:f,maxZoom:d,translateExtent:Od,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...X6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tte,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Q6,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},fre=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:d,nodeOrigin:p,nodeExtent:m,zIndexMode:x})=>Rne((y,b)=>{async function v(){const{nodeLookup:w,panZoom:S,fitViewOptions:C,fitViewResolver:k,width:_,height:R,minZoom:T,maxZoom:A}=b();S&&(await Rte({nodes:w,width:_,height:R,panZoom:S,minZoom:T,maxZoom:A},C),k==null||k.resolve(!0),y({fitViewResolver:null}))}return{...n3({nodes:e,edges:t,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:d,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:s,zIndexMode:x}),setNodes:w=>{const{nodeLookup:S,parentLookup:C,nodeOrigin:k,elevateNodesOnSelect:_,fitViewQueued:R,zIndexMode:T,nodesSelectionActive:A}=b(),{nodesInitialized:I,hasSelectedNodes:L}=UN(w,S,C,{nodeOrigin:k,nodeExtent:m,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:T}),$=A&&L;R&&I?(v(),y({nodes:w,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:$})):y({nodes:w,nodesInitialized:I,nodesSelectionActive:$})},setEdges:w=>{const{connectionLookup:S,edgeLookup:C}=b();p8(S,C,w),y({edges:w})},setDefaultNodesAndEdges:(w,S)=>{if(w){const{setNodes:C}=b();C(w),y({hasDefaultNodes:!0})}if(S){const{setEdges:C}=b();C(S),y({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:S,nodeLookup:C,parentLookup:k,domNode:_,nodeOrigin:R,nodeExtent:T,debug:A,fitViewQueued:I,zIndexMode:L}=b(),{changes:$,updatedInternals:O}=Jte(w,C,k,_,R,T,L);O&&(Yte(C,k,{nodeOrigin:R,nodeExtent:T,zIndexMode:L}),I?(v(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),($==null?void 0:$.length)>0&&(A&&console.log("React Flow: trigger node changes",$),S==null||S($)))},updateNodePositions:(w,S=!1)=>{const C=[];let k=[];const{nodeLookup:_,triggerNodeChanges:R,connection:T,updateConnection:A,onNodesChangeMiddlewareMap:I}=b();for(const[L,$]of w){const O=_.get(L),B=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&($!=null&&$.position)),H={id:L,type:"position",position:B?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:S};if(O&&T.inProgress&&T.fromNode.id===O.id){const P=ko(O,T.fromHandle,ye.Left,!0);A({...T,from:P})}B&&O.parentId&&C.push({id:L,parentId:O.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),k.push(H)}if(C.length>0){const{parentLookup:L,nodeOrigin:$}=b(),O=Ok(C,_,L,$);k.push(...O)}for(const L of I.values())k=L(k);R(k)},triggerNodeChanges:w=>{const{onNodesChange:S,setNodes:C,nodes:k,hasDefaultNodes:_,debug:R}=b();if(w!=null&&w.length){if(_){const T=Qne(w,k);C(T)}R&&console.log("React Flow: trigger node changes",w),S==null||S(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:S,setEdges:C,edges:k,hasDefaultEdges:_,debug:R}=b();if(w!=null&&w.length){if(_){const T=Xne(w,k);C(T)}R&&console.log("React Flow: trigger edge changes",w),S==null||S(w)}},addSelectedNodes:w=>{const{multiSelectionActive:S,edgeLookup:C,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:R}=b();if(S){const T=w.map(A=>Ka(A,!0));_(T);return}_(Gl(k,new Set([...w]),!0)),R(Gl(C))},addSelectedEdges:w=>{const{multiSelectionActive:S,edgeLookup:C,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:R}=b();if(S){const T=w.map(A=>Ka(A,!0));R(T);return}R(Gl(C,new Set([...w]))),_(Gl(k,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:S}={})=>{const{edges:C,nodes:k,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:T}=b(),A=w||k,I=S||C,L=[];for(const O of A){if(!O.selected)continue;const B=_.get(O.id);B&&(B.selected=!1),L.push(Ka(O.id,!1))}const $=[];for(const O of I)O.selected&&$.push(Ka(O.id,!1));R(L),T($)},setMinZoom:w=>{const{panZoom:S,maxZoom:C}=b();S==null||S.setScaleExtent([w,C]),y({minZoom:w})},setMaxZoom:w=>{const{panZoom:S,minZoom:C}=b();S==null||S.setScaleExtent([C,w]),y({maxZoom:w})},setTranslateExtent:w=>{var S;(S=b().panZoom)==null||S.setTranslateExtent(w),y({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:S,triggerNodeChanges:C,triggerEdgeChanges:k,elementsSelectable:_}=b();if(!_)return;const R=S.reduce((A,I)=>I.selected?[...A,Ka(I.id,!1)]:A,[]),T=w.reduce((A,I)=>I.selected?[...A,Ka(I.id,!1)]:A,[]);C(R),k(T)},setNodeExtent:w=>{const{nodes:S,nodeLookup:C,parentLookup:k,nodeOrigin:_,elevateNodesOnSelect:R,nodeExtent:T,zIndexMode:A}=b();w[0][0]===T[0][0]&&w[0][1]===T[0][1]&&w[1][0]===T[1][0]&&w[1][1]===T[1][1]||(UN(S,C,k,{nodeOrigin:_,nodeExtent:w,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:A}),y({nodeExtent:w}))},panBy:w=>{const{transform:S,width:C,height:k,panZoom:_,translateExtent:R}=b();return ene({delta:w,panZoom:_,transform:S,translateExtent:R,width:C,height:k})},setCenter:async(w,S,C)=>{const{width:k,height:_,maxZoom:R,panZoom:T}=b();if(!T)return Promise.resolve(!1);const A=typeof(C==null?void 0:C.zoom)<"u"?C.zoom:R;return await T.setViewport({x:k/2-w*A,y:_/2-S*A,zoom:A},{duration:C==null?void 0:C.duration,ease:C==null?void 0:C.ease,interpolate:C==null?void 0:C.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...X6}})},updateConnection:w=>{y({connection:w})},reset:()=>y({...n3()})}},Object.is);function hre({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:r,initialHeight:a,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:f,fitView:d,nodeOrigin:p,nodeExtent:m,zIndexMode:x,children:y}){const[b]=E.useState(()=>fre({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:d,minZoom:l,maxZoom:u,fitViewOptions:f,nodeOrigin:p,nodeExtent:m,zIndexMode:x}));return i.jsx(Ane,{value:b,children:i.jsx(ese,{children:y})})}function pre({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:p,nodeOrigin:m,nodeExtent:x,zIndexMode:y}){return E.useContext(Rg)?i.jsx(i.Fragment,{children:e}):i.jsx(hre,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:r,initialWidth:a,initialHeight:l,fitView:u,initialFitViewOptions:f,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:m,nodeExtent:x,zIndexMode:y,children:e})}const mre={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function gre({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:r,nodeTypes:a,edgeTypes:l,onNodeClick:u,onEdgeClick:f,onInit:d,onMove:p,onMoveStart:m,onMoveEnd:x,onConnect:y,onConnectStart:b,onConnectEnd:v,onClickConnectStart:w,onClickConnectEnd:S,onNodeMouseEnter:C,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:T,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:L,onNodesDelete:$,onEdgesDelete:O,onDelete:B,onSelectionChange:H,onSelectionDragStart:P,onSelectionDrag:G,onSelectionDragStop:q,onSelectionContextMenu:V,onSelectionStart:K,onSelectionEnd:Y,onBeforeDelete:J,connectionMode:D,connectionLineType:F=Ui.Bezier,connectionLineStyle:te,connectionLineComponent:U,connectionLineContainerStyle:Q,deleteKeyCode:X="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:re=!1,selectionMode:ce=Ld.Full,panActivationKeyCode:me="Space",multiSelectionKeyCode:ge=$d()?"Meta":"Control",zoomActivationKeyCode:ve=$d()?"Meta":"Control",snapToGrid:xe,snapGrid:je,onlyRenderVisibleElements:Se=!1,selectNodesOnDrag:$e,nodesDraggable:Re,autoPanOnNodeFocus:xt,nodesConnectable:wt,nodesFocusable:Ot,nodeOrigin:fn=C8,edgesFocusable:Yt,edgesReconnectable:jt,elementsSelectable:yt=!0,defaultViewport:Ke=Hne,minZoom:pt=.5,maxZoom:Qt=2,translateExtent:hn=Od,preventScrolling:Do=!0,nodeExtent:pr,defaultMarkerColor:zc="#b1b1b7",zoomOnScroll:qo=!0,zoomOnPinch:pn=!0,panOnScroll:Et=!1,panOnScrollSpeed:Gs=.5,panOnScrollMode:_n=xo.Free,zoomOnDoubleClick:ox=!0,panOnDrag:lx=!0,onPaneClick:cx,onPaneMouseEnter:zo,onPaneMouseMove:Bo,onPaneMouseLeave:Fo,onPaneScroll:mr,onPaneContextMenu:Ho,paneClickDistance:ja=1,nodeClickDistance:ux=0,children:Cf,onReconnect:Bc,onReconnectStart:Sa,onReconnectEnd:dx,onEdgeContextMenu:Ef,onEdgeDoubleClick:Rf,onEdgeMouseEnter:Af,onEdgeMouseMove:Fc,onEdgeMouseLeave:Hc,reconnectRadius:Tf=10,onNodesChange:If,onEdgesChange:Ks,noDragClassName:Xt="nodrag",noWheelClassName:mn="nowheel",noPanClassName:gr="nopan",fitView:Uo,fitViewOptions:Mf,connectOnClick:fx,attributionPosition:Of,proOptions:Na,defaultEdgeOptions:Uc,elevateNodesOnSelect:ri=!0,elevateEdgesOnSelect:ii=!1,disableKeyboardA11y:ai=!1,autoPanOnConnect:oi,autoPanOnNodeDrag:Bt,autoPanSpeed:Lf,connectionRadius:Pf,isValidConnection:xr,onError:li,style:hx,id:Vc,nodeDragThreshold:$f,connectionDragThreshold:px,viewport:Vo,onViewportChange:Go,width:Cs,height:Tn,colorMode:Df="light",debug:mx,onScroll:ci,ariaLabelConfig:qf,zIndexMode:ka="basic",...gx},In){const _a=Vc||"1",zf=Kne(Df),Gc=E.useCallback(yr=>{yr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ci==null||ci(yr)},[ci]);return i.jsx("div",{"data-testid":"rf__wrapper",...gx,onScroll:Gc,style:{...hx,...mre},ref:In,className:Kt(["react-flow",r,zf]),id:Vc,role:"application",children:i.jsxs(pre,{nodes:e,edges:t,width:Cs,height:Tn,fitView:Uo,fitViewOptions:Mf,minZoom:pt,maxZoom:Qt,nodeOrigin:fn,nodeExtent:pr,zIndexMode:ka,children:[i.jsx(Gne,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:y,onConnectStart:b,onConnectEnd:v,onClickConnectStart:w,onClickConnectEnd:S,nodesDraggable:Re,autoPanOnNodeFocus:xt,nodesConnectable:wt,nodesFocusable:Ot,edgesFocusable:Yt,edgesReconnectable:jt,elementsSelectable:yt,elevateNodesOnSelect:ri,elevateEdgesOnSelect:ii,minZoom:pt,maxZoom:Qt,nodeExtent:pr,onNodesChange:If,onEdgesChange:Ks,snapToGrid:xe,snapGrid:je,connectionMode:D,translateExtent:hn,connectOnClick:fx,defaultEdgeOptions:Uc,fitView:Uo,fitViewOptions:Mf,onNodesDelete:$,onEdgesDelete:O,onDelete:B,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:L,onSelectionDrag:G,onSelectionDragStart:P,onSelectionDragStop:q,onMove:p,onMoveStart:m,onMoveEnd:x,noPanClassName:gr,nodeOrigin:fn,rfId:_a,autoPanOnConnect:oi,autoPanOnNodeDrag:Bt,autoPanSpeed:Lf,onError:li,connectionRadius:Pf,isValidConnection:xr,selectNodesOnDrag:$e,nodeDragThreshold:$f,connectionDragThreshold:px,onBeforeDelete:J,debug:mx,ariaLabelConfig:qf,zIndexMode:ka}),i.jsx(dre,{onInit:d,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:C,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:T,nodeTypes:a,edgeTypes:l,connectionLineType:F,connectionLineStyle:te,connectionLineComponent:U,connectionLineContainerStyle:Q,selectionKeyCode:se,selectionOnDrag:re,selectionMode:ce,deleteKeyCode:X,multiSelectionKeyCode:ge,panActivationKeyCode:me,zoomActivationKeyCode:ve,onlyRenderVisibleElements:Se,defaultViewport:Ke,translateExtent:hn,minZoom:pt,maxZoom:Qt,preventScrolling:Do,zoomOnScroll:qo,zoomOnPinch:pn,zoomOnDoubleClick:ox,panOnScroll:Et,panOnScrollSpeed:Gs,panOnScrollMode:_n,panOnDrag:lx,onPaneClick:cx,onPaneMouseEnter:zo,onPaneMouseMove:Bo,onPaneMouseLeave:Fo,onPaneScroll:mr,onPaneContextMenu:Ho,paneClickDistance:ja,nodeClickDistance:ux,onSelectionContextMenu:V,onSelectionStart:K,onSelectionEnd:Y,onReconnect:Bc,onReconnectStart:Sa,onReconnectEnd:dx,onEdgeContextMenu:Ef,onEdgeDoubleClick:Rf,onEdgeMouseEnter:Af,onEdgeMouseMove:Fc,onEdgeMouseLeave:Hc,reconnectRadius:Tf,defaultMarkerColor:zc,noDragClassName:Xt,noWheelClassName:mn,noPanClassName:gr,rfId:_a,disableKeyboardA11y:ai,nodeExtent:pr,viewport:Vo,onViewportChange:Go}),i.jsx(Fne,{onSelectionChange:H}),Cf,i.jsx($ne,{proOptions:Na,position:Of}),i.jsx(Pne,{rfId:_a,disableKeyboardA11y:ai})]})})}var gf=R8(gre);function xre({dimensions:e,lineWidth:t,variant:n,className:s}){return i.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Kt(["react-flow__background-pattern",n,s])})}function yre({radius:e,className:t}){return i.jsx("circle",{cx:e,cy:e,r:e,className:Kt(["react-flow__background-pattern","dots",t])})}var ca;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ca||(ca={}));const vre={[ca.Dots]:1,[ca.Lines]:1,[ca.Cross]:6},bre=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function J8({id:e,variant:t=ca.Dots,gap:n=20,size:s,lineWidth:r=1,offset:a=0,color:l,bgColor:u,style:f,className:d,patternClassName:p}){const m=E.useRef(null),{transform:x,patternId:y}=et(bre,kt),b=s||vre[t],v=t===ca.Dots,w=t===ca.Cross,S=Array.isArray(n)?n:[n,n],C=[S[0]*x[2]||1,S[1]*x[2]||1],k=b*x[2],_=Array.isArray(a)?a:[a,a],R=w?[k,k]:C,T=[_[0]*x[2]||1+R[0]/2,_[1]*x[2]||1+R[1]/2],A=`${y}${e||""}`;return i.jsxs("svg",{className:Kt(["react-flow__background",d]),style:{...f,...Tg,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:m,"data-testid":"rf__background",children:[i.jsx("pattern",{id:A,x:x[0]%C[0],y:x[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:v?i.jsx(yre,{radius:k/2,className:p}):i.jsx(xre,{dimensions:R,lineWidth:r,variant:t,className:p})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}J8.displayName="Background";const Pk=E.memo(J8);function wre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function jre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:i.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Sre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:i.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Nre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function kre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function _p({children:e,className:t,...n}){return i.jsx("button",{type:"button",className:Kt(["react-flow__controls-button",t]),...n,children:e})}const _re=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function eq({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:r,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:f,className:d,children:p,position:m="bottom-left",orientation:x="vertical","aria-label":y}){const b=_t(),{isInteractive:v,minZoomReached:w,maxZoomReached:S,ariaLabelConfig:C}=et(_re,kt),{zoomIn:k,zoomOut:_,fitView:R}=Ag(),T=()=>{k(),a==null||a()},A=()=>{_(),l==null||l()},I=()=>{R(r),u==null||u()},L=()=>{b.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),f==null||f(!v)},$=x==="horizontal"?"horizontal":"vertical";return i.jsxs(pf,{className:Kt(["react-flow__controls",$,d]),position:m,style:e,"data-testid":"rf__controls","aria-label":y??C["controls.ariaLabel"],children:[t&&i.jsxs(i.Fragment,{children:[i.jsx(_p,{onClick:T,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:S,children:i.jsx(wre,{})}),i.jsx(_p,{onClick:A,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:w,children:i.jsx(jre,{})})]}),n&&i.jsx(_p,{className:"react-flow__controls-fitview",onClick:I,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:i.jsx(Sre,{})}),s&&i.jsx(_p,{className:"react-flow__controls-interactive",onClick:L,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:v?i.jsx(kre,{}):i.jsx(Nre,{})}),p]})}eq.displayName="Controls";const xf=E.memo(eq);function Cre({id:e,x:t,y:n,width:s,height:r,style:a,color:l,strokeColor:u,strokeWidth:f,className:d,borderRadius:p,shapeRendering:m,selected:x,onClick:y}){const{background:b,backgroundColor:v}=a||{},w=l||b||v;return i.jsx("rect",{className:Kt(["react-flow__minimap-node",{selected:x},d]),x:t,y:n,rx:p,ry:p,width:s,height:r,style:{fill:w,stroke:u,strokeWidth:f},shapeRendering:m,onClick:y?S=>y(S,e):void 0})}const Ere=E.memo(Cre),Rre=e=>e.nodes.map(t=>t.id),sv=e=>e instanceof Function?e:()=>e;function Are({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:r,nodeComponent:a=Ere,onClick:l}){const u=et(Rre,kt),f=sv(t),d=sv(e),p=sv(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:u.map(x=>i.jsx(Ire,{id:x,nodeColorFunc:f,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:s,nodeStrokeWidth:r,NodeComponent:a,onClick:l,shapeRendering:m},x))})}function Tre({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:r,nodeStrokeWidth:a,shapeRendering:l,NodeComponent:u,onClick:f}){const{node:d,x:p,y:m,width:x,height:y}=et(b=>{const v=b.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const w=v.internals.userNode,{x:S,y:C}=v.internals.positionAbsolute,{width:k,height:_}=ei(w);return{node:w,x:S,y:C,width:k,height:_}},kt);return!d||d.hidden||!r8(d)?null:i.jsx(u,{x:p,y:m,width:x,height:y,style:d.style,selected:!!d.selected,className:s(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:a,shapeRendering:l,onClick:f,id:d.id})}const Ire=E.memo(Tre);var Mre=E.memo(Are);const Ore=200,Lre=150,Pre=e=>!e.hidden,$re=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?s8(df(e.nodeLookup,{filter:Pre}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Dre="react-flow__minimap-desc";function tq({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:r="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:f,maskColor:d,maskStrokeColor:p,maskStrokeWidth:m,position:x="bottom-right",onClick:y,onNodeClick:b,pannable:v=!1,zoomable:w=!1,ariaLabel:S,inversePan:C,zoomStep:k=1,offsetScale:_=5}){const R=_t(),T=E.useRef(null),{boundingRect:A,viewBB:I,rfId:L,panZoom:$,translateExtent:O,flowWidth:B,flowHeight:H,ariaLabelConfig:P}=et($re,kt),G=(e==null?void 0:e.width)??Ore,q=(e==null?void 0:e.height)??Lre,V=A.width/G,K=A.height/q,Y=Math.max(V,K),J=Y*G,D=Y*q,F=_*Y,te=A.x-(J-A.width)/2-F,U=A.y-(D-A.height)/2-F,Q=J+F*2,X=D+F*2,se=`${Dre}-${L}`,re=E.useRef(0),ce=E.useRef();re.current=Y,E.useEffect(()=>{if(T.current&&$)return ce.current=cne({domNode:T.current,panZoom:$,getTransform:()=>R.getState().transform,getViewScale:()=>re.current}),()=>{var xe;(xe=ce.current)==null||xe.destroy()}},[$]),E.useEffect(()=>{var xe;(xe=ce.current)==null||xe.update({translateExtent:O,width:B,height:H,inversePan:C,pannable:v,zoomStep:k,zoomable:w})},[v,w,C,k,O,B,H]);const me=y?xe=>{var $e;const[je,Se]=(($e=ce.current)==null?void 0:$e.pointer(xe))||[0,0];y(xe,{x:je,y:Se})}:void 0,ge=b?E.useCallback((xe,je)=>{const Se=R.getState().nodeLookup.get(je).internals.userNode;b(xe,Se)},[]):void 0,ve=S??P["minimap.ariaLabel"];return i.jsx(pf,{position:x,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*Y:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Kt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:G,height:q,viewBox:`${te} ${U} ${Q} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:T,onClick:me,children:[ve&&i.jsx("title",{id:se,children:ve}),i.jsx(Mre,{onClick:ge,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:r,nodeStrokeWidth:l,nodeComponent:u}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${te-F},${U-F}h${Q+F*2}v${X+F*2}h${-Q-F*2}z
|
|
467
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}tq.displayName="MiniMap";E.memo(tq);const qre=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,zre={[Ec.Line]:"right",[Ec.Handle]:"bottom-right"};function Bre({nodeId:e,position:t,variant:n=Ec.Handle,className:s,style:r=void 0,children:a,color:l,minWidth:u=10,minHeight:f=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:x,autoScale:y=!0,shouldResize:b,onResizeStart:v,onResize:w,onResizeEnd:S}){const C=M8(),k=typeof e=="string"?e:C,_=_t(),R=E.useRef(null),T=n===Ec.Handle,A=et(E.useCallback(qre(T&&y),[T,y]),kt),I=E.useRef(null),L=t??zre[n];E.useEffect(()=>{if(!(!R.current||!k))return I.current||(I.current=Sne({domNode:R.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:O,transform:B,snapGrid:H,snapToGrid:P,nodeOrigin:G,domNode:q}=_.getState();return{nodeLookup:O,transform:B,snapGrid:H,snapToGrid:P,nodeOrigin:G,paneDomNode:q}},onChange:(O,B)=>{const{triggerNodeChanges:H,nodeLookup:P,parentLookup:G,nodeOrigin:q}=_.getState(),V=[],K={x:O.x,y:O.y},Y=P.get(k);if(Y&&Y.expandParent&&Y.parentId){const J=Y.origin??q,D=O.width??Y.measured.width??0,F=O.height??Y.measured.height??0,te={id:Y.id,parentId:Y.parentId,rect:{width:D,height:F,...i8({x:O.x??Y.position.x,y:O.y??Y.position.y},{width:D,height:F},Y.parentId,P,J)}},U=Ok([te],P,G,q);V.push(...U),K.x=O.x?Math.max(J[0]*D,O.x):void 0,K.y=O.y?Math.max(J[1]*F,O.y):void 0}if(K.x!==void 0&&K.y!==void 0){const J={id:k,type:"position",position:{...K}};V.push(J)}if(O.width!==void 0&&O.height!==void 0){const D={id:k,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};V.push(D)}for(const J of B){const D={...J,type:"position"};V.push(D)}H(V)},onEnd:({width:O,height:B})=>{const H={id:k,type:"dimensions",resizing:!1,dimensions:{width:O,height:B}};_.getState().triggerNodeChanges([H])}})),I.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:f,maxWidth:d,maxHeight:p},keepAspectRatio:m,resizeDirection:x,onResizeStart:v,onResize:w,onResizeEnd:S,shouldResize:b}),()=>{var O;(O=I.current)==null||O.destroy()}},[L,u,f,d,p,m,v,w,S,b]);const $=L.split("-");return i.jsx("div",{className:Kt(["react-flow__resize-control","nodrag",...$,n,s]),ref:R,style:{...r,scale:A,...l&&{[T?"backgroundColor":"borderColor"]:l}},children:a})}E.memo(Bre);async function Fre(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Hre(e){return De({queryKey:["rig",e,"graph"],queryFn:()=>Fre(e),enabled:!!e,refetchInterval:3e4})}const Ure=100;function Vre(e){const t=Mt(),[n,s]=E.useState(!1),[r,a]=E.useState(!1),l=E.useRef(!1),u=E.useRef(null),f=E.useCallback(()=>{e&&(u.current||(u.current=setTimeout(()=>{u.current=null,t.invalidateQueries({queryKey:["rig",e,"graph"]})},Ure)))},[e,t]);return E.useEffect(()=>{if(!e){s(!1),a(!1);return}l.current=!1,s(!1),a(!1);const d=SD(m=>{if(s(m.connected),a(m.reconnecting),m.reconnecting){l.current=!0;return}m.connected&&l.current&&(l.current=!1,f())}),p=ag(m=>{m.rigId===e&&f()});return()=>{p(),d(),u.current&&(clearTimeout(u.current),u.current=null)}},[e,f]),{connected:n,reconnecting:r}}const Dl="#546073",Qu={type:Nc.ArrowClosed,color:Dl,width:12,height:12};function Gre(e){switch(e){case"delegates_to":return{style:{stroke:Dl,strokeWidth:1.5},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Qu,label:void 0};case"spawned_by":return{style:{stroke:Dl,strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Qu,label:void 0};case"can_observe":return{style:{stroke:Dl,strokeWidth:1,strokeDasharray:"4 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Qu,label:void 0};case"uses":return{style:{stroke:Dl,strokeWidth:1,strokeDasharray:"2 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Qu,label:void 0};default:return{style:{stroke:Dl,strokeWidth:1},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Qu,label:void 0}}}function s3(e){return e.type==="group"||e.type==="podGroup"}const pd=240,md=160,Om=3,nq=36,sq=32,rq=28,iq=44,Kre=28,Wre=120,Yre=0,Qre=new Set(["delegates_to","spawned_by"]);function Xre(e,t){if(e.length<=1)return e;const n=new Set(e.filter(d=>s3(d)).map(d=>d.id)),s=new Map;for(const d of e)typeof d.parentId!="string"||!n.has(d.parentId)||(s.has(d.parentId)||s.set(d.parentId,[]),s.get(d.parentId).push(d));const r=[],a=new Map;for(const d of e){if(s3(d)){const p=s.get(d.id)??[],{width:m,height:x}=Jre(p.length);r.push({id:d.id,kind:"group",node:d,width:m,height:x,members:p}),a.set(d.id,d.id);for(const y of p)a.set(y.id,d.id);continue}typeof d.parentId=="string"&&n.has(d.parentId)||(r.push({id:d.id,kind:"standalone",node:d,width:pd,height:md,members:[]}),a.set(d.id,d.id))}if(r.length===0)return e;const l=Zre(t,a),u=nie(r,l),f=new Map;for(const d of e)f.set(d.id,{...d});for(const d of r){const p=u.get(d.id);if(!p)continue;if(d.kind==="standalone"){const x=f.get(d.node.id);x.position={x:p.x,y:p.y},x.initialWidth=pd,x.initialHeight=md;continue}const m=f.get(d.node.id);m.position={x:p.x,y:p.y},m.initialWidth=d.width,m.initialHeight=d.height,m.style={...m.style??{},width:d.width,height:d.height,background:"linear-gradient(180deg, rgba(84, 96, 115, 0.08) 0px, rgba(84, 96, 115, 0.08) 32px, rgba(255, 255, 255, 0.22) 32px, rgba(255, 255, 255, 0.22) 100%)",border:"1px dashed rgba(84, 96, 115, 0.45)",boxShadow:"0 0 0 1px rgba(84, 96, 115, 0.10)"};for(let x=0;x<d.members.length;x+=1){const y=d.members[x],b=f.get(y.id);b.position=eie(x),b.initialWidth=pd,b.initialHeight=md}}return e.map(d=>f.get(d.id)??d)}function Zre(e,t){const n=r3(e.filter(s=>Qre.has(tie(s))),t);return n.length>0?n:r3(e,t)}function r3(e,t){const n=new Map;for(const s of e){const r=t.get(s.source),a=t.get(s.target);if(!r||!a||r===a)continue;const l=`${r}->${a}`;n.has(l)||n.set(l,{source:r,target:a})}return Array.from(n.values())}function Jre(e){const t=Math.max(e,1),n=Math.min(t,Om),s=Math.ceil(t/Om),r=n*pd+Math.max(n-1,0)*nq,a=s*md+Math.max(s-1,0)*sq;return{width:r+rq*2,height:a+iq+Kre}}function eie(e){const t=e%Om,n=Math.floor(e/Om);return{x:rq+t*(pd+nq),y:iq+n*(md+sq)}}function tie(e){var t;return((t=e.data)==null?void 0:t.kind)??e.label??""}function nie(e,t){const n=new Map(e.map(y=>[y.id,y])),s=new Map,r=new Map,a=[],l=new Set;for(const y of e)s.set(y.id,new Set),r.set(y.id,0);for(const y of t)!n.has(y.source)||!n.has(y.target)||s.get(y.source).has(y.target)||(s.get(y.source).add(y.target),r.set(y.target,(r.get(y.target)??0)+1));const u=e.filter(y=>{var b;return(r.get(y.id)??0)===0&&(((b=s.get(y.id))==null?void 0:b.size)??0)>0}).map(y=>y.id).sort((y,b)=>Cp(y,b,s,e)),f=e.filter(y=>{var b;return(r.get(y.id)??0)===0&&(((b=s.get(y.id))==null?void 0:b.size)??0)===0}).map(y=>y.id).sort((y,b)=>Cp(y,b,s,e)),d=y=>{const b=new Map(r),v=[...y],w=new Set(v);for(;v.length>0;){const S=v.shift();if(l.has(S))continue;l.add(S),a.push(S);const C=Array.from(s.get(S)??[]).sort((_,R)=>Cp(_,R,s,e));for(const _ of C)b.set(_,(b.get(_)??1)-1);const k=C.filter(_=>(b.get(_)??0)===0&&!l.has(_)&&!w.has(_));for(const _ of k)v.push(_),w.add(_)}};d(u),d(f);const p=e.map(y=>y.id).filter(y=>!l.has(y)).sort((y,b)=>Cp(y,b,s,e));a.push(...p);const m=new Map;let x=0;for(const y of a){const b=n.get(y);b&&(m.set(b.id,{x:Yre,y:x}),x+=b.height+Wre)}return m}function Cp(e,t,n,s){var l,u;const r=((l=n.get(e))==null?void 0:l.size)??0,a=((u=n.get(t))==null?void 0:u.size)??0;return r!==a?a-r:s.findIndex(f=>f.id===e)-s.findIndex(f=>f.id===t)}function aq(e,t){return t!=="known"||typeof e!="number"?"unknown":e>=80?"critical":e>=60?"warning":"low"}const sie={critical:"border-red-500",warning:"border-amber-500",low:"border-emerald-500",unknown:"border-stone-400 border-dotted"},rie={critical:"text-red-600",warning:"text-amber-600",low:"text-green-700",unknown:"text-stone-300"};function oq(e,t,n){const s=aq(e,n??void 0);return`${rie[s]}${s!=="unknown"&&t===!1?" opacity-50":""}`}function iie({percent:e,fresh:t,availability:n,testIdSuffix:s}){const r=aq(e,n),a=[];r==="unknown"?a.push("context: unknown"):typeof e=="number"&&a.push(`context: ${e}% (${r})`),r!=="unknown"&&t===!1&&a.push("stale sample");const l=a.join(" · ");return i.jsx("span",{"data-testid":s?`context-ring-${s}`:"context-ring","data-context-tier":r,className:`inline-block h-2.5 w-2.5 rounded-full border-2 bg-transparent ${sie[r]}${r!=="unknown"&&t===!1?" opacity-50":""}`,"aria-label":l||"context usage",title:l||"context usage"})}const aie={active:"border-emerald-500/70 shadow-[0_0_0_1px_rgba(16,185,129,0.10)]",needs_input:"border-amber-500/80 shadow-[0_0_0_1px_rgba(245,158,11,0.15)]",blocked:"border-red-600/80 shadow-[0_0_0_1px_rgba(220,38,38,0.16)]"},oie={active:"activity-ring-active",needs_input:"activity-ring-needs-input",blocked:"activity-ring-blocked"};function $k({as:e="div",state:t,flash:n=null,reducedMotion:s=!1,children:r,className:a,ringClassName:l,testId:u}){const f=e;return i.jsxs(f,{className:he("relative",e==="span"?"inline-flex":"block",a),children:[t!=="idle"?i.jsx("span",{"aria-hidden":"true","data-testid":u,"data-activity-ring-state":t,"data-activity-flash":n??"none","data-reduced-motion":s?"true":"false",className:he("pointer-events-none absolute -inset-1 rounded-[inherit] border",aie[t],!s&&oie[t],n==="source"&&"activity-ring-source-flash",n==="target"&&"activity-ring-target-flash",l)}):null,r]})}function lie(e){return e==="running"?"active":e==="needs_input"?"needs_input":"idle"}function lq(e){var t,n;return{state:((t=e.activityRing)==null?void 0:t.state)??lie(e.activityState),flash:((n=e.activityRing)==null?void 0:n.flash)??null}}function cq(e){return he("activity-card-surface",e.state==="active"&&"activity-card-active",e.state==="needs_input"&&"activity-card-needs-input",e.state==="blocked"&&"activity-card-blocked",e.flash==="source"&&"activity-card-source-flash",e.flash==="target"&&"activity-card-target-flash",e.reducedMotion&&"activity-card-reduced-motion")}function cie(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=4}function Ig({sessionName:e,lines:t,paused:n,testIdPrefix:s="session-preview",variant:r="default"}){var m,x;const a=AX({sessionName:e,lines:t,paused:n}),l=E.useRef(null),u=E.useRef(!0),f=Za(a.data)||(m=a.data)==null?void 0:m.content,d=r==="compact-terminal";E.useLayoutEffect(()=>{const y=l.current;!y||!a.data||Za(a.data)||u.current&&(y.scrollTop=y.scrollHeight)},[f,a.data]);const p=()=>{const y=l.current;y&&(u.current=cie(y))};return i.jsxs("div",{"data-testid":`${s}-pane`,"data-session-name":e,"data-variant":r,className:he("space-y-1",d?"border-0 bg-transparent p-0 text-stone-50":"border border-stone-300/40 bg-white/8 px-3 py-2"),children:[!d&&i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",e]}),a.isLoading&&i.jsx("div",{"data-testid":`${s}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),a.isError&&i.jsx("div",{"data-testid":`${s}-error`,className:he("font-mono text-[9px]",d?"text-red-200":"text-red-600"),children:((x=a.error)==null?void 0:x.message)??"Preview failed."}),Za(a.data)&&i.jsx("div",{"data-testid":`${s}-unavailable`,className:he("font-mono space-y-0.5",d?"text-[10px] text-stone-50":"text-[9px] text-stone-500"),children:d?i.jsxs(i.Fragment,{children:[i.jsx("div",{children:"Preview unavailable."}),i.jsx("div",{className:"text-stone-400",children:"$ waiting for terminal output"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:["Preview unavailable: ",a.data.reason,"."]}),a.data.hint&&i.jsx("div",{className:"text-stone-400",children:a.data.hint}),i.jsxs("div",{className:"text-stone-400",children:["Use ",i.jsxs("code",{children:["rig capture ",e]})," from terminal as a fallback."]})]})}),!Za(a.data)&&a.data&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{ref:l,"data-testid":`${s}-content`,onScroll:p,className:he("font-mono",d?"scrollbar-none max-h-72 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words bg-transparent px-1 py-0.5 text-[8px] leading-[1.2] text-stone-50":"max-h-32 overflow-y-auto whitespace-pre-wrap break-all bg-stone-50 px-2 py-1 text-[9px] text-stone-800"),children:a.data.content||"(empty pane)"}),!d&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[i.jsxs("span",{children:["captured"," ",new Date(a.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),i.jsxs("span",{children:[a.data.lines," lines"]})]})]})]})}const rv="openrig:topology-terminal-preview",iv=8,vn=8,i3=408,a3=240;function o3(e){const t=e==null?void 0:e.getBoundingClientRect();return{left:(t==null?void 0:t.left)??vn,right:(t==null?void 0:t.right)??vn,top:(t==null?void 0:t.top)??vn,bottom:(t==null?void 0:t.bottom)??vn}}function l3(e,t,n){return Math.min(Math.max(e,t),n)}function c3(e,t,n,s){const r=typeof window>"u"?t+vn*2:window.innerWidth,a=typeof window>"u"?n+vn*2:window.innerHeight,l=e.right+iv,u=e.left-t-iv,f=l+t<=r-vn?l:u,d=e.top,p=e.top-n-iv,m=d+n<=a-vn?d:p>=vn?p:a-n-vn;return{left:l3(f,vn,Math.max(vn,r-t-vn)),top:l3(m,vn,Math.max(vn,a-n-vn))}}function Mg({rigId:e,logicalId:t,sessionName:n,reducedMotion:s,wrapperClassName:r,buttonClassName:a,popoverClassName:l,testIdPrefix:u,renderTrigger:f=!0}){const d=`${e??"unknown"}:${t}`,p=E.useRef(null),m=E.useRef(null),[x,y]=E.useState(!1),[b,v]=E.useState(null),w=E.useCallback(()=>{var T,A;if(!x)return;const k=o3(p.current),_=((T=m.current)==null?void 0:T.offsetWidth)||i3,R=((A=m.current)==null?void 0:A.offsetHeight)||a3;v(c3(k,_,R))},[x]);if(E.useEffect(()=>{const k=_=>{const R=_.detail,T=(R==null?void 0:R.key)===d;if(y(T),T){const A=o3(p.current);v(c3(A,i3,a3))}};return window.addEventListener(rv,k),()=>window.removeEventListener(rv,k)},[d]),E.useLayoutEffect(()=>{if(!x||!m.current)return;w();const k=window.requestAnimationFrame(w);return()=>window.cancelAnimationFrame(k)},[x,w]),E.useEffect(()=>{if(!x)return;const k=()=>w(),_=typeof ResizeObserver>"u"||!m.current?null:new ResizeObserver(k);return m.current&&(_==null||_.observe(m.current)),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{_==null||_.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[x,w]),E.useEffect(()=>{if(!x)return;const k=_=>{var T,A;const R=_.target;R instanceof Node&&((T=p.current)!=null&&T.contains(R)||(A=m.current)!=null&&A.contains(R)||y(!1))};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[x]),!n)return null;const S=k=>{k.stopPropagation(),window.dispatchEvent(new CustomEvent(rv,{detail:{key:d}}))},C=x&&b?Vm.createPortal(i.jsx("div",{ref:m,"data-testid":`${u}-terminal-popover`,"data-reduced-motion":s?"true":"false",className:he("nodrag nopan fixed z-[1000] max-h-[calc(100vh-1rem)] w-[calc(80ch+24px)] max-w-[calc(100vw-1rem)] overflow-hidden bg-stone-950/65 p-1.5 backdrop-blur-sm","cursor-default select-text font-mono text-[8px] text-stone-50",l),style:{left:b.left,top:b.top},onClick:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:i.jsx(Ig,{sessionName:n,lines:80,testIdPrefix:`${u}-terminal-preview`,variant:"compact-terminal"})}),document.body):null;return i.jsxs("div",{ref:p,className:he("relative inline-flex",r),children:[f?i.jsx("button",{type:"button","data-testid":`${u}-terminal-open`,"aria-label":`View ${t} terminal`,title:"View terminal",onClick:S,className:a,children:i.jsx(Pe,{tool:"terminal",size:"sm"})}):null,C]})}function qd(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.round(e)}function u3(e){const n=Math.abs(e)<10?Math.round(e*10)/10:Math.round(e);return String(n).replace(/\.0$/,"")}function ma(e,t){const n=qd(e),s=qd(t);return n===null&&s===null?null:(n??0)+(s??0)}function yf(e){const t=qd(e);return t===null?null:t>=999500?`${u3(t/1e6)}m`:t>=1e3?`${u3(t/1e3)}k`:t.toLocaleString("en-US")}function Og(e,t){const n=qd(e),s=qd(t),r=ma(n,s);if(r===null)return null;const a=[`Tokens: ${r.toLocaleString("en-US")}`];return n!==null&&a.push(`Input: ${n.toLocaleString("en-US")}`),s!==null&&a.push(`Output: ${s.toLocaleString("en-US")}`),a.join(`
|
|
468
|
-
`)}function uie(e){return e==="architect"||e==="lead"||e==="orchestrator"}function die({data:e}){var G,q,V;const t=E.useRef(e.startupStatus),n=E.useRef(null),[s,r]=E.useState(!1),[a,l]=E.useState(null),u=uie(e.role),f=e.nodeKind==="infrastructure";E.useEffect(()=>{if(t.current!==e.startupStatus&&t.current!==null){r(!0);const K=setTimeout(()=>r(!1),600);return t.current=e.startupStatus,()=>clearTimeout(K)}t.current=e.startupStatus},[e.startupStatus]),E.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]);const d=e.runtime||e.model?oD(e.runtime,e.model):null,p=ig(e.logicalId),m=A2(e.agentActivity),x=T2(m),y=eD(m),b=tD(m),v=nD(e.agentActivity),w=lq({activityRing:e.activityRing,activityState:m}),S=ma(e.contextTotalInputTokens,e.contextTotalOutputTokens),C=yf(S),k=Og(e.contextTotalInputTokens,e.contextTotalOutputTokens),_=e.placementState==="selected"?"target":e.placementState==="available"?"avail":null,R=e.currentQitems??[],T=R.length>0?R.map(K=>`On: ${nK(K.qitemId)} — ${K.bodyExcerpt}`):[],A=[`Activity: ${x}${v?" (stale sample)":""}`,e.canonicalSessionName?`Session: ${e.canonicalSessionName}`:null,d?`Runtime: ${d}`:null,e.resolvedSpecName?`Spec: ${e.resolvedSpecName}`:null,e.profile?`Profile: ${e.profile}`:null,typeof e.edgeCount=="number"?`Edges: ${e.edgeCount}`:null,k,...T].filter(K=>!!K),I=A.join(`
|
|
469
|
-
`),L=K=>{n.current&&clearTimeout(n.current),l(K),n.current=setTimeout(()=>{l(Y=>Y===K?null:Y),n.current=null},900)},$=async K=>{if(K.stopPropagation(),!!e.rigId)try{(await fetch(`/api/rigs/${encodeURIComponent(e.rigId)}/nodes/${encodeURIComponent(e.logicalId)}/open-cmux`,{method:"POST"})).ok&&L("cmux")}catch{}},O=K=>`inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors ${a===K?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"}`,B="border font-mono text-[7px] uppercase transition-colors bg-white text-stone-900 border-stone-300 hover:bg-stone-100 inline-flex h-6 w-6 items-center justify-center px-0 py-0",H=e.canonicalSessionName??((G=e.binding)==null?void 0:G.tmuxSession)??null,P=i.jsxs("div",{className:he("group relative min-w-[200px] border hard-shadow transition-[background-color,border-color,box-shadow] duration-300",cq({state:w.state,flash:w.flash,reducedMotion:e.reducedMotion}),e.placementState==="selected"?"border-emerald-600 ring-2 ring-emerald-400/70 shadow-[0_0_0_3px_rgba(52,211,153,0.12)]":e.placementState==="available"?"border-emerald-500 ring-1 ring-emerald-300/70":"border-stone-900"),"data-activity-card-state":w.state,"data-activity-card-flash":w.flash??"none","data-testid":"rig-node",title:I||void 0,children:[i.jsx(Sn,{type:"target",position:ye.Top}),i.jsxs("div",{className:`px-3 py-1 font-mono text-[10px] flex justify-between items-center ${f?"bg-stone-500 text-white border-b border-stone-900":u?"bg-stone-900 text-white":"bg-stone-200 text-stone-900 border-b border-stone-900"}`,children:[i.jsx("span",{className:"font-bold truncate",children:p}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[v&&i.jsx("span",{"data-testid":`activity-staleness-${e.logicalId}`,className:"font-mono text-[7px] uppercase tracking-[0.10em] text-stone-300",title:"Activity sample is older than threshold; daemon may not be probing this seat",children:"stale"}),i.jsx("span",{className:`inline-flex h-2.5 w-2.5 rounded-full border border-white/50 ${y} ${b} ${s?"status-changed":""}`,"data-testid":`activity-dot-${e.logicalId}`,"data-activity-state":m,"aria-label":`activity: ${x}`,title:`activity: ${x}`}),i.jsx(iie,{percent:e.contextUsedPercentage,fresh:e.contextFresh,availability:e.contextAvailability,testIdSuffix:e.logicalId})]})]}),i.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[i.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(Kn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!d&&e.profile?i.jsx("span",{className:"ml-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e.profile}):null]}),e.resolvedSpecName&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-400","data-testid":"spec-hint",children:[e.resolvedSpecName,e.profile?` · ${e.profile}`:""]}),i.jsxs("div",{className:"flex items-end justify-between gap-3 pt-0.5",children:[e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number"?i.jsxs("div",{className:`font-mono text-base font-bold leading-none ${e.contextUsedPercentage>=80?"text-red-600":e.contextUsedPercentage>=60?"text-amber-600":"text-green-700"}${e.contextFresh?"":" opacity-50"}`,"data-testid":"context-badge",title:e.contextFresh?"Context usage (fresh)":"Context usage (stale sample)",children:[e.contextUsedPercentage,"%"]}):i.jsx("div",{className:"font-mono text-xs text-stone-400","data-testid":"context-badge-unknown",children:"?"}),i.jsx("div",{className:`font-mono text-base font-bold leading-none tracking-[0.02em] ${C?"text-stone-500":"text-stone-300"}`,"data-testid":"token-total",title:k??"Token sample unavailable",children:C??"--"})]}),e.restoreOutcome&&e.restoreOutcome!=="n-a"&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RESTORE: ",e.restoreOutcome]}),e.packageRefs&&e.packageRefs.length>0&&i.jsxs("div",{"data-testid":"package-badge",title:e.packageRefs.join(", "),className:"font-mono text-[8px] text-stone-400",onClick:K=>K.stopPropagation(),onKeyDown:K=>K.stopPropagation(),children:["PKG ",e.packageRefs.length]}),e.startupStatus==="attention_required"&&i.jsxs("div",{className:"stamp-badge",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"}),i.jsx("span",{className:"text-orange-600",children:"ATTN"})]}),e.startupStatus==="failed"&&i.jsxs("div",{className:"stamp-badge",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsx("span",{className:"text-red-600",children:"FAILED"})]}),(H??e.rigId)&&i.jsxs("div",{"data-testid":"node-toolbar",className:"absolute right-2 top-8 z-20 flex flex-wrap justify-end gap-1 opacity-0 transition-opacity group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",onClick:K=>K.stopPropagation(),onKeyDown:K=>K.stopPropagation(),children:[e.rigId&&i.jsxs("button",{onClick:$,"data-testid":"toolbar-cmux-open",className:`${O("cmux")} inline-flex h-6 w-6 items-center justify-center px-0 py-0`,"aria-label":"Open in cmux",title:"Open in cmux",children:[i.jsx(Pe,{tool:"cmux",size:"sm"}),i.jsx("span",{className:"sr-only",children:a==="cmux"?"opened":"cmux"})]}),e.rigId&&H&&i.jsx(Mg,{rigId:e.rigId,logicalId:e.logicalId,sessionName:H,reducedMotion:e.reducedMotion,testIdPrefix:`rig-node-${e.logicalId}`,buttonClassName:B})]}),_&&i.jsx("div",{className:"pt-1",children:i.jsx("span",{"data-testid":`placement-chip-${e.logicalId}`,className:`inline-flex items-center border px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] ${e.placementState==="selected"?"border-emerald-700 bg-emerald-700 text-white":"border-emerald-300 bg-emerald-50 text-emerald-800"}`,children:_})})]}),A.length>0&&i.jsx("div",{"data-testid":"node-hover-hint",className:"pointer-events-none absolute left-2 top-full z-20 mt-2 hidden min-w-[180px] border border-stone-900 bg-white px-2 py-1 font-mono text-[8px] text-stone-700 shadow-[4px_4px_0_rgba(28,25,23,0.14)] group-hover:block",children:A.map(K=>i.jsx("div",{children:K},K))}),i.jsx(Sn,{type:"source",position:ye.Bottom})]});return i.jsx($k,{state:((q=e.activityRing)==null?void 0:q.state)??"idle",flash:((V=e.activityRing)==null?void 0:V.flash)??null,reducedMotion:e.reducedMotion,testId:`rig-node-activity-ring-${e.logicalId}`,className:"rounded-none",children:P})}function uq({id:e,sourceX:t,sourceY:n,targetX:s,targetY:r,sourcePosition:a,targetPosition:l,style:u,markerEnd:f,data:d}){const[p]=Rk({sourceX:t,sourceY:n,sourcePosition:a,targetX:s,targetY:r,targetPosition:l}),m=d??{},x=m.hotPotatoPacket??null,y=m.hotPotatoCrossRig??!1,b=m.hotPotatoReducedMotion??!1,v=x?y?1.25:2.25:u==null?void 0:u.strokeWidth;return i.jsxs(i.Fragment,{children:[i.jsx(mf,{id:e,path:p,markerEnd:f,style:{...u,strokeWidth:v,filter:x?"drop-shadow(0 0 3px rgba(16,185,129,0.22))":u==null?void 0:u.filter}}),x?b?i.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"true",cx:s,cy:r,r:y?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:y?1.75:2.25,vectorEffect:"non-scaling-stroke",className:y?"fill-stone-500":"fill-emerald-600"}):i.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"false",r:y?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:y?1.75:2.25,vectorEffect:"non-scaling-stroke",className:y?"fill-stone-500 hot-potato-packet-cross":"fill-emerald-600 hot-potato-packet",children:i.jsx("animateMotion",{dur:`${x.durationMs}ms`,path:p,fill:"freeze",calcMode:"spline",keySplines:"0.2 0 0 1",keyTimes:"0;1"})},x.id):null]})}const fie=_D("relative w-full p-4 bg-surface-low border-l-2 border-l-stone-900 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-on-surface",{variants:{variant:{default:"bg-background text-foreground",destructive:"text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),wn=E.forwardRef(({className:e,variant:t,...n},s)=>i.jsx("div",{ref:s,role:"alert",className:he(fie({variant:t}),e),...n}));wn.displayName="Alert";const dq=E.forwardRef(({className:e,...t},n)=>i.jsx("h5",{ref:n,className:he("mb-1 font-medium leading-none tracking-tight",e),...t}));dq.displayName="AlertTitle";const dn=E.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:he("text-sm [&_p]:leading-relaxed",e),...t}));dn.displayName="AlertDescription";function Dk(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var av,d3;function hie(){if(d3)return av;d3=1;function e(){this.__data__=[],this.size=0}return av=e,av}var ov,f3;function Lc(){if(f3)return ov;f3=1;function e(t,n){return t===n||t!==t&&n!==n}return ov=e,ov}var lv,h3;function Lg(){if(h3)return lv;h3=1;var e=Lc();function t(n,s){for(var r=n.length;r--;)if(e(n[r][0],s))return r;return-1}return lv=t,lv}var cv,p3;function pie(){if(p3)return cv;p3=1;var e=Lg(),t=Array.prototype,n=t.splice;function s(r){var a=this.__data__,l=e(a,r);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return cv=s,cv}var uv,m3;function mie(){if(m3)return uv;m3=1;var e=Lg();function t(n){var s=this.__data__,r=e(s,n);return r<0?void 0:s[r][1]}return uv=t,uv}var dv,g3;function gie(){if(g3)return dv;g3=1;var e=Lg();function t(n){return e(this.__data__,n)>-1}return dv=t,dv}var fv,x3;function xie(){if(x3)return fv;x3=1;var e=Lg();function t(n,s){var r=this.__data__,a=e(r,n);return a<0?(++this.size,r.push([n,s])):r[a][1]=s,this}return fv=t,fv}var hv,y3;function Pg(){if(y3)return hv;y3=1;var e=hie(),t=pie(),n=mie(),s=gie(),r=xie();function a(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var d=l[u];this.set(d[0],d[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,hv=a,hv}var pv,v3;function yie(){if(v3)return pv;v3=1;var e=Pg();function t(){this.__data__=new e,this.size=0}return pv=t,pv}var mv,b3;function vie(){if(b3)return mv;b3=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return mv=e,mv}var gv,w3;function bie(){if(w3)return gv;w3=1;function e(t){return this.__data__.get(t)}return gv=e,gv}var xv,j3;function wie(){if(j3)return xv;j3=1;function e(t){return this.__data__.has(t)}return xv=e,xv}var yv,S3;function fq(){if(S3)return yv;S3=1;var e=typeof Xh=="object"&&Xh&&Xh.Object===Object&&Xh;return yv=e,yv}var vv,N3;function Us(){if(N3)return vv;N3=1;var e=fq(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return vv=n,vv}var bv,k3;function Pc(){if(k3)return bv;k3=1;var e=Us(),t=e.Symbol;return bv=t,bv}var wv,_3;function jie(){if(_3)return wv;_3=1;var e=Pc(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,r=e?e.toStringTag:void 0;function a(l){var u=n.call(l,r),f=l[r];try{l[r]=void 0;var d=!0}catch{}var p=s.call(l);return d&&(u?l[r]=f:delete l[r]),p}return wv=a,wv}var jv,C3;function Sie(){if(C3)return jv;C3=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return jv=n,jv}var Sv,E3;function Mo(){if(E3)return Sv;E3=1;var e=Pc(),t=jie(),n=Sie(),s="[object Null]",r="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?r:s:a&&a in Object(u)?t(u):n(u)}return Sv=l,Sv}var Nv,R3;function ks(){if(R3)return Nv;R3=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Nv=e,Nv}var kv,A3;function vf(){if(A3)return kv;A3=1;var e=Mo(),t=ks(),n="[object AsyncFunction]",s="[object Function]",r="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var f=e(u);return f==s||f==r||f==n||f==a}return kv=l,kv}var _v,T3;function Nie(){if(T3)return _v;T3=1;var e=Us(),t=e["__core-js_shared__"];return _v=t,_v}var Cv,I3;function kie(){if(I3)return Cv;I3=1;var e=Nie(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return Cv=n,Cv}var Ev,M3;function hq(){if(M3)return Ev;M3=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Ev=n,Ev}var Rv,O3;function _ie(){if(O3)return Rv;O3=1;var e=vf(),t=kie(),n=ks(),s=hq(),r=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,f=l.toString,d=u.hasOwnProperty,p=RegExp("^"+f.call(d).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(x){if(!n(x)||t(x))return!1;var y=e(x)?p:a;return y.test(s(x))}return Rv=m,Rv}var Av,L3;function Cie(){if(L3)return Av;L3=1;function e(t,n){return t==null?void 0:t[n]}return Av=e,Av}var Tv,P3;function Oo(){if(P3)return Tv;P3=1;var e=_ie(),t=Cie();function n(s,r){var a=t(s,r);return e(a)?a:void 0}return Tv=n,Tv}var Iv,$3;function qk(){if($3)return Iv;$3=1;var e=Oo(),t=Us(),n=e(t,"Map");return Iv=n,Iv}var Mv,D3;function $g(){if(D3)return Mv;D3=1;var e=Oo(),t=e(Object,"create");return Mv=t,Mv}var Ov,q3;function Eie(){if(q3)return Ov;q3=1;var e=$g();function t(){this.__data__=e?e(null):{},this.size=0}return Ov=t,Ov}var Lv,z3;function Rie(){if(z3)return Lv;z3=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Lv=e,Lv}var Pv,B3;function Aie(){if(B3)return Pv;B3=1;var e=$g(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function r(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return Pv=r,Pv}var $v,F3;function Tie(){if(F3)return $v;F3=1;var e=$g(),t=Object.prototype,n=t.hasOwnProperty;function s(r){var a=this.__data__;return e?a[r]!==void 0:n.call(a,r)}return $v=s,$v}var Dv,H3;function Iie(){if(H3)return Dv;H3=1;var e=$g(),t="__lodash_hash_undefined__";function n(s,r){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&r===void 0?t:r,this}return Dv=n,Dv}var qv,U3;function Mie(){if(U3)return qv;U3=1;var e=Eie(),t=Rie(),n=Aie(),s=Tie(),r=Iie();function a(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var d=l[u];this.set(d[0],d[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,qv=a,qv}var zv,V3;function Oie(){if(V3)return zv;V3=1;var e=Mie(),t=Pg(),n=qk();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return zv=s,zv}var Bv,G3;function Lie(){if(G3)return Bv;G3=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Bv=e,Bv}var Fv,K3;function Dg(){if(K3)return Fv;K3=1;var e=Lie();function t(n,s){var r=n.__data__;return e(s)?r[typeof s=="string"?"string":"hash"]:r.map}return Fv=t,Fv}var Hv,W3;function Pie(){if(W3)return Hv;W3=1;var e=Dg();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Hv=t,Hv}var Uv,Y3;function $ie(){if(Y3)return Uv;Y3=1;var e=Dg();function t(n){return e(this,n).get(n)}return Uv=t,Uv}var Vv,Q3;function Die(){if(Q3)return Vv;Q3=1;var e=Dg();function t(n){return e(this,n).has(n)}return Vv=t,Vv}var Gv,X3;function qie(){if(X3)return Gv;X3=1;var e=Dg();function t(n,s){var r=e(this,n),a=r.size;return r.set(n,s),this.size+=r.size==a?0:1,this}return Gv=t,Gv}var Kv,Z3;function zk(){if(Z3)return Kv;Z3=1;var e=Oie(),t=Pie(),n=$ie(),s=Die(),r=qie();function a(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var d=l[u];this.set(d[0],d[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,Kv=a,Kv}var Wv,J3;function zie(){if(J3)return Wv;J3=1;var e=Pg(),t=qk(),n=zk(),s=200;function r(a,l){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(a,l),this.size=u.size,this}return Wv=r,Wv}var Yv,eM;function qg(){if(eM)return Yv;eM=1;var e=Pg(),t=yie(),n=vie(),s=bie(),r=wie(),a=zie();function l(u){var f=this.__data__=new e(u);this.size=f.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=r,l.prototype.set=a,Yv=l,Yv}var Qv,tM;function Bk(){if(tM)return Qv;tM=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r&&n(t[s],s,t)!==!1;);return t}return Qv=e,Qv}var Xv,nM;function pq(){if(nM)return Xv;nM=1;var e=Oo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Xv=t,Xv}var Zv,sM;function zg(){if(sM)return Zv;sM=1;var e=pq();function t(n,s,r){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[s]=r}return Zv=t,Zv}var Jv,rM;function Bg(){if(rM)return Jv;rM=1;var e=zg(),t=Lc(),n=Object.prototype,s=n.hasOwnProperty;function r(a,l,u){var f=a[l];(!(s.call(a,l)&&t(f,u))||u===void 0&&!(l in a))&&e(a,l,u)}return Jv=r,Jv}var eb,iM;function bf(){if(iM)return eb;iM=1;var e=Bg(),t=zg();function n(s,r,a,l){var u=!a;a||(a={});for(var f=-1,d=r.length;++f<d;){var p=r[f],m=l?l(a[p],s[p],p,a,s):void 0;m===void 0&&(m=s[p]),u?t(a,p,m):e(a,p,m)}return a}return eb=n,eb}var tb,aM;function Bie(){if(aM)return tb;aM=1;function e(t,n){for(var s=-1,r=Array(t);++s<t;)r[s]=n(s);return r}return tb=e,tb}var nb,oM;function hr(){if(oM)return nb;oM=1;function e(t){return t!=null&&typeof t=="object"}return nb=e,nb}var sb,lM;function Fie(){if(lM)return sb;lM=1;var e=Mo(),t=hr(),n="[object Arguments]";function s(r){return t(r)&&e(r)==n}return sb=s,sb}var rb,cM;function wf(){if(cM)return rb;cM=1;var e=Fie(),t=hr(),n=Object.prototype,s=n.hasOwnProperty,r=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!r.call(l,"callee")};return rb=a,rb}var ib,uM;function Wt(){if(uM)return ib;uM=1;var e=Array.isArray;return ib=e,ib}var ad={exports:{}},ab,dM;function Hie(){if(dM)return ab;dM=1;function e(){return!1}return ab=e,ab}ad.exports;var fM;function $c(){return fM||(fM=1,(function(e,t){var n=Us(),s=Hie(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,u=l?n.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||s;e.exports=d})(ad,ad.exports)),ad.exports}var ob,hM;function Fg(){if(hM)return ob;hM=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,r){var a=typeof s;return r=r??e,!!r&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<r}return ob=n,ob}var lb,pM;function Fk(){if(pM)return lb;pM=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return lb=t,lb}var cb,mM;function Uie(){if(mM)return cb;mM=1;var e=Mo(),t=Fk(),n=hr(),s="[object Arguments]",r="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",f="[object Function]",d="[object Map]",p="[object Number]",m="[object Object]",x="[object RegExp]",y="[object Set]",b="[object String]",v="[object WeakMap]",w="[object ArrayBuffer]",S="[object DataView]",C="[object Float32Array]",k="[object Float64Array]",_="[object Int8Array]",R="[object Int16Array]",T="[object Int32Array]",A="[object Uint8Array]",I="[object Uint8ClampedArray]",L="[object Uint16Array]",$="[object Uint32Array]",O={};O[C]=O[k]=O[_]=O[R]=O[T]=O[A]=O[I]=O[L]=O[$]=!0,O[s]=O[r]=O[w]=O[a]=O[S]=O[l]=O[u]=O[f]=O[d]=O[p]=O[m]=O[x]=O[y]=O[b]=O[v]=!1;function B(H){return n(H)&&t(H.length)&&!!O[e(H)]}return cb=B,cb}var ub,gM;function Hg(){if(gM)return ub;gM=1;function e(t){return function(n){return t(n)}}return ub=e,ub}var od={exports:{}};od.exports;var xM;function Hk(){return xM||(xM=1,(function(e,t){var n=fq(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,a=r&&r.exports===s,l=a&&n.process,u=(function(){try{var f=r&&r.require&&r.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(od,od.exports)),od.exports}var db,yM;function jf(){if(yM)return db;yM=1;var e=Uie(),t=Hg(),n=Hk(),s=n&&n.isTypedArray,r=s?t(s):e;return db=r,db}var fb,vM;function mq(){if(vM)return fb;vM=1;var e=Bie(),t=wf(),n=Wt(),s=$c(),r=Fg(),a=jf(),l=Object.prototype,u=l.hasOwnProperty;function f(d,p){var m=n(d),x=!m&&t(d),y=!m&&!x&&s(d),b=!m&&!x&&!y&&a(d),v=m||x||y||b,w=v?e(d.length,String):[],S=w.length;for(var C in d)(p||u.call(d,C))&&!(v&&(C=="length"||y&&(C=="offset"||C=="parent")||b&&(C=="buffer"||C=="byteLength"||C=="byteOffset")||r(C,S)))&&w.push(C);return w}return fb=f,fb}var hb,bM;function Ug(){if(bM)return hb;bM=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,r=typeof s=="function"&&s.prototype||e;return n===r}return hb=t,hb}var pb,wM;function gq(){if(wM)return pb;wM=1;function e(t,n){return function(s){return t(n(s))}}return pb=e,pb}var mb,jM;function Vie(){if(jM)return mb;jM=1;var e=gq(),t=e(Object.keys,Object);return mb=t,mb}var gb,SM;function Uk(){if(SM)return gb;SM=1;var e=Ug(),t=Vie(),n=Object.prototype,s=n.hasOwnProperty;function r(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return gb=r,gb}var xb,NM;function ti(){if(NM)return xb;NM=1;var e=vf(),t=Fk();function n(s){return s!=null&&t(s.length)&&!e(s)}return xb=n,xb}var yb,kM;function wa(){if(kM)return yb;kM=1;var e=mq(),t=Uk(),n=ti();function s(r){return n(r)?e(r):t(r)}return yb=s,yb}var vb,_M;function Gie(){if(_M)return vb;_M=1;var e=bf(),t=wa();function n(s,r){return s&&e(r,t(r),s)}return vb=n,vb}var bb,CM;function Kie(){if(CM)return bb;CM=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return bb=e,bb}var wb,EM;function Wie(){if(EM)return wb;EM=1;var e=ks(),t=Ug(),n=Kie(),s=Object.prototype,r=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),f=[];for(var d in l)d=="constructor"&&(u||!r.call(l,d))||f.push(d);return f}return wb=a,wb}var jb,RM;function Lo(){if(RM)return jb;RM=1;var e=mq(),t=Wie(),n=ti();function s(r){return n(r)?e(r,!0):t(r)}return jb=s,jb}var Sb,AM;function Yie(){if(AM)return Sb;AM=1;var e=bf(),t=Lo();function n(s,r){return s&&e(r,t(r),s)}return Sb=n,Sb}var ld={exports:{}};ld.exports;var TM;function xq(){return TM||(TM=1,(function(e,t){var n=Us(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,a=r&&r.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function f(d,p){if(p)return d.slice();var m=d.length,x=u?u(m):new d.constructor(m);return d.copy(x),x}e.exports=f})(ld,ld.exports)),ld.exports}var Nb,IM;function yq(){if(IM)return Nb;IM=1;function e(t,n){var s=-1,r=t.length;for(n||(n=Array(r));++s<r;)n[s]=t[s];return n}return Nb=e,Nb}var kb,MM;function vq(){if(MM)return kb;MM=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,a=0,l=[];++s<r;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return kb=e,kb}var _b,OM;function bq(){if(OM)return _b;OM=1;function e(){return[]}return _b=e,_b}var Cb,LM;function Vk(){if(LM)return Cb;LM=1;var e=vq(),t=bq(),n=Object.prototype,s=n.propertyIsEnumerable,r=Object.getOwnPropertySymbols,a=r?function(l){return l==null?[]:(l=Object(l),e(r(l),function(u){return s.call(l,u)}))}:t;return Cb=a,Cb}var Eb,PM;function Qie(){if(PM)return Eb;PM=1;var e=bf(),t=Vk();function n(s,r){return e(s,t(s),r)}return Eb=n,Eb}var Rb,$M;function Gk(){if($M)return Rb;$M=1;function e(t,n){for(var s=-1,r=n.length,a=t.length;++s<r;)t[a+s]=n[s];return t}return Rb=e,Rb}var Ab,DM;function Vg(){if(DM)return Ab;DM=1;var e=gq(),t=e(Object.getPrototypeOf,Object);return Ab=t,Ab}var Tb,qM;function wq(){if(qM)return Tb;qM=1;var e=Gk(),t=Vg(),n=Vk(),s=bq(),r=Object.getOwnPropertySymbols,a=r?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Tb=a,Tb}var Ib,zM;function Xie(){if(zM)return Ib;zM=1;var e=bf(),t=wq();function n(s,r){return e(s,t(s),r)}return Ib=n,Ib}var Mb,BM;function jq(){if(BM)return Mb;BM=1;var e=Gk(),t=Wt();function n(s,r,a){var l=r(s);return t(s)?l:e(l,a(s))}return Mb=n,Mb}var Ob,FM;function Sq(){if(FM)return Ob;FM=1;var e=jq(),t=Vk(),n=wa();function s(r){return e(r,n,t)}return Ob=s,Ob}var Lb,HM;function Zie(){if(HM)return Lb;HM=1;var e=jq(),t=wq(),n=Lo();function s(r){return e(r,n,t)}return Lb=s,Lb}var Pb,UM;function Jie(){if(UM)return Pb;UM=1;var e=Oo(),t=Us(),n=e(t,"DataView");return Pb=n,Pb}var $b,VM;function eae(){if(VM)return $b;VM=1;var e=Oo(),t=Us(),n=e(t,"Promise");return $b=n,$b}var Db,GM;function Nq(){if(GM)return Db;GM=1;var e=Oo(),t=Us(),n=e(t,"Set");return Db=n,Db}var qb,KM;function tae(){if(KM)return qb;KM=1;var e=Oo(),t=Us(),n=e(t,"WeakMap");return qb=n,qb}var zb,WM;function Dc(){if(WM)return zb;WM=1;var e=Jie(),t=qk(),n=eae(),s=Nq(),r=tae(),a=Mo(),l=hq(),u="[object Map]",f="[object Object]",d="[object Promise]",p="[object Set]",m="[object WeakMap]",x="[object DataView]",y=l(e),b=l(t),v=l(n),w=l(s),S=l(r),C=a;return(e&&C(new e(new ArrayBuffer(1)))!=x||t&&C(new t)!=u||n&&C(n.resolve())!=d||s&&C(new s)!=p||r&&C(new r)!=m)&&(C=function(k){var _=a(k),R=_==f?k.constructor:void 0,T=R?l(R):"";if(T)switch(T){case y:return x;case b:return u;case v:return d;case w:return p;case S:return m}return _}),zb=C,zb}var Bb,YM;function nae(){if(YM)return Bb;YM=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var r=s.length,a=new s.constructor(r);return r&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Bb=n,Bb}var Fb,QM;function kq(){if(QM)return Fb;QM=1;var e=Us(),t=e.Uint8Array;return Fb=t,Fb}var Hb,XM;function Kk(){if(XM)return Hb;XM=1;var e=kq();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Hb=t,Hb}var Ub,ZM;function sae(){if(ZM)return Ub;ZM=1;var e=Kk();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}return Ub=t,Ub}var Vb,JM;function rae(){if(JM)return Vb;JM=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Vb=t,Vb}var Gb,e4;function iae(){if(e4)return Gb;e4=1;var e=Pc(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(r){return n?Object(n.call(r)):{}}return Gb=s,Gb}var Kb,t4;function _q(){if(t4)return Kb;t4=1;var e=Kk();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}return Kb=t,Kb}var Wb,n4;function aae(){if(n4)return Wb;n4=1;var e=Kk(),t=sae(),n=rae(),s=iae(),r=_q(),a="[object Boolean]",l="[object Date]",u="[object Map]",f="[object Number]",d="[object RegExp]",p="[object Set]",m="[object String]",x="[object Symbol]",y="[object ArrayBuffer]",b="[object DataView]",v="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",C="[object Int16Array]",k="[object Int32Array]",_="[object Uint8Array]",R="[object Uint8ClampedArray]",T="[object Uint16Array]",A="[object Uint32Array]";function I(L,$,O){var B=L.constructor;switch($){case y:return e(L);case a:case l:return new B(+L);case b:return t(L,O);case v:case w:case S:case C:case k:case _:case R:case T:case A:return r(L,O);case u:return new B;case f:case m:return new B(L);case d:return n(L);case p:return new B;case x:return s(L)}}return Wb=I,Wb}var Yb,s4;function Cq(){if(s4)return Yb;s4=1;var e=ks(),t=Object.create,n=(function(){function s(){}return function(r){if(!e(r))return{};if(t)return t(r);s.prototype=r;var a=new s;return s.prototype=void 0,a}})();return Yb=n,Yb}var Qb,r4;function Eq(){if(r4)return Qb;r4=1;var e=Cq(),t=Vg(),n=Ug();function s(r){return typeof r.constructor=="function"&&!n(r)?e(t(r)):{}}return Qb=s,Qb}var Xb,i4;function oae(){if(i4)return Xb;i4=1;var e=Dc(),t=hr(),n="[object Map]";function s(r){return t(r)&&e(r)==n}return Xb=s,Xb}var Zb,a4;function lae(){if(a4)return Zb;a4=1;var e=oae(),t=Hg(),n=Hk(),s=n&&n.isMap,r=s?t(s):e;return Zb=r,Zb}var Jb,o4;function cae(){if(o4)return Jb;o4=1;var e=Dc(),t=hr(),n="[object Set]";function s(r){return t(r)&&e(r)==n}return Jb=s,Jb}var e1,l4;function uae(){if(l4)return e1;l4=1;var e=cae(),t=Hg(),n=Hk(),s=n&&n.isSet,r=s?t(s):e;return e1=r,e1}var t1,c4;function Rq(){if(c4)return t1;c4=1;var e=qg(),t=Bk(),n=Bg(),s=Gie(),r=Yie(),a=xq(),l=yq(),u=Qie(),f=Xie(),d=Sq(),p=Zie(),m=Dc(),x=nae(),y=aae(),b=Eq(),v=Wt(),w=$c(),S=lae(),C=ks(),k=uae(),_=wa(),R=Lo(),T=1,A=2,I=4,L="[object Arguments]",$="[object Array]",O="[object Boolean]",B="[object Date]",H="[object Error]",P="[object Function]",G="[object GeneratorFunction]",q="[object Map]",V="[object Number]",K="[object Object]",Y="[object RegExp]",J="[object Set]",D="[object String]",F="[object Symbol]",te="[object WeakMap]",U="[object ArrayBuffer]",Q="[object DataView]",X="[object Float32Array]",se="[object Float64Array]",re="[object Int8Array]",ce="[object Int16Array]",me="[object Int32Array]",ge="[object Uint8Array]",ve="[object Uint8ClampedArray]",xe="[object Uint16Array]",je="[object Uint32Array]",Se={};Se[L]=Se[$]=Se[U]=Se[Q]=Se[O]=Se[B]=Se[X]=Se[se]=Se[re]=Se[ce]=Se[me]=Se[q]=Se[V]=Se[K]=Se[Y]=Se[J]=Se[D]=Se[F]=Se[ge]=Se[ve]=Se[xe]=Se[je]=!0,Se[H]=Se[P]=Se[te]=!1;function $e(Re,xt,wt,Ot,fn,Yt){var jt,yt=xt&T,Ke=xt&A,pt=xt&I;if(wt&&(jt=fn?wt(Re,Ot,fn,Yt):wt(Re)),jt!==void 0)return jt;if(!C(Re))return Re;var Qt=v(Re);if(Qt){if(jt=x(Re),!yt)return l(Re,jt)}else{var hn=m(Re),Do=hn==P||hn==G;if(w(Re))return a(Re,yt);if(hn==K||hn==L||Do&&!fn){if(jt=Ke||Do?{}:b(Re),!yt)return Ke?f(Re,r(jt,Re)):u(Re,s(jt,Re))}else{if(!Se[hn])return fn?Re:{};jt=y(Re,hn,yt)}}Yt||(Yt=new e);var pr=Yt.get(Re);if(pr)return pr;Yt.set(Re,jt),k(Re)?Re.forEach(function(pn){jt.add($e(pn,xt,wt,pn,Re,Yt))}):S(Re)&&Re.forEach(function(pn,Et){jt.set(Et,$e(pn,xt,wt,Et,Re,Yt))});var zc=pt?Ke?p:d:Ke?R:_,qo=Qt?void 0:zc(Re);return t(qo||Re,function(pn,Et){qo&&(Et=pn,pn=Re[Et]),n(jt,Et,$e(pn,xt,wt,Et,Re,Yt))}),jt}return t1=$e,t1}var n1,u4;function dae(){if(u4)return n1;u4=1;var e=Rq(),t=4;function n(s){return e(s,t)}return n1=n,n1}var s1,d4;function Wk(){if(d4)return s1;d4=1;function e(t){return function(){return t}}return s1=e,s1}var r1,f4;function fae(){if(f4)return r1;f4=1;function e(t){return function(n,s,r){for(var a=-1,l=Object(n),u=r(n),f=u.length;f--;){var d=u[t?f:++a];if(s(l[d],d,l)===!1)break}return n}}return r1=e,r1}var i1,h4;function Yk(){if(h4)return i1;h4=1;var e=fae(),t=e();return i1=t,i1}var a1,p4;function Qk(){if(p4)return a1;p4=1;var e=Yk(),t=wa();function n(s,r){return s&&e(s,r,t)}return a1=n,a1}var o1,m4;function hae(){if(m4)return o1;m4=1;var e=ti();function t(n,s){return function(r,a){if(r==null)return r;if(!e(r))return n(r,a);for(var l=r.length,u=s?l:-1,f=Object(r);(s?u--:++u<l)&&a(f[u],u,f)!==!1;);return r}}return o1=t,o1}var l1,g4;function Gg(){if(g4)return l1;g4=1;var e=Qk(),t=hae(),n=t(e);return l1=n,l1}var c1,x4;function Po(){if(x4)return c1;x4=1;function e(t){return t}return c1=e,c1}var u1,y4;function Aq(){if(y4)return u1;y4=1;var e=Po();function t(n){return typeof n=="function"?n:e}return u1=t,u1}var d1,v4;function Tq(){if(v4)return d1;v4=1;var e=Bk(),t=Gg(),n=Aq(),s=Wt();function r(a,l){var u=s(a)?e:t;return u(a,n(l))}return d1=r,d1}var f1,b4;function Iq(){return b4||(b4=1,f1=Tq()),f1}var h1,w4;function pae(){if(w4)return h1;w4=1;var e=Gg();function t(n,s){var r=[];return e(n,function(a,l,u){s(a,l,u)&&r.push(a)}),r}return h1=t,h1}var p1,j4;function mae(){if(j4)return p1;j4=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return p1=t,p1}var m1,S4;function gae(){if(S4)return m1;S4=1;function e(t){return this.__data__.has(t)}return m1=e,m1}var g1,N4;function Mq(){if(N4)return g1;N4=1;var e=zk(),t=mae(),n=gae();function s(r){var a=-1,l=r==null?0:r.length;for(this.__data__=new e;++a<l;)this.add(r[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,g1=s,g1}var x1,k4;function xae(){if(k4)return x1;k4=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r;)if(n(t[s],s,t))return!0;return!1}return x1=e,x1}var y1,_4;function Oq(){if(_4)return y1;_4=1;function e(t,n){return t.has(n)}return y1=e,y1}var v1,C4;function Lq(){if(C4)return v1;C4=1;var e=Mq(),t=xae(),n=Oq(),s=1,r=2;function a(l,u,f,d,p,m){var x=f&s,y=l.length,b=u.length;if(y!=b&&!(x&&b>y))return!1;var v=m.get(l),w=m.get(u);if(v&&w)return v==u&&w==l;var S=-1,C=!0,k=f&r?new e:void 0;for(m.set(l,u),m.set(u,l);++S<y;){var _=l[S],R=u[S];if(d)var T=x?d(R,_,S,u,l,m):d(_,R,S,l,u,m);if(T!==void 0){if(T)continue;C=!1;break}if(k){if(!t(u,function(A,I){if(!n(k,I)&&(_===A||p(_,A,f,d,m)))return k.push(I)})){C=!1;break}}else if(!(_===R||p(_,R,f,d,m))){C=!1;break}}return m.delete(l),m.delete(u),C}return v1=a,v1}var b1,E4;function yae(){if(E4)return b1;E4=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r,a){s[++n]=[a,r]}),s}return b1=e,b1}var w1,R4;function Xk(){if(R4)return w1;R4=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r){s[++n]=r}),s}return w1=e,w1}var j1,A4;function vae(){if(A4)return j1;A4=1;var e=Pc(),t=kq(),n=Lc(),s=Lq(),r=yae(),a=Xk(),l=1,u=2,f="[object Boolean]",d="[object Date]",p="[object Error]",m="[object Map]",x="[object Number]",y="[object RegExp]",b="[object Set]",v="[object String]",w="[object Symbol]",S="[object ArrayBuffer]",C="[object DataView]",k=e?e.prototype:void 0,_=k?k.valueOf:void 0;function R(T,A,I,L,$,O,B){switch(I){case C:if(T.byteLength!=A.byteLength||T.byteOffset!=A.byteOffset)return!1;T=T.buffer,A=A.buffer;case S:return!(T.byteLength!=A.byteLength||!O(new t(T),new t(A)));case f:case d:case x:return n(+T,+A);case p:return T.name==A.name&&T.message==A.message;case y:case v:return T==A+"";case m:var H=r;case b:var P=L&l;if(H||(H=a),T.size!=A.size&&!P)return!1;var G=B.get(T);if(G)return G==A;L|=u,B.set(T,A);var q=s(H(T),H(A),L,$,O,B);return B.delete(T),q;case w:if(_)return _.call(T)==_.call(A)}return!1}return j1=R,j1}var S1,T4;function bae(){if(T4)return S1;T4=1;var e=Sq(),t=1,n=Object.prototype,s=n.hasOwnProperty;function r(a,l,u,f,d,p){var m=u&t,x=e(a),y=x.length,b=e(l),v=b.length;if(y!=v&&!m)return!1;for(var w=y;w--;){var S=x[w];if(!(m?S in l:s.call(l,S)))return!1}var C=p.get(a),k=p.get(l);if(C&&k)return C==l&&k==a;var _=!0;p.set(a,l),p.set(l,a);for(var R=m;++w<y;){S=x[w];var T=a[S],A=l[S];if(f)var I=m?f(A,T,S,l,a,p):f(T,A,S,a,l,p);if(!(I===void 0?T===A||d(T,A,u,f,p):I)){_=!1;break}R||(R=S=="constructor")}if(_&&!R){var L=a.constructor,$=l.constructor;L!=$&&"constructor"in a&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof $=="function"&&$ instanceof $)&&(_=!1)}return p.delete(a),p.delete(l),_}return S1=r,S1}var N1,I4;function wae(){if(I4)return N1;I4=1;var e=qg(),t=Lq(),n=vae(),s=bae(),r=Dc(),a=Wt(),l=$c(),u=jf(),f=1,d="[object Arguments]",p="[object Array]",m="[object Object]",x=Object.prototype,y=x.hasOwnProperty;function b(v,w,S,C,k,_){var R=a(v),T=a(w),A=R?p:r(v),I=T?p:r(w);A=A==d?m:A,I=I==d?m:I;var L=A==m,$=I==m,O=A==I;if(O&&l(v)){if(!l(w))return!1;R=!0,L=!1}if(O&&!L)return _||(_=new e),R||u(v)?t(v,w,S,C,k,_):n(v,w,A,S,C,k,_);if(!(S&f)){var B=L&&y.call(v,"__wrapped__"),H=$&&y.call(w,"__wrapped__");if(B||H){var P=B?v.value():v,G=H?w.value():w;return _||(_=new e),k(P,G,S,C,_)}}return O?(_||(_=new e),s(v,w,S,C,k,_)):!1}return N1=b,N1}var k1,M4;function Pq(){if(M4)return k1;M4=1;var e=wae(),t=hr();function n(s,r,a,l,u){return s===r?!0:s==null||r==null||!t(s)&&!t(r)?s!==s&&r!==r:e(s,r,a,l,n,u)}return k1=n,k1}var _1,O4;function jae(){if(O4)return _1;O4=1;var e=qg(),t=Pq(),n=1,s=2;function r(a,l,u,f){var d=u.length,p=d,m=!f;if(a==null)return!p;for(a=Object(a);d--;){var x=u[d];if(m&&x[2]?x[1]!==a[x[0]]:!(x[0]in a))return!1}for(;++d<p;){x=u[d];var y=x[0],b=a[y],v=x[1];if(m&&x[2]){if(b===void 0&&!(y in a))return!1}else{var w=new e;if(f)var S=f(b,v,y,a,l,w);if(!(S===void 0?t(v,b,n|s,f,w):S))return!1}}return!0}return _1=r,_1}var C1,L4;function $q(){if(L4)return C1;L4=1;var e=ks();function t(n){return n===n&&!e(n)}return C1=t,C1}var E1,P4;function Sae(){if(P4)return E1;P4=1;var e=$q(),t=wa();function n(s){for(var r=t(s),a=r.length;a--;){var l=r[a],u=s[l];r[a]=[l,u,e(u)]}return r}return E1=n,E1}var R1,$4;function Dq(){if($4)return R1;$4=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return R1=e,R1}var A1,D4;function Nae(){if(D4)return A1;D4=1;var e=jae(),t=Sae(),n=Dq();function s(r){var a=t(r);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===r||e(l,r,a)}}return A1=s,A1}var T1,q4;function qc(){if(q4)return T1;q4=1;var e=Mo(),t=hr(),n="[object Symbol]";function s(r){return typeof r=="symbol"||t(r)&&e(r)==n}return T1=s,T1}var I1,z4;function Zk(){if(z4)return I1;z4=1;var e=Wt(),t=qc(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function r(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return I1=r,I1}var M1,B4;function kae(){if(B4)return M1;B4=1;var e=zk(),t="Expected a function";function n(s,r){if(typeof s!="function"||r!=null&&typeof r!="function")throw new TypeError(t);var a=function(){var l=arguments,u=r?r.apply(this,l):l[0],f=a.cache;if(f.has(u))return f.get(u);var d=s.apply(this,l);return a.cache=f.set(u,d)||f,d};return a.cache=new(n.Cache||e),a}return n.Cache=e,M1=n,M1}var O1,F4;function _ae(){if(F4)return O1;F4=1;var e=kae(),t=500;function n(s){var r=e(s,function(l){return a.size===t&&a.clear(),l}),a=r.cache;return r}return O1=n,O1}var L1,H4;function Cae(){if(H4)return L1;H4=1;var e=_ae(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(r){var a=[];return r.charCodeAt(0)===46&&a.push(""),r.replace(t,function(l,u,f,d){a.push(f?d.replace(n,"$1"):u||l)}),a});return L1=s,L1}var P1,U4;function Kg(){if(U4)return P1;U4=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,a=Array(r);++s<r;)a[s]=n(t[s],s,t);return a}return P1=e,P1}var $1,V4;function Eae(){if(V4)return $1;V4=1;var e=Pc(),t=Kg(),n=Wt(),s=qc(),r=e?e.prototype:void 0,a=r?r.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return $1=l,$1}var D1,G4;function qq(){if(G4)return D1;G4=1;var e=Eae();function t(n){return n==null?"":e(n)}return D1=t,D1}var q1,K4;function Wg(){if(K4)return q1;K4=1;var e=Wt(),t=Zk(),n=Cae(),s=qq();function r(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return q1=r,q1}var z1,W4;function Sf(){if(W4)return z1;W4=1;var e=qc();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return z1=t,z1}var B1,Y4;function Yg(){if(Y4)return B1;Y4=1;var e=Wg(),t=Sf();function n(s,r){r=e(r,s);for(var a=0,l=r.length;s!=null&&a<l;)s=s[t(r[a++])];return a&&a==l?s:void 0}return B1=n,B1}var F1,Q4;function Rae(){if(Q4)return F1;Q4=1;var e=Yg();function t(n,s,r){var a=n==null?void 0:e(n,s);return a===void 0?r:a}return F1=t,F1}var H1,X4;function Aae(){if(X4)return H1;X4=1;function e(t,n){return t!=null&&n in Object(t)}return H1=e,H1}var U1,Z4;function zq(){if(Z4)return U1;Z4=1;var e=Wg(),t=wf(),n=Wt(),s=Fg(),r=Fk(),a=Sf();function l(u,f,d){f=e(f,u);for(var p=-1,m=f.length,x=!1;++p<m;){var y=a(f[p]);if(!(x=u!=null&&d(u,y)))break;u=u[y]}return x||++p!=m?x:(m=u==null?0:u.length,!!m&&r(m)&&s(y,m)&&(n(u)||t(u)))}return U1=l,U1}var V1,J4;function Bq(){if(J4)return V1;J4=1;var e=Aae(),t=zq();function n(s,r){return s!=null&&t(s,r,e)}return V1=n,V1}var G1,e5;function Tae(){if(e5)return G1;e5=1;var e=Pq(),t=Rae(),n=Bq(),s=Zk(),r=$q(),a=Dq(),l=Sf(),u=1,f=2;function d(p,m){return s(p)&&r(m)?a(l(p),m):function(x){var y=t(x,p);return y===void 0&&y===m?n(x,p):e(m,y,u|f)}}return G1=d,G1}var K1,t5;function Fq(){if(t5)return K1;t5=1;function e(t){return function(n){return n==null?void 0:n[t]}}return K1=e,K1}var W1,n5;function Iae(){if(n5)return W1;n5=1;var e=Yg();function t(n){return function(s){return e(s,n)}}return W1=t,W1}var Y1,s5;function Mae(){if(s5)return Y1;s5=1;var e=Fq(),t=Iae(),n=Zk(),s=Sf();function r(a){return n(a)?e(s(a)):t(a)}return Y1=r,Y1}var Q1,r5;function ni(){if(r5)return Q1;r5=1;var e=Nae(),t=Tae(),n=Po(),s=Wt(),r=Mae();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):r(l)}return Q1=a,Q1}var X1,i5;function Hq(){if(i5)return X1;i5=1;var e=vq(),t=pae(),n=ni(),s=Wt();function r(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return X1=r,X1}var Z1,a5;function Oae(){if(a5)return Z1;a5=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,r){return s!=null&&t.call(s,r)}return Z1=n,Z1}var J1,o5;function Uq(){if(o5)return J1;o5=1;var e=Oae(),t=zq();function n(s,r){return s!=null&&t(s,r,e)}return J1=n,J1}var ew,l5;function Lae(){if(l5)return ew;l5=1;var e=Uk(),t=Dc(),n=wf(),s=Wt(),r=ti(),a=$c(),l=Ug(),u=jf(),f="[object Map]",d="[object Set]",p=Object.prototype,m=p.hasOwnProperty;function x(y){if(y==null)return!0;if(r(y)&&(s(y)||typeof y=="string"||typeof y.splice=="function"||a(y)||u(y)||n(y)))return!y.length;var b=t(y);if(b==f||b==d)return!y.size;if(l(y))return!e(y).length;for(var v in y)if(m.call(y,v))return!1;return!0}return ew=x,ew}var tw,c5;function Vq(){if(c5)return tw;c5=1;function e(t){return t===void 0}return tw=e,tw}var nw,u5;function Gq(){if(u5)return nw;u5=1;var e=Gg(),t=ti();function n(s,r){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,f,d){l[++a]=r(u,f,d)}),l}return nw=n,nw}var sw,d5;function Kq(){if(d5)return sw;d5=1;var e=Kg(),t=ni(),n=Gq(),s=Wt();function r(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return sw=r,sw}var rw,f5;function Pae(){if(f5)return rw;f5=1;function e(t,n,s,r){var a=-1,l=t==null?0:t.length;for(r&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return rw=e,rw}var iw,h5;function $ae(){if(h5)return iw;h5=1;function e(t,n,s,r,a){return a(t,function(l,u,f){s=r?(r=!1,l):n(s,l,u,f)}),s}return iw=e,iw}var aw,p5;function Wq(){if(p5)return aw;p5=1;var e=Pae(),t=Gg(),n=ni(),s=$ae(),r=Wt();function a(l,u,f){var d=r(l)?e:s,p=arguments.length<3;return d(l,n(u,4),f,p,t)}return aw=a,aw}var ow,m5;function Dae(){if(m5)return ow;m5=1;var e=Mo(),t=Wt(),n=hr(),s="[object String]";function r(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return ow=r,ow}var lw,g5;function qae(){if(g5)return lw;g5=1;var e=Fq(),t=e("length");return lw=t,lw}var cw,x5;function zae(){if(x5)return cw;x5=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+r+a+"]");function f(d){return u.test(d)}return cw=f,cw}var uw,y5;function Bae(){if(y5)return uw;y5=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+r+"]",f="\\ud83c[\\udffb-\\udfff]",d="(?:"+u+"|"+f+")",p="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",b=d+"?",v="["+a+"]?",w="(?:"+y+"(?:"+[p,m,x].join("|")+")"+v+b+")*",S=v+b+w,C="(?:"+[p+u+"?",u,m,x,l].join("|")+")",k=RegExp(f+"(?="+f+")|"+C+S,"g");function _(R){for(var T=k.lastIndex=0;k.test(R);)++T;return T}return uw=_,uw}var dw,v5;function Fae(){if(v5)return dw;v5=1;var e=qae(),t=zae(),n=Bae();function s(r){return t(r)?n(r):e(r)}return dw=s,dw}var fw,b5;function Hae(){if(b5)return fw;b5=1;var e=Uk(),t=Dc(),n=ti(),s=Dae(),r=Fae(),a="[object Map]",l="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?r(f):f.length;var d=t(f);return d==a||d==l?f.size:e(f).length}return fw=u,fw}var hw,w5;function Uae(){if(w5)return hw;w5=1;var e=Bk(),t=Cq(),n=Qk(),s=ni(),r=Vg(),a=Wt(),l=$c(),u=vf(),f=ks(),d=jf();function p(m,x,y){var b=a(m),v=b||l(m)||d(m);if(x=s(x,4),y==null){var w=m&&m.constructor;v?y=b?new w:[]:f(m)?y=u(w)?t(r(m)):{}:y={}}return(v?e:n)(m,function(S,C,k){return x(y,S,C,k)}),y}return hw=p,hw}var pw,j5;function Vae(){if(j5)return pw;j5=1;var e=Pc(),t=wf(),n=Wt(),s=e?e.isConcatSpreadable:void 0;function r(a){return n(a)||t(a)||!!(s&&a&&a[s])}return pw=r,pw}var mw,S5;function Jk(){if(S5)return mw;S5=1;var e=Gk(),t=Vae();function n(s,r,a,l,u){var f=-1,d=s.length;for(a||(a=t),u||(u=[]);++f<d;){var p=s[f];r>0&&a(p)?r>1?n(p,r-1,a,l,u):e(u,p):l||(u[u.length]=p)}return u}return mw=n,mw}var gw,N5;function Gae(){if(N5)return gw;N5=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return gw=e,gw}var xw,k5;function Yq(){if(k5)return xw;k5=1;var e=Gae(),t=Math.max;function n(s,r,a){return r=t(r===void 0?s.length-1:r,0),function(){for(var l=arguments,u=-1,f=t(l.length-r,0),d=Array(f);++u<f;)d[u]=l[r+u];u=-1;for(var p=Array(r+1);++u<r;)p[u]=l[u];return p[r]=a(d),e(s,this,p)}}return xw=n,xw}var yw,_5;function Kae(){if(_5)return yw;_5=1;var e=Wk(),t=pq(),n=Po(),s=t?function(r,a){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return yw=s,yw}var vw,C5;function Wae(){if(C5)return vw;C5=1;var e=800,t=16,n=Date.now;function s(r){var a=0,l=0;return function(){var u=n(),f=t-(u-l);if(l=u,f>0){if(++a>=e)return arguments[0]}else a=0;return r.apply(void 0,arguments)}}return vw=s,vw}var bw,E5;function Qq(){if(E5)return bw;E5=1;var e=Kae(),t=Wae(),n=t(e);return bw=n,bw}var ww,R5;function Qg(){if(R5)return ww;R5=1;var e=Po(),t=Yq(),n=Qq();function s(r,a){return n(t(r,a,e),r+"")}return ww=s,ww}var jw,A5;function Xq(){if(A5)return jw;A5=1;function e(t,n,s,r){for(var a=t.length,l=s+(r?1:-1);r?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return jw=e,jw}var Sw,T5;function Yae(){if(T5)return Sw;T5=1;function e(t){return t!==t}return Sw=e,Sw}var Nw,I5;function Qae(){if(I5)return Nw;I5=1;function e(t,n,s){for(var r=s-1,a=t.length;++r<a;)if(t[r]===n)return r;return-1}return Nw=e,Nw}var kw,M5;function Xae(){if(M5)return kw;M5=1;var e=Xq(),t=Yae(),n=Qae();function s(r,a,l){return a===a?n(r,a,l):e(r,t,l)}return kw=s,kw}var _w,O5;function Zae(){if(O5)return _w;O5=1;var e=Xae();function t(n,s){var r=n==null?0:n.length;return!!r&&e(n,s,0)>-1}return _w=t,_w}var Cw,L5;function Jae(){if(L5)return Cw;L5=1;function e(t,n,s){for(var r=-1,a=t==null?0:t.length;++r<a;)if(s(n,t[r]))return!0;return!1}return Cw=e,Cw}var Ew,P5;function eoe(){if(P5)return Ew;P5=1;function e(){}return Ew=e,Ew}var Rw,$5;function toe(){if($5)return Rw;$5=1;var e=Nq(),t=eoe(),n=Xk(),s=1/0,r=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Rw=r,Rw}var Aw,D5;function noe(){if(D5)return Aw;D5=1;var e=Mq(),t=Zae(),n=Jae(),s=Oq(),r=toe(),a=Xk(),l=200;function u(f,d,p){var m=-1,x=t,y=f.length,b=!0,v=[],w=v;if(p)b=!1,x=n;else if(y>=l){var S=d?null:r(f);if(S)return a(S);b=!1,x=s,w=new e}else w=d?[]:v;e:for(;++m<y;){var C=f[m],k=d?d(C):C;if(C=p||C!==0?C:0,b&&k===k){for(var _=w.length;_--;)if(w[_]===k)continue e;d&&w.push(k),v.push(C)}else x(w,k,p)||(w!==v&&w.push(k),v.push(C))}return v}return Aw=u,Aw}var Tw,q5;function Zq(){if(q5)return Tw;q5=1;var e=ti(),t=hr();function n(s){return t(s)&&e(s)}return Tw=n,Tw}var Iw,z5;function soe(){if(z5)return Iw;z5=1;var e=Jk(),t=Qg(),n=noe(),s=Zq(),r=t(function(a){return n(e(a,1,s,!0))});return Iw=r,Iw}var Mw,B5;function roe(){if(B5)return Mw;B5=1;var e=Kg();function t(n,s){return e(s,function(r){return n[r]})}return Mw=t,Mw}var Ow,F5;function Jq(){if(F5)return Ow;F5=1;var e=roe(),t=wa();function n(s){return s==null?[]:e(s,t(s))}return Ow=n,Ow}var Lw,H5;function _s(){if(H5)return Lw;H5=1;var e;if(typeof Dk=="function")try{e={clone:dae(),constant:Wk(),each:Iq(),filter:Hq(),has:Uq(),isArray:Wt(),isEmpty:Lae(),isFunction:vf(),isUndefined:Vq(),keys:wa(),map:Kq(),reduce:Wq(),size:Hae(),transform:Uae(),union:soe(),values:Jq()}}catch{}return e||(e=window._),Lw=e,Lw}var Pw,U5;function e_(){if(U5)return Pw;U5=1;var e=_s();Pw=r;var t="\0",n="\0",s="";function r(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(p){return this._label=p,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return e.keys(this._nodes)},r.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._in[m])})},r.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._out[m])})},r.prototype.setNodes=function(p,m){var x=arguments,y=this;return e.each(p,function(b){x.length>1?y.setNode(b,m):y.setNode(b)}),this},r.prototype.setNode=function(p,m){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=m),this):(this._nodes[p]=arguments.length>1?m:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=n,this._children[p]={},this._children[n][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},r.prototype.node=function(p){return this._nodes[p]},r.prototype.hasNode=function(p){return e.has(this._nodes,p)},r.prototype.removeNode=function(p){var m=this;if(e.has(this._nodes,p)){var x=function(y){m.removeEdge(m._edgeObjs[y])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(y){m.setParent(y)}),delete this._children[p]),e.each(e.keys(this._in[p]),x),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),x),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},r.prototype.setParent=function(p,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var x=m;!e.isUndefined(x);x=this.parent(x))if(x===p)throw new Error("Setting "+m+" as parent of "+p+" would create a cycle");this.setNode(m)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=m,this._children[m][p]=!0,this},r.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},r.prototype.parent=function(p){if(this._isCompound){var m=this._parent[p];if(m!==n)return m}},r.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var m=this._children[p];if(m)return e.keys(m)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},r.prototype.predecessors=function(p){var m=this._preds[p];if(m)return e.keys(m)},r.prototype.successors=function(p){var m=this._sucs[p];if(m)return e.keys(m)},r.prototype.neighbors=function(p){var m=this.predecessors(p);if(m)return e.union(m,this.successors(p))},r.prototype.isLeaf=function(p){var m;return this.isDirected()?m=this.successors(p):m=this.neighbors(p),m.length===0},r.prototype.filterNodes=function(p){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var x=this;e.each(this._nodes,function(v,w){p(w)&&m.setNode(w,v)}),e.each(this._edgeObjs,function(v){m.hasNode(v.v)&&m.hasNode(v.w)&&m.setEdge(v,x.edge(v))});var y={};function b(v){var w=x.parent(v);return w===void 0||m.hasNode(w)?(y[v]=w,w):w in y?y[w]:b(w)}return this._isCompound&&e.each(m.nodes(),function(v){m.setParent(v,b(v))}),m},r.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return e.values(this._edgeObjs)},r.prototype.setPath=function(p,m){var x=this,y=arguments;return e.reduce(p,function(b,v){return y.length>1?x.setEdge(b,v,m):x.setEdge(b,v),v}),this},r.prototype.setEdge=function(){var p,m,x,y,b=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(p=v.v,m=v.w,x=v.name,arguments.length===2&&(y=arguments[1],b=!0)):(p=v,m=arguments[1],x=arguments[3],arguments.length>2&&(y=arguments[2],b=!0)),p=""+p,m=""+m,e.isUndefined(x)||(x=""+x);var w=u(this._isDirected,p,m,x);if(e.has(this._edgeLabels,w))return b&&(this._edgeLabels[w]=y),this;if(!e.isUndefined(x)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(m),this._edgeLabels[w]=b?y:this._defaultEdgeLabelFn(p,m,x);var S=f(this._isDirected,p,m,x);return p=S.v,m=S.w,Object.freeze(S),this._edgeObjs[w]=S,a(this._preds[m],p),a(this._sucs[p],m),this._in[m][w]=S,this._out[p][w]=S,this._edgeCount++,this},r.prototype.edge=function(p,m,x){var y=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,p,m,x);return this._edgeLabels[y]},r.prototype.hasEdge=function(p,m,x){var y=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,p,m,x);return e.has(this._edgeLabels,y)},r.prototype.removeEdge=function(p,m,x){var y=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,p,m,x),b=this._edgeObjs[y];return b&&(p=b.v,m=b.w,delete this._edgeLabels[y],delete this._edgeObjs[y],l(this._preds[m],p),l(this._sucs[p],m),delete this._in[m][y],delete this._out[p][y],this._edgeCount--),this},r.prototype.inEdges=function(p,m){var x=this._in[p];if(x){var y=e.values(x);return m?e.filter(y,function(b){return b.v===m}):y}},r.prototype.outEdges=function(p,m){var x=this._out[p];if(x){var y=e.values(x);return m?e.filter(y,function(b){return b.w===m}):y}},r.prototype.nodeEdges=function(p,m){var x=this.inEdges(p,m);if(x)return x.concat(this.outEdges(p,m))};function a(p,m){p[m]?p[m]++:p[m]=1}function l(p,m){--p[m]||delete p[m]}function u(p,m,x,y){var b=""+m,v=""+x;if(!p&&b>v){var w=b;b=v,v=w}return b+s+v+s+(e.isUndefined(y)?t:y)}function f(p,m,x,y){var b=""+m,v=""+x;if(!p&&b>v){var w=b;b=v,v=w}var S={v:b,w:v};return y&&(S.name=y),S}function d(p,m){return u(p,m.v,m.w,m.name)}return Pw}var $w,V5;function ioe(){return V5||(V5=1,$w="2.1.8"),$w}var Dw,G5;function aoe(){return G5||(G5=1,Dw={Graph:e_(),version:ioe()}),Dw}var qw,K5;function ooe(){if(K5)return qw;K5=1;var e=_s(),t=e_();qw={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:r(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var f=l.node(u),d=l.parent(u),p={v:u};return e.isUndefined(f)||(p.value=f),e.isUndefined(d)||(p.parent=d),p})}function r(l){return e.map(l.edges(),function(u){var f=l.edge(u),d={v:u.v,w:u.w};return e.isUndefined(u.name)||(d.name=u.name),e.isUndefined(f)||(d.value=f),d})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(l.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return qw}var zw,W5;function loe(){if(W5)return zw;W5=1;var e=_s();zw=t;function t(n){var s={},r=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&r.push(a)}),r}return zw}var Bw,Y5;function e9(){if(Y5)return Bw;Y5=1;var e=_s();Bw=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var a=this._arr,l=a.length;return r[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var r=this._keyIndices[n];if(s>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+s);this._arr[r].priority=s,this._decrease(r)},t.prototype._heapify=function(n){var s=this._arr,r=2*n,a=r+1,l=n;r<s.length&&(l=s[r].priority<s[l].priority?r:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,r=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<r));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var r=this._arr,a=this._keyIndices,l=r[n],u=r[s];r[n]=u,r[s]=l,a[u.key]=n,a[l.key]=s},Bw}var Fw,Q5;function t9(){if(Q5)return Fw;Q5=1;var e=_s(),t=e9();Fw=s;var n=e.constant(1);function s(a,l,u,f){return r(a,String(l),u||n,f||function(d){return a.outEdges(d)})}function r(a,l,u,f){var d={},p=new t,m,x,y=function(b){var v=b.v!==m?b.v:b.w,w=d[v],S=u(b),C=x.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+b+" Weight: "+S);C<w.distance&&(w.distance=C,w.predecessor=m,p.decrease(v,C))};for(a.nodes().forEach(function(b){var v=b===l?0:Number.POSITIVE_INFINITY;d[b]={distance:v},p.add(b,v)});p.size()>0&&(m=p.removeMin(),x=d[m],x.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(y);return d}return Fw}var Hw,X5;function coe(){if(X5)return Hw;X5=1;var e=t9(),t=_s();Hw=n;function n(s,r,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,r,a)},{})}return Hw}var Uw,Z5;function n9(){if(Z5)return Uw;Z5=1;var e=_s();Uw=t;function t(n){var s=0,r=[],a={},l=[];function u(f){var d=a[f]={onStack:!0,lowlink:s,index:s++};if(r.push(f),n.successors(f).forEach(function(x){e.has(a,x)?a[x].onStack&&(d.lowlink=Math.min(d.lowlink,a[x].index)):(u(x),d.lowlink=Math.min(d.lowlink,a[x].lowlink))}),d.lowlink===d.index){var p=[],m;do m=r.pop(),a[m].onStack=!1,p.push(m);while(f!==m);l.push(p)}}return n.nodes().forEach(function(f){e.has(a,f)||u(f)}),l}return Uw}var Vw,J5;function uoe(){if(J5)return Vw;J5=1;var e=_s(),t=n9();Vw=n;function n(s){return e.filter(t(s),function(r){return r.length>1||r.length===1&&s.hasEdge(r[0],r[0])})}return Vw}var Gw,eO;function doe(){if(eO)return Gw;eO=1;var e=_s();Gw=n;var t=e.constant(1);function n(r,a,l){return s(r,a||t,l||function(u){return r.outEdges(u)})}function s(r,a,l){var u={},f=r.nodes();return f.forEach(function(d){u[d]={},u[d][d]={distance:0},f.forEach(function(p){d!==p&&(u[d][p]={distance:Number.POSITIVE_INFINITY})}),l(d).forEach(function(p){var m=p.v===d?p.w:p.v,x=a(p);u[d][m]={distance:x,predecessor:d}})}),f.forEach(function(d){var p=u[d];f.forEach(function(m){var x=u[m];f.forEach(function(y){var b=x[d],v=p[y],w=x[y],S=b.distance+v.distance;S<w.distance&&(w.distance=S,w.predecessor=v.predecessor)})})}),u}return Gw}var Kw,tO;function s9(){if(tO)return Kw;tO=1;var e=_s();Kw=t,t.CycleException=n;function t(s){var r={},a={},l=[];function u(f){if(e.has(a,f))throw new n;e.has(r,f)||(a[f]=!0,r[f]=!0,e.each(s.predecessors(f),u),delete a[f],l.push(f))}if(e.each(s.sinks(),u),e.size(r)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Kw}var Ww,nO;function foe(){if(nO)return Ww;nO=1;var e=s9();Ww=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Ww}var Yw,sO;function r9(){if(sO)return Yw;sO=1;var e=_s();Yw=t;function t(s,r,a){e.isArray(r)||(r=[r]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(r,function(d){if(!s.hasNode(d))throw new Error("Graph does not have node: "+d);n(s,d,a==="post",f,l,u)}),u}function n(s,r,a,l,u,f){e.has(l,r)||(l[r]=!0,a||f.push(r),e.each(u(r),function(d){n(s,d,a,l,u,f)}),a&&f.push(r))}return Yw}var Qw,rO;function hoe(){if(rO)return Qw;rO=1;var e=r9();Qw=t;function t(n,s){return e(n,s,"post")}return Qw}var Xw,iO;function poe(){if(iO)return Xw;iO=1;var e=r9();Xw=t;function t(n,s){return e(n,s,"pre")}return Xw}var Zw,aO;function moe(){if(aO)return Zw;aO=1;var e=_s(),t=e_(),n=e9();Zw=s;function s(r,a){var l=new t,u={},f=new n,d;function p(x){var y=x.v===d?x.w:x.v,b=f.priority(y);if(b!==void 0){var v=a(x);v<b&&(u[y]=d,f.decrease(y,v))}}if(r.nodeCount()===0)return l;e.each(r.nodes(),function(x){f.add(x,Number.POSITIVE_INFINITY),l.setNode(x)}),f.decrease(r.nodes()[0],0);for(var m=!1;f.size()>0;){if(d=f.removeMin(),e.has(u,d))l.setEdge(d,u[d]);else{if(m)throw new Error("Input graph is not connected: "+r);m=!0}r.nodeEdges(d).forEach(p)}return l}return Zw}var Jw,oO;function goe(){return oO||(oO=1,Jw={components:loe(),dijkstra:t9(),dijkstraAll:coe(),findCycles:uoe(),floydWarshall:doe(),isAcyclic:foe(),postorder:hoe(),preorder:poe(),prim:moe(),tarjan:n9(),topsort:s9()}),Jw}var ej,lO;function xoe(){if(lO)return ej;lO=1;var e=aoe();return ej={Graph:e.Graph,json:ooe(),alg:goe(),version:e.version},ej}var tj,cO;function Bs(){if(cO)return tj;cO=1;var e;if(typeof Dk=="function")try{e=xoe()}catch{}return e||(e=window.graphlib),tj=e,tj}var nj,uO;function yoe(){if(uO)return nj;uO=1;var e=Rq(),t=1,n=4;function s(r){return e(r,t|n)}return nj=s,nj}var sj,dO;function Xg(){if(dO)return sj;dO=1;var e=Lc(),t=ti(),n=Fg(),s=ks();function r(a,l,u){if(!s(u))return!1;var f=typeof l;return(f=="number"?t(u)&&n(l,u.length):f=="string"&&l in u)?e(u[l],a):!1}return sj=r,sj}var rj,fO;function voe(){if(fO)return rj;fO=1;var e=Qg(),t=Lc(),n=Xg(),s=Lo(),r=Object.prototype,a=r.hasOwnProperty,l=e(function(u,f){u=Object(u);var d=-1,p=f.length,m=p>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(p=1);++d<p;)for(var x=f[d],y=s(x),b=-1,v=y.length;++b<v;){var w=y[b],S=u[w];(S===void 0||t(S,r[w])&&!a.call(u,w))&&(u[w]=x[w])}return u});return rj=l,rj}var ij,hO;function boe(){if(hO)return ij;hO=1;var e=ni(),t=ti(),n=wa();function s(r){return function(a,l,u){var f=Object(a);if(!t(a)){var d=e(l,3);a=n(a),l=function(m){return d(f[m],m,f)}}var p=r(a,l,u);return p>-1?f[d?a[p]:p]:void 0}}return ij=s,ij}var aj,pO;function woe(){if(pO)return aj;pO=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return aj=t,aj}var oj,mO;function joe(){if(mO)return oj;mO=1;var e=woe(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return oj=n,oj}var lj,gO;function Soe(){if(gO)return lj;gO=1;var e=joe(),t=ks(),n=qc(),s=NaN,r=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function f(d){if(typeof d=="number")return d;if(n(d))return s;if(t(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=t(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=e(d);var m=a.test(d);return m||l.test(d)?u(d.slice(2),m?2:8):r.test(d)?s:+d}return lj=f,lj}var cj,xO;function i9(){if(xO)return cj;xO=1;var e=Soe(),t=1/0,n=17976931348623157e292;function s(r){if(!r)return r===0?r:0;if(r=e(r),r===t||r===-t){var a=r<0?-1:1;return a*n}return r===r?r:0}return cj=s,cj}var uj,yO;function Noe(){if(yO)return uj;yO=1;var e=i9();function t(n){var s=e(n),r=s%1;return s===s?r?s-r:s:0}return uj=t,uj}var dj,vO;function koe(){if(vO)return dj;vO=1;var e=Xq(),t=ni(),n=Noe(),s=Math.max;function r(a,l,u){var f=a==null?0:a.length;if(!f)return-1;var d=u==null?0:n(u);return d<0&&(d=s(f+d,0)),e(a,t(l,3),d)}return dj=r,dj}var fj,bO;function _oe(){if(bO)return fj;bO=1;var e=boe(),t=koe(),n=e(t);return fj=n,fj}var hj,wO;function a9(){if(wO)return hj;wO=1;var e=Jk();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return hj=t,hj}var pj,jO;function Coe(){if(jO)return pj;jO=1;var e=Yk(),t=Aq(),n=Lo();function s(r,a){return r==null?r:e(r,t(a),n)}return pj=s,pj}var mj,SO;function Eoe(){if(SO)return mj;SO=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return mj=e,mj}var gj,NO;function Roe(){if(NO)return gj;NO=1;var e=zg(),t=Qk(),n=ni();function s(r,a){var l={};return a=n(a,3),t(r,function(u,f,d){e(l,f,a(u,f,d))}),l}return gj=s,gj}var xj,kO;function t_(){if(kO)return xj;kO=1;var e=qc();function t(n,s,r){for(var a=-1,l=n.length;++a<l;){var u=n[a],f=s(u);if(f!=null&&(d===void 0?f===f&&!e(f):r(f,d)))var d=f,p=u}return p}return xj=t,xj}var yj,_O;function Aoe(){if(_O)return yj;_O=1;function e(t,n){return t>n}return yj=e,yj}var vj,CO;function Toe(){if(CO)return vj;CO=1;var e=t_(),t=Aoe(),n=Po();function s(r){return r&&r.length?e(r,n,t):void 0}return vj=s,vj}var bj,EO;function o9(){if(EO)return bj;EO=1;var e=zg(),t=Lc();function n(s,r,a){(a!==void 0&&!t(s[r],a)||a===void 0&&!(r in s))&&e(s,r,a)}return bj=n,bj}var wj,RO;function Ioe(){if(RO)return wj;RO=1;var e=Mo(),t=Vg(),n=hr(),s="[object Object]",r=Function.prototype,a=Object.prototype,l=r.toString,u=a.hasOwnProperty,f=l.call(Object);function d(p){if(!n(p)||e(p)!=s)return!1;var m=t(p);if(m===null)return!0;var x=u.call(m,"constructor")&&m.constructor;return typeof x=="function"&&x instanceof x&&l.call(x)==f}return wj=d,wj}var jj,AO;function l9(){if(AO)return jj;AO=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return jj=e,jj}var Sj,TO;function Moe(){if(TO)return Sj;TO=1;var e=bf(),t=Lo();function n(s){return e(s,t(s))}return Sj=n,Sj}var Nj,IO;function Ooe(){if(IO)return Nj;IO=1;var e=o9(),t=xq(),n=_q(),s=yq(),r=Eq(),a=wf(),l=Wt(),u=Zq(),f=$c(),d=vf(),p=ks(),m=Ioe(),x=jf(),y=l9(),b=Moe();function v(w,S,C,k,_,R,T){var A=y(w,C),I=y(S,C),L=T.get(I);if(L){e(w,C,L);return}var $=R?R(A,I,C+"",w,S,T):void 0,O=$===void 0;if(O){var B=l(I),H=!B&&f(I),P=!B&&!H&&x(I);$=I,B||H||P?l(A)?$=A:u(A)?$=s(A):H?(O=!1,$=t(I,!0)):P?(O=!1,$=n(I,!0)):$=[]:m(I)||a(I)?($=A,a(A)?$=b(A):(!p(A)||d(A))&&($=r(I))):O=!1}O&&(T.set(I,$),_($,I,k,R,T),T.delete(I)),e(w,C,$)}return Nj=v,Nj}var kj,MO;function Loe(){if(MO)return kj;MO=1;var e=qg(),t=o9(),n=Yk(),s=Ooe(),r=ks(),a=Lo(),l=l9();function u(f,d,p,m,x){f!==d&&n(d,function(y,b){if(x||(x=new e),r(y))s(f,d,b,p,u,m,x);else{var v=m?m(l(f,b),y,b+"",f,d,x):void 0;v===void 0&&(v=y),t(f,b,v)}},a)}return kj=u,kj}var _j,OO;function Poe(){if(OO)return _j;OO=1;var e=Qg(),t=Xg();function n(s){return e(function(r,a){var l=-1,u=a.length,f=u>1?a[u-1]:void 0,d=u>2?a[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,d&&t(a[0],a[1],d)&&(f=u<3?void 0:f,u=1),r=Object(r);++l<u;){var p=a[l];p&&s(r,p,l,f)}return r})}return _j=n,_j}var Cj,LO;function $oe(){if(LO)return Cj;LO=1;var e=Loe(),t=Poe(),n=t(function(s,r,a){e(s,r,a)});return Cj=n,Cj}var Ej,PO;function c9(){if(PO)return Ej;PO=1;function e(t,n){return t<n}return Ej=e,Ej}var Rj,$O;function Doe(){if($O)return Rj;$O=1;var e=t_(),t=c9(),n=Po();function s(r){return r&&r.length?e(r,n,t):void 0}return Rj=s,Rj}var Aj,DO;function qoe(){if(DO)return Aj;DO=1;var e=t_(),t=ni(),n=c9();function s(r,a){return r&&r.length?e(r,t(a,2),n):void 0}return Aj=s,Aj}var Tj,qO;function zoe(){if(qO)return Tj;qO=1;var e=Us(),t=function(){return e.Date.now()};return Tj=t,Tj}var Ij,zO;function Boe(){if(zO)return Ij;zO=1;var e=Bg(),t=Wg(),n=Fg(),s=ks(),r=Sf();function a(l,u,f,d){if(!s(l))return l;u=t(u,l);for(var p=-1,m=u.length,x=m-1,y=l;y!=null&&++p<m;){var b=r(u[p]),v=f;if(b==="__proto__"||b==="constructor"||b==="prototype")return l;if(p!=x){var w=y[b];v=d?d(w,b,y):void 0,v===void 0&&(v=s(w)?w:n(u[p+1])?[]:{})}e(y,b,v),y=y[b]}return l}return Ij=a,Ij}var Mj,BO;function Foe(){if(BO)return Mj;BO=1;var e=Yg(),t=Boe(),n=Wg();function s(r,a,l){for(var u=-1,f=a.length,d={};++u<f;){var p=a[u],m=e(r,p);l(m,p)&&t(d,n(p,r),m)}return d}return Mj=s,Mj}var Oj,FO;function Hoe(){if(FO)return Oj;FO=1;var e=Foe(),t=Bq();function n(s,r){return e(s,r,function(a,l){return t(s,l)})}return Oj=n,Oj}var Lj,HO;function Uoe(){if(HO)return Lj;HO=1;var e=a9(),t=Yq(),n=Qq();function s(r){return n(t(r,void 0,e),r+"")}return Lj=s,Lj}var Pj,UO;function Voe(){if(UO)return Pj;UO=1;var e=Hoe(),t=Uoe(),n=t(function(s,r){return s==null?{}:e(s,r)});return Pj=n,Pj}var $j,VO;function Goe(){if(VO)return $j;VO=1;var e=Math.ceil,t=Math.max;function n(s,r,a,l){for(var u=-1,f=t(e((r-s)/(a||1)),0),d=Array(f);f--;)d[l?f:++u]=s,s+=a;return d}return $j=n,$j}var Dj,GO;function Koe(){if(GO)return Dj;GO=1;var e=Goe(),t=Xg(),n=i9();function s(r){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,r)}}return Dj=s,Dj}var qj,KO;function Woe(){if(KO)return qj;KO=1;var e=Koe(),t=e();return qj=t,qj}var zj,WO;function Yoe(){if(WO)return zj;WO=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return zj=e,zj}var Bj,YO;function Qoe(){if(YO)return Bj;YO=1;var e=qc();function t(n,s){if(n!==s){var r=n!==void 0,a=n===null,l=n===n,u=e(n),f=s!==void 0,d=s===null,p=s===s,m=e(s);if(!d&&!m&&!u&&n>s||u&&f&&p&&!d&&!m||a&&f&&p||!r&&p||!l)return 1;if(!a&&!u&&!m&&n<s||m&&r&&l&&!a&&!u||d&&r&&l||!f&&l||!p)return-1}return 0}return Bj=t,Bj}var Fj,QO;function Xoe(){if(QO)return Fj;QO=1;var e=Qoe();function t(n,s,r){for(var a=-1,l=n.criteria,u=s.criteria,f=l.length,d=r.length;++a<f;){var p=e(l[a],u[a]);if(p){if(a>=d)return p;var m=r[a];return p*(m=="desc"?-1:1)}}return n.index-s.index}return Fj=t,Fj}var Hj,XO;function Zoe(){if(XO)return Hj;XO=1;var e=Kg(),t=Yg(),n=ni(),s=Gq(),r=Yoe(),a=Hg(),l=Xoe(),u=Po(),f=Wt();function d(p,m,x){m.length?m=e(m,function(v){return f(v)?function(w){return t(w,v.length===1?v[0]:v)}:v}):m=[u];var y=-1;m=e(m,a(n));var b=s(p,function(v,w,S){var C=e(m,function(k){return k(v)});return{criteria:C,index:++y,value:v}});return r(b,function(v,w){return l(v,w,x)})}return Hj=d,Hj}var Uj,ZO;function Joe(){if(ZO)return Uj;ZO=1;var e=Jk(),t=Zoe(),n=Qg(),s=Xg(),r=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return Uj=r,Uj}var Vj,JO;function ele(){if(JO)return Vj;JO=1;var e=qq(),t=0;function n(s){var r=++t;return e(s)+r}return Vj=n,Vj}var Gj,eL;function tle(){if(eL)return Gj;eL=1;function e(t,n,s){for(var r=-1,a=t.length,l=n.length,u={};++r<a;){var f=r<l?n[r]:void 0;s(u,t[r],f)}return u}return Gj=e,Gj}var Kj,tL;function nle(){if(tL)return Kj;tL=1;var e=Bg(),t=tle();function n(s,r){return t(s||[],r||[],e)}return Kj=n,Kj}var Wj,nL;function Ct(){if(nL)return Wj;nL=1;var e;if(typeof Dk=="function")try{e={cloneDeep:yoe(),constant:Wk(),defaults:voe(),each:Iq(),filter:Hq(),find:_oe(),flatten:a9(),forEach:Tq(),forIn:Coe(),has:Uq(),isUndefined:Vq(),last:Eoe(),map:Kq(),mapValues:Roe(),max:Toe(),merge:$oe(),min:Doe(),minBy:qoe(),now:zoe(),pick:Voe(),range:Woe(),reduce:Wq(),sortBy:Joe(),uniqueId:ele(),values:Jq(),zipObject:nle()}}catch{}return e||(e=window._),Wj=e,Wj}var Yj,sL;function sle(){if(sL)return Yj;sL=1,Yj=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,r=s._prev;if(r!==s)return t(r),r},e.prototype.enqueue=function(s){var r=this._sentinel;s._prev&&s._next&&t(s),s._next=r._next,r._next._prev=s,r._next=s,s._prev=r},e.prototype.toString=function(){for(var s=[],r=this._sentinel,a=r._prev;a!==r;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,r){if(s!=="_next"&&s!=="_prev")return r}return Yj}var Qj,rL;function rle(){if(rL)return Qj;rL=1;var e=Ct(),t=Bs().Graph,n=sle();Qj=r;var s=e.constant(1);function r(d,p){if(d.nodeCount()<=1)return[];var m=u(d,p||s),x=a(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(x,function(y){return d.outEdges(y.v,y.w)}),!0)}function a(d,p,m){for(var x=[],y=p[p.length-1],b=p[0],v;d.nodeCount();){for(;v=b.dequeue();)l(d,p,m,v);for(;v=y.dequeue();)l(d,p,m,v);if(d.nodeCount()){for(var w=p.length-2;w>0;--w)if(v=p[w].dequeue(),v){x=x.concat(l(d,p,m,v,!0));break}}}return x}function l(d,p,m,x,y){var b=y?[]:void 0;return e.forEach(d.inEdges(x.v),function(v){var w=d.edge(v),S=d.node(v.v);y&&b.push({v:v.v,w:v.w}),S.out-=w,f(p,m,S)}),e.forEach(d.outEdges(x.v),function(v){var w=d.edge(v),S=v.w,C=d.node(S);C.in-=w,f(p,m,C)}),d.removeNode(x.v),b}function u(d,p){var m=new t,x=0,y=0;e.forEach(d.nodes(),function(w){m.setNode(w,{v:w,in:0,out:0})}),e.forEach(d.edges(),function(w){var S=m.edge(w.v,w.w)||0,C=p(w),k=S+C;m.setEdge(w.v,w.w,k),y=Math.max(y,m.node(w.v).out+=C),x=Math.max(x,m.node(w.w).in+=C)});var b=e.range(y+x+3).map(function(){return new n}),v=x+1;return e.forEach(m.nodes(),function(w){f(b,v,m.node(w))}),{graph:m,buckets:b,zeroIdx:v}}function f(d,p,m){m.out?m.in?d[m.out-m.in+p].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}return Qj}var Xj,iL;function ile(){if(iL)return Xj;iL=1;var e=Ct(),t=rle();Xj={run:n,undo:r};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(f){var d=a.edge(f);a.removeEdge(f),d.forwardName=f.name,d.reversed=!0,a.setEdge(f.w,f.v,d,e.uniqueId("rev"))});function u(f){return function(d){return f.edge(d).weight}}}function s(a){var l=[],u={},f={};function d(p){e.has(f,p)||(f[p]=!0,u[p]=!0,e.forEach(a.outEdges(p),function(m){e.has(u,m.w)?l.push(m):d(m.w)}),delete u[p])}return e.forEach(a.nodes(),d),l}function r(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var f=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,f)}})}return Xj}var Zj,aL;function Vn(){if(aL)return Zj;aL=1;var e=Ct(),t=Bs().Graph;Zj={addDummyNode:n,simplify:s,asNonCompoundGraph:r,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:f,normalizeRanks:d,removeEmptyRanks:p,addBorderNode:m,maxRank:x,partition:y,time:b,notime:v};function n(w,S,C,k){var _;do _=e.uniqueId(k);while(w.hasNode(_));return C.dummy=S,w.setNode(_,C),_}function s(w){var S=new t().setGraph(w.graph());return e.forEach(w.nodes(),function(C){S.setNode(C,w.node(C))}),e.forEach(w.edges(),function(C){var k=S.edge(C.v,C.w)||{weight:0,minlen:1},_=w.edge(C);S.setEdge(C.v,C.w,{weight:k.weight+_.weight,minlen:Math.max(k.minlen,_.minlen)})}),S}function r(w){var S=new t({multigraph:w.isMultigraph()}).setGraph(w.graph());return e.forEach(w.nodes(),function(C){w.children(C).length||S.setNode(C,w.node(C))}),e.forEach(w.edges(),function(C){S.setEdge(C,w.edge(C))}),S}function a(w){var S=e.map(w.nodes(),function(C){var k={};return e.forEach(w.outEdges(C),function(_){k[_.w]=(k[_.w]||0)+w.edge(_).weight}),k});return e.zipObject(w.nodes(),S)}function l(w){var S=e.map(w.nodes(),function(C){var k={};return e.forEach(w.inEdges(C),function(_){k[_.v]=(k[_.v]||0)+w.edge(_).weight}),k});return e.zipObject(w.nodes(),S)}function u(w,S){var C=w.x,k=w.y,_=S.x-C,R=S.y-k,T=w.width/2,A=w.height/2;if(!_&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var I,L;return Math.abs(R)*T>Math.abs(_)*A?(R<0&&(A=-A),I=A*_/R,L=A):(_<0&&(T=-T),I=T,L=T*R/_),{x:C+I,y:k+L}}function f(w){var S=e.map(e.range(x(w)+1),function(){return[]});return e.forEach(w.nodes(),function(C){var k=w.node(C),_=k.rank;e.isUndefined(_)||(S[_][k.order]=C)}),S}function d(w){var S=e.min(e.map(w.nodes(),function(C){return w.node(C).rank}));e.forEach(w.nodes(),function(C){var k=w.node(C);e.has(k,"rank")&&(k.rank-=S)})}function p(w){var S=e.min(e.map(w.nodes(),function(R){return w.node(R).rank})),C=[];e.forEach(w.nodes(),function(R){var T=w.node(R).rank-S;C[T]||(C[T]=[]),C[T].push(R)});var k=0,_=w.graph().nodeRankFactor;e.forEach(C,function(R,T){e.isUndefined(R)&&T%_!==0?--k:k&&e.forEach(R,function(A){w.node(A).rank+=k})})}function m(w,S,C,k){var _={width:0,height:0};return arguments.length>=4&&(_.rank=C,_.order=k),n(w,"border",_,S)}function x(w){return e.max(e.map(w.nodes(),function(S){var C=w.node(S).rank;if(!e.isUndefined(C))return C}))}function y(w,S){var C={lhs:[],rhs:[]};return e.forEach(w,function(k){S(k)?C.lhs.push(k):C.rhs.push(k)}),C}function b(w,S){var C=e.now();try{return S()}finally{console.log(w+" time: "+(e.now()-C)+"ms")}}function v(w,S){return S()}return Zj}var Jj,oL;function ale(){if(oL)return Jj;oL=1;var e=Ct(),t=Vn();Jj={run:n,undo:r};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,f=a.node(u).rank,d=l.w,p=a.node(d).rank,m=l.name,x=a.edge(l),y=x.labelRank;if(p!==f+1){a.removeEdge(l);var b,v,w;for(w=0,++f;f<p;++w,++f)x.points=[],v={width:0,height:0,edgeLabel:x,edgeObj:l,rank:f},b=t.addDummyNode(a,"edge",v,"_d"),f===y&&(v.width=x.width,v.height=x.height,v.dummy="edge-label",v.labelpos=x.labelpos),a.setEdge(u,b,{weight:x.weight},m),w===0&&a.graph().dummyChains.push(b),u=b;a.setEdge(u,d,{weight:x.weight},m)}}function r(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),f=u.edgeLabel,d;for(a.setEdge(u.edgeObj,f);u.dummy;)d=a.successors(l)[0],a.removeNode(l),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),l=d,u=a.node(l)})}return Jj}var eS,lL;function Lm(){if(lL)return eS;lL=1;var e=Ct();eS={longestPath:t,slack:n};function t(s){var r={};function a(l){var u=s.node(l);if(e.has(r,l))return u.rank;r[l]=!0;var f=e.min(e.map(s.outEdges(l),function(d){return a(d.w)-s.edge(d).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),a)}function n(s,r){return s.node(r.w).rank-s.node(r.v).rank-s.edge(r).minlen}return eS}var tS,cL;function u9(){if(cL)return tS;cL=1;var e=Ct(),t=Bs().Graph,n=Lm().slack;tS=s;function s(u){var f=new t({directed:!1}),d=u.nodes()[0],p=u.nodeCount();f.setNode(d,{});for(var m,x;r(f,u)<p;)m=a(f,u),x=f.hasNode(m.v)?n(u,m):-n(u,m),l(f,u,x);return f}function r(u,f){function d(p){e.forEach(f.nodeEdges(p),function(m){var x=m.v,y=p===x?m.w:x;!u.hasNode(y)&&!n(f,m)&&(u.setNode(y,{}),u.setEdge(p,y,{}),d(y))})}return e.forEach(u.nodes(),d),u.nodeCount()}function a(u,f){return e.minBy(f.edges(),function(d){if(u.hasNode(d.v)!==u.hasNode(d.w))return n(f,d)})}function l(u,f,d){e.forEach(u.nodes(),function(p){f.node(p).rank+=d})}return tS}var nS,uL;function ole(){if(uL)return nS;uL=1;var e=Ct(),t=u9(),n=Lm().slack,s=Lm().longestPath,r=Bs().alg.preorder,a=Bs().alg.postorder,l=Vn().simplify;nS=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=p,u.leaveEdge=y,u.enterEdge=b,u.exchangeEdges=v;function u(k){k=l(k),s(k);var _=t(k);m(_),f(_,k);for(var R,T;R=y(_);)T=b(_,k,R),v(_,k,R,T)}function f(k,_){var R=a(k,k.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(T){d(k,_,T)})}function d(k,_,R){var T=k.node(R),A=T.parent;k.edge(R,A).cutvalue=p(k,_,R)}function p(k,_,R){var T=k.node(R),A=T.parent,I=!0,L=_.edge(R,A),$=0;return L||(I=!1,L=_.edge(A,R)),$=L.weight,e.forEach(_.nodeEdges(R),function(O){var B=O.v===R,H=B?O.w:O.v;if(H!==A){var P=B===I,G=_.edge(O).weight;if($+=P?G:-G,S(k,R,H)){var q=k.edge(R,H).cutvalue;$+=P?-q:q}}}),$}function m(k,_){arguments.length<2&&(_=k.nodes()[0]),x(k,{},1,_)}function x(k,_,R,T,A){var I=R,L=k.node(T);return _[T]=!0,e.forEach(k.neighbors(T),function($){e.has(_,$)||(R=x(k,_,R,$,T))}),L.low=I,L.lim=R++,A?L.parent=A:delete L.parent,R}function y(k){return e.find(k.edges(),function(_){return k.edge(_).cutvalue<0})}function b(k,_,R){var T=R.v,A=R.w;_.hasEdge(T,A)||(T=R.w,A=R.v);var I=k.node(T),L=k.node(A),$=I,O=!1;I.lim>L.lim&&($=L,O=!0);var B=e.filter(_.edges(),function(H){return O===C(k,k.node(H.v),$)&&O!==C(k,k.node(H.w),$)});return e.minBy(B,function(H){return n(_,H)})}function v(k,_,R,T){var A=R.v,I=R.w;k.removeEdge(A,I),k.setEdge(T.v,T.w,{}),m(k),f(k,_),w(k,_)}function w(k,_){var R=e.find(k.nodes(),function(A){return!_.node(A).parent}),T=r(k,R);T=T.slice(1),e.forEach(T,function(A){var I=k.node(A).parent,L=_.edge(A,I),$=!1;L||(L=_.edge(I,A),$=!0),_.node(A).rank=_.node(I).rank+($?L.minlen:-L.minlen)})}function S(k,_,R){return k.hasEdge(_,R)}function C(k,_,R){return R.low<=_.lim&&_.lim<=R.lim}return nS}var sS,dL;function lle(){if(dL)return sS;dL=1;var e=Lm(),t=e.longestPath,n=u9(),s=ole();sS=r;function r(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":l(f);break;case"longest-path":a(f);break;default:u(f)}}var a=t;function l(f){t(f),n(f)}function u(f){s(f)}return sS}var rS,fL;function cle(){if(fL)return rS;fL=1;var e=Ct();rS=t;function t(r){var a=s(r);e.forEach(r.graph().dummyChains,function(l){for(var u=r.node(l),f=u.edgeObj,d=n(r,a,f.v,f.w),p=d.path,m=d.lca,x=0,y=p[x],b=!0;l!==f.w;){if(u=r.node(l),b){for(;(y=p[x])!==m&&r.node(y).maxRank<u.rank;)x++;y===m&&(b=!1)}if(!b){for(;x<p.length-1&&r.node(y=p[x+1]).minRank<=u.rank;)x++;y=p[x]}r.setParent(l,y),l=r.successors(l)[0]}})}function n(r,a,l,u){var f=[],d=[],p=Math.min(a[l].low,a[u].low),m=Math.max(a[l].lim,a[u].lim),x,y;x=l;do x=r.parent(x),f.push(x);while(x&&(a[x].low>p||m>a[x].lim));for(y=x,x=u;(x=r.parent(x))!==y;)d.push(x);return{path:f.concat(d.reverse()),lca:y}}function s(r){var a={},l=0;function u(f){var d=l;e.forEach(r.children(f),u),a[f]={low:d,lim:l++}}return e.forEach(r.children(),u),a}return rS}var iS,hL;function ule(){if(hL)return iS;hL=1;var e=Ct(),t=Vn();iS={run:n,cleanup:l};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),d=r(u),p=e.max(e.values(d))-1,m=2*p+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(y){u.edge(y).minlen*=m});var x=a(u)+1;e.forEach(u.children(),function(y){s(u,f,m,x,p,d,y)}),u.graph().nodeRankFactor=m}function s(u,f,d,p,m,x,y){var b=u.children(y);if(!b.length){y!==f&&u.setEdge(f,y,{weight:0,minlen:d});return}var v=t.addBorderNode(u,"_bt"),w=t.addBorderNode(u,"_bb"),S=u.node(y);u.setParent(v,y),S.borderTop=v,u.setParent(w,y),S.borderBottom=w,e.forEach(b,function(C){s(u,f,d,p,m,x,C);var k=u.node(C),_=k.borderTop?k.borderTop:C,R=k.borderBottom?k.borderBottom:C,T=k.borderTop?p:2*p,A=_!==R?1:m-x[y]+1;u.setEdge(v,_,{weight:T,minlen:A,nestingEdge:!0}),u.setEdge(R,w,{weight:T,minlen:A,nestingEdge:!0})}),u.parent(y)||u.setEdge(f,v,{weight:0,minlen:m+x[y]})}function r(u){var f={};function d(p,m){var x=u.children(p);x&&x.length&&e.forEach(x,function(y){d(y,m+1)}),f[p]=m}return e.forEach(u.children(),function(p){d(p,1)}),f}function a(u){return e.reduce(u.edges(),function(f,d){return f+u.edge(d).weight},0)}function l(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(d){var p=u.edge(d);p.nestingEdge&&u.removeEdge(d)})}return iS}var aS,pL;function dle(){if(pL)return aS;pL=1;var e=Ct(),t=Vn();aS=n;function n(r){function a(l){var u=r.children(l),f=r.node(l);if(u.length&&e.forEach(u,a),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var d=f.minRank,p=f.maxRank+1;d<p;++d)s(r,"borderLeft","_bl",l,f,d),s(r,"borderRight","_br",l,f,d)}}e.forEach(r.children(),a)}function s(r,a,l,u,f,d){var p={width:0,height:0,rank:d,borderType:a},m=f[a][d-1],x=t.addDummyNode(r,"border",p,l);f[a][d]=x,r.setParent(x,u),m&&r.setEdge(m,x,{weight:1})}return aS}var oS,mL;function fle(){if(mL)return oS;mL=1;var e=Ct();oS={adjust:t,undo:n};function t(d){var p=d.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&s(d)}function n(d){var p=d.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&a(d),(p==="lr"||p==="rl")&&(u(d),s(d))}function s(d){e.forEach(d.nodes(),function(p){r(d.node(p))}),e.forEach(d.edges(),function(p){r(d.edge(p))})}function r(d){var p=d.width;d.width=d.height,d.height=p}function a(d){e.forEach(d.nodes(),function(p){l(d.node(p))}),e.forEach(d.edges(),function(p){var m=d.edge(p);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(d){d.y=-d.y}function u(d){e.forEach(d.nodes(),function(p){f(d.node(p))}),e.forEach(d.edges(),function(p){var m=d.edge(p);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(d){var p=d.x;d.x=d.y,d.y=p}return oS}var lS,gL;function hle(){if(gL)return lS;gL=1;var e=Ct();lS=t;function t(n){var s={},r=e.filter(n.nodes(),function(d){return!n.children(d).length}),a=e.max(e.map(r,function(d){return n.node(d).rank})),l=e.map(e.range(a+1),function(){return[]});function u(d){if(!e.has(s,d)){s[d]=!0;var p=n.node(d);l[p.rank].push(d),e.forEach(n.successors(d),u)}}var f=e.sortBy(r,function(d){return n.node(d).rank});return e.forEach(f,u),l}return lS}var cS,xL;function ple(){if(xL)return cS;xL=1;var e=Ct();cS=t;function t(s,r){for(var a=0,l=1;l<r.length;++l)a+=n(s,r[l-1],r[l]);return a}function n(s,r,a){for(var l=e.zipObject(a,e.map(a,function(x,y){return y})),u=e.flatten(e.map(r,function(x){return e.sortBy(e.map(s.outEdges(x),function(y){return{pos:l[y.w],weight:s.edge(y).weight}}),"pos")}),!0),f=1;f<a.length;)f<<=1;var d=2*f-1;f-=1;var p=e.map(new Array(d),function(){return 0}),m=0;return e.forEach(u.forEach(function(x){var y=x.pos+f;p[y]+=x.weight;for(var b=0;y>0;)y%2&&(b+=p[y+1]),y=y-1>>1,p[y]+=x.weight;m+=x.weight*b})),m}return cS}var uS,yL;function mle(){if(yL)return uS;yL=1;var e=Ct();uS=t;function t(n,s){return e.map(s,function(r){var a=n.inEdges(r);if(a.length){var l=e.reduce(a,function(u,f){var d=n.edge(f),p=n.node(f.v);return{sum:u.sum+d.weight*p.order,weight:u.weight+d.weight}},{sum:0,weight:0});return{v:r,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:r}})}return uS}var dS,vL;function gle(){if(vL)return dS;vL=1;var e=Ct();dS=t;function t(r,a){var l={};e.forEach(r,function(f,d){var p=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:d};e.isUndefined(f.barycenter)||(p.barycenter=f.barycenter,p.weight=f.weight)}),e.forEach(a.edges(),function(f){var d=l[f.v],p=l[f.w];!e.isUndefined(d)&&!e.isUndefined(p)&&(p.indegree++,d.out.push(l[f.w]))});var u=e.filter(l,function(f){return!f.indegree});return n(u)}function n(r){var a=[];function l(d){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(d.barycenter)||p.barycenter>=d.barycenter)&&s(d,p)}}function u(d){return function(p){p.in.push(d),--p.indegree===0&&r.push(p)}}for(;r.length;){var f=r.pop();a.push(f),e.forEach(f.in.reverse(),l(f)),e.forEach(f.out,u(f))}return e.map(e.filter(a,function(d){return!d.merged}),function(d){return e.pick(d,["vs","i","barycenter","weight"])})}function s(r,a){var l=0,u=0;r.weight&&(l+=r.barycenter*r.weight,u+=r.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),r.vs=a.vs.concat(r.vs),r.barycenter=l/u,r.weight=u,r.i=Math.min(a.i,r.i),a.merged=!0}return dS}var fS,bL;function xle(){if(bL)return fS;bL=1;var e=Ct(),t=Vn();fS=n;function n(a,l){var u=t.partition(a,function(v){return e.has(v,"barycenter")}),f=u.lhs,d=e.sortBy(u.rhs,function(v){return-v.i}),p=[],m=0,x=0,y=0;f.sort(r(!!l)),y=s(p,d,y),e.forEach(f,function(v){y+=v.vs.length,p.push(v.vs),m+=v.barycenter*v.weight,x+=v.weight,y=s(p,d,y)});var b={vs:e.flatten(p,!0)};return x&&(b.barycenter=m/x,b.weight=x),b}function s(a,l,u){for(var f;l.length&&(f=e.last(l)).i<=u;)l.pop(),a.push(f.vs),u++;return u}function r(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return fS}var hS,wL;function yle(){if(wL)return hS;wL=1;var e=Ct(),t=mle(),n=gle(),s=xle();hS=r;function r(u,f,d,p){var m=u.children(f),x=u.node(f),y=x?x.borderLeft:void 0,b=x?x.borderRight:void 0,v={};y&&(m=e.filter(m,function(R){return R!==y&&R!==b}));var w=t(u,m);e.forEach(w,function(R){if(u.children(R.v).length){var T=r(u,R.v,d,p);v[R.v]=T,e.has(T,"barycenter")&&l(R,T)}});var S=n(w,d);a(S,v);var C=s(S,p);if(y&&(C.vs=e.flatten([y,C.vs,b],!0),u.predecessors(y).length)){var k=u.node(u.predecessors(y)[0]),_=u.node(u.predecessors(b)[0]);e.has(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+k.order+_.order)/(C.weight+2),C.weight+=2}return C}function a(u,f){e.forEach(u,function(d){d.vs=e.flatten(d.vs.map(function(p){return f[p]?f[p].vs:p}),!0)})}function l(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return hS}var pS,jL;function vle(){if(jL)return pS;jL=1;var e=Ct(),t=Bs().Graph;pS=n;function n(r,a,l){var u=s(r),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(d){return r.node(d)});return e.forEach(r.nodes(),function(d){var p=r.node(d),m=r.parent(d);(p.rank===a||p.minRank<=a&&a<=p.maxRank)&&(f.setNode(d),f.setParent(d,m||u),e.forEach(r[l](d),function(x){var y=x.v===d?x.w:x.v,b=f.edge(y,d),v=e.isUndefined(b)?0:b.weight;f.setEdge(y,d,{weight:r.edge(x).weight+v})}),e.has(p,"minRank")&&f.setNode(d,{borderLeft:p.borderLeft[a],borderRight:p.borderRight[a]}))}),f}function s(r){for(var a;r.hasNode(a=e.uniqueId("_root")););return a}return pS}var mS,SL;function ble(){if(SL)return mS;SL=1;var e=Ct();mS=t;function t(n,s,r){var a={},l;e.forEach(r,function(u){for(var f=n.parent(u),d,p;f;){if(d=n.parent(f),d?(p=a[d],a[d]=f):(p=l,l=f),p&&p!==f){s.setEdge(p,f);return}f=d}})}return mS}var gS,NL;function wle(){if(NL)return gS;NL=1;var e=Ct(),t=hle(),n=ple(),s=yle(),r=vle(),a=ble(),l=Bs().Graph,u=Vn();gS=f;function f(x){var y=u.maxRank(x),b=d(x,e.range(1,y+1),"inEdges"),v=d(x,e.range(y-1,-1,-1),"outEdges"),w=t(x);m(x,w);for(var S=Number.POSITIVE_INFINITY,C,k=0,_=0;_<4;++k,++_){p(k%2?b:v,k%4>=2),w=u.buildLayerMatrix(x);var R=n(x,w);R<S&&(_=0,C=e.cloneDeep(w),S=R)}m(x,C)}function d(x,y,b){return e.map(y,function(v){return r(x,v,b)})}function p(x,y){var b=new l;e.forEach(x,function(v){var w=v.graph().root,S=s(v,w,b,y);e.forEach(S.vs,function(C,k){v.node(C).order=k}),a(v,b,S.vs)})}function m(x,y){e.forEach(y,function(b){e.forEach(b,function(v,w){x.node(v).order=w})})}return gS}var xS,kL;function jle(){if(kL)return xS;kL=1;var e=Ct(),t=Bs().Graph,n=Vn();xS={positionX:b,findType1Conflicts:s,findType2Conflicts:r,addConflict:l,hasConflict:u,verticalAlignment:f,horizontalCompaction:d,alignCoordinates:x,findSmallestWidthAlignment:m,balance:y};function s(S,C){var k={};function _(R,T){var A=0,I=0,L=R.length,$=e.last(T);return e.forEach(T,function(O,B){var H=a(S,O),P=H?S.node(H).order:L;(H||O===$)&&(e.forEach(T.slice(I,B+1),function(G){e.forEach(S.predecessors(G),function(q){var V=S.node(q),K=V.order;(K<A||P<K)&&!(V.dummy&&S.node(G).dummy)&&l(k,q,G)})}),I=B+1,A=P)}),T}return e.reduce(C,_),k}function r(S,C){var k={};function _(T,A,I,L,$){var O;e.forEach(e.range(A,I),function(B){O=T[B],S.node(O).dummy&&e.forEach(S.predecessors(O),function(H){var P=S.node(H);P.dummy&&(P.order<L||P.order>$)&&l(k,H,O)})})}function R(T,A){var I=-1,L,$=0;return e.forEach(A,function(O,B){if(S.node(O).dummy==="border"){var H=S.predecessors(O);H.length&&(L=S.node(H[0]).order,_(A,$,B,I,L),$=B,I=L)}_(A,$,A.length,L,T.length)}),A}return e.reduce(C,R),k}function a(S,C){if(S.node(C).dummy)return e.find(S.predecessors(C),function(k){return S.node(k).dummy})}function l(S,C,k){if(C>k){var _=C;C=k,k=_}var R=S[C];R||(S[C]=R={}),R[k]=!0}function u(S,C,k){if(C>k){var _=C;C=k,k=_}return e.has(S[C],k)}function f(S,C,k,_){var R={},T={},A={};return e.forEach(C,function(I){e.forEach(I,function(L,$){R[L]=L,T[L]=L,A[L]=$})}),e.forEach(C,function(I){var L=-1;e.forEach(I,function($){var O=_($);if(O.length){O=e.sortBy(O,function(q){return A[q]});for(var B=(O.length-1)/2,H=Math.floor(B),P=Math.ceil(B);H<=P;++H){var G=O[H];T[$]===$&&L<A[G]&&!u(k,$,G)&&(T[G]=$,T[$]=R[$]=R[G],L=A[G])}}})}),{root:R,align:T}}function d(S,C,k,_,R){var T={},A=p(S,C,k,R),I=R?"borderLeft":"borderRight";function L(B,H){for(var P=A.nodes(),G=P.pop(),q={};G;)q[G]?B(G):(q[G]=!0,P.push(G),P=P.concat(H(G))),G=P.pop()}function $(B){T[B]=A.inEdges(B).reduce(function(H,P){return Math.max(H,T[P.v]+A.edge(P))},0)}function O(B){var H=A.outEdges(B).reduce(function(G,q){return Math.min(G,T[q.w]-A.edge(q))},Number.POSITIVE_INFINITY),P=S.node(B);H!==Number.POSITIVE_INFINITY&&P.borderType!==I&&(T[B]=Math.max(T[B],H))}return L($,A.predecessors.bind(A)),L(O,A.successors.bind(A)),e.forEach(_,function(B){T[B]=T[k[B]]}),T}function p(S,C,k,_){var R=new t,T=S.graph(),A=v(T.nodesep,T.edgesep,_);return e.forEach(C,function(I){var L;e.forEach(I,function($){var O=k[$];if(R.setNode(O),L){var B=k[L],H=R.edge(B,O);R.setEdge(B,O,Math.max(A(S,$,L),H||0))}L=$})}),R}function m(S,C){return e.minBy(e.values(C),function(k){var _=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(k,function(T,A){var I=w(S,A)/2;_=Math.max(T+I,_),R=Math.min(T-I,R)}),_-R})}function x(S,C){var k=e.values(C),_=e.min(k),R=e.max(k);e.forEach(["u","d"],function(T){e.forEach(["l","r"],function(A){var I=T+A,L=S[I],$;if(L!==C){var O=e.values(L);$=A==="l"?_-e.min(O):R-e.max(O),$&&(S[I]=e.mapValues(L,function(B){return B+$}))}})})}function y(S,C){return e.mapValues(S.ul,function(k,_){if(C)return S[C.toLowerCase()][_];var R=e.sortBy(e.map(S,_));return(R[1]+R[2])/2})}function b(S){var C=n.buildLayerMatrix(S),k=e.merge(s(S,C),r(S,C)),_={},R;e.forEach(["u","d"],function(A){R=A==="u"?C:e.values(C).reverse(),e.forEach(["l","r"],function(I){I==="r"&&(R=e.map(R,function(B){return e.values(B).reverse()}));var L=(A==="u"?S.predecessors:S.successors).bind(S),$=f(S,R,k,L),O=d(S,R,$.root,$.align,I==="r");I==="r"&&(O=e.mapValues(O,function(B){return-B})),_[A+I]=O})});var T=m(S,_);return x(_,T),y(_,S.graph().align)}function v(S,C,k){return function(_,R,T){var A=_.node(R),I=_.node(T),L=0,$;if(L+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":$=-A.width/2;break;case"r":$=A.width/2;break}if($&&(L+=k?$:-$),$=0,L+=(A.dummy?C:S)/2,L+=(I.dummy?C:S)/2,L+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":$=I.width/2;break;case"r":$=-I.width/2;break}return $&&(L+=k?$:-$),$=0,L}}function w(S,C){return S.node(C).width}return xS}var yS,_L;function Sle(){if(_L)return yS;_L=1;var e=Ct(),t=Vn(),n=jle().positionX;yS=s;function s(a){a=t.asNonCompoundGraph(a),r(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function r(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,f=0;e.forEach(l,function(d){var p=e.max(e.map(d,function(m){return a.node(m).height}));e.forEach(d,function(m){a.node(m).y=f+p/2}),f+=p+u})}return yS}var vS,CL;function Nle(){if(CL)return vS;CL=1;var e=Ct(),t=ile(),n=ale(),s=lle(),r=Vn().normalizeRanks,a=cle(),l=Vn().removeEmptyRanks,u=ule(),f=dle(),d=fle(),p=wle(),m=Sle(),x=Vn(),y=Bs().Graph;vS=b;function b(U,Q){var X=Q&&Q.debugTiming?x.time:x.notime;X("layout",function(){var se=X(" buildLayoutGraph",function(){return L(U)});X(" runLayout",function(){v(se,X)}),X(" updateInputGraph",function(){w(U,se)})})}function v(U,Q){Q(" makeSpaceForEdgeLabels",function(){$(U)}),Q(" removeSelfEdges",function(){Y(U)}),Q(" acyclic",function(){t.run(U)}),Q(" nestingGraph.run",function(){u.run(U)}),Q(" rank",function(){s(x.asNonCompoundGraph(U))}),Q(" injectEdgeLabelProxies",function(){O(U)}),Q(" removeEmptyRanks",function(){l(U)}),Q(" nestingGraph.cleanup",function(){u.cleanup(U)}),Q(" normalizeRanks",function(){r(U)}),Q(" assignRankMinMax",function(){B(U)}),Q(" removeEdgeLabelProxies",function(){H(U)}),Q(" normalize.run",function(){n.run(U)}),Q(" parentDummyChains",function(){a(U)}),Q(" addBorderSegments",function(){f(U)}),Q(" order",function(){p(U)}),Q(" insertSelfEdges",function(){J(U)}),Q(" adjustCoordinateSystem",function(){d.adjust(U)}),Q(" position",function(){m(U)}),Q(" positionSelfEdges",function(){D(U)}),Q(" removeBorderNodes",function(){K(U)}),Q(" normalize.undo",function(){n.undo(U)}),Q(" fixupEdgeLabelCoords",function(){q(U)}),Q(" undoCoordinateSystem",function(){d.undo(U)}),Q(" translateGraph",function(){P(U)}),Q(" assignNodeIntersects",function(){G(U)}),Q(" reversePoints",function(){V(U)}),Q(" acyclic.undo",function(){t.undo(U)})}function w(U,Q){e.forEach(U.nodes(),function(X){var se=U.node(X),re=Q.node(X);se&&(se.x=re.x,se.y=re.y,Q.children(X).length&&(se.width=re.width,se.height=re.height))}),e.forEach(U.edges(),function(X){var se=U.edge(X),re=Q.edge(X);se.points=re.points,e.has(re,"x")&&(se.x=re.x,se.y=re.y)}),U.graph().width=Q.graph().width,U.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},k=["acyclicer","ranker","rankdir","align"],_=["width","height"],R={width:0,height:0},T=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function L(U){var Q=new y({multigraph:!0,compound:!0}),X=te(U.graph());return Q.setGraph(e.merge({},C,F(X,S),e.pick(X,k))),e.forEach(U.nodes(),function(se){var re=te(U.node(se));Q.setNode(se,e.defaults(F(re,_),R)),Q.setParent(se,U.parent(se))}),e.forEach(U.edges(),function(se){var re=te(U.edge(se));Q.setEdge(se,e.merge({},A,F(re,T),e.pick(re,I)))}),Q}function $(U){var Q=U.graph();Q.ranksep/=2,e.forEach(U.edges(),function(X){var se=U.edge(X);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function O(U){e.forEach(U.edges(),function(Q){var X=U.edge(Q);if(X.width&&X.height){var se=U.node(Q.v),re=U.node(Q.w),ce={rank:(re.rank-se.rank)/2+se.rank,e:Q};x.addDummyNode(U,"edge-proxy",ce,"_ep")}})}function B(U){var Q=0;e.forEach(U.nodes(),function(X){var se=U.node(X);se.borderTop&&(se.minRank=U.node(se.borderTop).rank,se.maxRank=U.node(se.borderBottom).rank,Q=e.max(Q,se.maxRank))}),U.graph().maxRank=Q}function H(U){e.forEach(U.nodes(),function(Q){var X=U.node(Q);X.dummy==="edge-proxy"&&(U.edge(X.e).labelRank=X.rank,U.removeNode(Q))})}function P(U){var Q=Number.POSITIVE_INFINITY,X=0,se=Number.POSITIVE_INFINITY,re=0,ce=U.graph(),me=ce.marginx||0,ge=ce.marginy||0;function ve(xe){var je=xe.x,Se=xe.y,$e=xe.width,Re=xe.height;Q=Math.min(Q,je-$e/2),X=Math.max(X,je+$e/2),se=Math.min(se,Se-Re/2),re=Math.max(re,Se+Re/2)}e.forEach(U.nodes(),function(xe){ve(U.node(xe))}),e.forEach(U.edges(),function(xe){var je=U.edge(xe);e.has(je,"x")&&ve(je)}),Q-=me,se-=ge,e.forEach(U.nodes(),function(xe){var je=U.node(xe);je.x-=Q,je.y-=se}),e.forEach(U.edges(),function(xe){var je=U.edge(xe);e.forEach(je.points,function(Se){Se.x-=Q,Se.y-=se}),e.has(je,"x")&&(je.x-=Q),e.has(je,"y")&&(je.y-=se)}),ce.width=X-Q+me,ce.height=re-se+ge}function G(U){e.forEach(U.edges(),function(Q){var X=U.edge(Q),se=U.node(Q.v),re=U.node(Q.w),ce,me;X.points?(ce=X.points[0],me=X.points[X.points.length-1]):(X.points=[],ce=re,me=se),X.points.unshift(x.intersectRect(se,ce)),X.points.push(x.intersectRect(re,me))})}function q(U){e.forEach(U.edges(),function(Q){var X=U.edge(Q);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function V(U){e.forEach(U.edges(),function(Q){var X=U.edge(Q);X.reversed&&X.points.reverse()})}function K(U){e.forEach(U.nodes(),function(Q){if(U.children(Q).length){var X=U.node(Q),se=U.node(X.borderTop),re=U.node(X.borderBottom),ce=U.node(e.last(X.borderLeft)),me=U.node(e.last(X.borderRight));X.width=Math.abs(me.x-ce.x),X.height=Math.abs(re.y-se.y),X.x=ce.x+X.width/2,X.y=se.y+X.height/2}}),e.forEach(U.nodes(),function(Q){U.node(Q).dummy==="border"&&U.removeNode(Q)})}function Y(U){e.forEach(U.edges(),function(Q){if(Q.v===Q.w){var X=U.node(Q.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:Q,label:U.edge(Q)}),U.removeEdge(Q)}})}function J(U){var Q=x.buildLayerMatrix(U);e.forEach(Q,function(X){var se=0;e.forEach(X,function(re,ce){var me=U.node(re);me.order=ce+se,e.forEach(me.selfEdges,function(ge){x.addDummyNode(U,"selfedge",{width:ge.label.width,height:ge.label.height,rank:me.rank,order:ce+ ++se,e:ge.e,label:ge.label},"_se")}),delete me.selfEdges})})}function D(U){e.forEach(U.nodes(),function(Q){var X=U.node(Q);if(X.dummy==="selfedge"){var se=U.node(X.e.v),re=se.x+se.width/2,ce=se.y,me=X.x-re,ge=se.height/2;U.setEdge(X.e,X.label),U.removeNode(Q),X.label.points=[{x:re+2*me/3,y:ce-ge},{x:re+5*me/6,y:ce-ge},{x:re+me,y:ce},{x:re+5*me/6,y:ce+ge},{x:re+2*me/3,y:ce+ge}],X.label.x=X.x,X.label.y=X.y}})}function F(U,Q){return e.mapValues(e.pick(U,Q),Number)}function te(U){var Q={};return e.forEach(U,function(X,se){Q[se.toLowerCase()]=X}),Q}return vS}var bS,EL;function kle(){if(EL)return bS;EL=1;var e=Ct(),t=Vn(),n=Bs().Graph;bS={debugOrdering:s};function s(r){var a=t.buildLayerMatrix(r),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(r.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+r.node(u).rank)}),e.forEach(r.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,f){var d="layer"+f;l.setNode(d,{rank:"same"}),e.reduce(u,function(p,m){return l.setEdge(p,m,{style:"invis"}),m})}),l}return bS}var wS,RL;function _le(){return RL||(RL=1,wS="0.8.5"),wS}var jS,AL;function Cle(){return AL||(AL=1,jS={graphlib:Bs(),layout:Nle(),debug:kle(),util:{time:Vn().time,notime:Vn().notime},version:_le()}),jS}var Ele=Cle();const Pm=Bm(Ele),Rle="::",ql=166,zl=94,Ep=38,SS=28,TL=22,Ale=188,Rp=78,Ap=42,Tle=40,Ile=320,d9=280,WN=118,Tp=96,Mle=3,n_="6 7";function Tl(e,t){return`${e}${Rle}${t}`}function NS(e){return e.type==="podGroup"||e.type==="group"}function Ole(e,t=!1){return t?{stroke:"#a8a29e",strokeWidth:1,strokeDasharray:n_}:e==="pod-internal"||e==="contains"||e==="member"?{stroke:"#44403c",strokeWidth:1.5}:{stroke:"#78716c",strokeWidth:1.5}}function Lle(e){if(e.collapsed)return{nodes:[],edges:[],width:d9,height:WN,podCount:0};const t=new Set(e.nodes.filter(NS).map(w=>w.id)),n=new Map,s=[];for(const w of e.nodes)if(!NS(w)){if(typeof w.parentId=="string"&&t.has(w.parentId)){n.has(w.parentId)||n.set(w.parentId,[]),n.get(w.parentId).push(w);continue}s.push(w)}const r=e.nodes.filter(NS).map(w=>$le(w,n.get(w.id)??[],e.edges)),a=s.map(w=>({node:w,width:w.initialWidth??ql,height:w.initialHeight??zl,position:{x:0,y:0}})),l=[...r.map(w=>({id:w.node.id,width:w.width,height:w.height})),...a.map(w=>({id:w.node.id,width:w.width,height:w.height}))],u=Dle(r,a),f=qle(e.edges.map(w=>{const S=u.get(w.source),C=u.get(w.target);return!S||!C||S===C?null:{source:S,target:C}}).filter(w=>!!w)),d=s_(l,f,"LR",{nodesep:34,ranksep:34}),p=r_(l,d,{x:Ap,y:Rp});for(const w of r)w.position=p.positions.get(w.node.id)??{x:Ap,y:Rp};for(const w of a)w.position=p.positions.get(w.node.id)??{x:Ap,y:Rp};const m=Math.max(Ile,p.width+Ap*2),x=Math.max(WN,p.height+Rp+Tle),y=`rig-${e.rigId}`,b=[];for(const w of r){const S=Tl(e.rigId,w.node.id);b.push({...w.node,id:S,type:"podGroup",parentId:y,extent:"parent",position:w.position,data:{...w.node.data??{},rigId:e.rigId,rigName:e.rigName??null,agentCount:w.members.length},style:{...w.node.style??{},width:w.width,height:w.height},draggable:!1,zIndex:1});for(const C of w.members)b.push({...C.node,id:Tl(e.rigId,C.node.id),type:"rigNode",parentId:S,extent:"parent",position:C.position,data:{...C.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...C.node.style??{},width:ql,height:zl},initialWidth:ql,initialHeight:zl,sourcePosition:ye.Right,targetPosition:ye.Left,draggable:!1,zIndex:2})}for(const w of a)b.push({...w.node,id:Tl(e.rigId,w.node.id),type:"rigNode",parentId:y,extent:"parent",position:w.position,data:{...w.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...w.node.style??{},width:ql,height:zl},initialWidth:ql,initialHeight:zl,sourcePosition:ye.Right,targetPosition:ye.Left,draggable:!1,zIndex:2});const v=e.edges.map(w=>{var A;const S=e.rigId,C=e.rigId,k=w.id||`${w.source}->${w.target}`,_=typeof((A=w.data)==null?void 0:A.kind)=="string"?w.data.kind:typeof w.label=="string"?w.label:null,{label:R,...T}=w;return{...T,id:Tl(e.rigId,k),source:Tl(S,w.source),target:Tl(C,w.target),label:typeof R=="string"?R:void 0,type:w.type??"default",selectable:!1,focusable:!1,interactionWidth:w.interactionWidth??10,style:{...Ole(_),...w.style??{}},data:{...w.data??{},kind:_}}});return{nodes:b,edges:v,width:m,height:x,podCount:r.length}}function Ple(e){const t=e.map(l=>({id:l.rigId,width:l.width,height:l.height})),n=Array.from({length:Mle},()=>[]);e.forEach((l,u)=>{n[u%n.length].push(l.rigId)});const s=[];for(const l of n)for(let u=0;u<l.length-1;u+=1)s.push({source:l[u],target:l[u+1]});const r=s_(t,s,"TB",{nodesep:68,ranksep:62}),a=r_(t,r,{x:Tp,y:Tp});return e.map(l=>({...l,position:a.positions.get(l.rigId)??{x:Tp,y:Tp}}))}function $le(e,t,n){const s=t.map(p=>({id:p.id,width:ql,height:zl})),r=new Set(t.map(p=>p.id)),a=n.filter(p=>r.has(p.source)&&r.has(p.target)),l=s_(s,a,"TB",{nodesep:16,ranksep:16}),u=r_(s,l,{x:SS,y:Ep}),f=Math.max(Ale,u.width+SS*2),d=Math.max(Ep+TL,u.height+Ep+TL);return{node:e,width:f,height:d,position:{x:0,y:0},members:t.map(p=>({node:p,position:u.positions.get(p.id)??{x:SS,y:Ep}}))}}function Dle(e,t){const n=new Map;for(const s of e){n.set(s.node.id,s.node.id);for(const r of s.members)n.set(r.node.id,s.node.id)}for(const s of t)n.set(s.node.id,s.node.id);return n}function qle(e){const t=new Set,n=[];for(const s of e){const r=`${s.source}->${s.target}`;t.has(r)||(t.add(r),n.push(s))}return n}function s_(e,t,n,s){const r=new Pm.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:n,nodesep:s.nodesep,ranksep:s.ranksep,marginx:0,marginy:0});for(const u of e)r.setNode(u.id,{width:u.width,height:u.height});const a=new Set(e.map(u=>u.id));for(const u of t)!a.has(u.source)||!a.has(u.target)||u.source===u.target||r.setEdge(u.source,u.target);Pm.layout(r);const l=new Map;for(const u of e){const f=r.node(u.id);l.set(u.id,f??{x:0,y:0})}return l}function r_(e,t,n){let s=1/0,r=1/0,a=-1/0,l=-1/0;for(const f of e){const d=t.get(f.id)??{x:0,y:0};s=Math.min(s,d.x-f.width/2),r=Math.min(r,d.y-f.height/2),a=Math.max(a,d.x+f.width/2),l=Math.max(l,d.y+f.height/2)}if(!Number.isFinite(s)||!Number.isFinite(r))return{positions:new Map,width:0,height:0};const u=new Map;for(const f of e){const d=t.get(f.id)??{x:0,y:0};u.set(f.id,{x:n.x+d.x-f.width/2-s,y:n.y+d.y-f.height/2-r})}return{positions:u,width:a-s,height:l-r}}const zle="\0",i_=1e4,f9=4e3,Ble=1100,Fle=1600,Hle=3e3,Ule=650,Vle=900;function Zg(e){var r;const t=new Map,n=new Map,s=(a,l)=>{const u=a==null?void 0:a.trim();if(u)for(const f of[u,u.toLowerCase()]){const d=n.get(f);d&&d.nodeId!==l.nodeId?n.set(f,null):n.has(f)||n.set(f,l)}};for(const a of e){t.set(a.nodeId,a);const l=YN(a.nodeId);s(a.nodeId,a),s(l,a),s(a.logicalId,a),s(a.canonicalSessionName,a);for(const u of[a.rigName,a.rigId])if(u&&(s(`${a.logicalId??l}@${u}`,a),(r=a.canonicalSessionName)!=null&&r.includes("@"))){const[f]=a.canonicalSessionName.split("@");s(`${f}@${u}`,a)}}return{byNodeId:t,bySession:n}}function kS(e,t){var u;const n=t==null?void 0:t.trim();if(!n)return null;const s=e.bySession.get(n)??e.bySession.get(n.toLowerCase());if(s)return{...s,session:n};if(s===null)return null;const r=n.lastIndexOf("@");if(r<0)return null;const a=n.slice(0,r),l=n.slice(r+1);for(const f of e.byNodeId.values()){const d=f.logicalId??YN(f.nodeId),p=((u=f.canonicalSessionName)==null?void 0:u.split("@")[0])??null,m=d===a||p===a||YN(f.nodeId)===a,x=f.rigName===l||f.rigId===l;if(m&&x)return{...f,session:n}}return null}function Gle(e){var t,n,s;return e?e.startupStatus==="failed"?"blocked":e.startupStatus==="attention_required"||((t=e.agentActivity)==null?void 0:t.state)==="needs_input"?"needs_input":((n=e.agentActivity)==null?void 0:n.state)==="running"||(((s=e.currentQitems)==null?void 0:s.length)??0)>0?"active":"idle":"idle"}function Kle(e){const t=Gle(e.baseline),n=e.recent,s=n&&e.nowMs-n.lastActiveAt<=i_?n:null,r=s?Xle(t,s.state):t,a=(s==null?void 0:s.sourceFlashAt)&&e.nowMs-s.sourceFlashAt<=Ule,l=(s==null?void 0:s.targetFlashAt)&&e.nowMs-s.targetFlashAt<=Vle;return{state:r,flash:l?"target":a?"source":null,recent:!!s}}function Wle(e,t){return typeof e=="number"&&t-e<=f9}function Yle(e){if(!e||typeof e!="object")return null;const t=e,n=cn(t,"type");if(!n)return null;const s=cn(t,"qitemId"),r=(a,l="active",u=null)=>a?{session:a,state:l,flash:u}:null;if(n==="agent.activity"){const a=cn(t,"sessionName"),l=t.activity&&typeof t.activity=="object"?t.activity:null,u=(l==null?void 0:l.state)==="needs_input"?"needs_input":(l==null?void 0:l.state)==="running"?"active":"idle";return{type:n,qitemId:s,sessions:[r(a,u)].filter(Dr)}}if(n==="queue.created"){const a=cn(t,"sourceSession"),l=cn(t,"destinationSession");return!a||!l?null:{type:n,qitemId:s,packet:{sourceSession:a,targetSession:l},sessions:[r(a,"active","source"),r(l,"active","target")].filter(Dr)}}if(n==="queue.handed_off"){const a=cn(t,"fromSession"),l=cn(t,"toSession");return!a||!l?null:{type:n,qitemId:s,packet:{sourceSession:a,targetSession:l},sessions:[r(a,"active","source"),r(l,"active","target")].filter(Dr)}}if(n==="queue.claimed"){const a=cn(t,"destinationSession");return{type:n,qitemId:s,sessions:[r(a,"active","target")].filter(Dr)}}if(n==="queue.updated"){const a=cn(t,"actorSession"),l=cn(t,"closureTarget"),f=cn(t,"toState")==="blocked"?"blocked":"active";return{type:n,qitemId:s,packet:a&&l?{sourceSession:a,targetSession:l}:void 0,sessions:[r(a,f,"source"),r(l,f,"target")].filter(Dr)}}return n==="queue.unclaimed"?{type:n,qitemId:s,sessions:[r(cn(t,"destinationSession"),"active")].filter(Dr)}:n==="qitem.fallback_routed"?{type:n,qitemId:s,sessions:[r(cn(t,"originalDestination"),"active","source"),r(cn(t,"rerouteDestination"),"active","target")].filter(Dr)}:n==="qitem.closure_overdue"?{type:n,qitemId:s,sessions:[r(cn(t,"destinationSession"),"blocked","target")].filter(Dr)}:n==="inbox.absorbed"||n==="inbox.denied"?{type:n,qitemId:s,sessions:[r(cn(t,"senderSession"),"active","source"),r(cn(t,"destinationSession"),"needs_input","target")].filter(Dr)}:null}function _S(e,t){return`${e}${zle}${t}`}function Qle(e){const t=!!(e.sourceSession.rigId&&e.targetSession.rigId&&e.sourceSession.rigId!==e.targetSession.rigId);return{id:`${e.createdAt}-${e.sequence}-${e.sourceSession.nodeId}-${e.targetSession.nodeId}`,eventType:e.eventType,qitemId:e.qitemId??null,sourceSession:e.sourceSession.session,targetSession:e.targetSession.session,sourceNodeId:e.sourceSession.nodeId,targetNodeId:e.targetSession.nodeId,sourceRigId:e.sourceSession.rigId,targetRigId:e.targetSession.rigId,crossRig:t,createdAt:e.createdAt,durationMs:t?Fle:Ble}}function h9(e,t,n){const s=new Map;for(const l of t)s.set(_S(l.sourceNodeId,l.targetNodeId),l);const r=new Set,a=e.map(l=>{const u=_S(l.source,l.target),f=s.get(u)??null;return f&&r.add(u),IL(l,f,n.reducedMotion)});for(const l of t){const u=_S(l.sourceNodeId,l.targetNodeId);r.has(u)||a.push(IL({id:`hot-potato-${l.id}`,source:l.sourceNodeId,target:l.targetNodeId,type:"hotPotato",selectable:!1,focusable:!1,interactionWidth:8,style:p9(l.crossRig),data:{}},l,n.reducedMotion))}return a}function IL(e,t,n){var a;const s=(t==null?void 0:t.crossRig)||((a=e.style)==null?void 0:a.strokeDasharray)===n_,r={...e.data??{},hotPotatoPacket:t,hotPotatoRecent:!!t,hotPotatoCrossRig:s,hotPotatoReducedMotion:n};return{...e,type:"hotPotato",className:[e.className,t?"hot-potato-edge-active":""].filter(Boolean).join(" ")||void 0,data:r,style:{...e.style??{},...t?p9(t.crossRig):{}}}}function p9(e){return{stroke:e?"#a8a29e":"#047857",strokeWidth:e?1.25:2.25,strokeDasharray:e?n_:void 0}}function Xle(e,t){return ML(t)>ML(e)?t:e}function ML(e){return e==="blocked"?3:e==="needs_input"?2:e==="active"?1:0}function YN(e){const t=e.indexOf("::");return t<0?e:e.slice(t+2)}function cn(e,t){const n=e[t];return typeof n=="string"&&n.trim()?n:null}function Dr(e){return e!==null}function Zle(){return{nodeActivity:new Map,rigActivity:new Map,packets:[],unresolvedCount:0,sequence:0}}let Jle=Zle();function CS(e,t,n,s,r){const a=e.nodeActivity.get(t),l=a&&s-a.lastActiveAt<=i_?a:void 0,u={state:ece((l==null?void 0:l.state)??"idle",n),lastActiveAt:s,sourceFlashAt:r==="source"?s:l==null?void 0:l.sourceFlashAt,targetFlashAt:r==="target"?s:l==null?void 0:l.targetFlashAt};e.nodeActivity.set(t,u)}function ece(e,t){const n=s=>s==="blocked"?3:s==="needs_input"?2:s==="active"?1:0;return n(t)>n(e)?t:e}function OL(e,t){let n=!1;const s=e.packets.length;e.packets=e.packets.filter(r=>t-r.createdAt<=Hle),n||(n=e.packets.length!==s);for(const[r,a]of e.nodeActivity.entries())t-a.lastActiveAt>i_&&(e.nodeActivity.delete(r),n=!0);for(const[r,a]of e.rigActivity.entries())t-a>f9&&(e.rigActivity.delete(r),n=!0);return n}function Jg(e){const[t,n]=E.useState(0),s=E.useRef(e),r=E.useRef(Jle);s.current=e;const a=E.useCallback(()=>{n(l=>l+1)},[]);return E.useEffect(()=>ag(u=>{const f=Yle(u);if(!f)return;const d=Date.now(),p=r.current,m=s.current;let x=!1;for(const y of f.sessions){const b=kS(m,y.session);if(!b){p.unresolvedCount+=1,x=!0;continue}CS(p,b.nodeId,y.state,d,y.flash??null),b.rigId&&p.rigActivity.set(b.rigId,d),x=!0}if(f.packet){const y=kS(m,f.packet.sourceSession),b=kS(m,f.packet.targetSession);y&&b?(p.sequence+=1,p.packets.push(Qle({eventType:f.type,qitemId:f.qitemId,sourceSession:y,targetSession:b,createdAt:d,sequence:p.sequence})),CS(p,y.nodeId,"active",d,"source"),CS(p,b.nodeId,"active",d,"target"),y.rigId&&p.rigActivity.set(y.rigId,d),b.rigId&&p.rigActivity.set(b.rigId,d),x=!0):(p.unresolvedCount+=1,x=!0)}x||(x=OL(p,d)),x&&a()}),[a]),E.useEffect(()=>{const l=window.setInterval(()=>{const u=Date.now(),f=r.current;OL(f,u)&&a()},1e3);return()=>window.clearInterval(l)},[a]),E.useMemo(()=>{const l=r.current,u=Date.now();return{version:t,unresolvedCount:l.unresolvedCount,packets:[...l.packets],getNodeActivity(f,d){return Kle({baseline:d,recent:l.nodeActivity.get(f)??null,nowMs:u})},isRigRecentlyActive(f){return f?Wle(l.rigActivity.get(f),u):!1}}},[t])}const LL="(prefers-reduced-motion: reduce)";function a_(){const[e,t]=E.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(LL).matches);return E.useEffect(()=>{var r;if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(LL);t(n.matches);const s=()=>t(n.matches);return(r=n.addEventListener)==null||r.call(n,"change",s),()=>{var a;return(a=n.removeEventListener)==null?void 0:a.call(n,"change",s)}},[]),e}function tce({data:e}){const t=e.podDisplayName??e.podNamespace??ir(e.logicalId)??Ql(e.podId??e.logicalId);return i.jsx("div",{"data-testid":"pod-group-node",className:`w-full h-full relative pointer-events-auto ${e.placementState==="selected"?"ring-2 ring-emerald-500/80 shadow-[0_0_0_4px_rgba(52,211,153,0.12)]":e.placementState==="available"?"ring-1 ring-emerald-300/80":""}`,children:i.jsx("div",{className:"absolute left-4 top-3 inline-flex items-center font-mono text-[12px] font-bold leading-none tracking-[0.08em] text-stone-800",children:`${t} pod`})})}function nce({data:e}){const t=e.session;return i.jsxs("div",{"data-testid":"discovered-graph-node",className:"border-dashed border-2 border-foreground/30 bg-surface-low/50 p-spacing-3 min-w-[180px]",children:[i.jsx(Sn,{type:"target",position:ye.Top,className:"opacity-0"}),i.jsxs("div",{className:"text-label-sm font-mono uppercase mb-spacing-1",children:[t.tmuxSession,":",t.tmuxPane]}),i.jsxs("div",{className:"flex gap-spacing-2 items-center mb-spacing-1",children:[i.jsx("span",{className:"text-label-sm uppercase text-foreground-muted",children:t.runtimeHint}),i.jsx("span",{className:"text-label-sm text-foreground-muted",children:t.confidence})]}),t.cwd&&i.jsx("div",{className:"text-label-sm font-mono text-foreground-muted truncate",children:t.cwd}),i.jsx(Sn,{type:"source",position:ye.Bottom,className:"opacity-0"})]})}const sce={rigNode:die,discoveredNode:nce,podGroup:tce},rce={hotPotato:uq};function ice(){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative text-foreground-muted","data-testid":"empty-topology",children:[i.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 400 300",fill:"none",style:{opacity:.08},children:[i.jsx("rect",{x:"160",y:"60",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("rect",{x:"60",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("rect",{x:"260",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("line",{x1:"200",y1:"100",x2:"100",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"}),i.jsx("line",{x1:"200",y1:"100",x2:"300",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"})]}),i.jsx("div",{className:"relative z-10 text-center",children:i.jsx("h2",{className:"text-headline-md uppercase",children:"EMPTY TOPOLOGY"})})]})}function o_({rigId:e,rigName:t=null,showDiscovered:n=!0,podScope:s}){const{data:r,isPending:a,error:l}=Hre(e??""),u=fY(n),f=(r==null?void 0:r.nodes)??[],d=(r==null?void 0:r.edges)??[],{rawNodes:p,rawEdges:m}=E.useMemo(()=>{if(!s)return{rawNodes:f,rawEdges:d};const D=new Set,F=f.filter(U=>{var se,re,ce,me,ge;if(U.type==="podGroup"||U.type==="group"){const ve=(((se=U.data)==null?void 0:se.podNamespace)??((re=U.data)==null?void 0:re.podId))===s;return ve&&D.add(U.id),ve}const X=(((ce=U.data)==null?void 0:ce.podNamespace)??((me=U.data)==null?void 0:me.podId)??ir(((ge=U.data)==null?void 0:ge.logicalId)??null))===s;return X&&D.add(U.id),X}),te=d.filter(U=>D.has(U.source)&&D.has(U.target));return{rawNodes:F,rawEdges:te}},[f,d,s]),x=(l==null?void 0:l.message)??null,{reconnecting:y}=Vre(e),b=a_(),[v,w]=E.useState(null),S=E.useRef(null),C=E.useRef(null),k=e!==null&&C.current!==e;E.useEffect(()=>{e&&p.length>0&&C.current!==e&&(C.current=e)},[e,p.length]);const _=E.useCallback(D=>{S.current&&clearTimeout(S.current),w(D),S.current=setTimeout(()=>{w(null),S.current=null},3e3)},[]);E.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const R=E.useMemo(()=>Zg(p.filter(D=>D.type==="rigNode").map(D=>{const F=D.data;return{nodeId:D.id,rigId:e,rigName:t,logicalId:(F==null?void 0:F.logicalId)??null,canonicalSessionName:(F==null?void 0:F.canonicalSessionName)??null,agentActivity:(F==null?void 0:F.agentActivity)??null,currentQitems:(F==null?void 0:F.currentQitems)??null,startupStatus:(F==null?void 0:F.startupStatus)??null}})),[p,e,t]),T=Jg(R),A=E.useMemo(()=>m.map(D=>{var U;const F=((U=D.data)==null?void 0:U.kind)??D.label??"delegates_to",te=Gre(F);return{...D,...te,className:k?"edge-draw-in":void 0,style:{...te.style,animationDelay:k?`${Math.min(p.length*50+100,2e3)}ms`:void 0}}}),[m,k,p.length]),I=E.useMemo(()=>{const D=new Map;for(const F of p){const te=F.data;if((F.type==="podGroup"||F.type==="group")&&(te!=null&&te.podId)){D.set(te.podId,{displayName:te.podLabel??te.podNamespace??ir(te.logicalId)??Ql(te.podId),namespace:te.podNamespace??te.logicalId??null});continue}const U=(te==null?void 0:te.podId)??null;if(!U)continue;const Q=(te==null?void 0:te.podNamespace)??ir(te==null?void 0:te.logicalId)??null,X=(te==null?void 0:te.podLabel)??Q??Ql(U);D.has(U)||D.set(U,{displayName:X,namespace:Q})}return D},[p]),{selection:L,setSelection:$}=bg(),{selectedDiscoveredId:O,placementTarget:B,setPlacementTarget:H}=BX(),P=(L==null?void 0:L.type)==="discovery"&&!!O,G=E.useMemo(()=>{const D=new Map;for(const X of p){if(!X.parentId)continue;const se=typeof X.data=="object"&&X.data!==null&&"logicalId"in X.data?X.data.logicalId:null,re=typeof X.data=="object"&&X.data!==null&&"podId"in X.data?X.data.podId:null,ce=ir(se)??Ql(re);ce&&!D.has(X.parentId)&&D.set(X.parentId,ce)}const te=Xre(p,m).map((X,se)=>({...X,data:(()=>{if(X.type==="podGroup"||X.type==="group"){const re=X.data,ce=(re==null?void 0:re.podId)??null,me=(B==null?void 0:B.kind)==="pod"&&ce!==null&&B.podId===ce;return{...X.data??{},podDisplayName:D.get(X.id)??null,placementState:P?me?"selected":"available":null}}if(X.type==="rigNode"){const re=X.data,ce=!(re!=null&&re.binding)&&!(re!=null&&re.canonicalSessionName),me=(B==null?void 0:B.kind)==="node"&&(re==null?void 0:re.logicalId)!==void 0&&B.logicalId===re.logicalId;return{...X.data??{},placementState:P?me?"selected":ce?"available":null:null}}return X.data})(),className:k?"node-enter":void 0,style:{...X.style??{},animationDelay:k?`${Math.min(se*50,2e3)}ms`:void 0}})),U=te.reduce((X,se)=>{var re;return Math.max(X,((re=se.position)==null?void 0:re.y)??0)},0),Q=u.map((X,se)=>({id:`discovered-${X.id}`,type:"discoveredNode",position:{x:300,y:U+200+se*150},data:{session:X}}));return[...te,...Q]},[p,m,k,u,P,B]),q=E.useMemo(()=>G.map(D=>{if(D.type!=="rigNode")return D;const F=D.data;return{...D,data:{...D.data??{},activityRing:T.getNodeActivity(D.id,F),reducedMotion:b}}}),[G,T,b]),V=E.useMemo(()=>h9(A,T.packets,{reducedMotion:b}),[A,T.packets,b]),K=zt(),Y=t!=null&&t.trim()?t:e?J2(e):null,J=E.useCallback(async(D,F)=>{var U;if(!e)return;if(P){if(F.type==="podGroup"||F.type==="group"){const Q=F.data,X=(Q==null?void 0:Q.podId)??null,se=X?I.get(X):null,re=!!(X&&(se!=null&&se.namespace));H({kind:"pod",rigId:e,podId:X??"",podNamespace:(se==null?void 0:se.namespace)??null,podLabel:(se==null?void 0:se.displayName)??null,eligible:re,...re?{}:{reason:"This pod cannot receive a new node yet."}});return}if(F.type==="rigNode"){const Q=F.data,X=!Q.binding&&!Q.canonicalSessionName;H({kind:"node",rigId:e,logicalId:Q.logicalId,eligible:X,...X?{}:{reason:"This node is already claimed."}});return}}if(F.type==="podGroup"||F.type==="group")return;const te=F.data;if(K({to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(te.logicalId)}}),!((U=te.binding)!=null&&U.cmuxSurface)){_({text:"Not bound to cmux surface",type:"info"});return}try{const Q=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(te.logicalId)}/focus`,{method:"POST"});if(!Q.ok){_({text:"Focus failed",type:"error"});return}const X=await Q.json();X.ok===!1&&X.code==="unavailable"?_({text:"cmux not connected",type:"error"}):X.ok?_({text:"Focused",type:"success"}):_({text:"Focus failed",type:"error"})}catch{_({text:"Focus failed",type:"error"})}},[P,I,e,H,K,$,_]);return e===null?i.jsx("div",{className:"p-spacing-6 text-foreground-muted",children:"No rig selected"}):a?i.jsxs("div",{className:"p-spacing-6","data-testid":"graph-loading",children:[i.jsx("div",{className:"h-8 w-48 animate-pulse-tactical mb-spacing-4"}),i.jsx("div",{className:"h-64 animate-pulse-tactical"})]}):x?i.jsx("div",{className:"p-spacing-6",children:i.jsx(wn,{"data-testid":"graph-error",children:i.jsxs(dn,{children:["Error: ",x]})})}):q.length===0?i.jsx(ice,{}):i.jsxs("div",{className:"w-full h-full relative","data-testid":"graph-view","data-animated":k?"true":"false",children:[i.jsx("div",{className:"absolute top-4 left-4 w-3 h-3 reg-mark",children:i.jsx("div",{className:"reg-tl"})}),i.jsx("div",{className:"absolute top-4 right-4 w-3 h-3",children:i.jsx("div",{className:"reg-tr"})}),i.jsx("div",{className:"absolute bottom-4 left-4 w-3 h-3",children:i.jsx("div",{className:"reg-bl"})}),i.jsx("div",{className:"absolute bottom-4 right-4 w-3 h-3",children:i.jsx("div",{className:"reg-br"})}),Y&&i.jsx("div",{"data-testid":"rig-stamp-watermark",className:"stamp-watermark text-3xl left-[20%] top-[35%]",children:Y}),y&&i.jsx("div",{className:"absolute top-spacing-4 right-spacing-4 z-20",children:i.jsx(wn,{children:i.jsx(dn,{className:"text-warning",children:"Live updates disconnected from daemon - reconnecting..."})})}),v&&i.jsx("div",{className:`absolute top-spacing-4 left-spacing-4 z-20 px-spacing-4 py-spacing-2 font-mono text-[10px] border ${v.type==="success"?"bg-white border-stone-900 text-stone-900":v.type==="error"?"bg-tertiary/10 border-tertiary text-tertiary":"bg-white border-stone-300 text-stone-600"}`,children:v.text}),P&&i.jsx("div",{"data-testid":"graph-placement-banner",className:"absolute top-spacing-4 left-1/2 z-20 -translate-x-1/2 border border-emerald-300/90 bg-[rgba(236,253,245,0.92)] px-3.5 py-2 font-mono text-[10px] text-emerald-950 shadow-[0_12px_28px_rgba(34,197,94,0.14)] backdrop-blur-sm",children:"PLACEMENT MODE / click an available node to bind, or click a pod to add a new node."}),i.jsx(gf,{nodes:q,edges:V,nodeTypes:sce,edgeTypes:rce,onNodeClick:J,nodesDraggable:!1,selectionOnDrag:!1,panOnDrag:!0,fitView:!0,fitViewOptions:{padding:.16,maxZoom:1.15},className:"relative z-10",proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,children:i.jsx(xf,{})})]})}class QN extends Error{constructor(n){var r;const s=((r=n.errors)==null?void 0:r.join(", "))??n.message??"Import failed";super(s);ns(this,"errors");ns(this,"warnings");ns(this,"code");this.name="ImportError",this.code=n.code??"unknown",this.errors=n.errors??(n.message?[n.message]:["Import failed"]),this.warnings=n.warnings??[]}}function ace(){const e=Mt();return sn({mutationFn:async({yaml:t,rigRoot:n})=>{const s={"Content-Type":"text/yaml"};n&&(s["X-Rig-Root"]=n);const r=await fetch("/api/rigs/import",{method:"POST",headers:s,body:t});if(!r.ok){const a=await r.json().catch(()=>({}));throw a.code==="cycle_error"?new QN({...a,errors:a.errors??["Cycle detected in rig topology"]}):new QN(a)}return r.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}function oce(e){switch(e){case"launched":return"text-success";case"failed":return"text-destructive";default:return"text-foreground-muted"}}const l_=E.forwardRef(({className:e,type:t,...n},s)=>i.jsx("input",{type:t,className:he("flex h-11 w-full border border-stone-300/55 bg-white/85 px-4 py-2 text-base text-foreground placeholder:text-foreground-muted/60 transition-colors duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));l_.displayName="Input";const c_=E.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:he("flex min-h-[80px] w-full border border-stone-300/55 bg-white/85 px-4 py-3 text-base text-on-surface font-mono placeholder:text-stone-400 transition-all duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));c_.displayName="Textarea";function at({children:e,className:t,innerClassName:n}){return i.jsx("div",{"data-testid":"workspace-page",className:he("w-full flex-1 overflow-y-auto lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",t),children:i.jsx("div",{"data-testid":"workspace-page-inner",className:he("mx-auto w-full max-w-[960px] px-4 py-6 sm:px-6 sm:py-8 md:px-8 lg:px-10",n),children:e})})}const u_=E.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:he("w-full caption-bottom text-sm",e),...t})}));u_.displayName="Table";const d_=E.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:he("bg-surface-low [&_tr]:border-b [&_tr]:border-stone-300",e),...t}));d_.displayName="TableHeader";const f_=E.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:he("[&_tr:last-child]:border-0",e),...t}));f_.displayName="TableBody";const lce=E.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:he("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));lce.displayName="TableFooter";const zd=E.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:he("border-b border-stone-200 transition-colors duration-150 hover:bg-surface-low data-[state=selected]:bg-surface-mid odd:bg-surface-low/50",e),...t}));zd.displayName="TableRow";const eo=E.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:he("h-12 px-4 text-left align-middle font-medium text-foreground-muted uppercase text-label-md tracking-[0.04em] [&:has([role=checkbox])]:pr-0",e),...t}));eo.displayName="TableHead";const to=E.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:he("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));to.displayName="TableCell";const cce=E.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:he("mt-4 text-sm text-foreground-muted",e),...t}));cce.displayName="TableCaption";function Nn({eyebrow:e,title:t,description:n,actions:s}){return i.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),i.jsx("h2",{className:"text-2xl font-bold uppercase tracking-[0.04em] text-stone-900 sm:text-3xl",children:t}),n&&i.jsx("p",{className:"max-w-2xl text-base leading-8 text-stone-600",children:n})]}),s?i.jsx("div",{className:"flex flex-wrap gap-2",children:s}):null]})}function m9({steps:e,currentStep:t,errorAtStep:n=0,"data-testid":s}){const r=n||t;return i.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3","data-testid":s,children:e.map((a,l)=>{const u=r>a.num,f=r===a.num,d=r<a.num,p=u?"done":f?"active":"upcoming";return i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsxs("div",{"data-testid":`step-${a.num}`,"data-step-state":p,className:he("inline-flex min-h-0 items-center gap-2 border-b-2 px-1 py-1 font-mono text-[10px] uppercase tracking-[0.16em] transition-colors",u&&"border-primary/35 text-foreground-muted",f&&"border-stone-900 text-foreground",d&&"border-transparent text-foreground-muted/35"),children:[i.jsxs("span",{className:"text-[9px] tracking-[0.22em]",children:[u?"✓ ":"",String(a.num).padStart(2,"0")]}),i.jsx("span",{className:"text-[10px] leading-none tracking-[0.2em]",children:a.label})]}),l<e.length-1?i.jsx("div",{"aria-hidden":"true",className:he("h-px w-4 shrink-0 sm:w-6",u?"bg-primary/35":"bg-stone-300/45")}):null]},a.num)})})}function bs({title:e,description:t,children:n,className:s}){return i.jsxs("section",{className:he("space-y-4 border border-stone-300/45 bg-[rgba(255,255,255,0.62)] p-5 shadow-[0_1px_0_rgba(255,255,255,0.95)_inset,0_10px_26px_rgba(34,34,24,0.035)] sm:p-6",s),children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),t?i.jsx("p",{className:"text-base leading-8 text-stone-600",children:t}):null]}),n]})}function $o({children:e}){return i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:e})}function st({label:e,value:t,testId:n}){return i.jsxs("div",{className:"border border-stone-300/35 bg-white/10 px-4 py-4",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),i.jsx("div",{"data-testid":n,className:"mt-2 text-2xl font-semibold uppercase tracking-[0.04em] text-stone-900",children:t})]})}function g9({title:e,testId:t,children:n}){return i.jsx(bs,{title:e,children:i.jsx("pre",{"data-testid":t,className:"overflow-x-auto border border-stone-300/45 bg-white/75 p-4 text-xs leading-6 text-stone-800",children:n})})}const uce=[{num:1,label:"VALIDATE RIGSPEC"},{num:2,label:"PREFLIGHT"},{num:3,label:"INSTANTIATE"}];function dce(e){switch(e){case"input":case"validating":return 1;case"valid":case"preflight":return 2;case"preflight_done":case"instantiating":case"done":return 3;case"error":return 0}}function fce({onBack:e}={}){const t=ace(),{currentRigDraft:n,selectedRigDraft:s,saveRigDraft:r,rememberRigDraft:a,clearSelectedRigDraft:l}=of(),[u,f]=E.useState(()=>(s==null?void 0:s.yaml)??(n==null?void 0:n.yaml)??""),[d,p]=E.useState(""),[m,x]=E.useState("input"),[y,b]=E.useState(0),[v,w]=E.useState([]),[S,C]=E.useState([]),[k,_]=E.useState(null);E.useEffect(()=>{r(u)},[r,u]),E.useEffect(()=>{s&&(f(s.yaml),l())},[l,s]);const R=async()=>{a(u),x("validating"),w([]);try{const L=await(await fetch("/api/rigs/import/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:u})).json();L.valid?x("valid"):(w(L.errors??["Validation failed"]),b(1),x("error"))}catch{w(["Validation request failed"]),b(1),x("error")}},T=async()=>{x("preflight"),w([]),C([]);try{const I={"Content-Type":"text/yaml"};d&&(I["X-Rig-Root"]=d);const $=await(await fetch("/api/rigs/import/preflight",{method:"POST",headers:I,body:u})).json();C($.warnings??[]),$.errors&&$.errors.length>0?(w($.errors),b(2),x("error")):x("preflight_done")}catch{w(["Preflight request failed"]),b(2),x("error")}},A=async()=>{x("instantiating"),w([]);try{const I=await t.mutateAsync({yaml:u,rigRoot:d.trim()||void 0});_(I),x("done")}catch(I){I instanceof QN?(I.code==="cycle_error"?w(["Cycle detected in rig topology"]):w(I.errors),C(I.warnings)):w([I instanceof Error?I.message:"Instantiate request failed"]),b(3),x("error")}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"import-flow",className:"space-y-8",children:[i.jsx(Nn,{eyebrow:"Rig Import",title:"Import Rig",description:"Validate a RigSpec, run preflight checks, then instantiate a topology from YAML."}),i.jsx(m9,{"data-testid":"step-indicator",steps:uce,currentStep:dce(m),errorAtStep:m==="error"?y:0}),m==="input"&&i.jsxs(bs,{title:"Rig YAML",description:"Paste a rig spec and optionally provide a rig root to anchor relative references during import.",children:[i.jsx(c_,{"data-testid":"yaml-input",value:u,onChange:I=>f(I.target.value),placeholder:"Paste YAML rig spec here...",rows:14,className:"font-mono text-body-sm mb-spacing-4"}),i.jsxs("div",{className:"mb-spacing-4",children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RIG ROOT (OPTIONAL)"}),i.jsx(l_,{"data-testid":"rig-root-input",type:"text",value:d,onChange:I=>p(I.target.value),placeholder:"/path/to/rig/root",className:"font-mono text-body-sm"})]}),i.jsx(_e,{variant:"tactical","data-testid":"validate-btn",onClick:R,disabled:!u.trim(),children:"VALIDATE RIGSPEC"})]}),m==="validating"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Validating..."}),m==="valid"&&i.jsxs(bs,{title:"Validation Passed",description:"The RigSpec is valid. Run preflight checks before you instantiate it.",children:[i.jsx(wn,{className:"mb-spacing-4","data-testid":"valid-message",children:i.jsx(dn,{className:"text-primary",children:"RigSpec valid. Run preflight checks?"})}),i.jsx(_e,{variant:"tactical","data-testid":"preflight-btn",onClick:T,children:"RUN PREFLIGHT"})]}),m==="preflight"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Running preflight..."}),m==="preflight_done"&&i.jsxs(bs,{title:"Preflight Results",description:"Review warnings before you instantiate the rig into live runtime sessions.",children:[S.length>0&&i.jsx(wn,{className:"mb-spacing-4","data-testid":"preflight-warnings",children:i.jsxs(dn,{className:"text-warning",children:[i.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),S.map((I,L)=>i.jsxs("div",{children:["— ",I]},L))]})}),i.jsx(wn,{className:"mb-spacing-4","data-testid":"preflight-ready",children:i.jsx(dn,{className:"text-primary",children:"Preflight passed. Ready to instantiate."})}),i.jsx(_e,{variant:"tactical","data-testid":"instantiate-btn",onClick:A,children:"INSTANTIATE"})]}),m==="instantiating"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Instantiating..."}),m==="done"&&k&&i.jsx(bs,{title:"Instantiate Result",description:"The daemon returned per-node launch status for the imported topology.",className:"space-y-4",children:i.jsxs("div",{"data-testid":"import-result",children:[i.jsx(wn,{className:"mb-spacing-4",children:i.jsxs(dn,{children:[i.jsx("span",{className:"text-primary font-mono",children:k.specName}),i.jsxs("span",{className:"text-foreground-muted",children:[" (",k.rigId,")"]})]})}),i.jsxs(u_,{children:[i.jsx(d_,{children:i.jsxs(zd,{children:[i.jsx(eo,{children:"NODE"}),i.jsx(eo,{children:"STATUS"})]})}),i.jsx(f_,{children:k.nodes.map(I=>i.jsxs(zd,{children:[i.jsx(to,{className:"font-mono",children:I.logicalId}),i.jsx(to,{children:i.jsx("span",{className:`font-mono ${oce(I.status)}`,"data-testid":`inst-status-${I.logicalId}`,children:I.status})})]},I.logicalId))})]}),e?i.jsx("div",{className:"mt-spacing-6",children:i.jsx(_e,{variant:"ghost",onClick:e,children:"Close"})}):null]})}),m==="error"&&i.jsx(bs,{title:"Import Errors",description:"Fix the reported issues, then retry the import flow.",children:i.jsxs("div",{"data-testid":"import-errors",children:[S.length>0&&i.jsx(wn,{className:"mb-spacing-2","data-testid":"error-warnings",children:i.jsxs(dn,{className:"text-warning",children:[i.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),S.map((I,L)=>i.jsxs("div",{children:["— ",I]},L))]})}),v.map((I,L)=>i.jsx(wn,{className:"mb-spacing-2",children:i.jsx(dn,{className:"text-destructive",children:I})},L)),i.jsx(_e,{variant:"tactical",className:"mt-spacing-4",onClick:()=>{x("input"),w([]),C([]),_(null),b(0),p("")},children:"TRY AGAIN"})]})})]})})}async function hce(){const e=await fetch("/api/packages/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function pce(){return De({queryKey:["packages"],queryFn:hce})}function mce(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted-on-dark"}}function gce(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return"NONE"}}function xce({pkg:e,onSelect:t}){return i.jsxs("div",{"data-testid":"package-card",role:"link",tabIndex:0,className:"card-dark p-spacing-6 mb-spacing-3 cursor-pointer",onClick:()=>t(e.id),onKeyDown:n=>{n.key==="Enter"&&t(e.id)},children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-md uppercase",children:e.name}),i.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",e.version]})]}),e.summary&&i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-4",children:e.summary}),i.jsx("div",{className:"flex items-center gap-spacing-4 text-label-sm",children:i.jsxs("span",{className:"text-foreground-muted-on-dark",children:["SOURCE ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:e.sourceRef})]})}),i.jsxs("div",{className:"flex items-center gap-spacing-4 mt-spacing-3 text-label-sm",children:[i.jsxs("span",{className:"text-foreground-muted-on-dark",children:["INSTALLS ",i.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"install-count",children:e.installCount})]}),i.jsxs("span",{className:"flex items-center gap-spacing-1",children:[i.jsx("span",{className:he("inline-block w-[6px] h-[6px]",mce(e.latestInstallStatus))}),i.jsx("span",{className:"text-foreground-muted-on-dark","data-testid":"install-status",children:gce(e.latestInstallStatus)})]})]})]})}function yce(){const e=zt(),{data:t,isPending:n,error:s}=pce(),r=t?[...t].sort((a,l)=>l.createdAt.localeCompare(a.createdAt)):[];return n?i.jsx(at,{children:i.jsxs("div",{"data-testid":"packages-loading",children:[i.jsxs("div",{className:"flex justify-between mb-spacing-6",children:[i.jsx("div",{className:"h-8 w-32 shimmer"}),i.jsx("div",{className:"h-8 w-28 shimmer"})]}),[1,2].map(a=>i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-3",children:[i.jsx("div",{className:"h-6 w-48 shimmer-dark mb-spacing-4"}),i.jsx("div",{className:"h-12 shimmer-dark mb-spacing-4"}),i.jsx("div",{className:"h-4 w-64 shimmer-dark"})]},a))]})}):s?i.jsx(at,{children:i.jsx("div",{children:i.jsx(wn,{"data-testid":"packages-error",children:i.jsx(dn,{children:s.message})})})}):r.length===0?i.jsx(at,{children:i.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh]","data-testid":"packages-empty",children:[i.jsx("h2",{className:"text-display-lg text-foreground mb-spacing-4",children:"NO LEGACY PACKAGE INSTALLS"}),i.jsx("p",{className:"text-body-md text-foreground-muted mb-spacing-8",children:"Legacy package tools remain available for bootstrap internals while Library becomes the main authoring surface."}),i.jsxs("div",{className:"flex flex-col items-center gap-spacing-3",children:[i.jsx(_e,{variant:"default",size:"lg","data-testid":"empty-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),i.jsx(_e,{variant:"ghost",size:"lg","data-testid":"empty-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]})}):i.jsx(at,{children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-baseline mb-spacing-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-headline-lg uppercase",children:"LEGACY PACKAGE TOOLS"}),i.jsxs("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:[r.length," legacy package install",r.length!==1?"s":""," retained for bootstrap internals"]})]}),i.jsxs("div",{className:"flex flex-col items-end gap-spacing-2",children:[i.jsx(_e,{variant:"default",size:"sm","data-testid":"header-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"header-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]}),r.map(a=>i.jsx(xce,{pkg:a,onSelect:l=>e({to:"/packages/$packageId",params:{packageId:l}})},a.id))]})})}const vce=[{num:1,label:"ENTER"},{num:2,label:"VALIDATE"},{num:3,label:"CONFIGURE"},{num:4,label:"PLAN"},{num:5,label:"APPLY"}];function bce(e){switch(e){case"enter":return 1;case"validating":case"validated":return 2;case"configure":return 3;case"planning":case"planned":return 4;case"applying":case"done":return 5;case"error":return 0}}function wce({currentStep:e,errorAtStep:t}){const n=e==="error"?t:bce(e);return i.jsx("div",{className:"flex items-center gap-spacing-2 mb-spacing-8 p-spacing-4 inset-light flex-wrap","data-testid":"step-indicator",children:vce.map((s,r)=>{const a=n>s.num,l=n===s.num;return i.jsxs("div",{className:"flex items-center gap-spacing-2",children:[r>0&&i.jsx("div",{className:`w-6 h-px mx-spacing-1 ${a?"bg-primary/40":"bg-foreground-muted/20"}`}),i.jsxs("span",{"data-testid":`step-${s.num}`,className:he("text-label-sm uppercase tracking-[0.04em] font-mono px-spacing-2 py-spacing-1 transition-colors whitespace-nowrap",a?"text-foreground-muted":l?"text-foreground bg-foreground/10":"text-foreground-muted/30"),children:[a?"✓":""," [ ",s.num," ",s.label," ]"]})]},s.num)})})}function jce(e){switch(e){case"approved":return"text-success";case"rejected":return"text-warning";case"deferred":return"text-foreground-muted";case"conflict":return"text-destructive";case"noop":return"text-foreground-muted/50";default:return""}}function Sce(e){switch(e){case"approved":return"bg-success/8";case"rejected":return"bg-warning/8";case"deferred":return"bg-foreground-muted/4";case"conflict":return"bg-destructive/8";default:return""}}function Nce(){const e=zt(),[t,n]=E.useState(""),[s,r]=E.useState("enter"),[a,l]=E.useState(0),[u,f]=E.useState([]),[d,p]=E.useState(null),[m,x]=E.useState("claude-code"),[y,b]=E.useState("."),[v,w]=E.useState(""),[S,C]=E.useState(!1),[k,_]=E.useState(null),[R,T]=E.useState(null),A=async()=>{r("validating"),f([]);try{const B=await(await fetch("/api/packages/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t})})).json();B.valid?(p(B.manifest),r("validated")):(f(B.errors??[B.error??"Validation failed"]),l(2),r("error"))}catch{f(["Validation request failed"]),l(2),r("error")}},I=async()=>{r("planning"),f([]);try{const O=await fetch("/api/packages/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:y,runtime:m,roleName:v||void 0,allowMerge:S})});if(!O.ok){const H=await O.json();f(H.errors??[H.error??"Plan failed"]),l(4),r("error");return}const B=await O.json();_(B),r("planned")}catch{f(["Plan request failed"]),l(4),r("error")}},L=async()=>{r("applying"),f([]);try{const O=await fetch("/api/packages/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:y,runtime:m,roleName:v||void 0,allowMerge:S})}),B=await O.json();if(O.status>=400){f(B.errors??[B.error??"Install failed"]),l(5),r("error");return}T(B),r("done")}catch{f(["Install request failed"]),l(5),r("error")}},$=((k==null?void 0:k.conflicts)??0)>0;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"install-flow",children:[i.jsx("div",{className:"mb-spacing-8",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-headline-lg uppercase tracking-[0.06em]",children:"INSTALL PACKAGE (Legacy)"}),i.jsx("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:"Validate, configure, and apply an agent package"})]})}),i.jsx(wce,{currentStep:s,errorAtStep:a}),s==="enter"&&i.jsxs("div",{children:[i.jsx("label",{className:"text-label-md text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-2",children:"PACKAGE PATH"}),i.jsx("input",{"data-testid":"source-path-input",type:"text",value:t,onChange:O=>n(O.target.value),placeholder:"/path/to/package",className:"w-full bg-transparent border-b border-foreground/20 focus:border-foreground px-0 py-spacing-2 text-body-md font-mono outline-none transition-colors"}),i.jsx(_e,{variant:"tactical","data-testid":"validate-btn",onClick:A,disabled:!t.trim(),className:"mt-spacing-4",children:"VALIDATE"})]}),s==="validating"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"validating-indicator",children:"Validating..."}),s==="validated"&&d&&i.jsxs("div",{"data-testid":"manifest-summary",children:[i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4",children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsx("span",{className:"text-headline-md uppercase",children:d.name}),i.jsxs("span",{className:"font-mono text-foreground-muted-on-dark",children:["v",d.version]})]}),i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-3",children:d.summary}),i.jsxs("div",{className:"flex flex-wrap gap-spacing-3 text-label-sm",children:[i.jsxs("span",{children:["Skills: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:d.exportCounts.skills})]}),i.jsxs("span",{children:["Guidance: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:d.exportCounts.guidance})]}),i.jsxs("span",{children:["Agents: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:d.exportCounts.agents})]}),i.jsxs("span",{children:["Hooks: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:d.exportCounts.hooks})]}),i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[i.jsx("span",{children:"Runtimes:"}),i.jsx("span",{className:"inline-flex min-w-0 flex-wrap items-center gap-1",children:d.runtimes.map(O=>i.jsx(Kn,{runtime:O,size:"xs",compact:!0,className:"border-white/20 bg-white/10 text-foreground-on-dark"},O))})]})]})]}),i.jsx(_e,{variant:"tactical","data-testid":"configure-btn",onClick:()=>r("configure"),children:"CONFIGURE"})]}),s==="configure"&&d&&i.jsxs("div",{"data-testid":"configure-step",children:[i.jsxs("div",{className:"space-y-spacing-4 mb-spacing-6",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RUNTIME"}),i.jsx("select",{"data-testid":"runtime-select",value:m,onChange:O=>x(O.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:d.runtimes.map(O=>i.jsx("option",{value:O,children:O},O))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"TARGET ROOT"}),i.jsx("input",{"data-testid":"target-root-input",type:"text",value:y,onChange:O=>b(O.target.value),className:"w-full bg-transparent border-b border-foreground/20 px-0 py-spacing-1 text-body-md font-mono outline-none"})]}),d.roles.length>0&&i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"ROLE"}),i.jsxs("select",{"data-testid":"role-select",value:v,onChange:O=>w(O.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:[i.jsx("option",{value:"",children:"All exports"}),d.roles.map(O=>i.jsxs("option",{value:O.name,children:[O.name,O.description?` — ${O.description}`:""]},O.name))]})]}),i.jsxs("div",{className:"flex items-center gap-spacing-2",children:[i.jsx("input",{"data-testid":"allow-merge-toggle",type:"checkbox",checked:S,onChange:O=>C(O.target.checked),className:"accent-primary"}),i.jsx("label",{className:"text-label-sm text-foreground-muted",children:"Allow managed block merges into existing files"})]}),(d.requirements.cliTools.length>0||d.requirements.systemPackages.length>0)&&i.jsxs("div",{"data-testid":"requirements-section",className:"p-spacing-3 bg-foreground/4",children:[i.jsx("span",{className:"text-label-sm text-foreground-muted uppercase block mb-spacing-1",children:"REQUIREMENTS"}),d.requirements.cliTools.map(O=>i.jsxs("div",{className:"text-body-sm font-mono",children:["CLI: ",O.name]},O.name)),d.requirements.systemPackages.map(O=>i.jsxs("div",{className:"text-body-sm font-mono",children:["System: ",O.name]},O.name))]})]}),i.jsx(_e,{variant:"tactical","data-testid":"plan-btn",onClick:I,children:"PREVIEW PLAN"})]}),s==="planning"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"planning-indicator",children:"Planning..."}),s==="planned"&&k&&i.jsxs("div",{"data-testid":"plan-preview",children:[i.jsxs("div",{className:"flex flex-wrap gap-spacing-4 mb-spacing-4 text-label-sm",children:[i.jsxs("span",{children:["Approved: ",i.jsx("span",{className:"font-mono text-success","data-testid":"plan-actionable",children:k.actionable})]}),i.jsxs("span",{children:["Deferred: ",i.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"plan-deferred",children:k.deferred})]}),i.jsxs("span",{children:["Conflicts: ",i.jsx("span",{className:"font-mono text-destructive","data-testid":"plan-conflicts",children:k.conflicts})]}),i.jsxs("span",{children:["No-ops: ",i.jsx("span",{className:"font-mono","data-testid":"plan-noops",children:k.noOps})]}),k.rejected>0&&i.jsxs("span",{children:["Rejected: ",i.jsx("span",{className:"font-mono text-warning","data-testid":"plan-rejected",children:k.rejected})]})]}),$&&i.jsx(wn,{className:"mb-spacing-4","data-testid":"conflict-warning",children:i.jsx(dn,{className:"text-destructive",children:"Conflicts detected — resolve before applying"})}),i.jsxs(u_,{children:[i.jsx(d_,{children:i.jsxs(zd,{children:[i.jsx(eo,{children:"TYPE"}),i.jsx(eo,{children:"NAME"}),i.jsx(eo,{children:"STATUS"}),i.jsx(eo,{children:"TARGET"})]})}),i.jsx(f_,{children:k.entries.map((O,B)=>i.jsxs(zd,{className:Sce(O.policyStatus),"data-testid":"plan-entry","data-policy-status":O.policyStatus,children:[i.jsx(to,{className:"font-mono text-label-sm",children:O.exportType}),i.jsx(to,{className:"font-mono text-label-sm",children:O.exportName}),i.jsxs(to,{className:he("font-mono text-label-sm uppercase",jce(O.policyStatus)),children:[O.policyStatus,O.deferReason&&i.jsxs("span",{className:"text-foreground-muted normal-case",children:[" — ",O.deferReason]}),O.conflict&&i.jsxs("span",{className:"text-destructive normal-case",children:[" — ",O.conflict.reason]})]}),i.jsx(to,{className:"font-mono text-label-sm text-foreground-muted truncate max-w-[200px]",children:O.targetPath||"—"})]},B))})]}),i.jsx("div",{className:"mt-spacing-4",children:i.jsx(_e,{variant:"tactical","data-testid":"apply-btn",onClick:L,disabled:$,title:$?"Resolve conflicts before applying":void 0,children:"APPLY"})})]}),s==="applying"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"applying-indicator",children:"Applying..."}),s==="done"&&R&&i.jsxs("div",{"data-testid":"install-result",children:[i.jsx(wn,{className:"mb-spacing-4",children:i.jsxs(dn,{children:[i.jsx("span",{className:"text-primary font-mono",children:R.packageName}),i.jsx("span",{className:"text-foreground-muted",children:" installed as "}),i.jsx("span",{className:"font-mono","data-testid":"result-install-id",children:R.installId})]})}),i.jsxs("div",{className:"flex gap-spacing-4 text-label-sm mb-spacing-4",children:[i.jsxs("span",{children:["Applied: ",i.jsx("span",{className:"font-mono text-success","data-testid":"result-applied",children:R.applied.length})]}),i.jsxs("span",{children:["Deferred: ",i.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"result-deferred",children:R.deferred.length})]}),i.jsxs("span",{children:["Verified: ",i.jsx("span",{className:he("font-mono",R.verification.passed?"text-success":"text-destructive"),"data-testid":"result-verified",children:R.verification.passed?"PASS":"FAIL"})]})]}),i.jsx("div",{className:"flex gap-spacing-3",children:i.jsx(_e,{variant:"tactical","data-testid":"detail-link",onClick:()=>e({to:"/packages/$packageId",params:{packageId:R.packageId}}),children:"VIEW INSTALL DETAILS"})})]}),s==="error"&&i.jsxs("div",{"data-testid":"install-errors",children:[u.map((O,B)=>i.jsx(wn,{className:"mb-spacing-2",children:i.jsx(dn,{className:"text-destructive",children:O})},B)),i.jsx(_e,{variant:"tactical",className:"mt-spacing-4","data-testid":"try-again-btn",onClick:()=>{r("enter"),f([]),p(null),_(null),T(null),l(0)},children:"TRY AGAIN"})]})]})})}function ua(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function kce(e,t){const n=E.createContext(t),s=a=>{const{children:l,...u}=a,f=E.useMemo(()=>u,Object.values(u));return i.jsx(n.Provider,{value:f,children:l})};s.displayName=e+"Provider";function r(a){const l=E.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,r]}function _ce(e,t=[]){let n=[];function s(a,l){const u=E.createContext(l),f=n.length;n=[...n,l];const d=m=>{var S;const{scope:x,children:y,...b}=m,v=((S=x==null?void 0:x[e])==null?void 0:S[f])||u,w=E.useMemo(()=>b,Object.values(b));return i.jsx(v.Provider,{value:w,children:y})};d.displayName=a+"Provider";function p(m,x){var v;const y=((v=x==null?void 0:x[e])==null?void 0:v[f])||u,b=E.useContext(y);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[d,p]}const r=()=>{const a=n.map(l=>E.createContext(l));return function(u){const f=(u==null?void 0:u[e])||a;return E.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return r.scopeName=e,[s,Cce(r,...t)]}function Cce(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const l=s.reduce((u,{useScope:f,scopeName:d})=>{const m=f(a)[`__scope${d}`];return{...u,...m}},{});return E.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Bd=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},Ece=c2[" useId ".trim().toString()]||(()=>{}),Rce=0;function ES(e){const[t,n]=E.useState(Ece());return Bd(()=>{n(s=>s??String(Rce++))},[e]),e||(t?`radix-${t}`:"")}var Ace=c2[" useInsertionEffect ".trim().toString()]||Bd;function Tce({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,a,l]=Ice({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:r;{const p=E.useRef(e!==void 0);E.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${s} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,s])}const d=E.useCallback(p=>{var m;if(u){const x=Mce(p)?p(e):p;x!==e&&((m=l.current)==null||m.call(l,x))}else a(p)},[u,e,a,l]);return[f,d]}function Ice({defaultProp:e,onChange:t}){const[n,s]=E.useState(e),r=E.useRef(n),a=E.useRef(t);return Ace(()=>{a.current=t},[t]),E.useEffect(()=>{var l;r.current!==n&&((l=a.current)==null||l.call(a,n),r.current=n)},[n,r]),[n,s,a]}function Mce(e){return typeof e=="function"}function x9(e){const t=Oce(e),n=E.forwardRef((s,r)=>{const{children:a,...l}=s,u=E.Children.toArray(a),f=u.find(Pce);if(f){const d=f.props.children,p=u.map(m=>m===f?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:m);return i.jsx(t,{...l,ref:r,children:E.isValidElement(d)?E.cloneElement(d,void 0,p):null})}return i.jsx(t,{...l,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function Oce(e){const t=E.forwardRef((n,s)=>{const{children:r,...a}=n;if(E.isValidElement(r)){const l=Dce(r),u=$ce(a,r.props);return r.type!==E.Fragment&&(u.ref=s?Z2(s,l):l),E.cloneElement(r,u)}return E.Children.count(r)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Lce=Symbol("radix.slottable");function Pce(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Lce}function $ce(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...u)=>{const f=a(...u);return r(...u),f}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function Dce(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qce=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],si=qce.reduce((e,t)=>{const n=x9(`Primitive.${t}`),s=E.forwardRef((r,a)=>{const{asChild:l,...u}=r,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(f,{...u,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function zce(e,t){e&&Vm.flushSync(()=>e.dispatchEvent(t))}function Fd(e){const t=E.useRef(e);return E.useEffect(()=>{t.current=e}),E.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Bce(e,t=globalThis==null?void 0:globalThis.document){const n=Fd(e);E.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var Fce="DismissableLayer",XN="dismissableLayer.update",Hce="dismissableLayer.pointerDownOutside",Uce="dismissableLayer.focusOutside",PL,y9=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v9=E.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...f}=e,d=E.useContext(y9),[p,m]=E.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=E.useState({}),b=To(t,A=>m(A)),v=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),S=v.indexOf(w),C=p?v.indexOf(p):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,_=C>=S,R=Kce(A=>{const I=A.target,L=[...d.branches].some($=>$.contains(I));!_||L||(r==null||r(A),l==null||l(A),A.defaultPrevented||u==null||u())},x),T=Wce(A=>{const I=A.target;[...d.branches].some($=>$.contains(I))||(a==null||a(A),l==null||l(A),A.defaultPrevented||u==null||u())},x);return Bce(A=>{C===d.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))},x),E.useEffect(()=>{if(p)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(PL=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),$L(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=PL)}},[p,x,n,d]),E.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),$L())},[p,d]),E.useEffect(()=>{const A=()=>y({});return document.addEventListener(XN,A),()=>document.removeEventListener(XN,A)},[]),i.jsx(si.div,{...f,ref:b,style:{pointerEvents:k?_?"auto":"none":void 0,...e.style},onFocusCapture:ua(e.onFocusCapture,T.onFocusCapture),onBlurCapture:ua(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ua(e.onPointerDownCapture,R.onPointerDownCapture)})});v9.displayName=Fce;var Vce="DismissableLayerBranch",Gce=E.forwardRef((e,t)=>{const n=E.useContext(y9),s=E.useRef(null),r=To(t,s);return E.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(si.div,{...e,ref:r})});Gce.displayName=Vce;function Kce(e,t=globalThis==null?void 0:globalThis.document){const n=Fd(e),s=E.useRef(!1),r=E.useRef(()=>{});return E.useEffect(()=>{const a=u=>{if(u.target&&!s.current){let f=function(){b9(Hce,n,d,{discrete:!0})};const d={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=f,t.addEventListener("click",r.current,{once:!0})):f()}else t.removeEventListener("click",r.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Wce(e,t=globalThis==null?void 0:globalThis.document){const n=Fd(e),s=E.useRef(!1);return E.useEffect(()=>{const r=a=>{a.target&&!s.current&&b9(Uce,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function $L(){const e=new CustomEvent(XN);document.dispatchEvent(e)}function b9(e,t,n,{discrete:s}){const r=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?zce(r,a):r.dispatchEvent(a)}var RS="focusScope.autoFocusOnMount",AS="focusScope.autoFocusOnUnmount",DL={bubbles:!1,cancelable:!0},Yce="FocusScope",w9=E.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:a,...l}=e,[u,f]=E.useState(null),d=Fd(r),p=Fd(a),m=E.useRef(null),x=To(t,v=>f(v)),y=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(s){let v=function(k){if(y.paused||!u)return;const _=k.target;u.contains(_)?m.current=_:Bi(m.current,{select:!0})},w=function(k){if(y.paused||!u)return;const _=k.relatedTarget;_!==null&&(u.contains(_)||Bi(m.current,{select:!0}))},S=function(k){if(document.activeElement===document.body)for(const R of k)R.removedNodes.length>0&&Bi(u)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const C=new MutationObserver(S);return u&&C.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),C.disconnect()}}},[s,u,y.paused]),E.useEffect(()=>{if(u){zL.add(y);const v=document.activeElement;if(!u.contains(v)){const S=new CustomEvent(RS,DL);u.addEventListener(RS,d),u.dispatchEvent(S),S.defaultPrevented||(Qce(tue(j9(u)),{select:!0}),document.activeElement===v&&Bi(u))}return()=>{u.removeEventListener(RS,d),setTimeout(()=>{const S=new CustomEvent(AS,DL);u.addEventListener(AS,p),u.dispatchEvent(S),S.defaultPrevented||Bi(v??document.body,{select:!0}),u.removeEventListener(AS,p),zL.remove(y)},0)}}},[u,d,p,y]);const b=E.useCallback(v=>{if(!n&&!s||y.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,S=document.activeElement;if(w&&S){const C=v.currentTarget,[k,_]=Xce(C);k&&_?!v.shiftKey&&S===_?(v.preventDefault(),n&&Bi(k,{select:!0})):v.shiftKey&&S===k&&(v.preventDefault(),n&&Bi(_,{select:!0})):S===C&&v.preventDefault()}},[n,s,y.paused]);return i.jsx(si.div,{tabIndex:-1,...l,ref:x,onKeyDown:b})});w9.displayName=Yce;function Qce(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Bi(s,{select:t}),document.activeElement!==n)return}function Xce(e){const t=j9(e),n=qL(t,e),s=qL(t.reverse(),e);return[n,s]}function j9(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qL(e,t){for(const n of e)if(!Zce(n,{upTo:t}))return n}function Zce(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Jce(e){return e instanceof HTMLInputElement&&"select"in e}function Bi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Jce(e)&&t&&e.select()}}var zL=eue();function eue(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=BL(e,t),e.unshift(t)},remove(t){var n;e=BL(e,t),(n=e[0])==null||n.resume()}}}function BL(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function tue(e){return e.filter(t=>t.tagName!=="A")}var nue="Portal",S9=E.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[r,a]=E.useState(!1);Bd(()=>a(!0),[]);const l=n||r&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?zH.createPortal(i.jsx(si.div,{...s,ref:t}),l):null});S9.displayName=nue;function sue(e,t){return E.useReducer((n,s)=>t[n][s]??n,e)}var ex=e=>{const{present:t,children:n}=e,s=rue(t),r=typeof n=="function"?n({present:s.isPresent}):E.Children.only(n),a=To(s.ref,iue(r));return typeof n=="function"||s.isPresent?E.cloneElement(r,{ref:a}):null};ex.displayName="Presence";function rue(e){const[t,n]=E.useState(),s=E.useRef(null),r=E.useRef(e),a=E.useRef("none"),l=e?"mounted":"unmounted",[u,f]=sue(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const d=Ip(s.current);a.current=u==="mounted"?d:"none"},[u]),Bd(()=>{const d=s.current,p=r.current;if(p!==e){const x=a.current,y=Ip(d);e?f("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?f("UNMOUNT"):f(p&&x!==y?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,f]),Bd(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=y=>{const v=Ip(s.current).includes(CSS.escape(y.animationName));if(y.target===t&&v&&(f("ANIMATION_END"),!r.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},x=y=>{y.target===t&&(a.current=Ip(s.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:E.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Ip(e){return(e==null?void 0:e.animationName)||"none"}function iue(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TS=0;function aue(){E.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??FL()),document.body.insertAdjacentElement("beforeend",e[1]??FL()),TS++,()=>{TS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),TS--}},[])}function FL(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var rr=function(){return rr=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},rr.apply(this,arguments)};function N9(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function oue(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,a;s<r;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var am="right-scroll-bar-position",om="width-before-scroll-bar",lue="with-scroll-bars-hidden",cue="--removed-body-scroll-bar-size";function IS(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function uue(e,t){var n=E.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var due=typeof window<"u"?E.useLayoutEffect:E.useEffect,HL=new WeakMap;function fue(e,t){var n=uue(null,function(s){return e.forEach(function(r){return IS(r,s)})});return due(function(){var s=HL.get(n);if(s){var r=new Set(s),a=new Set(e),l=n.current;r.forEach(function(u){a.has(u)||IS(u,null)}),a.forEach(function(u){r.has(u)||IS(u,l)})}HL.set(n,e)},[e]),n}function hue(e){return e}function pue(e,t){t===void 0&&(t=hue);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,s);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(s=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){s=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var f=function(){var p=l;l=[],p.forEach(a)},d=function(){return Promise.resolve().then(f)};d(),n={push:function(p){l.push(p),d()},filter:function(p){return l=l.filter(p),n}}}};return r}function mue(e){e===void 0&&(e={});var t=pue(null);return t.options=rr({async:!0,ssr:!1},e),t}var k9=function(e){var t=e.sideCar,n=N9(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return E.createElement(s,rr({},n))};k9.isSideCarExport=!0;function gue(e,t){return e.useMedium(t),k9}var _9=mue(),MS=function(){},tx=E.forwardRef(function(e,t){var n=E.useRef(null),s=E.useState({onScrollCapture:MS,onWheelCapture:MS,onTouchMoveCapture:MS}),r=s[0],a=s[1],l=e.forwardProps,u=e.children,f=e.className,d=e.removeScrollBar,p=e.enabled,m=e.shards,x=e.sideCar,y=e.noRelative,b=e.noIsolation,v=e.inert,w=e.allowPinchZoom,S=e.as,C=S===void 0?"div":S,k=e.gapMode,_=N9(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=x,T=fue([n,t]),A=rr(rr({},_),r);return E.createElement(E.Fragment,null,p&&E.createElement(R,{sideCar:_9,removeScrollBar:d,shards:m,noRelative:y,noIsolation:b,inert:v,setCallbacks:a,allowPinchZoom:!!w,lockRef:n,gapMode:k}),l?E.cloneElement(E.Children.only(u),rr(rr({},A),{ref:T})):E.createElement(C,rr({},A,{className:f,ref:T}),u))});tx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};tx.classNames={fullWidth:om,zeroRight:am};var xue=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function yue(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xue();return t&&e.setAttribute("nonce",t),e}function vue(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bue(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var wue=function(){var e=0,t=null;return{add:function(n){e==0&&(t=yue())&&(vue(t,n),bue(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jue=function(){var e=wue();return function(t,n){E.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},C9=function(){var e=jue(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},Sue={left:0,top:0,right:0,gap:0},OS=function(e){return parseInt(e||"",10)||0},Nue=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[OS(n),OS(s),OS(r)]},kue=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Sue;var t=Nue(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},_ue=C9(),tc="data-scroll-locked",Cue=function(e,t,n,s){var r=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
470
|
-
.`.concat(lue,` {
|
|
471
|
-
overflow: hidden `).concat(s,`;
|
|
472
|
-
padding-right: `).concat(u,"px ").concat(s,`;
|
|
473
|
-
}
|
|
474
|
-
body[`).concat(tc,`] {
|
|
475
|
-
overflow: hidden `).concat(s,`;
|
|
476
|
-
overscroll-behavior: contain;
|
|
477
|
-
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
478
|
-
padding-left: `.concat(r,`px;
|
|
479
|
-
padding-top: `).concat(a,`px;
|
|
480
|
-
padding-right: `).concat(l,`px;
|
|
481
|
-
margin-left:0;
|
|
482
|
-
margin-top:0;
|
|
483
|
-
margin-right: `).concat(u,"px ").concat(s,`;
|
|
484
|
-
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.`).concat(am,` {
|
|
488
|
-
right: `).concat(u,"px ").concat(s,`;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
.`).concat(om,` {
|
|
492
|
-
margin-right: `).concat(u,"px ").concat(s,`;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.`).concat(am," .").concat(am,` {
|
|
496
|
-
right: 0 `).concat(s,`;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.`).concat(om," .").concat(om,` {
|
|
500
|
-
margin-right: 0 `).concat(s,`;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
body[`).concat(tc,`] {
|
|
504
|
-
`).concat(cue,": ").concat(u,`px;
|
|
505
|
-
}
|
|
506
|
-
`)},UL=function(){var e=parseInt(document.body.getAttribute(tc)||"0",10);return isFinite(e)?e:0},Eue=function(){E.useEffect(function(){return document.body.setAttribute(tc,(UL()+1).toString()),function(){var e=UL()-1;e<=0?document.body.removeAttribute(tc):document.body.setAttribute(tc,e.toString())}},[])},Rue=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;Eue();var a=E.useMemo(function(){return kue(r)},[r]);return E.createElement(_ue,{styles:Cue(a,!t,r,n?"":"!important")})},ZN=!1;if(typeof window<"u")try{var Mp=Object.defineProperty({},"passive",{get:function(){return ZN=!0,!0}});window.addEventListener("test",Mp,Mp),window.removeEventListener("test",Mp,Mp)}catch{ZN=!1}var Il=ZN?{passive:!1}:!1,Aue=function(e){return e.tagName==="TEXTAREA"},E9=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Aue(e)&&n[t]==="visible")},Tue=function(e){return E9(e,"overflowY")},Iue=function(e){return E9(e,"overflowX")},VL=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=R9(e,s);if(r){var a=A9(e,s),l=a[1],u=a[2];if(l>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Mue=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Oue=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},R9=function(e,t){return e==="v"?Tue(t):Iue(t)},A9=function(e,t){return e==="v"?Mue(t):Oue(t)},Lue=function(e,t){return e==="h"&&t==="rtl"?-1:1},Pue=function(e,t,n,s,r){var a=Lue(e,window.getComputedStyle(t).direction),l=a*s,u=n.target,f=t.contains(u),d=!1,p=l>0,m=0,x=0;do{if(!u)break;var y=A9(e,u),b=y[0],v=y[1],w=y[2],S=v-w-a*b;(b||S)&&R9(e,u)&&(m+=S,x+=b);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&Math.abs(m)<1||!p&&Math.abs(x)<1)&&(d=!0),d},Op=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},GL=function(e){return[e.deltaX,e.deltaY]},KL=function(e){return e&&"current"in e?e.current:e},$ue=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Due=function(e){return`
|
|
507
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
508
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
509
|
-
`)},que=0,Ml=[];function zue(e){var t=E.useRef([]),n=E.useRef([0,0]),s=E.useRef(),r=E.useState(que++)[0],a=E.useState(C9)[0],l=E.useRef(e);E.useEffect(function(){l.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var v=oue([e.lockRef.current],(e.shards||[]).map(KL),!0).filter(Boolean);return v.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),v.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var u=E.useCallback(function(v,w){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!l.current.allowPinchZoom;var S=Op(v),C=n.current,k="deltaX"in v?v.deltaX:C[0]-S[0],_="deltaY"in v?v.deltaY:C[1]-S[1],R,T=v.target,A=Math.abs(k)>Math.abs(_)?"h":"v";if("touches"in v&&A==="h"&&T.type==="range")return!1;var I=window.getSelection(),L=I&&I.anchorNode,$=L?L===T||L.contains(T):!1;if($)return!1;var O=VL(A,T);if(!O)return!0;if(O?R=A:(R=A==="v"?"h":"v",O=VL(A,T)),!O)return!1;if(!s.current&&"changedTouches"in v&&(k||_)&&(s.current=R),!R)return!0;var B=s.current||R;return Pue(B,w,v,B==="h"?k:_)},[]),f=E.useCallback(function(v){var w=v;if(!(!Ml.length||Ml[Ml.length-1]!==a)){var S="deltaY"in w?GL(w):Op(w),C=t.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&$ue(R.delta,S)})[0];if(C&&C.should){w.cancelable&&w.preventDefault();return}if(!C){var k=(l.current.shards||[]).map(KL).filter(Boolean).filter(function(R){return R.contains(w.target)}),_=k.length>0?u(w,k[0]):!l.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),d=E.useCallback(function(v,w,S,C){var k={name:v,delta:w,target:S,should:C,shadowParent:Bue(S)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(_){return _!==k})},1)},[]),p=E.useCallback(function(v){n.current=Op(v),s.current=void 0},[]),m=E.useCallback(function(v){d(v.type,GL(v),v.target,u(v,e.lockRef.current))},[]),x=E.useCallback(function(v){d(v.type,Op(v),v.target,u(v,e.lockRef.current))},[]);E.useEffect(function(){return Ml.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Il),document.addEventListener("touchmove",f,Il),document.addEventListener("touchstart",p,Il),function(){Ml=Ml.filter(function(v){return v!==a}),document.removeEventListener("wheel",f,Il),document.removeEventListener("touchmove",f,Il),document.removeEventListener("touchstart",p,Il)}},[]);var y=e.removeScrollBar,b=e.inert;return E.createElement(E.Fragment,null,b?E.createElement(a,{styles:Due(r)}):null,y?E.createElement(Rue,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bue(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Fue=gue(_9,zue);var T9=E.forwardRef(function(e,t){return E.createElement(tx,rr({},e,{ref:t,sideCar:Fue}))});T9.classNames=tx.classNames;var Hue=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ol=new WeakMap,Lp=new WeakMap,Pp={},LS=0,I9=function(e){return e&&(e.host||I9(e.parentNode))},Uue=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=I9(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Vue=function(e,t,n,s){var r=Uue(t,Array.isArray(e)?e:[e]);Pp[n]||(Pp[n]=new WeakMap);var a=Pp[n],l=[],u=new Set,f=new Set(r),d=function(m){!m||u.has(m)||(u.add(m),d(m.parentNode))};r.forEach(d);var p=function(m){!m||f.has(m)||Array.prototype.forEach.call(m.children,function(x){if(u.has(x))p(x);else try{var y=x.getAttribute(s),b=y!==null&&y!=="false",v=(Ol.get(x)||0)+1,w=(a.get(x)||0)+1;Ol.set(x,v),a.set(x,w),l.push(x),v===1&&b&&Lp.set(x,!0),w===1&&x.setAttribute(n,"true"),b||x.setAttribute(s,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return p(t),u.clear(),LS++,function(){l.forEach(function(m){var x=Ol.get(m)-1,y=a.get(m)-1;Ol.set(m,x),a.set(m,y),x||(Lp.has(m)||m.removeAttribute(s),Lp.delete(m)),y||m.removeAttribute(n)}),LS--,LS||(Ol=new WeakMap,Ol=new WeakMap,Lp=new WeakMap,Pp={})}},Gue=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=Hue(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),Vue(s,r,n,"aria-hidden")):function(){return null}},nx="Dialog",[M9]=_ce(nx),[Kue,Vs]=M9(nx),O9=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:a,modal:l=!0}=e,u=E.useRef(null),f=E.useRef(null),[d,p]=Tce({prop:s,defaultProp:r??!1,onChange:a,caller:nx});return i.jsx(Kue,{scope:t,triggerRef:u,contentRef:f,contentId:ES(),titleId:ES(),descriptionId:ES(),open:d,onOpenChange:p,onOpenToggle:E.useCallback(()=>p(m=>!m),[p]),modal:l,children:n})};O9.displayName=nx;var L9="DialogTrigger",Wue=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(L9,n),a=To(t,r.triggerRef);return i.jsx(si.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":m_(r.open),...s,ref:a,onClick:ua(e.onClick,r.onOpenToggle)})});Wue.displayName=L9;var h_="DialogPortal",[Yue,P9]=M9(h_,{forceMount:void 0}),$9=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,a=Vs(h_,t);return i.jsx(Yue,{scope:t,forceMount:n,children:E.Children.map(s,l=>i.jsx(ex,{present:n||a.open,children:i.jsx(S9,{asChild:!0,container:r,children:l})}))})};$9.displayName=h_;var $m="DialogOverlay",D9=E.forwardRef((e,t)=>{const n=P9($m,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Vs($m,e.__scopeDialog);return a.modal?i.jsx(ex,{present:s||a.open,children:i.jsx(Xue,{...r,ref:t})}):null});D9.displayName=$m;var Que=x9("DialogOverlay.RemoveScroll"),Xue=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs($m,n);return i.jsx(T9,{as:Que,allowPinchZoom:!0,shards:[r.contentRef],children:i.jsx(si.div,{"data-state":m_(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),_o="DialogContent",q9=E.forwardRef((e,t)=>{const n=P9(_o,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Vs(_o,e.__scopeDialog);return i.jsx(ex,{present:s||a.open,children:a.modal?i.jsx(Zue,{...r,ref:t}):i.jsx(Jue,{...r,ref:t})})});q9.displayName=_o;var Zue=E.forwardRef((e,t)=>{const n=Vs(_o,e.__scopeDialog),s=E.useRef(null),r=To(t,n.contentRef,s);return E.useEffect(()=>{const a=s.current;if(a)return Gue(a)},[]),i.jsx(z9,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ua(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ua(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:ua(e.onFocusOutside,a=>a.preventDefault())})}),Jue=E.forwardRef((e,t)=>{const n=Vs(_o,e.__scopeDialog),s=E.useRef(!1),r=E.useRef(!1);return i.jsx(z9,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:a=>{var f,d;(f=e.onInteractOutside)==null||f.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const l=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),z9=E.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:a,...l}=e,u=Vs(_o,n),f=E.useRef(null),d=To(t,f);return aue(),i.jsxs(i.Fragment,{children:[i.jsx(w9,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:a,children:i.jsx(v9,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":m_(u.open),...l,ref:d,onDismiss:()=>u.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(ede,{titleId:u.titleId}),i.jsx(nde,{contentRef:f,descriptionId:u.descriptionId})]})]})}),p_="DialogTitle",B9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(p_,n);return i.jsx(si.h2,{id:r.titleId,...s,ref:t})});B9.displayName=p_;var F9="DialogDescription",H9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(F9,n);return i.jsx(si.p,{id:r.descriptionId,...s,ref:t})});H9.displayName=F9;var U9="DialogClose",V9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Vs(U9,n);return i.jsx(si.button,{type:"button",...s,ref:t,onClick:ua(e.onClick,()=>r.onOpenChange(!1))})});V9.displayName=U9;function m_(e){return e?"open":"closed"}var G9="DialogTitleWarning",[lye,K9]=kce(G9,{contentName:_o,titleName:p_,docsSlug:"dialog"}),ede=({titleId:e})=>{const t=K9(G9),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
510
|
-
|
|
511
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
512
|
-
|
|
513
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return E.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},tde="DialogDescriptionWarning",nde=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${K9(tde).contentName}}.`;return E.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},sde=O9,rde=$9,W9=D9,Y9=q9,Q9=B9,X9=H9,ide=V9;const Z9=sde,ade=rde,J9=E.forwardRef(({className:e,...t},n)=>i.jsx(W9,{ref:n,className:he("fixed inset-0 z-50 bg-black/20 backdrop-blur-[8px]",e),...t}));J9.displayName=W9.displayName;const g_=E.forwardRef(({className:e,children:t,hideCloseButton:n,...s},r)=>i.jsxs(ade,{children:[i.jsx(J9,{}),i.jsxs(Y9,{ref:r,className:he("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 vellum-heavy p-6 shadow-[0_20px_40px_rgba(46,52,46,0.06)] border border-stone-300",e),...s,children:[t,!n&&i.jsxs(ide,{className:"absolute right-4 top-4 opacity-70 transition-opacity duration-150 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background disabled:pointer-events-none",children:[i.jsx(C2,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));g_.displayName=Y9.displayName;const x_=({className:e,...t})=>i.jsx("div",{className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});x_.displayName="DialogHeader";const y_=({className:e,...t})=>i.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});y_.displayName="DialogFooter";const v_=E.forwardRef(({className:e,...t},n)=>i.jsx(Q9,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",e),...t}));v_.displayName=Q9.displayName;const b_=E.forwardRef(({className:e,...t},n)=>i.jsx(X9,{ref:n,className:he("text-sm text-foreground-muted",e),...t}));b_.displayName=X9.displayName;function ode(e){return De({queryKey:["packages",e],queryFn:async()=>{const t=await fetch(`/api/packages/${e}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function lde(e){return De({queryKey:["packages",e,"installs"],queryFn:async()=>{const t=await fetch(`/api/packages/${e}/installs`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function cde(e){return De({queryKey:["installs",e,"journal"],queryFn:async()=>{const t=await fetch(`/api/packages/installs/${e}/journal`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function ude(e){const t=Mt();return sn({mutationFn:async n=>{const s=await fetch(`/api/packages/${n}/rollback`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["packages",e,"installs"]}),t.invalidateQueries({queryKey:["installs"]})}})}function dde(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted"}}function fde(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return e.toUpperCase()}}function hde({installId:e}){const{data:t,isPending:n,isError:s}=cde(e);return n?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"Loading journal..."}):s?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-destructive","data-testid":"journal-error",children:"Failed to load journal entries"}):!t||t.length===0?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"No journal entries"}):i.jsx("div",{className:"pl-spacing-6 py-spacing-2 space-y-spacing-1","data-testid":"journal-entries",children:t.map(r=>i.jsxs("div",{"data-testid":"journal-entry",className:"flex items-center gap-spacing-3 text-label-sm font-mono py-spacing-1 border-b border-foreground/6 last:border-0",children:[i.jsx("span",{className:"text-foreground-muted w-6 text-right",children:r.seq}),i.jsx("span",{className:"uppercase",children:r.action}),i.jsx("span",{className:"text-foreground-muted",children:r.exportType}),i.jsx("span",{className:"text-foreground-muted truncate max-w-[200px]",children:r.targetPath}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:r.status})]},r.id))})}function pde({install:e,onRollback:t}){const[n,s]=E.useState(!1);return i.jsxs("div",{"data-testid":"install-row",className:"card-dark p-spacing-4 mb-spacing-2",children:[i.jsxs("div",{className:"flex items-center gap-spacing-4",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-spacing-3 mb-spacing-1",children:[i.jsx("span",{className:"font-mono text-label-sm text-foreground-muted",children:e.createdAt}),i.jsx("span",{"data-testid":"install-status-badge",className:he("inline-block px-spacing-2 py-px text-label-sm uppercase",dde(e.status)),children:fde(e.status)})]}),i.jsx("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:e.targetRoot}),i.jsxs("div",{className:"flex items-center gap-spacing-3 mt-spacing-1 text-label-sm",children:[i.jsxs("span",{"data-testid":"applied-count",children:[i.jsx("span",{className:"font-mono",children:e.appliedCount})," applied"]}),i.jsx("span",{"data-testid":"deferred-placeholder",className:"text-foreground-muted",children:"— deferred"})]})]}),i.jsxs("div",{className:"flex items-center gap-spacing-2 shrink-0",children:[i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"expand-btn",onClick:()=>s(!n),children:n?"COLLAPSE":"EXPAND"}),e.status==="applied"&&i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"rollback-btn",onClick:()=>t(e.id),children:"ROLLBACK"})]})]}),n&&i.jsx(hde,{installId:e.id})]})}function mde(){var v;const{packageId:e}=kn({strict:!1}),{data:t,isPending:n,error:s}=ode(e),{data:r,isPending:a,error:l}=lde(e),u=ude(e),[f,d]=E.useState(null),[p,m]=E.useState(!1),x=w=>{d(w),m(!0)},y=()=>{f&&u.mutate(f,{onSuccess:()=>{m(!1),d(null)}})};if(n||a)return i.jsx(at,{children:i.jsxs("div",{"data-testid":"detail-loading",children:[i.jsx("div",{className:"h-8 w-48 shimmer mb-spacing-4"}),i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-4",children:[i.jsx("div",{className:"h-6 w-64 shimmer-dark mb-spacing-3"}),i.jsx("div",{className:"h-4 w-full shimmer-dark"})]})]})});if(s)return i.jsx(at,{children:i.jsx("div",{"data-testid":"detail-error",children:i.jsx("p",{className:"text-destructive",children:s.message})})});if(l)return i.jsx(at,{children:i.jsx("div",{"data-testid":"installs-error",children:i.jsx("p",{className:"text-destructive",children:"Failed to load install history"})})});const b=r??[];return i.jsx(at,{children:i.jsxs("div",{children:[t&&i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-6","data-testid":"package-header",children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsxs("h2",{className:"text-headline-lg uppercase",children:[t.name," (Legacy)"]}),i.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",t.version]})]}),i.jsxs("div",{className:"text-label-sm text-foreground-muted-on-dark mb-spacing-2",children:["SOURCE"," ",i.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"package-source",children:t.sourceRef})]}),t.summary&&i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark",children:t.summary})]}),i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-4",children:"INSTALL HISTORY"}),b.length===0?i.jsx("div",{"data-testid":"empty-installs",className:"text-body-md text-foreground-muted",children:"No installs yet"}):i.jsx("div",{"data-testid":"install-list",children:b.map(w=>i.jsx(pde,{install:w,onRollback:x},w.id))}),i.jsx(Z9,{open:p,onOpenChange:w=>{u.isPending||(m(w),w||u.reset())},children:i.jsxs(g_,{"data-testid":"rollback-dialog",onPointerDownOutside:w=>{u.isPending&&w.preventDefault()},onEscapeKeyDown:w=>{u.isPending&&w.preventDefault()},hideCloseButton:u.isPending,children:[i.jsxs(x_,{children:[i.jsx(v_,{className:"text-headline-md uppercase",children:"CONFIRM ROLLBACK"}),i.jsx(b_,{children:"This will roll back the install and restore previous file states. This action cannot be undone."})]}),u.isError&&i.jsxs("p",{className:"text-destructive text-label-sm","data-testid":"rollback-error",children:["Rollback failed: ",((v=u.error)==null?void 0:v.message)??"Unknown error"]}),i.jsxs(y_,{children:[i.jsx(_e,{variant:"ghost",onClick:()=>{u.reset(),m(!1)},"data-testid":"rollback-cancel",disabled:u.isPending,children:"CANCEL"}),i.jsx(_e,{variant:"destructive",onClick:y,"data-testid":"rollback-confirm",disabled:u.isPending,children:u.isPending?"ROLLING BACK...":"ROLLBACK"})]})]})})]})})}function gde(e){switch(e){case"installed":return"bg-success";case"missing":return"bg-destructive";case"unsupported":return"bg-warning";case"unknown":return"bg-warning";default:return"bg-foreground-muted"}}function xde(e){switch(e){case"installed":return"OK";case"missing":return"MISSING";case"unsupported":return"MANUAL";case"unknown":return"UNKNOWN";default:return e.toUpperCase()}}function yde({results:e}){return e.length===0?i.jsx("div",{className:"text-body-sm text-foreground-muted","data-testid":"no-requirements",children:"No requirements declared."}):i.jsx("div",{className:"space-y-spacing-1","data-testid":"requirements-panel",children:e.map(t=>i.jsxs("div",{"data-testid":"requirement-row",className:"flex items-center gap-spacing-3 py-spacing-1 text-label-sm font-mono",children:[i.jsx("span",{"data-testid":"requirement-dot",className:he("w-2 h-2 shrink-0",gde(t.status))}),i.jsx("span",{"data-testid":"requirement-status",className:"w-16 uppercase",children:xde(t.status)}),i.jsx("span",{className:"text-foreground-muted w-24",children:t.kind}),i.jsx("span",{children:t.name}),t.detectedPath&&i.jsx("span",{className:"text-foreground-muted ml-auto truncate max-w-[200px]",children:t.detectedPath})]},`${t.kind}:${t.name}`))})}function ez(e,t){var s,r;const n=((s=e.stages)==null?void 0:s.flatMap(a=>{const l=a.detail;if(!l)return[];const u=[];return Array.isArray(l.errors)&&u.push(...l.errors.filter(f=>typeof f=="string")),typeof l.error=="string"&&u.push(l.error),u}))??[];return((r=e.errors)==null?void 0:r.find(a=>typeof a=="string"))??n[0]??e.error??`HTTP ${t}`}function vde(){return sn({mutationFn:async({sourceRef:e})=>{const t=await fetch("/api/bootstrap/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:e})});if(!t.ok){const n=await t.json().catch(()=>({})),s=new Error(ez(n,t.status));throw s.data=n,s}return t.json()}})}function bde(){const e=Mt();return sn({mutationFn:async({sourceRef:t,autoApprove:n,approvedActionKeys:s})=>{const r=await fetch("/api/bootstrap/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,autoApprove:n,approvedActionKeys:s})}),a=await r.json();if(!r.ok){const l=new Error(ez(a,r.status));throw l.data=a,l}return a},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}const wde=["ENTER","PLAN","REVIEW","APPLY"],jde=wde.map((e,t)=>({num:t+1,label:e}));function Sde(e){switch(e){case"enter":return 1;case"planning":return 2;case"planned":return 3;case"applying":return 4;case"done":case"error":return 4;default:return 1}}function Nde(){const e=zt(),{bootstrapSourceRef:t,setBootstrapSourceRef:n}=of(),[s,r]=E.useState("enter"),[a,l]=E.useState(()=>t),[u,f]=E.useState(null),[d,p]=E.useState(new Set),[m,x]=E.useState(!1),[y,b]=E.useState(null),v=vde(),w=bde();E.useEffect(()=>{n(a)},[n,a]);const S=async()=>{if(a.trim()){r("planning");try{const H=await v.mutateAsync({sourceRef:a.trim()});f(H),p(new Set(H.actionKeys??[])),r("planned")}catch(H){b(H.message),r("error")}}},C=async()=>{r("applying");try{const H=await w.mutateAsync({sourceRef:a.trim(),autoApprove:m,approvedActionKeys:m?void 0:[...d]});f(H),r("done")}catch(H){b(H.message),r("error")}},k=()=>{r("enter"),l(""),f(null),p(new Set),x(!1),b(null),v.reset(),w.reset()},_=u==null?void 0:u.stages.find(H=>H.stage==="probe_requirements"),R=_==null?void 0:_.detail,T=(R==null?void 0:R.results)??[],A=u==null?void 0:u.stages.find(H=>H.stage==="build_install_plan"),I=A==null?void 0:A.detail,L=(I==null?void 0:I.actions)??[],$=(A==null?void 0:A.status)==="blocked",B=L.some(H=>H.classification!=="manual_only"&&H.commandPreview)&&d.size===0&&!m;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bootstrap-wizard",className:"space-y-8",children:[i.jsx(Nn,{eyebrow:"Bootstrap",title:"Bootstrap",description:"Plan environment requirements, approve install actions, then import the rig into a running topology."}),i.jsx(m9,{"data-testid":"step-indicator",steps:jde,currentStep:Sde(s)}),s==="enter"&&i.jsx(bs,{title:"Source",description:"Provide a rig spec or bundle path. Bootstrap will inspect requirements before it imports anything.",children:i.jsxs("div",{"data-testid":"step-enter",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"SPEC OR BUNDLE PATH"}),i.jsx(l_,{"data-testid":"spec-input",type:"text",value:a,onChange:H=>l(H.target.value),placeholder:"/path/to/rig.yaml or /path/to/bundle.rigbundle",className:"font-mono text-body-md"}),i.jsxs("p",{className:"text-label-sm text-foreground-muted mt-spacing-1",children:["Accepts .yaml rig specs or .rigbundle archives."," ",i.jsx("span",{role:"link",tabIndex:0,className:"text-primary cursor-pointer","data-testid":"inspect-link",onClick:()=>e({to:"/bundles/inspect"}),onKeyDown:H=>{H.key==="Enter"&&e({to:"/bundles/inspect"})},children:"Inspect a bundle first →"})]}),i.jsx("div",{className:"mt-spacing-4",children:i.jsx(_e,{variant:"tactical",onClick:S,disabled:!a.trim(),"data-testid":"plan-btn",children:"PLAN"})})]})}),s==="planning"&&i.jsx("div",{"data-testid":"step-planning",className:"text-body-md text-foreground-muted",children:"Planning..."}),s==="planned"&&u&&i.jsx(bs,{title:"Plan Review",description:"Review requirement probe results and approve the install actions that bootstrap should execute.",children:i.jsxs("div",{"data-testid":"step-planned",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"STAGES"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-6","data-testid":"stage-list",children:u.stages.map(H=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"stage-row",children:[i.jsx("span",{className:H.status==="ok"?"text-success":H.status==="blocked"?"text-warning":"text-foreground-muted",children:H.status.toUpperCase()}),i.jsx("span",{children:H.stage})]},H.stage))}),T.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"REQUIREMENTS"}),i.jsx("div",{className:"mb-spacing-6",children:i.jsx(yde,{results:T})})]}),L.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"ACTIONS"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:L.map(H=>i.jsxs("label",{className:"flex items-center gap-spacing-3 text-label-sm font-mono cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:m||d.has(H.key),disabled:m||H.classification==="manual_only",onChange:P=>{const G=new Set(d);P.target.checked?G.add(H.key):G.delete(H.key),p(G)}}),i.jsx("span",{className:H.classification==="manual_only"?"text-warning":"",children:H.requirementName}),H.commandPreview&&i.jsx("span",{className:"text-foreground-muted",children:H.commandPreview})]},H.key))}),i.jsxs("label",{className:"flex items-center gap-spacing-2 text-label-sm mb-spacing-4",children:[i.jsx("input",{type:"checkbox",checked:m,onChange:H=>x(H.target.checked)}),"Auto-approve all trusted actions"]})]}),$&&i.jsx("div",{className:"text-warning text-label-sm mb-spacing-4","data-testid":"blocked-warning",children:"Manual requirements must be resolved before bootstrap can proceed."}),u.warnings.length>0&&i.jsx("div",{className:"mb-spacing-4",children:u.warnings.map((H,P)=>i.jsx("div",{className:"text-warning text-label-sm",children:H},P))}),i.jsx(_e,{variant:"tactical",onClick:C,disabled:$||B,title:$?"Manual requirements must be resolved":B?"Select actions to approve":void 0,"data-testid":"apply-btn",children:"APPLY"})]})}),s==="applying"&&u&&i.jsx(bs,{title:"Applying",description:"Bootstrap is executing the approved actions and importing the rig.",children:i.jsxs("div",{"data-testid":"step-applying",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"APPLYING"}),i.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"applying-checklist",children:[u.stages.map(H=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:H.stage})]},H.stage)),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"execute_external_installs"})]}),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"install_packages"})]}),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"import_rig"})]})]}),i.jsx("p",{className:"text-body-sm text-foreground-muted",children:"Bootstrapping..."})]})}),s==="done"&&u&&i.jsx(bs,{title:"Result",description:"Bootstrap finished and returned the managed rig identity.",children:i.jsxs("div",{"data-testid":"step-done",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:u.status==="completed"?"BOOTSTRAP COMPLETE":"BOOTSTRAP PARTIAL"}),i.jsxs("div",{className:"text-label-sm font-mono space-y-spacing-1 mb-spacing-4",children:[i.jsxs("div",{children:["Status: ",i.jsx("span",{className:u.status==="completed"?"text-success":"text-warning",children:u.status.toUpperCase()})]}),u.rigId&&i.jsxs("div",{"data-testid":"result-rig-id",children:["Rig: ",u.rigId]})]}),u.rigId&&i.jsx(_e,{variant:"tactical","data-testid":"view-rig-btn",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:u.rigId}}),children:"VIEW RIG"})]})}),s==="error"&&i.jsx(bs,{title:"Bootstrap Error",description:"Bootstrap could not complete. Fix the issue and retry the plan.",children:i.jsxs("div",{"data-testid":"step-error",children:[i.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:y}),i.jsx(_e,{variant:"tactical",onClick:k,"data-testid":"try-again-btn",children:"TRY AGAIN"})]})})]})})}function kde(){const{currentAgentDraft:e,selectedAgentDraft:t,saveAgentDraft:n,rememberAgentDraft:s,clearSelectedAgentDraft:r}=of(),[a,l]=E.useState(()=>(t==null?void 0:t.yaml)??(e==null?void 0:e.yaml)??""),[u,f]=E.useState("idle"),[d,p]=E.useState([]);E.useEffect(()=>{n(a)},[n,a]),E.useEffect(()=>{t&&(l(t.yaml),r())},[r,t]);const m=async()=>{s(a),f("pending"),p([]);try{const x=await fetch("/api/agents/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:a}),y=await x.json().catch(()=>({}));if(x.ok&&y.valid){f("valid");return}p(y.errors??["Validation failed"]),f("invalid")}catch{p(["Validation request failed"]),f("error")}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-validate-flow",className:"space-y-8",children:[i.jsx(Nn,{eyebrow:"Agent Spec Validation",title:"VALIDATE AGENT",description:"Check an AgentSpec before you use it in a rig."}),i.jsxs(bs,{title:"Agent YAML",description:"Paste or refine an AgentSpec draft, then validate it against the daemon contract.",children:[i.jsx(c_,{"data-testid":"agent-spec-yaml-input",value:a,onChange:x=>l(x.target.value),placeholder:"Paste agent.yaml here...",rows:16,className:"bg-background font-mono text-body-sm"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:i.jsx(_e,{variant:"tactical","data-testid":"agent-spec-validate-btn",onClick:m,disabled:!a.trim()||u==="pending",children:u==="pending"?"VALIDATING...":"VALIDATE AGENTSPEC"})}),u==="valid"&&i.jsx(wn,{className:"mt-spacing-1","data-testid":"agent-spec-valid",children:i.jsx(dn,{className:"text-primary",children:"AgentSpec valid."})}),(u==="invalid"||u==="error")&&i.jsx(wn,{className:"mt-spacing-1","data-testid":"agent-spec-invalid",children:i.jsx(dn,{children:i.jsx("ul",{className:"list-disc pl-5",children:d.map(x=>i.jsx("li",{children:x},x))})})})]})]})})}async function _de(e,t="draft"){var s;const n=await fetch("/api/specs/review/rig",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}async function Cde(e,t="draft"){var s;const n=await fetch("/api/specs/review/agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}function tz(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function Ede(e,t="draft"){return De({queryKey:["spec-review","rig",e?tz(e):null,t],queryFn:()=>_de(e,t),enabled:!!e})}function Rde(e,t="draft"){return De({queryKey:["spec-review","agent",e?tz(e):null,t],queryFn:()=>Cde(e,t),enabled:!!e})}const Ade=160,Tde=48,WL=200,Ide=100;function Mde(e){switch(e){case"claude-code":return"#d4c4a8";case"codex":return"#b8c9d4";case"terminal":return"#c4c4c4";default:return"#e0ddd4"}}function Ode(e){const t=new Map,n=[];for(const a of e)a.pod?(t.has(a.pod)||t.set(a.pod,[]),t.get(a.pod).push(a)):n.push(a);const s=[];let r=0;for(const[,a]of t)a.forEach((l,u)=>{s.push({id:l.id,x:u*WL,y:r})}),r+=Ide;return n.forEach((a,l)=>{s.push({id:a.id,x:l*WL,y:r})}),s}function Lde({graph:e,testId:t}){const n=e??{nodes:[],edges:[]},{nodes:s,edges:r}=E.useMemo(()=>{const a=Ode(n.nodes),l=new Map(a.map(d=>[d.id,d])),u=n.nodes.map(d=>{const p=l.get(d.id)??{x:0,y:0};return{id:d.id,type:"default",position:{x:p.x,y:p.y},data:{label:i.jsxs("div",{className:"flex h-full min-w-0 flex-col justify-center gap-1 font-mono leading-tight",children:[i.jsxs("div",{className:"truncate text-[10px] font-bold text-stone-900",children:[d.pod?`${d.pod} / `:"",d.label]}),i.jsx(Kn,{runtime:d.runtime,size:"xs",compact:!0,variant:"inline"})]})},style:{backgroundColor:Mde(d.runtime),border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:Ade,height:Tde}}}),f=n.edges.map((d,p)=>({id:`e-${p}`,source:d.source,target:d.target,label:d.kind,labelStyle:{fontSize:9,fontFamily:"monospace"},style:{strokeDasharray:"4 4",stroke:"#8a8577"}}));return{nodes:u,edges:f}},[n]);return i.jsx("div",{"data-testid":t??"spec-topology-preview",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:i.jsxs(gf,{nodes:s,edges:r,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Pk,{gap:20,size:.5,color:"#d4d0c8"}),i.jsx(xf,{showInteractive:!1})]})})}function Pde({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=bg();return i.jsx("button",{type:"button","data-testid":r??"sub-spec-trigger",onClick:()=>a({type:"sub-spec",data:e}),className:n??"text-left",style:s,children:t})}function $de(e){const n=(e.startsWith("local:")?e.slice(6):e).replace(/^(builtin|user|fork):/,""),s=n.startsWith("agents/")?n.slice(7):n,r=s.split("@")[0]??s,a=e.startsWith("fork:")?"fork":e.startsWith("builtin:")?"builtin":"user_file";return{specName:r,source:a}}function w_({review:e,yaml:t,testIdPrefix:n="",yamlTestId:s,showEnvironmentTab:r,onMemberClick:a}){var b,v,w;const l=r&&!!(e!=null&&e.services),u=l?["topology","configuration","environment","yaml"]:["topology","configuration","yaml"],[f,d]=E.useState("topology"),p=(e==null?void 0:e.pods)??[],m=(e==null?void 0:e.nodes)??[],x=(e==null?void 0:e.edges)??[],y=n?`${n}-`:"";return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:u.map(S=>i.jsx("button",{"data-testid":`${y}tab-${S}`,onClick:()=>d(S),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${f===S?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:S},S))}),f==="topology"&&e&&i.jsx(Lde,{graph:e.graph,testId:`${y}topology-preview`}),f==="configuration"&&e&&i.jsxs("div",{"data-testid":`${y}config-tables`,className:"space-y-4",children:[e.format==="pod_aware"&&p.map(S=>i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:S.label??S.id}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"Member"}),i.jsx("th",{className:"text-left py-1",children:"Agent Ref"}),i.jsx("th",{className:"text-left py-1",children:"Runtime"}),i.jsx("th",{className:"text-left py-1",children:"Profile"})]})}),i.jsx("tbody",{children:S.members.map(C=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:C.id}),a&&i.jsx(_e,{variant:"outline",size:"sm","data-testid":`${y}member-open-agent-${S.id}-${C.id}`,className:"h-6 px-2 font-mono text-[9px] uppercase tracking-[0.12em]",onClick:()=>a(S.id,C),children:"Agent Spec"})]})}),i.jsx("td",{className:"py-1 text-stone-600",children:(()=>{const k=$de(C.agentRef);return i.jsx(Pde,{data:{specKind:"agent",specName:k.specName,source:k.source},testId:`${y}member-sub-spec-${S.id}-${C.id}`,className:"text-stone-600 underline decoration-dotted decoration-stone-400 hover:text-stone-900 hover:decoration-stone-700",children:C.agentRef})})()}),i.jsx("td",{className:"py-1",children:i.jsx(Kn,{runtime:C.runtime,size:"xs",compact:!0,variant:"inline"})}),i.jsx("td",{className:"py-1 text-stone-500",children:C.profile??"—"})]},C.id))})]})]},S.id)),e.format==="legacy"&&m.length>0&&i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Nodes"}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"ID"}),i.jsx("th",{className:"text-left py-1",children:"Runtime"}),i.jsx("th",{className:"text-left py-1",children:"Role"})]})}),i.jsx("tbody",{children:m.map(S=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:S.id}),i.jsx("td",{className:"py-1",children:i.jsx(Kn,{runtime:S.runtime,size:"xs",compact:!0,variant:"inline"})}),i.jsx("td",{className:"py-1 text-stone-500",children:S.role??"—"})]},S.id))})]})]}),x.length>0&&i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:e.format==="pod_aware"?"Cross-Pod Edges":"Edges"}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"From"}),i.jsx("th",{className:"text-left py-1",children:"To"}),i.jsx("th",{className:"text-left py-1",children:"Kind"})]})}),i.jsx("tbody",{children:x.map((S,C)=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:S.from}),i.jsx("td",{className:"py-1",children:S.to}),i.jsx("td",{className:"py-1 text-stone-500",children:S.kind})]},C))})]})]})]}),f==="environment"&&l&&(e==null?void 0:e.services)&&i.jsxs("div",{className:"space-y-4","data-testid":`${y}env-details`,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Services"}),(b=e.services.composePreview)==null?void 0:b.services.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"font-mono text-[11px] text-stone-800",children:S.name}),S.image&&i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.image})]},S.name))]}),e.services.waitFor.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Health Gates"}),e.services.waitFor.map((S,C)=>i.jsxs("div",{className:"font-mono text-[10px] text-stone-600 border border-stone-200 px-3 py-2",children:[S.url&&i.jsx("span",{children:S.url}),S.tcp&&i.jsxs("span",{children:["tcp: ",S.tcp]}),S.service&&i.jsxs("span",{children:["service: ",S.service,S.condition?` (${S.condition})`:""]})]},C))]}),e.services.surfaces&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Surfaces"}),(v=e.services.surfaces.urls)==null?void 0:v.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"text-[11px] text-stone-800",children:S.name}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.url})]},S.name)),(w=e.services.surfaces.commands)==null?void 0:w.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"text-[11px] text-stone-800",children:S.name}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.command})]},S.name))]})]}),f==="yaml"&&i.jsx(g9,{title:"YAML Preview",testId:s??`${y}spec-yaml`,children:t})]})}function Dde(){const e=zt(),{selectedRigDraft:t,currentRigDraft:n}=of(),s=t??n,{data:r,isLoading:a,error:l}=Ede((s==null?void 0:s.yaml)??null),u=(r==null?void 0:r.pods)??[],f=(r==null?void 0:r.nodes)??[],d=(r==null?void 0:r.edges)??[];return s?i.jsx(at,{children:i.jsxs("div",{"data-testid":"rig-spec-review",className:"space-y-6",children:[i.jsx(Nn,{eyebrow:"Rig Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.summary)??"Review the spec structure before import or bootstrap.",actions:i.jsxs(i.Fragment,{children:[i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open In Import"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/bootstrap"}),children:"Bootstrap"})]})}),r&&i.jsxs($o,{children:[i.jsx(st,{label:"Format",value:r.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"rig-spec-summary-format"}),i.jsx(st,{label:r.format==="pod_aware"?"Pods":"Nodes",value:r.format==="pod_aware"?u.length:f.length,testId:"rig-spec-summary-pods"}),i.jsx(st,{label:"Members",value:r.format==="pod_aware"?u.reduce((p,m)=>p+m.members.length,0):f.length,testId:"rig-spec-summary-members"}),i.jsx(st,{label:"Edges",value:d.length+(r.format==="pod_aware"?u.reduce((p,m)=>{var x;return p+(((x=m.edges)==null?void 0:x.length)??0)},0):0),testId:"rig-spec-summary-edges"})]}),a&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),l&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:l.message}),i.jsx(w_,{review:r,yaml:s.yaml,yamlTestId:"rig-spec-yaml"})]})}):i.jsx(at,{children:i.jsxs("div",{"data-testid":"rig-spec-review-empty",className:"space-y-5",children:[i.jsx(Nn,{eyebrow:"Rig Spec Review",title:"No RigSpec Selected",description:"Choose a current or recent rig draft from the Library drawer to review it here before you import or bootstrap it."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open Import"})]})})}function Nf({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=bg();return i.jsx("button",{type:"button","data-testid":r??"file-reference-trigger",onClick:()=>a({type:"file",data:e}),className:n??"text-left",style:s,children:t})}function qde(e,t){if(!e||!t)return null;if(t.startsWith("/"))return t;const s=`${e.replace(/\/[^/]*$/,"")}/${t}`.split("/"),r=[];for(const a of s)if(!(!a||a===".")){if(a===".."){r.pop();continue}r.push(a)}return`/${r.join("/")}`}function YL({label:e,sourcePath:t,testId:n,children:s}){const r=qde(t,e);return r?i.jsx(Nf,{data:{path:e,absolutePath:r},testId:n,className:"inline-block text-left",children:s}):i.jsx(i.Fragment,{children:s})}function j_({review:e,yaml:t,testIdPrefix:n="agent",sourcePath:s}){const r=(e==null?void 0:e.profiles)??[],a=(e==null?void 0:e.resources)??{skills:[],guidance:[],plugins:[]},l=(e==null?void 0:e.startup)??{files:[],actions:[]};return i.jsxs(i.Fragment,{children:[r.length>0&&i.jsxs("div",{"data-testid":`${n}-profiles-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Profiles"}),i.jsx("div",{className:"space-y-1",children:r.map(u=>i.jsxs("div",{className:"font-mono text-[10px] flex justify-between",children:[i.jsx("span",{className:"font-bold",children:u.name}),u.description&&i.jsx("span",{className:"text-stone-500",children:u.description})]},u.name))})]}),i.jsxs("div",{"data-testid":`${n}-resources-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Resources"}),i.jsxs("div",{className:"space-y-2 font-mono text-[10px]",children:[a.skills.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Skills:"})," ",a.skills.map((u,f)=>i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5",children:[i.jsx(Pe,{tool:"file",size:"xs",decorative:!0}),u]},f))]}),a.guidance.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Guidance:"})," ",a.guidance.map((u,f)=>i.jsx(YL,{label:u,sourcePath:s,testId:`${n}-guidance-file-trigger-${u}`,children:i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5 underline decoration-dotted decoration-stone-400",children:[i.jsx(Pe,{tool:u,size:"xs",decorative:!0}),u]})},`${u}-${f}`))]}),a.plugins.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Plugins:"})," ",a.plugins.map((u,f)=>i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5",children:[i.jsx(Pe,{tool:"file",size:"xs",decorative:!0}),u]},`${u}-${f}`))]})]})]}),(l.files.length>0||l.actions.length>0)&&i.jsxs("div",{"data-testid":`${n}-startup-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup"}),l.files.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Files"}),l.files.map((u,f)=>i.jsxs("div",{className:"font-mono text-[10px]",children:[i.jsx(YL,{label:u.path,sourcePath:s,testId:`${n}-startup-file-trigger-${u.path}`,children:i.jsxs("span",{className:"inline-flex items-center gap-1 underline decoration-dotted decoration-stone-400",children:[i.jsx(Pe,{tool:u.path,size:"xs",decorative:!0}),u.path]})})," ",u.required&&i.jsx("span",{className:"text-red-500 text-[8px]",children:"REQUIRED"})]},f))]}),l.actions.length>0&&i.jsxs("div",{children:[i.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Actions"}),l.actions.map((u,f)=>i.jsxs("div",{className:"font-mono text-[10px]",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 text-stone-500",children:[i.jsx(Pe,{tool:u.type.includes("command")?"terminal":u.type,size:"xs",decorative:!0}),u.type,":"]})," ",u.value]},f))]})]}),i.jsx(g9,{title:"YAML Preview",testId:`${n}-spec-yaml`,children:t})]})}function zde(){const e=zt(),{selectedAgentDraft:t,currentAgentDraft:n}=of(),s=t??n,{data:r,isLoading:a,error:l}=Rde((s==null?void 0:s.yaml)??null);return s?i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-review",className:"space-y-6",children:[i.jsx(Nn,{eyebrow:"Agent Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.description)??"Review the agent spec structure before validation.",actions:i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open In Validate"})}),r&&i.jsxs($o,{children:[i.jsx(st,{label:"Format",value:"AgentSpec",testId:"agent-spec-summary-format"}),i.jsx(st,{label:"Version",value:r.version,testId:"agent-spec-summary-version"}),i.jsx(st,{label:"Profiles",value:(r.profiles??[]).length,testId:"agent-spec-summary-profiles"}),i.jsx(st,{label:"Skills",value:(r.resources??{skills:[]}).skills.length,testId:"agent-spec-summary-skills"})]}),a&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),l&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:l.message}),i.jsx(j_,{review:r,yaml:s.yaml,testIdPrefix:"agent"})]})}):i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-review-empty",className:"space-y-5",children:[i.jsx(Nn,{eyebrow:"Agent Spec Review",title:"No AgentSpec Selected",description:"Choose a current or recent agent draft from the Library drawer to review it here before you validate it."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open Validate"})]})})}function Bde(){return sn({mutationFn:async({bundlePath:e})=>{const t=await fetch("/api/bundles/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e})}),n=await t.json();if(n.error)throw new Error(n.error);if(!t.ok)throw new Error(`HTTP ${t.status}`);return n}})}function Fde(){return sn({mutationFn:async({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})=>{const r=await fetch("/api/bundles/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})}),a=await r.json();if(!r.ok)throw new Error(a.error??`HTTP ${r.status}`);return a}})}function Hde(){var a,l;const[e,t]=E.useState(""),n=Bde(),s=()=>{e.trim()&&n.mutate({bundlePath:e.trim()})},r=n.data;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bundle-inspector",children:[i.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSPECT BUNDLE"}),i.jsxs("div",{className:"mb-spacing-4",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),i.jsx("input",{"data-testid":"bundle-path-input",type:"text",value:e,onChange:u=>t(u.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary"}),i.jsx(_e,{variant:"tactical",onClick:s,disabled:!e.trim()||n.isPending,className:"mt-spacing-3","data-testid":"inspect-btn",children:n.isPending?"INSPECTING...":"INSPECT"})]}),n.isError&&i.jsx("div",{className:"text-destructive text-body-md mb-spacing-4","data-testid":"inspect-error",children:n.error.message}),r&&i.jsxs("div",{"data-testid":"inspect-result",children:[i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4","data-testid":"manifest-summary",children:[i.jsxs("div",{className:"flex items-center gap-spacing-2 mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-md uppercase",children:r.manifest.name}),i.jsxs("span",{className:"text-label-sm font-mono px-spacing-2 py-px bg-foreground/10","data-testid":"schema-badge",children:["v",r.manifest.schemaVersion??1]})]}),i.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["v",r.manifest.version]}),i.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["Spec: ",r.manifest.rigSpec]}),i.jsxs("div",{className:"mt-spacing-2 flex gap-spacing-3",children:[i.jsxs("span",{className:he("text-label-sm",r.digestValid?"text-success":"text-destructive"),children:["DIGEST: ",r.digestValid?"VALID":"INVALID"]}),i.jsxs("span",{className:he("text-label-sm",r.integrityResult.passed?"text-success":"text-destructive"),"data-testid":"integrity-status",children:["INTEGRITY: ",r.integrityResult.passed?"PASS":"FAIL"]})]})]}),r.manifest.schemaVersion===2&&r.manifest.agents?i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"AGENTS"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"agent-list",children:r.manifest.agents.map(u=>i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"agent-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PACKAGES"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"package-list",children:(r.manifest.packages??[]).map(u=>i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"package-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}),r.integrityResult&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"FILE INTEGRITY"}),i.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"file-integrity",children:[Object.keys((r.manifest.packages??r.manifest.agents??[]).length>0?((l=(a=r.manifest)==null?void 0:a.integrity)==null?void 0:l.files)??{}:{}).map(u=>{const f=r.integrityResult.mismatches.includes(u),d=r.integrityResult.missing.includes(u),p=f?"MISMATCH":d?"MISSING":"OK";return i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[i.jsx("span",{className:he("w-2 h-2",p==="OK"?"bg-success":"bg-destructive"),"data-testid":"file-dot"}),i.jsx("span",{children:u}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:p})]},u)}),r.integrityResult.extra.map(u=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[i.jsx("span",{className:"w-2 h-2 bg-warning","data-testid":"file-dot"}),i.jsx("span",{children:u}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:"EXTRA"})]},u))]})]}),i.jsx(_e,{variant:"tactical","data-testid":"install-btn",onClick:()=>window.location.href=`/bundles/install?bundlePath=${encodeURIComponent(e)}`,children:"INSTALL THIS BUNDLE"})]})]})})}function Ude(){const e=zt(),[t,n]=E.useState("enter"),s=typeof window<"u"?new URLSearchParams(window.location.search):null,[r,a]=E.useState((s==null?void 0:s.get("bundlePath"))??""),[l,u]=E.useState(""),[f,d]=E.useState(null),[p,m]=E.useState(null),x=Fde(),y=async()=>{if(r.trim()){n("planning");try{const v=await x.mutateAsync({bundlePath:r.trim(),plan:!0});d(v),n("planned")}catch(v){m(v.message),n("error")}}},b=async()=>{if(l.trim()){n("applying");try{const v=await x.mutateAsync({bundlePath:r.trim(),autoApprove:!0,targetRoot:l.trim()});d(v),n("done")}catch(v){m(v.message),n("error")}}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bundle-install-flow",children:[i.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSTALL BUNDLE"}),t==="enter"&&i.jsxs("div",{"data-testid":"step-enter",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),i.jsx("input",{"data-testid":"bundle-input",type:"text",value:r,onChange:v=>a(v.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"TARGET ROOT"}),i.jsx("input",{"data-testid":"target-input",type:"text",value:l,onChange:v=>u(v.target.value),placeholder:"/path/to/target/project",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),i.jsx(_e,{variant:"tactical",onClick:y,disabled:!r.trim(),"data-testid":"plan-btn",children:"PLAN"})]}),t==="planning"&&i.jsx("div",{"data-testid":"step-planning",className:"text-foreground-muted",children:"Planning..."}),t==="planned"&&f&&i.jsxs("div",{"data-testid":"step-planned",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PLAN"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:f.stages.map(v=>i.jsxs("div",{className:"text-label-sm font-mono",children:[i.jsx("span",{className:v.status==="ok"?"text-success":"text-foreground-muted",children:v.status.toUpperCase()})," ",v.stage]},v.stage))}),i.jsx(_e,{variant:"tactical",onClick:b,disabled:!l.trim(),"data-testid":"apply-btn",children:"APPLY"})]}),t==="applying"&&i.jsx("div",{"data-testid":"step-applying",className:"text-foreground-muted",children:"Installing..."}),t==="done"&&f&&i.jsxs("div",{"data-testid":"step-done",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPLETE"}),i.jsxs("div",{className:"text-label-sm font-mono",children:["Status: ",i.jsx("span",{className:"text-success",children:f.status.toUpperCase()}),f.stages.some(v=>{var w;return((w=v.detail)==null?void 0:w.source)==="pod_bundle"})?i.jsx("span",{className:"ml-spacing-2 text-primary","data-testid":"bundle-type-label",children:"Pod-aware bundle"}):i.jsx("span",{className:"ml-spacing-2 text-foreground-muted","data-testid":"bundle-type-label",children:"Legacy bundle"})]}),f.rigId&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"result-rig-id",children:["Rig: ",f.rigId]}),f.rigId&&i.jsx(_e,{variant:"tactical",className:"mt-spacing-3",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:f.rigId}}),children:"VIEW RIG"})]}),t==="error"&&i.jsxs("div",{"data-testid":"step-error",children:[i.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:p}),i.jsx(_e,{variant:"tactical",onClick:()=>{n("enter"),m(null),x.reset()},"data-testid":"try-again-btn",children:"TRY AGAIN"})]})]})})}async function Vde(){const e=await fetch("/api/mission-control/destinations");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function nz(e){return De({queryKey:["mission-control","destinations"],queryFn:Vde,enabled:e,staleTime:3e4})}function Gde(e){const t=[`Install and launch the "${e.name}" managed app using OpenRig.`,""];return e.summary&&t.push(`About: ${e.summary}`,""),t.push(`Source: ${e.sourcePath}`,"","Steps:",`1. Run: rig up ${e.name}`,"2. Monitor: rig ps --nodes","3. Check env: rig env status <rig-name>"),t.join(`
|
|
514
|
-
`)}function S_({sourcePath:e,sourceState:t}){return i.jsxs("div",{className:"font-mono text-[9px] text-stone-500","data-testid":"library-provenance",children:["Source: ",e," · ",t]})}function Kde({review:e}){const t=zt(),n=e.profiles??[],s=e.resources??{skills:[]};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-agent",className:"space-y-6",children:[i.jsx(Nn,{eyebrow:"Library — Agent Spec",title:e.name,description:e.description??"Agent spec from library.",actions:i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/agents/validate"}),children:"Validate"})}),i.jsx(S_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),i.jsxs($o,{children:[i.jsx(st,{label:"Format",value:"AgentSpec",testId:"lib-agent-format"}),i.jsx(st,{label:"Version",value:e.version,testId:"lib-agent-version"}),i.jsx(st,{label:"Profiles",value:n.length,testId:"lib-agent-profiles"}),i.jsx(st,{label:"Skills",value:s.skills.length,testId:"lib-agent-skills"})]}),i.jsx(j_,{review:e,yaml:e.raw,testIdPrefix:"lib-agent",sourcePath:e.sourcePath})]})})}function Wde({review:e}){const t=zt(),[n,s]=E.useState(!1),{data:r=[]}=Ac("agent");new Map(r.map(d=>[d.name,d]));const a=e.pods??[],l=e.nodes??[],u=e.edges??[],f=d=>{if(!d.startsWith("local:"))return null;const p=d.slice(6),x=`${e.sourcePath.replace(/\/[^/]+$/,"")}/${p}`.split("/"),y=[];for(const v of x)v===".."?y.pop():v!=="."&&v!==""&&y.push(v);const b="/"+y.join("/");return r.find(v=>v.sourcePath.startsWith(b+"/"))??null};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-rig",className:"space-y-6",children:[i.jsx(Nn,{eyebrow:e.services?"Library — Managed App":"Library — Rig Spec",title:e.name,description:e.summary??"Rig spec from library.",actions:i.jsxs("div",{className:"flex gap-2",children:[e.services&&i.jsx(_e,{variant:"outline",size:"sm","data-testid":"copy-setup-prompt",onClick:()=>void(async()=>{await Xr(Gde({name:e.name,summary:e.summary,sourcePath:e.sourcePath}))&&(s(!0),window.setTimeout(()=>s(!1),2e3))})(),children:n?"Copied":"Copy Setup Prompt"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/import"}),children:"Import"})]})}),i.jsx(S_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),i.jsxs($o,{children:[i.jsx(st,{label:"Format",value:e.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"lib-rig-format"}),e.services&&i.jsx(st,{label:"Type",value:"Agent-Managed App",testId:"lib-rig-type"}),e.services&&a.length>0&&(()=>{const d=a.find(p=>p.members.some(m=>m.id==="specialist"));return d?i.jsx(st,{label:"Specialist Agent",value:`${d.id}.specialist`,testId:"lib-rig-specialist"}):null})(),i.jsx(st,{label:e.format==="pod_aware"?"Pods":"Nodes",value:e.format==="pod_aware"?a.length:l.length,testId:"lib-rig-pods"}),i.jsx(st,{label:"Members",value:e.format==="pod_aware"?a.reduce((d,p)=>d+p.members.length,0):l.length,testId:"lib-rig-members"}),i.jsx(st,{label:"Edges",value:u.length+(e.format==="pod_aware"?a.reduce((d,p)=>{var m;return d+(((m=p.edges)==null?void 0:m.length)??0)},0):0),testId:"lib-rig-edges"})]}),i.jsx(w_,{review:e,yaml:e.raw,testIdPrefix:"lib",yamlTestId:"lib-rig-yaml",showEnvironmentTab:!!e.services,onMemberClick:(d,p)=>{const m=f(p.agentRef);m&&t({to:"/specs/library/$entryId",params:{entryId:m.id}})}})]})})}function Yde({entryId:e}){return e.startsWith("context-pack:")?i.jsx(sfe,{entryId:e}):e.startsWith("agent-image:")?i.jsx(ife,{entryId:e}):i.jsx(Qde,{entryId:e})}function Qde({entryId:e}){const t=zt(),{data:n,isLoading:s,error:r}=K2(e);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading spec review..."})}):r||!n?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:"Library",title:"Spec Not Found",description:(r==null?void 0:r.message)??"Could not load spec."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):n.kind==="agent"?i.jsx(Kde,{review:n}):n.kind==="workflow"?i.jsx(nfe,{review:n}):i.jsx(Wde,{review:n})}const Xde=180,Zde=56,Jde=220,efe=110;function tfe({topology:e,testId:t}){const{nodes:n,edges:s}=E.useMemo(()=>{const r=new Map;for(const x of e.edges)r.has(x.fromStepId)||r.set(x.fromStepId,[]),r.get(x.fromStepId).push(x.toStepId);const a=new Map,l=[];for(const x of e.nodes)x.isEntry&&(a.set(x.stepId,0),l.push({id:x.stepId,d:0}));for(;l.length>0;){const{id:x,d:y}=l.shift(),b=r.get(x)??[];for(const v of b)a.has(v)||(a.set(v,y+1),l.push({id:v,d:y+1}))}let u=0;for(const x of e.nodes)a.has(x.stepId)||a.set(x.stepId,u++);const f=new Map;for(const x of e.nodes){const y=a.get(x.stepId)??0;f.has(y)||f.set(y,[]),f.get(y).push(x.stepId)}const d=new Map;for(const[x,y]of f)y.forEach((b,v)=>{d.set(b,{x:v*Jde,y:x*efe})});const p=e.nodes.map(x=>{const y=d.get(x.stepId)??{x:0,y:0},b=x.isEntry?"#a8c8d4":x.isTerminal?"#d4b8a8":"#d4c4a8";return{id:x.stepId,type:"default",position:y,data:{label:i.jsxs("div",{className:"font-mono text-[10px] leading-tight",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 font-bold",children:[i.jsx("span",{children:x.stepId}),x.isTerminal?i.jsx(Pe,{tool:"terminal",size:"xs",title:"Terminal step",decorative:!0}):null]}),i.jsx("div",{className:"text-stone-600",children:x.role}),x.preferredTarget&&i.jsxs("div",{className:"text-[8px] text-stone-500",children:["→ ",x.preferredTarget]})]})},style:{backgroundColor:b,border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:Xde,height:Zde,padding:6}}}),m=e.edges.map((x,y)=>({id:`e-${y}`,source:x.fromStepId,target:x.toStepId,style:{stroke:"#8a8577"}}));return{nodes:p,edges:m}},[e]);return i.jsx("div",{"data-testid":t??"workflow-topology-graph",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:i.jsxs(gf,{nodes:n,edges:s,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Pk,{gap:20,size:.5,color:"#d4d0c8"}),i.jsx(xf,{showInteractive:!1})]})})}function nfe({review:e}){const t=zt(),n=Mt(),{data:s}=iW(),[r,a]=E.useState(null),[l,u]=E.useState(!1),f=(s==null?void 0:s.specName)===e.name&&(s==null?void 0:s.specVersion)===e.version,d=async()=>{u(!0),a(null);try{await aW(e.name,e.version),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(m){a(m.message)}finally{u(!1)}},p=async()=>{u(!0),a(null);try{await oW(),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(m){a(m.message)}finally{u(!1)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-workflow",className:"space-y-6",children:[i.jsx(Nn,{eyebrow:e.isBuiltIn?"Library — Workflow (Built-in)":"Library — Workflow",title:`${e.name} v${e.version}`,description:e.purpose??"Workflow spec from library.",actions:i.jsxs("div",{className:"flex gap-2 items-center",children:[f?i.jsx(_e,{variant:"outline",size:"sm","data-testid":"workflow-deactivate-lens",onClick:()=>void p(),disabled:l,children:l?"...":"Deactivate Lens"}):i.jsx(_e,{variant:"outline",size:"sm","data-testid":"workflow-activate-lens",onClick:()=>void d(),disabled:l,children:l?"...":"Activate as Lens"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back"})]})}),i.jsx(S_,{sourcePath:e.sourcePath,sourceState:"library_item"}),r&&i.jsx("div",{"data-testid":"workflow-lens-error",className:"font-mono text-[10px] text-red-600",children:r}),i.jsxs($o,{children:[i.jsx(st,{label:"Format",value:"WorkflowSpec",testId:"lib-wf-format"}),i.jsx(st,{label:"Version",value:e.version,testId:"lib-wf-version"}),i.jsx(st,{label:"Roles",value:e.rolesCount,testId:"lib-wf-roles"}),i.jsx(st,{label:"Steps",value:e.stepsCount,testId:"lib-wf-steps"}),i.jsx(st,{label:"Target Rig",value:e.targetRig??"(any)",testId:"lib-wf-target-rig"}),i.jsx(st,{label:"Source",value:e.isBuiltIn?"built-in":"user file",testId:"lib-wf-source"})]}),i.jsxs("div",{"data-testid":"workflow-terminal-rule",className:"flex items-center gap-2 border border-stone-300/40 bg-white/10 px-3 py-2 font-mono text-[10px] text-stone-700",children:[i.jsx(Pe,{tool:"terminal",size:"xs",decorative:!0}),i.jsx("span",{className:"text-stone-500 uppercase tracking-[0.16em] text-[8px]",children:"Coordination Terminal Turn:"}),e.terminalTurnRule]}),i.jsx(tfe,{topology:e.topology}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Steps"}),i.jsx("div",{className:"space-y-1",children:e.steps.map(m=>i.jsxs("div",{"data-testid":`workflow-step-${m.stepId}`,className:"border border-stone-300/40 bg-white/5 px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[11px] font-bold text-stone-800",children:m.stepId}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:m.role})]}),m.objective&&i.jsx("div",{className:"mt-1 text-[10px] text-stone-600 leading-tight",children:m.objective}),m.allowedNextSteps.length>0&&i.jsxs("div",{className:"mt-1 font-mono text-[9px] text-stone-500",children:["next: ",m.allowedNextSteps.map(x=>`${x.stepId} (${x.role})`).join(", ")]}),m.allowedExits.length>0&&i.jsxs("div",{className:"font-mono text-[9px] text-stone-400",children:["exits: ",m.allowedExits.join(", ")]})]},m.stepId))})]})]})})}function sfe({entryId:e}){const t=zt(),{data:n=[],isLoading:s,error:r}=W2(),a=n.find(f=>f.id===e)??null,{data:l,isLoading:u}=uW(a?e:null);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading context pack…"})}):r||!a?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:"Library",title:"Context Pack Not Found",description:(r==null?void 0:r.message)??`No context pack with id ${e}.`}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):i.jsx(rfe,{entry:a,preview:l,previewLoading:u})}function rfe({entry:e,preview:t,previewLoading:n}){var S;const s=zt(),[r,a]=E.useState(!1),[l,u]=E.useState(""),[f,d]=E.useState(null),[p,m]=E.useState("idle"),x=dW(),{data:y}=nz(r),b=((y==null?void 0:y.destinations)??[]).filter(C=>C.source==="topology"&&C.status==="running").map(C=>C.sessionName).sort(),v=async()=>{if(d(null),!l){d("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:l,dryRun:!0}),m("dry-run-shown")}catch(C){d(C.message)}},w=async()=>{if(d(null),!l){d("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:l,dryRun:!1}),m("sent")}catch(C){d(C.message)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-context-pack",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:`Library — Context Pack${e.sourceType==="builtin"?" (built-in)":""}`,title:e.name,description:e.purpose??"Operator-authored composable context bundle.",actions:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"context-pack-send-button",onClick:()=>a(C=>!C),children:r?"Hide Send":"Send to seat"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),i.jsxs($o,{children:[i.jsx(st,{label:"Version",value:e.version,testId:"lib-pack-version"}),i.jsx(st,{label:"Files",value:e.files.length,testId:"lib-pack-files"}),i.jsx(st,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-pack-tokens"}),i.jsx(st,{label:"Source",value:e.sourceType,testId:"lib-pack-source"})]}),i.jsxs("div",{"data-testid":"lib-pack-source-path",className:"font-mono text-[9px] text-stone-500",children:["path: ",e.sourcePath]}),i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Files"}),i.jsx("ul",{"data-testid":"lib-pack-file-list",className:"divide-y divide-stone-100",children:e.files.map(C=>{const k=C.bytes===null;return i.jsx("li",{"data-testid":`lib-pack-file-${C.path}`,"data-missing":k?"true":"false",className:`font-mono text-[10px] ${k?"text-red-700":"text-stone-800"}`,children:i.jsxs(Nf,{data:{path:C.path,absolutePath:C.absolutePath},testId:`lib-pack-file-trigger-${C.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:C.path}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",C.role,k?" · MISSING":` · ${C.bytes}B · ~${C.estimatedTokens} tokens`]})]}),C.summary&&i.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:C.summary})]})},C.path)})})]}),r&&i.jsxs("section",{"data-testid":"context-pack-send-modal",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Send to seat"}),i.jsxs("select",{"data-testid":"context-pack-send-session",className:"w-full font-mono text-[10px] border border-stone-300 px-2 py-1",value:l,onChange:C=>u(C.target.value),children:[i.jsx("option",{value:"",children:"Pick a running session…"}),b.map(C=>i.jsx("option",{value:C,children:C},C))]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"context-pack-send-dry-run",onClick:()=>void v(),disabled:x.isPending,children:x.isPending?"…":"Dry run"}),i.jsx(_e,{size:"sm","data-testid":"context-pack-send-confirm",onClick:()=>void w(),disabled:x.isPending||!l,children:x.isPending?"Sending…":"Send"})]}),f&&i.jsx("div",{"data-testid":"context-pack-send-error",className:"font-mono text-[9px] text-red-600",children:f}),p==="sent"&&i.jsxs("div",{"data-testid":"context-pack-send-success",className:"font-mono text-[9px] text-emerald-700",children:["Sent to ",l,"."]}),p==="dry-run-shown"&&((S=x.data)==null?void 0:S.bundleText)&&i.jsx("pre",{"data-testid":"context-pack-send-bundle-preview",className:"font-mono text-[9px] bg-stone-50 border border-stone-200 px-2 py-1 max-h-64 overflow-y-auto whitespace-pre-wrap",children:x.data.bundleText})]}),i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Bundle preview"}),n&&i.jsx("div",{className:"px-3 py-2 font-mono text-[9px] text-stone-400",children:"Loading bundle…"}),t&&i.jsxs(i.Fragment,{children:[t.missingFiles.length>0&&i.jsxs("div",{"data-testid":"lib-pack-missing-warning",className:"px-3 py-2 font-mono text-[9px] text-red-700 border-b border-stone-200",children:["Warning: ",t.missingFiles.length," file",t.missingFiles.length===1?"":"s"," referenced by manifest but missing on disk."]}),i.jsx("pre",{"data-testid":"lib-pack-bundle-text",className:"font-mono text-[9px] text-stone-800 bg-stone-50 px-3 py-2 max-h-96 overflow-y-auto whitespace-pre-wrap",children:t.bundleText})]})]})]})})}function ife({entryId:e}){const t=zt(),{data:n=[],isLoading:s,error:r}=Y2(),a=n.find(f=>f.id===e)??null,{data:l,isLoading:u}=pW(a?e:null);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading agent image…"})}):r||!a?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:"Library",title:"Agent Image Not Found",description:(r==null?void 0:r.message)??`No agent image with id ${e}.`}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):i.jsx(afe,{entry:a,preview:l,previewLoading:u})}function afe({entry:e,preview:t,previewLoading:n}){const s=zt(),r=mW(),[a,l]=E.useState(!1),[u,f]=E.useState(null),d=async()=>{if(!(t!=null&&t.starterSnippet))return;await Xr(t.starterSnippet)&&(l(!0),window.setTimeout(()=>l(!1),2e3))},p=async()=>{f(null);try{await r.mutateAsync({id:e.id,pin:!e.pinned})}catch(m){f(m.message)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-agent-image",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:`Library — Agent Image${e.sourceType==="builtin"?" (built-in)":""}`,title:`${e.name} v${e.version}`,description:e.notes??`Snapshot of ${e.sourceSeat}.`,actions:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"agent-image-pin-toggle",onClick:()=>void p(),disabled:r.isPending,children:e.pinned?"Unpin":"Pin"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),i.jsxs($o,{children:[i.jsx(st,{label:"Runtime",value:i.jsx(Kn,{runtime:e.runtime,size:"sm",compact:!0,variant:"inline"}),testId:"lib-image-runtime"}),i.jsx(st,{label:"Forks",value:String(e.stats.forkCount),testId:"lib-image-forks"}),i.jsx(st,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-image-tokens"}),i.jsx(st,{label:"Size",value:`${e.stats.estimatedSizeBytes}B`,testId:"lib-image-size"})]}),i.jsxs("div",{"data-testid":"lib-image-source",className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[i.jsxs("div",{children:["source seat: ",e.sourceSeat]}),i.jsxs("div",{"data-testid":"lib-image-source-cwd",children:["source cwd: ",e.sourceCwd??"(unknown — pre-Finding-2 manifest)"]}),i.jsxs("div",{children:["created: ",e.createdAt]}),i.jsxs("div",{children:["last used: ",e.stats.lastUsedAt??"never"]}),i.jsxs("div",{children:["path: ",e.sourcePath]}),i.jsxs("div",{"data-testid":"lib-image-pinned",className:e.pinned?"text-amber-700 font-bold":"",children:["pinned: ",String(e.pinned)]})]}),e.lineage.length>0&&i.jsxs("section",{"data-testid":"lib-image-lineage",className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Lineage"}),i.jsxs("div",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[e.lineage.join(" → ")," → ",i.jsx("span",{className:"font-bold",children:e.name})]})]}),i.jsxs("section",{"data-testid":"lib-image-starter-snippet",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Use as starter"}),i.jsx(_e,{variant:"outline",size:"sm","data-testid":"agent-image-copy-snippet",onClick:()=>void d(),disabled:!(t!=null&&t.starterSnippet),children:a?"Copied":"Copy snippet"})]}),i.jsx("div",{className:"font-mono text-[9px] text-stone-500",children:"Paste into your agent.yaml's session_source. The instantiator resolves the image via the daemon AgentImageLibraryService at startup time."}),n&&i.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"Loading snippet…"}),(t==null?void 0:t.starterSnippet)&&i.jsx("pre",{"data-testid":"lib-image-snippet-text",className:"font-mono text-[10px] bg-stone-50 border border-stone-200 px-2 py-1 whitespace-pre-wrap",children:t.starterSnippet})]}),u&&i.jsx("div",{"data-testid":"lib-image-pin-error",className:"font-mono text-[9px] text-red-600",children:u}),e.files.length>0&&i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Supplementary files"}),i.jsx("ul",{className:"divide-y divide-stone-100",children:e.files.map(m=>i.jsx("li",{className:"font-mono text-[10px] text-stone-800","data-testid":`lib-image-file-${m.path}`,children:i.jsxs(Nf,{data:{path:m.path,absolutePath:m.absolutePath},testId:`lib-image-file-trigger-${m.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:m.path}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",m.role,m.bytes===null?" · MISSING":` · ${m.bytes}B`]})]}),m.summary&&i.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:m.summary})]})},m.path))})]})]})})}async function ofe(e,t){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function lfe(e,t){return De({queryKey:["rig",e,"nodes",t],queryFn:()=>ofe(e,t),enabled:!!e&&!!t,refetchInterval:3e4})}function cfe({pluginIds:e}){const{data:t=[]}=sg();if(e.length===0)return i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ve,{label:"NO PLUGINS",description:"This agent's profile does not declare any plugins.",variant:"card",testId:"agent-plugins-empty"})});const n=new Map;for(const s of t)n.set(s.id,s);return i.jsx("ul",{"data-testid":"agent-plugins-list",className:"flex flex-col gap-2",children:e.map(s=>{const r=n.get(s);return i.jsx("li",{children:r?i.jsx(ufe,{entry:r}):i.jsx(dfe,{pluginId:s})},s)})})}function ufe({entry:e}){return i.jsxs(Ue,{to:"/plugins/$pluginId",params:{pluginId:e.id},"data-testid":`agent-plugin-chip-${e.id}`,className:"flex items-center justify-between gap-3 border border-outline-variant bg-white/30 px-3 py-2 font-mono text-[11px] hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"skill",title:`${e.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e.name}),i.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:`v${e.version}`})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[e.runtimes.map(t=>i.jsx("span",{className:"inline-block border border-outline-variant px-1.5 py-0.5 font-mono",children:t},t)),i.jsx("span",{title:e.path,children:e.sourceLabel})]})]})}function dfe({pluginId:e}){return i.jsxs(Ue,{to:"/plugins/$pluginId",params:{pluginId:e},"data-testid":`agent-plugin-chip-${e}`,className:"flex items-center justify-between gap-3 border border-dashed border-outline-variant bg-white/20 px-3 py-2 font-mono text-[11px] hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"skill",title:`${e} plugin (unresolved)`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e})]}),i.jsx("span",{"data-testid":`agent-plugin-unresolved-${e}`,className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:"not discovered"})]})}function ffe(e){return e==null?i.jsx("span",{className:"text-stone-400",children:"—"}):typeof e=="string"&&e.trim()===""?i.jsx("span",{className:"text-stone-400",children:"—"}):e}function hfe(e){return e==="running"?"active":T2(e)}function pfe(e){return e==="active"?"active":e==="needs_input"?"needs input":e}function mfe({data:e,activityVisual:t}){var y,b,v;const n=A2(e.agentActivity),s=(t==null?void 0:t.state)??n,r=t?pfe(t.state):hfe(n),a=t?t.state==="active":n==="running",l=((y=e.contextUsage)==null?void 0:y.availability)==="known"&&typeof e.contextUsage.usedPercentage=="number"?`${e.contextUsage.usedPercentage}%`:null,u=ma((b=e.contextUsage)==null?void 0:b.totalInputTokens,(v=e.contextUsage)==null?void 0:v.totalOutputTokens),f=yf(u),d=e.resolvedSpecName&&e.resolvedSpecVersion?`${e.resolvedSpecName}@${e.resolvedSpecVersion}`:e.resolvedSpecName??null,p=i.jsx("span",{"data-testid":"seat-overview-activity-state","data-activity-state":s,className:a?"topology-table-active-shimmer text-emerald-600":"text-stone-700",children:r}),m=[{key:"runtime",label:"runtime",value:e.runtime?i.jsx(Kn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}):null},{key:"model",label:"model",value:e.model,mono:!0},{key:"profile",label:"profile",value:e.profile,mono:!0},{key:"spec",label:"spec",value:d,mono:!0},{key:"activity",label:"activity",value:p},{key:"context-percent",label:"context %",value:l,mono:!0},{key:"total-tokens",label:"tokens",value:f,mono:!0}],x=m.length-1;return i.jsx("section",{"data-testid":"seat-overview-table",className:"border border-outline-variant bg-white/30",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{children:i.jsx("tr",{"data-testid":"seat-overview-header-row",className:"border-b border-outline-variant/55 bg-stone-50/30",children:m.map((w,S)=>i.jsx("th",{scope:"col","data-testid":`seat-overview-header-${w.key}`,className:`px-3 py-1.5 text-left font-mono text-[10px] font-normal lowercase tracking-[0.04em] text-stone-500 ${S<x?"border-r border-outline-variant/55":""}`,children:w.label},w.key))})}),i.jsx("tbody",{children:i.jsx("tr",{"data-testid":"seat-overview-data-row","data-row-shape":"data",children:m.map((w,S)=>i.jsx("td",{"data-testid":`seat-overview-cell-${w.key}`,className:`min-w-0 px-3 py-1.5 align-middle ${w.mono?"font-mono text-[11px]":"text-[11px]"} text-stone-900 ${S<x?"border-r border-outline-variant/55":""}`,children:i.jsx("div",{className:"truncate",children:ffe(w.value)})},w.key))})})]})})})}function gfe(e){return e==null?i.jsx("span",{className:"text-stone-400",children:"—"}):typeof e=="string"&&e.trim()===""?i.jsx("span",{className:"text-stone-400",children:"—"}):e}function xfe({data:e}){var s;const t=((s=e.currentQitems)==null?void 0:s[0])??null,n=t?i.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[i.jsx("span",{className:"shrink-0 font-mono text-[10px] text-stone-500",children:t.qitemId}),i.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-900",children:t.bodyExcerpt})]}):null;return i.jsx("section",{"data-testid":"seat-overview-secondary",className:"border border-outline-variant bg-white/30",children:i.jsxs("dl",{className:"divide-y divide-outline-variant/55",children:[i.jsx(QL,{fieldKey:"cwd",label:"cwd",value:e.cwd,mono:!0,titleAttr:e.cwd??void 0}),i.jsx(QL,{fieldKey:"current-work",label:"current work",value:n})]})})}function QL({fieldKey:e,label:t,value:n,mono:s,titleAttr:r}){return i.jsxs("div",{"data-testid":`seat-overview-secondary-row-${e}`,className:"flex min-w-0 items-baseline gap-3 px-3 py-1.5",title:r,children:[i.jsx("dt",{className:"shrink-0 font-mono text-[10px] lowercase tracking-[0.04em] text-stone-500",children:t}),i.jsx("dd",{"data-testid":`seat-overview-secondary-cell-${e}`,className:`min-w-0 flex-1 truncate ${s?"font-mono text-[11px]":"text-[11px]"} text-stone-900`,children:gfe(n)})]})}function yfe(e){return e.startupStatus==="failed"?"Startup failed":e.startupStatus==="attention_required"?"Attention required":e.latestError?"Error":null}function vfe(e){return e.startupStatus==="failed"||e.latestError&&e.startupStatus!=="attention_required"?"destructive":"default"}function bfe({data:e}){const t=yfe(e);if(!t)return null;const n=!!e.latestError,s=!!e.recoveryGuidance;return i.jsxs(wn,{"data-testid":"seat-notification-banner","data-startup-status":e.startupStatus??"unknown",variant:vfe(e),children:[i.jsx(dq,{"data-testid":"seat-notification-headline",className:"font-mono text-[11px] uppercase tracking-[0.08em]",children:t}),n?i.jsx(dn,{"data-testid":"seat-notification-error",className:"font-mono text-[10px]",children:e.latestError}):null,s&&e.recoveryGuidance?i.jsx(dn,{"data-testid":"seat-notification-guidance",className:"mt-1 font-mono text-[10px] text-stone-700",children:e.recoveryGuidance.summary}):null]})}function wfe(e){switch(e){case"resumed":return"text-success";case"rebuilt":return"text-success";case"fresh":return"text-foreground-muted";case"failed":return"text-destructive";case"checkpoint_written":return"text-success";case"fresh_no_checkpoint":return"text-foreground-muted";default:return"text-foreground-muted"}}const ga="border border-outline-variant bg-white/30 p-3";function jfe(e){switch(e){case"ready":return"text-green-600";case"pending":return"text-amber-600";case"attention_required":return"text-orange-600";case"failed":return"text-red-600";default:return"text-stone-400"}}function Sfe(e){switch(e){case"attention_required":return"attention required";default:return e??"stopped"}}function Nfe(e){if(!e)return null;const t=e.match(/^local:agents\/([^/]+)$/);return(t==null?void 0:t[1])??null}function Ps({label:e,value:t}){return t==null||t===""?null:i.jsxs("div",{className:"flex justify-between gap-3 font-mono text-[10px]",children:[i.jsx("span",{className:"text-stone-500",children:e}),i.jsx("span",{className:"truncate text-right text-stone-900",children:t})]})}function kfe({data:e}){const t=Nfe(e.agentRef),{data:n=[],isLoading:s}=Ac("agent"),r=t?n.filter(f=>f.name===t):[],a=r.length===1?r[0].id:null,{data:l,isLoading:u}=K2(a);return i.jsxs("div",{"data-testid":"live-agent-spec-section",className:"space-y-4",children:[e.compactSpec.name&&i.jsxs("section",{"data-testid":"detail-compact-spec",className:ga,children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Resolved Agent Spec"}),i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(Ps,{label:"Spec",value:e.compactSpec.name}),i.jsx(Ps,{label:"Version",value:e.compactSpec.version}),i.jsx(Ps,{label:"Profile",value:e.compactSpec.profile}),i.jsx(Ps,{label:"Skills",value:e.compactSpec.skillCount}),i.jsx(Ps,{label:"Guidance",value:e.compactSpec.guidanceCount})]})]}),t?s||u?i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading agent spec..."}):r.length===0?i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):r.length>1?i.jsxs("div",{"data-testid":"agent-spec-ambiguous",className:"p-4 font-mono text-[10px] text-amber-600",children:["Agent spec ambiguous (",r.length,' matches for "',t,'")']}):!l||l.kind!=="agent"?i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):i.jsxs(i.Fragment,{children:[i.jsx(j_,{review:l,yaml:l.raw,testIdPrefix:"live-agent",sourcePath:l.sourcePath}),i.jsxs("section",{"data-testid":"live-agent-plugins-section",className:"border border-outline-variant bg-white/30 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Plugins"}),i.jsx(cfe,{pluginIds:_fe(l)})]})]}):i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"})]})}function _fe(e){if(!e||typeof e!="object")return[];const t=e.resources;if(!t||typeof t!="object")return[];const n=t.plugins;if(!Array.isArray(n))return[];const s=[];for(const r of n)r&&typeof r=="object"&&typeof r.id=="string"?s.push(r.id):typeof r=="string"&&s.push(r);return s}function Cfe({rigId:e,logicalId:t,data:n}){const s=async()=>{n.tmuxAttachCommand&&await Xr(n.tmuxAttachCommand)},r=async()=>{try{await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"})}catch{}},a=async()=>{n.resumeCommand&&await Xr(n.resumeCommand)};return i.jsxs("div",{"data-testid":"live-node-actions",className:"flex flex-wrap gap-2",children:[i.jsxs("button",{onClick:r,"data-testid":"detail-cmux-open",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100/60",children:[i.jsx(Pe,{tool:"cmux",size:"sm"}),"Open CMUX"]}),n.tmuxAttachCommand&&i.jsxs("button",{onClick:s,"data-testid":"detail-copy-attach",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[i.jsx(Pe,{tool:"tmux",size:"sm"}),"Copy tmux attach"]}),n.resumeCommand&&i.jsxs("button",{onClick:a,"data-testid":"detail-copy-resume",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[i.jsx(pV,{"aria-hidden":"true",className:"h-4 w-4 shrink-0",strokeWidth:1.5}),"Copy resume command"]})]})}function Efe({data:e}){const t=e.startupStatus==="failed"||e.startupStatus==="attention_required"||!!e.latestError;return i.jsxs("section",{"data-testid":"live-node-status",className:"grid gap-2 border border-outline-variant bg-white/30 p-3 sm:grid-cols-2",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Startup"}),i.jsx("span",{className:jfe(e.startupStatus),"data-testid":"detail-startup-status",children:Sfe(e.startupStatus)})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Restore"}),i.jsx("span",{className:`font-mono text-xs font-bold ${wfe(e.restoreOutcome)}`,"data-testid":"detail-restore-outcome",children:e.restoreOutcome})]}),t&&i.jsxs("div",{className:`sm:col-span-2 mt-1 p-2 border ${e.startupStatus==="attention_required"?"bg-orange-50 border-orange-200":"bg-red-50 border-red-200"}`,"data-testid":"detail-failure-banner",children:[i.jsx("div",{className:`font-mono text-[9px] font-bold mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-700"}`,children:e.startupStatus==="attention_required"?"Attention Required":e.startupStatus==="failed"?"Startup Failed":"Error"}),e.latestError&&i.jsx("div",{className:`font-mono text-[9px] mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-600"}`,children:e.latestError}),i.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:e.startupStatus==="attention_required"?`Use rig capture ${e.canonicalSessionName??"<session>"} to inspect the prompt, then rig send ${e.canonicalSessionName??"<session>"} to clear it.`:e.startupStatus==="failed"?"Check logs with: rig ps --nodes, or restart with: rig up":"Try: rig restore <snapshotId>"}),e.recoveryGuidance&&i.jsxs("div",{className:"mt-2 border-t border-stone-200 pt-2","data-testid":"detail-recovery-guidance",children:[i.jsx("div",{className:"font-mono text-[8px] font-bold text-stone-700 mb-1",children:"Recovery"}),i.jsx("div",{className:"font-mono text-[8px] text-stone-600 mb-1",children:e.recoveryGuidance.summary}),i.jsx("div",{className:"space-y-0.5 mb-1",children:e.recoveryGuidance.commands.map((n,s)=>i.jsx("code",{className:"font-mono text-[8px] text-stone-800 bg-stone-100 px-1 py-0.5 block",children:n},`${n}-${s}`))}),i.jsx("div",{className:"space-y-0.5",children:e.recoveryGuidance.notes.map((n,s)=>i.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:n},`${n}-${s}`))})]})]})]})}function Rfe({data:e}){return!e.recentEvents||e.recentEvents.length===0?null:i.jsxs("section",{"data-testid":"live-node-recent-events",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Recent Events"}),i.jsx("div",{className:"space-y-0.5",children:e.recentEvents.slice(0,10).map((t,n)=>i.jsxs("div",{className:"font-mono text-[9px] flex justify-between gap-3",children:[i.jsx("span",{className:"text-stone-700 truncate",children:t.type}),i.jsx("span",{className:"text-stone-400 ml-2 shrink-0",children:t.createdAt})]},`${t.type}-${n}`))})]})}function Afe({data:e}){const{outgoing:t,incoming:n}=e.edges;return t.length===0&&n.length===0?null:i.jsxs("section",{"data-testid":"detail-edges",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Edges"}),i.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[t.map((s,r)=>{var a;return i.jsxs("div",{className:"flex gap-1",children:[i.jsx("span",{className:"text-stone-400",children:"->"}),i.jsx("span",{className:"text-stone-500",children:s.kind}),i.jsx("span",{className:"text-stone-900",children:((a=s.to)==null?void 0:a.logicalId)??"?"})]},`out-${r}`)}),n.map((s,r)=>{var a;return i.jsxs("div",{className:"flex gap-1",children:[i.jsx("span",{className:"text-stone-400",children:"<-"}),i.jsx("span",{className:"text-stone-500",children:s.kind}),i.jsx("span",{className:"text-stone-900",children:((a=s.from)==null?void 0:a.logicalId)??"?"})]},`in-${r}`)})]})]})}function Tfe({data:e}){return e.peers.length===0?null:i.jsxs("section",{"data-testid":"detail-peers",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Peers"}),i.jsx("div",{className:"space-y-1 font-mono text-[10px]",children:e.peers.map(t=>i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"flex justify-between gap-3",children:[i.jsx("span",{className:"text-stone-900",children:t.logicalId}),i.jsx("span",{className:"text-stone-500",children:t.runtime??"-"})]}),t.canonicalSessionName&&i.jsx("div",{className:"text-[9px] text-stone-400 truncate",children:t.canonicalSessionName})]},t.logicalId))})]})}function Ife({data:e}){var n,s,r;const t=e.contextUsage;return i.jsxs("section",{"data-testid":"detail-context-usage",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Context"}),(t==null?void 0:t.availability)==="known"?i.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[i.jsx(Ps,{label:"Used",value:t.usedPercentage!=null?`${t.usedPercentage}%`:null}),i.jsx(Ps,{label:"Remaining",value:t.remainingPercentage!=null?`${t.remainingPercentage}%`:null}),i.jsx(Ps,{label:"Window",value:(n=t.contextWindowSize)==null?void 0:n.toLocaleString()}),i.jsx(Ps,{label:"Input tokens",value:(s=t.totalInputTokens)==null?void 0:s.toLocaleString()}),i.jsx(Ps,{label:"Output tokens",value:(r=t.totalOutputTokens)==null?void 0:r.toLocaleString()}),i.jsx(Ps,{label:"Sampled",value:t.sampledAt}),t.fresh===!1&&i.jsx("div",{className:"font-mono text-[9px] text-amber-600 mt-1",children:"Stale sample"})]}):i.jsxs("div",{className:"font-mono text-[10px] text-stone-400",children:["unknown",t!=null&&t.reason?` (${t.reason})`:""]})]})}function Mfe({data:e,activityVisual:t}){return i.jsxs("div",{"data-testid":"live-overview-section",className:"space-y-4",children:[i.jsx(bfe,{data:e}),i.jsx(mfe,{data:e,activityVisual:t}),i.jsx(xfe,{data:e}),i.jsx(Lfe,{data:e}),i.jsx(Rfe,{data:e})]})}function Ofe({rigId:e,logicalId:t,data:n,isAgent:s}){return i.jsxs("div",{"data-testid":"live-details-section",className:"space-y-4",children:[i.jsx(Pfe,{rigId:e,logicalId:t,data:n}),s?i.jsx(kfe,{data:n}):null,i.jsx(Afe,{data:n}),i.jsx(Tfe,{data:n}),i.jsx(Ife,{data:n}),i.jsx($fe,{data:n})]})}function Lfe({data:e}){return e.canonicalSessionName?i.jsx("div",{"data-testid":"live-terminal-shell",className:"bg-stone-950/65 p-2 text-stone-50 backdrop-blur-sm",children:i.jsx(Ig,{sessionName:e.canonicalSessionName,lines:80,testIdPrefix:"live-terminal-preview",variant:"compact-terminal"})}):i.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No canonical session name; terminal preview unavailable."})}function Pfe({rigId:e,logicalId:t,data:n}){return i.jsxs("div",{"data-testid":"live-startup-section",className:"space-y-4",children:[i.jsx(Efe,{data:n}),n.infrastructureStartupCommand&&i.jsxs("section",{"data-testid":"live-node-infra-startup",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Command"}),i.jsx("code",{className:"font-mono text-[9px] text-stone-700 bg-stone-100 px-2 py-1 block",children:n.infrastructureStartupCommand})]}),n.startupActions.length>0&&i.jsxs("section",{"data-testid":"live-startup-actions",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Actions"}),i.jsx("div",{className:"space-y-1",children:n.startupActions.map((s,r)=>i.jsxs("div",{className:"font-mono text-[10px] text-stone-700",children:[i.jsxs("span",{className:"text-stone-500",children:[s.type,":"]})," ",s.value]},`${s.type}-${s.value}-${r}`))})]}),n.startupFiles.length>0?i.jsxs("section",{className:"border border-outline-variant bg-white/30",children:[i.jsx("div",{className:"px-3 py-2 border-b border-outline-variant font-mono text-xs font-bold",children:"Startup Files"}),i.jsx("ul",{className:"divide-y divide-outline-variant",children:n.startupFiles.map((s,r)=>i.jsx("li",{"data-testid":`live-startup-file-${s.path}`,children:i.jsxs(Nf,{data:{path:s.path,absolutePath:s.absolutePath},testId:`live-startup-file-trigger-${s.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors font-mono text-[10px]",children:[i.jsx("span",{className:"font-bold underline decoration-dotted decoration-stone-400",children:s.path}),i.jsxs("span",{className:"text-stone-400 ml-2",children:["(",s.deliveryHint,")"]}),s.required&&i.jsx("span",{className:"text-red-500 text-[8px] ml-1",children:"REQUIRED"})]})},`${s.path}-${r}`))})]}):i.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No startup files declared"})]})}function $fe({data:e}){return e.transcript.enabled?i.jsx("div",{"data-testid":"live-transcript-section",className:"space-y-4",children:i.jsxs("section",{"data-testid":"detail-transcript",className:ga,children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Transcript"}),i.jsx("div",{className:"font-mono text-[10px] text-stone-700",children:e.transcript.path??"enabled"}),e.transcript.tailCommand&&i.jsx("button",{type:"button",onClick:()=>Xr(e.transcript.tailCommand),className:"mt-2 w-full border border-stone-300 bg-white/40 px-2 py-1 text-left font-mono text-[8px] uppercase text-stone-700 hover:bg-stone-100",children:"Copy tail command"})]})}):i.jsx("div",{"data-testid":"live-transcript-section",className:"font-mono text-[10px] text-stone-400 p-4",children:"Transcript capture not enabled"})}function Dfe({tabs:e,activeTab:t,onSelect:n}){return i.jsx("div",{className:"flex gap-1 border-b border-outline-variant",role:"tablist","data-testid":"live-node-tabs",children:e.map(s=>i.jsx("button",{role:"tab","aria-selected":t===s,"data-testid":`live-tab-${s}`,onClick:()=>n(s),className:`min-h-11 px-3 py-2 font-mono text-[10px] uppercase tracking-wider transition-colors ${t===s?"border-b-2 border-stone-900 text-stone-900 font-bold -mb-px":"text-stone-500 hover:text-stone-700"}`,children:s.replace("-"," ")},s))})}function sz({rigId:e,logicalId:t}){const{data:n,isLoading:s,error:r}=lfe(e,t),a=E.useMemo(()=>Zg(n?[{nodeId:`${n.rigId}::${n.logicalId}`,rigId:n.rigId,rigName:n.rigName,logicalId:n.logicalId,canonicalSessionName:n.canonicalSessionName,agentActivity:n.agentActivity??null,currentQitems:n.currentQitems??null,startupStatus:n.startupStatus}]:[]),[n]),l=Jg(a),u=n?l.getNodeActivity(`${n.rigId}::${n.logicalId}`,{agentActivity:n.agentActivity??null,currentQitems:n.currentQitems??null,startupStatus:n.startupStatus}):null,[f,d]=E.useState("overview"),p=n?n.nodeKind!=="infrastructure":!0,m=["overview","details"];return i.jsx(at,{children:i.jsxs("div",{"data-testid":"live-node-details",className:"space-y-4",children:[i.jsx(Nn,{eyebrow:"Live Node Details",title:(n==null?void 0:n.canonicalSessionName)??t,description:`${(n==null?void 0:n.rigName)??e} / ${(n==null?void 0:n.podNamespace)??ir(t)??Ql((n==null?void 0:n.podId)??null)} / ${t}`,actions:n?i.jsx(Kn,{runtime:n.runtime,model:n.model,size:"sm",compact:!0,className:"bg-white/40 backdrop-blur-sm"}):null}),s&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading..."}),r&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:r.message}),n&&i.jsxs(i.Fragment,{children:[i.jsx(Cfe,{rigId:e,logicalId:t,data:n}),i.jsx(Dfe,{tabs:m,activeTab:f,onSelect:d}),i.jsxs("div",{"data-testid":"live-node-tab-body",className:"space-y-4",children:[f==="overview"&&i.jsx(Mfe,{data:n,activityVisual:u}),f==="details"&&i.jsx(Ofe,{rigId:e,logicalId:t,data:n,isAgent:p})]})]})]})})}function qfe(e){return`'${e.replace(/'/g,"'\\''")}'`}function zfe(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${qfe(t)}`}function XL({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[a,l]=E.useState(!1),u=E.useRef(null);E.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const f=async()=>{await n()&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),u.current=null},900))};return i.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{f()},className:he("inline-flex items-center gap-1.5 px-spacing-2 py-1 border font-mono text-[10px] uppercase transition-colors duration-150 ease-tactical",a?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?i.jsx(Pe,{tool:r,size:"sm"}):null,i.jsx("span",{children:a?t:e})]})}function Bfe({session:e,onAdopt:t}){return i.jsx("div",{"data-testid":"discovered-node",className:he("border-dashed border border-foreground/20 bg-[rgba(255,255,255,0.72)] px-spacing-4 py-spacing-3 mb-spacing-2 shadow-[0_10px_28px_rgba(20,20,20,0.04)] backdrop-blur-sm"),children:i.jsxs("div",{className:"flex flex-col gap-spacing-3 lg:flex-row lg:items-center lg:justify-between",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-spacing-3 gap-y-spacing-1",children:[i.jsx("span",{"data-testid":"runtime-badge",children:i.jsx(Kn,{runtime:e.runtimeHint,size:"sm",compact:!0})}),i.jsx("div",{"data-testid":"session-name",className:"font-mono text-[13px] leading-5 text-foreground",title:e.tmuxSession,children:e.tmuxSession}),e.confidence==="medium"?i.jsx("div",{"data-testid":"runtime-inferred-note",className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"runtime inferred"}):null]}),e.cwd?i.jsxs("div",{className:"mt-spacing-2 min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"cwd"}),i.jsx("div",{className:"font-mono text-[12px] leading-5 text-foreground-muted truncate",title:e.cwd,children:e.cwd})]}):null]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-spacing-2 lg:justify-end",children:[i.jsx(XL,{label:"copy tmux",activeLabel:"copied",testId:"copy-tmux-btn",tool:"tmux",onClick:async()=>await Xr(zfe(e))}),e.cwd?i.jsx(XL,{label:"copy cwd",activeLabel:"copied",testId:"copy-cwd-btn",onClick:async()=>await Xr(e.cwd??"")}):null,i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"adopt-btn",onClick:()=>t(e.id),children:"ADOPT"})]})]})})}function Ffe(){const[e,t]=E.useState(null),[n,s]=E.useState(!1),r=E.useCallback(async()=>{s(!0);try{const a=await fetch("/api/discovery/draft-rig",{method:"POST"});if(!a.ok){t(`# Error: draft generation failed (HTTP ${a.status})`);return}const l=await a.text();t(l)}catch{t("# Error: failed to reach daemon")}finally{s(!1)}},[]);return i.jsxs("div",{className:"mt-spacing-4 border-t border-foreground/10 pt-spacing-4","data-testid":"generate-draft-section",children:[i.jsx(_e,{variant:"tactical",onClick:r,disabled:n,"data-testid":"generate-draft-btn",className:"mb-spacing-3",children:n?"GENERATING...":"GENERATE RIG SPEC"}),e&&(()=>{const a=e.split(`
|
|
515
|
-
`),l=a.filter(f=>f.startsWith("# WARNING:")).map(f=>f.replace(/^# WARNING:\s*/,"")),u=a.filter(f=>!f.startsWith("# WARNING:")).join(`
|
|
516
|
-
`).trim();return i.jsxs("div",{className:"relative",children:[l.length>0&&i.jsx("div",{className:"mb-spacing-2 p-spacing-2 bg-warning/10 border border-warning/30 text-label-sm","data-testid":"draft-warnings",children:l.map((f,d)=>i.jsx("div",{className:"text-warning font-mono",children:f},d))}),i.jsx("pre",{className:"bg-surface-low p-spacing-3 text-label-sm font-mono overflow-x-auto max-h-64 border border-foreground/10","data-testid":"draft-yaml",children:u}),i.jsx("button",{onClick:()=>{var f;return(f=navigator.clipboard)==null?void 0:f.writeText(e)},className:"absolute top-2 right-2 text-label-sm text-foreground-muted hover:text-foreground","data-testid":"copy-draft-btn",children:"COPY"})]})})()]})}function Hfe(){var C,k;const{data:e=[]}=ek({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),t=CD(),{data:n=[]}=dr(),s=hY(),r=e,[a,l]=E.useState(null),[u,f]=E.useState(!1),[d,p]=E.useState(""),[m,x]=E.useState(""),y=_=>{l(_),f(!0),p(""),x(""),s.reset()},b=()=>{f(!1),l(null)},v=()=>{!a||!d||!m.trim()||s.mutate({discoveredId:a,rigId:d,logicalId:m.trim()},{onSuccess:b})},w=((C=s.error)==null?void 0:C.message)??null,S=s.isPending;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"discovery-overlay",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-col gap-spacing-4 border-b border-foreground/10 pb-spacing-5 sm:flex-row sm:items-end sm:justify-between",children:[i.jsxs("div",{className:"max-w-[620px]",children:[i.jsx("h2",{className:"text-headline-lg uppercase",children:"DISCOVERY"}),i.jsx("p",{className:"mt-spacing-1 text-body-md text-foreground-muted",children:"Running agent sessions currently visible on this machine. Copy a tmux attach command, review the working directory, or adopt the session into a rig."})]}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"scan-now-btn",disabled:t.isPending,onClick:()=>t.mutate(),children:t.isPending?"SCANNING...":"SCAN NOW"})]}),t.isError?i.jsxs("div",{className:"mt-spacing-4 text-label-sm text-destructive","data-testid":"scan-error",children:["Discovery scan failed: ",(k=t.error)==null?void 0:k.message]}):null,r.length===0?i.jsx("div",{className:"py-spacing-8","data-testid":"discovery-empty",children:i.jsx("p",{className:"text-body-md text-foreground-muted",children:"No running Claude or Codex sessions are currently visible."})}):i.jsxs("div",{className:"mt-spacing-6 space-y-spacing-3","data-testid":"discovery-active-section",children:[i.jsxs("div",{className:"mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-sm uppercase",children:"Running agents"}),i.jsxs("p",{className:"text-label-md text-foreground-muted",children:[r.length," session",r.length!==1?"s":""," available to inspect or adopt"]})]}),r.map(_=>i.jsx(Bfe,{session:_,onAdopt:y},_.id))]}),i.jsx(Ffe,{})]}),i.jsx(Z9,{open:u,onOpenChange:f,children:i.jsxs(g_,{"data-testid":"adopt-dialog",children:[i.jsxs(x_,{children:[i.jsx(v_,{className:"text-headline-md uppercase",children:"ADOPT SESSION"}),i.jsx(b_,{children:"Bind this session to an existing logical node in the rig."})]}),i.jsxs("div",{className:"space-y-spacing-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"RIG"}),i.jsxs("select",{"data-testid":"adopt-rig-input",value:d,onChange:_=>p(_.target.value),className:"w-full bg-white border-b border-outline py-spacing-1 text-body-md font-mono focus:outline-none focus:border-stone-900 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:"Select a rig..."}),n.map(_=>i.jsxs("option",{value:_.id,children:[_.name," (",_.nodeCount," nodes)"]},_.id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"LOGICAL ID (required)"}),i.jsx("input",{"data-testid":"adopt-logical-input",type:"text",value:m,onChange:_=>x(_.target.value),className:"w-full bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono focus:outline-none focus:border-primary"}),i.jsx("p",{className:"mt-spacing-1 text-label-sm text-foreground-muted",children:"Enter the logical ID of an existing node in the target rig. For pod placement, use the Discovery drawer instead."})]})]}),w&&i.jsx("p",{className:"text-destructive text-label-sm","data-testid":"adopt-error",children:w}),i.jsxs(y_,{children:[i.jsx(_e,{variant:"ghost",onClick:()=>f(!1),children:"CANCEL"}),i.jsx(_e,{variant:"tactical",onClick:v,disabled:!d||!m.trim()||S,"data-testid":"adopt-confirm",children:S?"ADOPTING...":"ADOPT"})]})]})})]})})}async function Ufe(e){const t=new URLSearchParams;e.qitemId&&t.set("qitem_id",e.qitemId),e.actionVerb&&t.set("action_verb",e.actionVerb),e.actorSession&&t.set("actor_session",e.actorSession),e.since&&t.set("since",e.since),e.until&&t.set("until",e.until),e.limit!==void 0&&t.set("limit",String(e.limit)),e.beforeId&&t.set("before_id",e.beforeId);const n=t.toString(),s=`/api/mission-control/audit${n?`?${n}`:""}`,r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}function rz(e){return De({queryKey:["mission-control","audit",e],queryFn:()=>Ufe(e)})}const Vfe="openrig.missionControlBearerToken";function Gfe(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Vfe),t=e==null?void 0:e.trim();return t||null}catch{return null}}function Kfe(){const e=Gfe();return e?{Authorization:`Bearer ${e}`}:{}}const iz=["approve","deny","route","annotate","hold","drop","handoff"];async function Wfe(e){const t=await fetch("/api/mission-control/action",{method:"POST",headers:{"Content-Type":"application/json",...Kfe()},body:JSON.stringify(e)}),n=await t.json();if(!t.ok){const s=new Error(typeof n=="object"&&n&&"message"in n?String(n.message):`HTTP ${t.status}`);throw typeof n=="object"&&n&&"error"in n&&(s.code=String(n.error)),s.details=n,s}return n}function Yfe(){const e=Mt();return sn({mutationFn:Wfe,onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["mission-control","view"]}),e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["queue","item",n.qitemId]}),t.createdQitemId&&e.invalidateQueries({queryKey:["queue","item",t.createdQitemId]}),e.invalidateQueries({queryKey:["slices"]})}})}function qi(e){return typeof window>"u"?"":new URL(window.location.href).searchParams.get(e)??""}function Qfe(){var C,k,_,R;const[e,t]=E.useState(()=>qi("qitem_id")||qi("qitem")),[n,s]=E.useState(()=>qi("action_verb")||qi("verb")),[r,a]=E.useState(()=>qi("actor_session")||qi("actor")),[l,u]=E.useState(()=>qi("since")),[f,d]=E.useState(()=>qi("until")),[p]=E.useState(50),[m,x]=E.useState([]),y={qitemId:e||void 0,actionVerb:n||void 0,actorSession:r||void 0,since:l||void 0,until:f||void 0,limit:p,beforeId:m[m.length-1]},b=rz(y);function v(){x([])}function w(){var T;(T=b.data)!=null&&T.nextBeforeId&&x([...m,b.data.nextBeforeId])}function S(){x(m.slice(0,-1))}return i.jsxs("div",{"data-testid":"mc-view-audit-history",className:"space-y-3 p-3",children:[i.jsxs("header",{className:"space-y-0.5",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-500",children:"audit-history"}),i.jsx("h2",{className:"font-headline text-lg text-stone-900",children:"Audit history"}),i.jsxs("p",{className:"text-xs text-stone-600",children:["Browse ",i.jsx("code",{children:"mission_control_actions"})," by qitem, verb, actor, and time range. Read-only."]})]}),i.jsxs("div",{"data-testid":"mc-audit-filters",className:"grid grid-cols-1 gap-2 border border-stone-200 bg-stone-50 p-2 sm:grid-cols-2",children:[i.jsx("input",{type:"text","data-testid":"mc-audit-filter-qitem-id",placeholder:"qitem_id (exact)",value:e,onChange:T=>t(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("select",{"data-testid":"mc-audit-filter-action-verb",value:n,onChange:T=>s(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs",children:[i.jsx("option",{value:"",children:"all verbs"}),iz.map(T=>i.jsx("option",{value:T,children:T},T))]}),i.jsx("input",{type:"text","data-testid":"mc-audit-filter-actor-session",placeholder:"actor_session (e.g., operator-alex@kernel)",value:r,onChange:T=>a(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-since",value:l,onChange:T=>u(T.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"since"}),i.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-until",value:f,onChange:T=>d(T.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"until"})]}),i.jsx("button",{type:"button","data-testid":"mc-audit-filter-apply",onClick:v,className:"border border-stone-700 bg-stone-800 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.12em] text-white",children:"Apply filters"})]}),b.isLoading?i.jsx("div",{"data-testid":"mc-audit-loading",className:"font-mono text-[10px] text-stone-500",children:"loading..."}):b.isError?i.jsxs("div",{"data-testid":"mc-audit-error",className:"font-mono text-[11px] text-red-700",children:["error: ",b.error.message]}):((C=b.data)==null?void 0:C.rows.length)===0?i.jsx("div",{"data-testid":"mc-audit-empty",className:"font-mono text-[11px] text-stone-500",children:"No audit entries match these filters."}):i.jsx("ul",{"data-testid":"mc-audit-rows",className:"space-y-1",children:(k=b.data)==null?void 0:k.rows.map(T=>i.jsxs("li",{"data-testid":"mc-audit-row","data-action-id":T.actionId,className:"border border-stone-200 bg-white p-2 text-[11px]",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-mono uppercase tracking-[0.1em] text-stone-700",children:T.actionVerb}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:T.actedAt})]}),i.jsxs("div",{className:"mt-1 text-stone-700",children:["qitem: ",i.jsx("span",{className:"font-mono",children:T.qitemId??"—"})]}),i.jsxs("div",{className:"text-stone-700",children:["actor: ",i.jsx("span",{className:"font-mono",children:T.actorSession})]}),T.reason?i.jsxs("div",{className:"text-stone-700",children:["reason: ",i.jsx("span",{className:"italic",children:T.reason})]}):null,T.annotation?i.jsxs("div",{className:"text-stone-700",children:["annotation: ",i.jsx("span",{className:"italic",children:T.annotation})]}):null]},T.actionId))}),i.jsxs("footer",{"data-testid":"mc-audit-pagination",className:"flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx("button",{type:"button","data-testid":"mc-audit-prev-page",onClick:S,disabled:m.length===0,className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"← prev"}),i.jsxs("span",{children:["rows: ",((_=b.data)==null?void 0:_.rows.length)??0]}),i.jsx("button",{type:"button","data-testid":"mc-audit-next-page",onClick:w,disabled:!((R=b.data)!=null&&R.hasMore),className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"next →"})]})]})}function Xfe(){const e=[{pos:"top-[18%] left-[36%]",text:"▪ 03°",size:"text-[10px]"},{pos:"top-[24%] right-[34%]",text:"**",size:"text-base"},{pos:"top-[44%] left-[44%]",text:"+",size:"text-sm"},{pos:"top-[52%] right-[36%]",text:"(A)",size:"text-[10px]"},{pos:"bottom-[34%] left-[20%]",text:"[?]",size:"text-sm"},{pos:"bottom-[42%] right-[24%]",text:"▪ 06°",size:"text-[10px]"},{pos:"bottom-[18%] left-[58%]",text:"+",size:"text-sm"}];return i.jsx(i.Fragment,{children:e.map((t,n)=>i.jsx("span",{className:`absolute ${t.pos} ${t.size??"text-xs"} font-mono text-stone-900 leading-none`,children:t.text},n))})}function Zfe({tier:e="mid"}){const t=e==="mid"?"text-base":"text-2xl",n=[{pos:"top-[22%] left-[58%]",text:"■ 03°"},{pos:"top-[60%] left-[18%]",text:"+"},{pos:"bottom-[26%] right-[40%]",text:"■ 06°"},{pos:"top-[68%] right-[22%]",text:"▣"},{pos:"top-[72%] left-[8%]",text:"**"},{pos:"top-[86%] right-[5%]",text:"(A)"}];return i.jsx(i.Fragment,{children:n.map((s,r)=>i.jsx("span",{className:`absolute ${s.pos} ${t} font-mono text-stone-900 leading-none`,children:s.text},r))})}function az({hostname:e="127.0.0.1"}={}){return i.jsxs("div",{"data-testid":"mid-layer","aria-hidden":"true",className:"absolute inset-0 z-[10] overflow-hidden pointer-events-none select-none",children:[i.jsxs("div",{className:"absolute top-[64%] left-[3%] font-mono text-[11px] text-stone-900 leading-tight max-w-[180px]",children:[i.jsx("div",{className:"font-bold uppercase",children:"▪ 06° Field Report"}),i.jsxs("div",{className:"text-stone-800 mt-1",children:["Operator session captured at field station ",e," — release 0.3.1; daemon trace nominal."]})]}),i.jsxs("div",{className:"absolute bottom-[8%] left-[6%] font-mono text-[11px] text-stone-900 leading-tight max-w-[180px]",children:[i.jsx("div",{className:"font-bold uppercase",children:"Data Streams ⚠⚠"}),i.jsxs("div",{className:"text-stone-800 mt-1 text-[10px]",children:["x-axis(1) y-axis(2) z-axis(3) — synchronized at ",e]})]}),i.jsx(Zfe,{tier:"mid"})]})}function oz({hostname:e="127.0.0.1",totalRigs:t=1,totalAgents:n=4,activeAgents:s=4}={}){return i.jsxs("div",{"data-testid":"top-layer",className:"absolute inset-0 z-20 pointer-events-none select-none",children:[i.jsx("div",{"data-testid":"dashboard-classification",className:"absolute top-0 inset-x-0 border-b border-stone-900/40 bg-background/40 backdrop-blur-[6px]",children:i.jsxs("div",{className:"mx-auto max-w-[1180px] px-6 py-2 flex items-center justify-between gap-4 font-mono text-[10px] uppercase tracking-[0.32em] text-stone-700",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"inline-block w-1.5 h-1.5 bg-success rounded-none"}),"Operator"]}),i.jsx("span",{className:"hidden sm:inline",children:"▪ OpenRig · 0.3.1"}),i.jsxs("span",{className:"hidden md:inline",children:["▪ Field Station ",e]}),i.jsx("span",{className:"hidden md:inline",children:"▪ Session 04°"}),i.jsx("span",{className:"text-stone-500",children:"04°"})]})}),i.jsxs("div",{className:"absolute top-[44px] left-[5%] right-[5%] z-20 pointer-events-none",children:[i.jsxs("h1",{"data-testid":"dashboard-greeting",className:"font-headline text-[44px] font-black tracking-tight uppercase text-stone-900 leading-[0.95] inky-display",children:["Welcome back",i.jsx("sup",{className:"text-[22px] tracking-tight align-super",children:"(s*)"})]}),i.jsxs("div",{"data-testid":"dashboard-stats",className:"font-mono text-xs text-stone-700 mt-2 flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[i.jsxs("span",{"data-testid":"stat-rigs",className:"inline-flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-stone-900 font-bold tabular-nums text-sm",children:String(t).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px]",children:"rigs"})]}),i.jsx("span",{"aria-hidden":"true",className:"text-stone-300",children:"·"}),i.jsxs("span",{"data-testid":"stat-agents",className:"inline-flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-stone-900 font-bold tabular-nums text-sm",children:String(n).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px]",children:"agents"}),i.jsx("span",{className:"ml-1 text-stone-600",children:"("}),i.jsx("span",{className:"text-success font-bold tabular-nums",children:String(s).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px] text-success",children:"active"}),i.jsx("span",{className:"text-stone-600",children:")"})]})]})]}),i.jsx("div",{className:"absolute bottom-8 right-10 rotate-[-4deg] origin-bottom-right",children:i.jsx("span",{className:"font-headline font-black text-[13px] tracking-[0.02em] text-stone-900 uppercase inky-text",children:"Eyes Everywhere"})}),i.jsx(Xfe,{}),i.jsx("div",{className:"absolute left-2 top-[42%] font-mono text-[9px] uppercase tracking-[0.2em] text-stone-600 rotate-[-90deg] origin-top-left whitespace-nowrap",children:"▪ Author redacted · entry 04°"}),i.jsx("div",{"data-testid":"dashboard-footer-marginalia",className:"absolute bottom-0 inset-x-0 border-t border-stone-900/40 bg-background/40 backdrop-blur-[6px]",children:i.jsxs("div",{className:"mx-auto max-w-[1180px] px-6 py-2 flex items-center justify-between gap-4 font-mono text-[10px] uppercase tracking-[0.24em] text-stone-700",children:[i.jsx("span",{children:"▪▪▪ End Surface · Dashboard · 01°"}),i.jsx("span",{className:"hidden sm:inline",children:"Operator-Grade · ConfigStore-Backed"}),i.jsx("span",{children:"OpenRig · 0.3.1"})]})})]})}function ws({position:e}){const t={tl:"top-1.5 left-1.5",tr:"top-1.5 right-1.5",bl:"bottom-1.5 left-1.5",br:"bottom-1.5 right-1.5"}[e],n={tl:"M 10 0 L 0 0 L 0 10",tr:"M 0 0 L 10 0 L 10 10",bl:"M 0 0 L 0 10 L 10 10",br:"M 10 0 L 10 10 L 0 10"}[e];return i.jsx("svg",{className:`absolute ${t} w-2.5 h-2.5 text-stone-900 pointer-events-none select-none`,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:i.jsx("path",{d:n})})}function Ll(e){const{to:t,num:n,big:s,label:r,icon:a,body:l,graphic:u,positionClass:f,accent:d,washed:p,layout:m="numeral",callouts:x,tint:y="white",shadow:b="none"}=e,v=p?"inky-display":"",w=p?"inky-text":"",S={white:"bg-white/30",cream:"bg-amber-50/45",stone:"bg-stone-100/45",rose:"bg-rose-50/45",slate:"bg-slate-50/50",sepia:"bg-yellow-50/45",mint:"bg-emerald-50/40"},C={none:{},soft:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},hard:{boxShadow:"3px 3px 0px #2e342e"},paper:{boxShadow:"0 2px 6px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.07)"},long:{boxShadow:"6px 6px 18px rgba(0, 0, 0, 0.1)"},inset:{boxShadow:"inset 0 1px 2px rgba(255,255,255,0.7), 0 2px 4px rgba(0,0,0,0.04)"},halo:{boxShadow:"0 0 24px rgba(0, 0, 0, 0.12)"},ambient:{boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")}},k=s??n;return i.jsx(Ue,{to:t,"data-testid":`dashboard-card-${n}`,className:`absolute ${f} w-[28%] h-[220px] pointer-events-auto group block`,children:i.jsxs("article",{"data-testid":`destination-${n}`,style:C[b],className:`relative h-full ${S[y]} backdrop-blur-[10px] overflow-hidden transition-transform duration-300 ease-tactical group-hover:-translate-y-0.5 motion-reduce:transition-none motion-reduce:group-hover:translate-y-0`,children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("span",{className:"absolute top-2 right-6 font-mono text-[9px] uppercase tracking-[0.18em] text-stone-700 select-none",children:["■ ",n,"°"]}),m==="headline"&&i.jsx(ehe,{label:r,icon:a,body:l,graphic:u,to:t,accent:d,textClass:w}),m==="stat"&&i.jsx(the,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:d,textClass:w}),m==="coordinate"&&i.jsx(nhe,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:d,textClass:w}),m==="schematic"&&i.jsx(she,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:d,textClass:w,callouts:x,washed:p}),(m==="numeral"||!m)&&i.jsx(Jfe,{big:k,numClass:v,graphic:u,body:l,label:r,icon:a,to:t,accent:d,textClass:w}),d&&i.jsxs("div",{className:"absolute bottom-[88px] right-[-14px] w-[156px] border border-tertiary text-tertiary font-mono text-[7.5px] uppercase tracking-[0.18em] px-1.5 py-[2px] flex items-center gap-1 bg-background/30",children:[i.jsx("span",{className:"inline-block w-[3px] h-[3px] bg-tertiary rounded-full"}),"Warning · Operator Live"]})]})})}function Jfe({big:e,numClass:t,graphic:n,body:s,label:r,icon:a,to:l,accent:u,textClass:f}){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`absolute top-7 left-3 font-headline font-black text-[110px] leading-[0.82] tracking-[-0.06em] text-stone-900 select-none ${t}`,children:[e[0],i.jsx("sup",{className:"text-[55px] tracking-tight align-super",children:e[1]})]}),i.jsx("div",{className:"absolute top-7 right-7 w-[58px] h-[58px]",children:n}),i.jsx("p",{className:`absolute bottom-12 right-1 w-[140px] font-mono text-[8.5px] leading-[1.35] uppercase text-stone-900 ${f}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:u?"text-tertiary":"text-stone-900",children:a}),i.jsx("h2",{className:`font-headline font-black text-[17px] leading-none uppercase tracking-tight ${f} ${u?"text-tertiary":"text-stone-900"}`,children:r}),i.jsxs("span",{className:`ml-auto font-mono text-[9px] tracking-tight text-stone-500 ${f}`,children:["[",l,"] →"]})]})]})}function ehe({label:e,icon:t,body:n,graphic:s,to:r,accent:a,textClass:l}){return i.jsxs(i.Fragment,{children:[i.jsx("h2",{className:`absolute top-6 left-3 right-3 font-headline font-black text-[40px] leading-[0.95] uppercase tracking-tight text-stone-900 ${l} ${a?"text-tertiary":""}`,children:e}),i.jsx("div",{className:"absolute top-[88px] left-3 right-3 h-px bg-stone-900/30"}),i.jsx("div",{className:"absolute top-[100px] left-3 w-[60px] h-[60px]",children:s}),i.jsx("p",{className:`absolute top-[100px] left-[80px] right-1 font-mono text-[8.5px] leading-[1.35] uppercase text-stone-900 ${l}`,children:n}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:a?"text-tertiary":"text-stone-900",children:t}),i.jsx("span",{className:`font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 ${l}`,children:"Destination · 01°"}),i.jsxs("span",{className:`ml-auto font-mono text-[9px] tracking-tight text-stone-500 ${l}`,children:["[",r,"] →"]})]})]})}function the({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u}){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-9 right-9 w-[36px] h-[36px]",children:r}),i.jsxs("div",{className:"absolute top-[44px] left-3 flex items-baseline gap-3",children:[i.jsx("span",{className:`font-headline font-black text-[64px] leading-[0.82] tracking-[-0.04em] text-stone-900 tabular-nums ${u}`,children:"38"}),i.jsxs("div",{className:"flex flex-col leading-tight",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-900",children:"Active"}),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-700",children:"Artifacts"})]})]}),i.jsxs("div",{className:"absolute top-[120px] left-3 right-3 grid grid-cols-3 gap-0",children:[i.jsx(PS,{big:"12",small:"Specs"}),i.jsx(PS,{big:"08",small:"Plugins"}),i.jsx(PS,{big:"18",small:"Skills"})]}),i.jsx("p",{className:`absolute bottom-12 left-3 right-1 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:`font-headline font-black text-[15px] leading-none uppercase tracking-tight ${l?"text-tertiary":"text-stone-900"}`,children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function PS({big:e,small:t}){return i.jsxs("div",{className:"border-l border-stone-900/30 first:border-l-0 pl-2",children:[i.jsx("div",{className:"font-mono text-[14px] font-bold tabular-nums text-stone-900 leading-none",children:e}),i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wide text-stone-600 mt-0.5",children:t})]})}function nhe({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u}){const f=Array.from({length:12});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-7 left-6 right-6 flex justify-between",children:f.map((d,p)=>i.jsx("span",{className:`w-px h-[6px] ${p%3===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute bottom-12 left-6 right-6 flex justify-between",children:f.map((d,p)=>i.jsx("span",{className:`w-px h-[6px] ${p%3===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-12 bottom-16 left-3 flex flex-col justify-between",children:Array.from({length:8}).map((d,p)=>i.jsx("span",{className:`h-px w-[6px] ${p%2===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-12 bottom-16 right-3 flex flex-col justify-between",children:Array.from({length:8}).map((d,p)=>i.jsx("span",{className:`h-px w-[6px] ${p%2===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-[40px] left-1/2 -translate-x-1/2 w-[72px] h-[72px]",children:r}),i.jsx("div",{className:"absolute top-[76px] left-6 right-6 h-px bg-stone-900/30"}),i.jsx("div",{className:"absolute top-[40px] bottom-[80px] left-1/2 w-px bg-stone-900/30"}),i.jsx("span",{className:"absolute top-[120px] left-1/2 ml-1 font-mono text-[8px] text-stone-700",children:"⟨x: 24, y: 18⟩"}),i.jsx("p",{className:`absolute bottom-[60px] left-6 right-6 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 text-center ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:"font-headline font-black text-[15px] leading-none uppercase tracking-tight text-stone-900",children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function she({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u,callouts:f,washed:d}){const p=f??["A","B","C","D"];return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-7 left-1/2 -translate-x-1/2 w-[110px] h-[110px]",children:r}),i.jsx($p,{num:".01",label:p[0],positionClass:"top-[42px] left-3",align:"left"}),i.jsx($p,{num:".02",label:p[1],positionClass:"top-[42px] right-3",align:"right"}),i.jsx($p,{num:".03",label:p[2],positionClass:"top-[98px] left-3",align:"left"}),i.jsx($p,{num:".04",label:p[3],positionClass:"top-[98px] right-3",align:"right"}),i.jsx("p",{className:`absolute bottom-12 left-3 right-3 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 text-center ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:`font-headline font-black text-[15px] leading-none uppercase tracking-tight ${d?"inky-text":""} ${l?"text-tertiary":"text-stone-900"}`,children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function $p({num:e,label:t,positionClass:n,align:s}){return i.jsxs("div",{className:`absolute ${n} font-mono text-[8px] text-stone-700 ${s==="right"?"text-right":"text-left"}`,children:[i.jsx("span",{className:"block",children:e}),i.jsx("span",{className:"block tabular-nums text-stone-900",children:t})]})}function rhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("path",{d:"M2 26 Q 18 18 30 22 T 58 18"}),i.jsx("path",{d:"M2 36 Q 18 28 30 32 T 58 28",strokeDasharray:"2 2"}),i.jsx("path",{d:"M2 46 Q 18 40 30 42 T 58 38",strokeDasharray:"2 2"}),i.jsx("circle",{cx:"30",cy:"22",r:"2",fill:"currentColor"}),i.jsx("line",{x1:"30",y1:"22",x2:"30",y2:"10"}),i.jsx("text",{x:"34",y:"12",fontSize:"6",fontFamily:"monospace",fill:"currentColor",fontWeight:"bold",children:"[01]"})]})}function ihe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("rect",{x:"22",y:"6",width:"16",height:"8"}),i.jsx("rect",{x:"6",y:"28",width:"14",height:"8"}),i.jsx("rect",{x:"40",y:"28",width:"14",height:"8"}),i.jsx("rect",{x:"6",y:"48",width:"14",height:"6"}),i.jsx("rect",{x:"22",y:"48",width:"14",height:"6"}),i.jsx("rect",{x:"40",y:"48",width:"14",height:"6"}),i.jsx("line",{x1:"30",y1:"14",x2:"13",y2:"28"}),i.jsx("line",{x1:"30",y1:"14",x2:"47",y2:"28"}),i.jsx("line",{x1:"13",y1:"36",x2:"13",y2:"48"}),i.jsx("line",{x1:"47",y1:"36",x2:"47",y2:"48"}),i.jsx("line",{x1:"13",y1:"44",x2:"29",y2:"48"}),i.jsx("line",{x1:"47",y1:"44",x2:"29",y2:"48"})]})}function ahe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"4",fill:"currentColor"}),i.jsx("circle",{cx:"30",cy:"30",r:"12"}),i.jsx("circle",{cx:"30",cy:"30",r:"20",strokeDasharray:"2 3"}),i.jsx("circle",{cx:"30",cy:"30",r:"27",strokeDasharray:"2 4"}),i.jsx("line",{x1:"30",y1:"0",x2:"30",y2:"60",strokeDasharray:"2 3"}),i.jsx("line",{x1:"0",y1:"30",x2:"60",y2:"30",strokeDasharray:"2 3"})]})}function ohe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"26"}),i.jsx("ellipse",{cx:"30",cy:"30",rx:"26",ry:"9"}),i.jsx("ellipse",{cx:"30",cy:"30",rx:"9",ry:"26"}),i.jsx("line",{x1:"0",y1:"30",x2:"60",y2:"30",strokeDasharray:"2 3"}),i.jsx("line",{x1:"30",y1:"0",x2:"30",y2:"60",strokeDasharray:"2 3"}),i.jsx("circle",{cx:"30",cy:"30",r:"3",fill:"currentColor"})]})}function lhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:[i.jsx("circle",{cx:"24",cy:"24",r:"14"}),i.jsx("line",{x1:"20",y1:"24",x2:"28",y2:"24"}),i.jsx("line",{x1:"24",y1:"20",x2:"24",y2:"28"}),i.jsx("line",{x1:"34",y1:"34",x2:"52",y2:"52",strokeWidth:"1.6"}),i.jsx("line",{x1:"48",y1:"48",x2:"55",y2:"48"}),i.jsx("line",{x1:"48",y1:"48",x2:"48",y2:"55"})]})}function che(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"20"}),i.jsx("circle",{cx:"30",cy:"30",r:"12"}),i.jsx("circle",{cx:"30",cy:"30",r:"3",fill:"currentColor"}),i.jsx("line",{x1:"30",y1:"6",x2:"30",y2:"11",strokeWidth:"1.5"}),i.jsx("line",{x1:"30",y1:"49",x2:"30",y2:"54",strokeWidth:"1.5"}),i.jsx("line",{x1:"6",y1:"30",x2:"11",y2:"30",strokeWidth:"1.5"}),i.jsx("line",{x1:"49",y1:"30",x2:"54",y2:"30",strokeWidth:"1.5"}),i.jsx("line",{x1:"13",y1:"13",x2:"17",y2:"17",strokeWidth:"1.5"}),i.jsx("line",{x1:"43",y1:"13",x2:"47",y2:"17",strokeWidth:"1.5"}),i.jsx("line",{x1:"13",y1:"47",x2:"17",y2:"43",strokeWidth:"1.5"}),i.jsx("line",{x1:"43",y1:"47",x2:"47",y2:"43",strokeWidth:"1.5"})]})}function lz({librarySize:e}={}){const t=e&&e>0?`Specs · Plugins · Skills · Context packs. Field catalog 0.3.1 — ${e} active artifacts.`:"Specs · Plugins · Skills · Context packs. Field catalog 0.3.1 — 38 active artifacts.";return i.jsxs("div",{"data-testid":"destinations-layer",className:"absolute inset-0 z-[18] pointer-events-none",children:[i.jsx(Ll,{to:"/topology",num:"01",big:"01",label:"Topology",icon:i.jsx(N2,{className:"h-4 w-4"}),body:"Host · Rig · Pod · Seat tree — live edges + runtimes; drill into any rig's pod graph.",positionClass:"top-[22%] left-[5%]",graphic:i.jsx(ihe,{}),layout:"numeral",callouts:["HOST","RIG","POD","SEAT"],tint:"stone",shadow:"ambient"}),i.jsx(Ll,{to:"/project",num:"02",big:"02",label:"Project",icon:i.jsx(S2,{className:"h-4 w-4"}),body:"Workspace · Mission · Slice. Browse all in-flight work by what agents are doing, not by repo.",positionClass:"top-[22%] left-[36%]",graphic:i.jsx(rhe,{}),layout:"numeral",callouts:["WORKSPACE","MISSION","SLICE","TASK"],washed:!0,tint:"stone",shadow:"ambient"}),i.jsx(Ll,{to:"/for-you",num:"03",big:"03",label:"For You",icon:i.jsx(_2,{className:"h-4 w-4"}),body:"Action feed → what needs you · what shipped · what's in flight. Prioritized for the operator.",positionClass:"top-[22%] left-[67%]",graphic:i.jsx(ahe,{}),layout:"numeral",callouts:["NEEDS YOU","SHIPPED","IN-FLIGHT","BLOCKED"],accent:!0,tint:"stone",shadow:"ambient"}),i.jsx(Ll,{to:"/specs",num:"04",big:"04",label:"Library",icon:i.jsx(O$,{className:"h-4 w-4"}),body:t,positionClass:"top-[55%] left-[5%]",graphic:i.jsx(ohe,{}),layout:"numeral",callouts:["SPECS","PLUGINS","SKILLS","PACKS"],tint:"stone",shadow:"ambient"}),i.jsx(Ll,{to:"/search",num:"05",big:"05",label:"Search & Audit",icon:i.jsx(WV,{className:"h-4 w-4"}),body:"Audit history · full artifact explorer. V1 placeholder; the full surface ships in V2.",positionClass:"top-[55%] left-[36%]",graphic:i.jsx(lhe,{}),layout:"numeral",callouts:["AUDIT","HISTORY","QUERY","FILTER"],tint:"stone",shadow:"ambient"}),i.jsx(Ll,{to:"/settings",num:"06",big:"06",label:"Settings",icon:i.jsx(M$,{className:"h-4 w-4"}),body:"Config · Policy · Log · Status. Operator-grade controls; ConfigStore-backed; reversible.",positionClass:"top-[55%] left-[67%]",graphic:i.jsx(che,{}),layout:"numeral",callouts:["CONFIG","POLICY","LOG","STATUS"],tint:"stone",shadow:"ambient"})]})}function uhe(){const{data:e}=dr(),{data:t}=Wm(),{data:n}=Ac(),s=(e==null?void 0:e.length)??0,r=(e==null?void 0:e.reduce((f,d)=>f+d.nodeCount,0))??0,a=(t==null?void 0:t.reduce((f,d)=>f+d.runningCount,0))??0,l=(n==null?void 0:n.length)??0,u=typeof window>"u"?"localhost":window.location.hostname||"localhost";return i.jsxs("div",{"data-testid":"dashboard-surface",className:"relative min-h-screen overflow-hidden",children:[i.jsx(az,{hostname:u}),i.jsx(oz,{hostname:u,totalRigs:s,totalAgents:r,activeAgents:a}),i.jsx(lz,{librarySize:l})]})}function JN(e){return typeof e=="string"&&e.length>0?e:void 0}function un(e,...t){for(const n of t){const s=JN(e[n]);if(s)return s}}function dhe(e){if(e)return e.length<=28?e:`${e.slice(0,18)}...${e.slice(-6)}`}function fhe(e){switch(e){case"queue.created":case"queue.item.created":return"Queue item created";case"queue.updated":case"queue.item.updated":return"Queue item updated";case"queue.handed_off":return"Queue item handed off";case"queue.claimed":return"Queue item claimed";case"queue.unclaimed":return"Queue item unclaimed";case"qitem.fallback_routed":return"Queue item fallback routed";case"qitem.closure_overdue":return"Queue item closure overdue";case"inbox.absorbed":return"Inbox item absorbed";case"inbox.denied":return"Inbox item denied";default:return e}}function hhe(e){return e==="queue.created"||e==="queue.updated"||e==="queue.claimed"||e==="queue.unclaimed"||e==="queue.handed_off"||e==="queue.item.created"||e==="queue.item.updated"||e==="qitem.fallback_routed"||e==="qitem.closure_overdue"||e==="inbox.absorbed"||e==="inbox.denied"}function phe(e,t){return e.startsWith("queue.")&&e.endsWith(".closed")?"shipped":e==="qitem.closure_overdue"||e==="inbox.denied"||t==="human-gate"||t==="pending-approval"?"action-required":t==="closeout-pending-ratify"?"approval":t==="done"||t==="closed"||t==="completed"||t==="shipped"?"shipped":"progress"}function mhe(e){const t=un(e,"sourceSession","source_session","fromSession"),n=un(e,"destinationSession","destination_session","toSession","destination"),s=t&&n?`${t} -> ${n}`:t?`Source: ${t}`:n?`Destination: ${n}`:void 0,r=[un(e,"priority")?`priority=${un(e,"priority")}`:void 0,un(e,"tier")?`tier=${un(e,"tier")}`:void 0,un(e,"state","toState")?`state=${un(e,"state","toState")}`:void 0,un(e,"closureReason")?`closure=${un(e,"closureReason")}`:void 0].filter(a=>!!a);return[s,r.length>0?r.join(" / "):void 0].filter(a=>!!a).join(`
|
|
517
|
-
`)||void 0}function ghe(e){return/^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/.test(e??"")}function xhe(e){const t=e.payload??{},n=un(t,"actor_session","actorSession","source_session","sourceSession","fromSession","sender"),s=un(t,"rig_id","rigId"),r=un(t,"summary","body","title"),a={id:`${e.type}-${e.seq}`,title:r??e.type,body:JN(t.body),authorSession:n,rigId:s,receivedAt:e.receivedAt,createdAt:e.createdAt,source:e};if(e.type.startsWith("queue.")&&e.type.endsWith(".closed"))return{...a,kind:"shipped"};if(hhe(e.type)){const l=un(t,"qitemId","qitem_id"),u=un(t,"destinationSession","destination_session","toSession","destination"),f=un(t,"state","toState"),d=phe(e.type,f),p=d==="approval"?"approval":ghe(u)?"action-required":d,m=un(t,"summary","title"),x=p==="shipped"&&e.type==="queue.updated"?"Queue item shipped":fhe(e.type),y=m??[x,dhe(l)].filter(b=>!!b).join(": ");return{...a,title:y,body:JN(t.body)??mhe(t),kind:p}}return e.type.startsWith("workflow.")?{...a,kind:"progress"}:e.type.startsWith("stream.")||e.type.startsWith("watchdog.")?{...a,kind:"observation"}:e.type.startsWith("lifecycle.")||e.type.startsWith("git.")?{...a,kind:"shipped"}:{...a,kind:"observation"}}function yhe(e){return e.map(xhe).filter(n=>n!==null).sort((n,s)=>s.receivedAt-n.receivedAt)}const cz="forYou.dismissedSeqs";function vhe(){try{const e=localStorage.getItem(cz);if(!e)return new Set;const t=JSON.parse(e);if(!Array.isArray(t))return new Set;const n=t.filter(s=>typeof s=="number"&&Number.isFinite(s));return new Set(n)}catch{return new Set}}function $S(e){try{localStorage.setItem(cz,JSON.stringify(Array.from(e)))}catch{}}function bhe(e){const[t,n]=E.useState(()=>vhe()),s=E.useMemo(()=>{if(e.length===0)return null;let l=e[0];for(const u of e)u<l&&(l=u);return l},[e]);E.useEffect(()=>{if(s===null)return;let l=!1;const u=new Set;for(const f of t)f>=s?u.add(f):l=!0;l&&(n(u),$S(u))},[s,t]);const r=E.useCallback(l=>{n(u=>{if(u.has(l))return u;const f=new Set(u);return f.add(l),$S(f),f})},[]),a=E.useCallback(l=>{n(u=>{if(!u.has(l))return u;const f=new Set(u);return f.delete(l),$S(f),f})},[]);return{dismissedSeqs:t,dismiss:r,undismiss:a}}const uz="forYou.completedMissionIds";function whe(){try{const e=localStorage.getItem(uz);if(!e)return new Set;const t=JSON.parse(e);if(!Array.isArray(t))return new Set;const n=t.filter(s=>typeof s=="string"&&s.length>0);return new Set(n)}catch{return new Set}}function ZL(e){try{localStorage.setItem(uz,JSON.stringify(Array.from(e)))}catch{}}function jhe(){const[e,t]=E.useState(()=>whe()),n=E.useCallback(r=>{t(a=>{if(a.has(r))return a;const l=new Set(a);return l.add(r),ZL(l),l})},[]),s=E.useCallback(r=>{t(a=>{if(!a.has(r))return a;const l=new Set(a);return l.delete(r),ZL(l),l})},[]);return{completedMissionIds:e,markCompleted:n,unmarkCompleted:s}}function She(e){const t=ef({queries:e.map(n=>({queryKey:["mission-status",n],queryFn:async()=>{const s=await fetch(`/api/missions/${encodeURIComponent(n)}`);if(!s.ok)return null;const r=await s.json();return typeof r.status=="string"&&r.status.length>0?r.status:null},enabled:n.length>0,staleTime:3e4}))});return E.useMemo(()=>{const n=new Map;let s=!1;for(let r=0;r<e.length;r++){const a=e[r],l=t[r];n.set(a,(l==null?void 0:l.data)??null),l!=null&&l.isPending&&(s=!0)}return{statuses:n,isLoading:s}},[e,t])}async function Nhe({rigId:e,logicalId:t}){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"}),s=await n.json().catch(()=>null);if(!n.ok||(s==null?void 0:s.ok)===!1)throw new Error((s==null?void 0:s.message)??(s==null?void 0:s.error)??(s==null?void 0:s.code)??`HTTP ${n.status}`);return s??{ok:!0}}function N_(){return sn({mutationFn:Nhe})}function khe(e){const t=e.indexOf("@");return t===-1?{logicalId:e,rigId:null}:{logicalId:e.slice(0,t),rigId:e.slice(t+1)}}function _he({authorSession:e,rigId:t,className:n,testId:s}){const r=khe(e),a=t??r.rigId,l=N_(),u=dD(e);return a?i.jsxs(Ue,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:a,logicalId:encodeURIComponent(r.logicalId)},"data-testid":s??"author-agent-tag",onClick:f=>{f.metaKey||f.ctrlKey||f.shiftKey||f.button!==0||l.mutate({rigId:a,logicalId:r.logicalId})},className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant hover:text-stone-900 hover:underline",children:[u?i.jsx(ym,{actor:e,size:"xs"}):null,i.jsx("span",{children:e})]}):i.jsxs("span",{"data-testid":s??"author-agent-tag",className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant",children:[u?i.jsx(ym,{actor:e,size:"xs"}):null,i.jsx("span",{children:e})]})}function sx({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=bg();return i.jsx("button",{type:"button","data-testid":r??"queue-item-trigger",onClick:()=>a({type:"qitem",data:e}),className:n??"text-left",style:s,children:t})}const Kl={approve:{label:"Approve",outcomeLabel:"Approved",description:"Accept the work and let it close or continue.",tone:"success",icon:kd},deny:{label:"Deny",outcomeLabel:"Denied",description:"Reject this request and leave a reason if needed.",tone:"danger",icon:JV},route:{label:"Route",outcomeLabel:"Routed",description:"Send this to another session for follow-up.",tone:"info",icon:P$},annotate:{label:"Annotate",outcomeLabel:"Annotated",description:"Add context without changing ownership.",tone:"neutral",icon:jV},hold:{label:"Hold",outcomeLabel:"Held",description:"Pause this item until more context is available.",tone:"warning",icon:BV},drop:{label:"Drop",outcomeLabel:"Dropped",description:"Remove this item from the active path.",tone:"neutral",icon:nG},handoff:{label:"Handoff",outcomeLabel:"Handed off",description:"Transfer active ownership to another session.",tone:"info",icon:Km}};function Che(e,t="action"){const n=Kl[e];return{label:t==="outcome"?n.outcomeLabel:n.label,tone:n.tone,icon:n.icon}}function Ehe(e){return e instanceof Error?e.message:typeof e=="string"?e:"Action failed."}const JL={approve:{idle:"border-success text-success hover:bg-success hover:text-white",active:"border-success bg-success text-white"},deny:{idle:"border-tertiary text-tertiary hover:bg-tertiary hover:text-white",active:"border-tertiary bg-tertiary text-white"},route:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},annotate:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},hold:{idle:"border-warning text-warning hover:bg-warning hover:text-white",active:"border-warning bg-warning text-white"},drop:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},handoff:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"}};function Rhe({qitemId:e,actorSession:t,enabledVerbs:n=[...iz],onSettled:s,onOptimisticOutcome:r}){var H;const a=Yfe(),[l,u]=E.useState(null),[f,d]=E.useState(""),[p,m]=E.useState(!1),[x,y]=E.useState(""),[b,v]=E.useState(""),[w,S]=E.useState(null),C=l==="route"||l==="handoff",k=l==="annotate",_=l==="hold"||l==="drop";function R(){u(null),d(""),m(!1),y(""),v(""),S(null)}function T(P){u(P),d(""),m(!1),y(""),v(""),S(null)}function A(){if(!l)return;const P=l,G=C?f:void 0,q=_?b:void 0;a.mutate({verb:P,qitemId:e,actorSession:t,destinationSession:G,annotation:k?x:void 0,reason:q},{onSuccess:()=>{r==null||r({verb:P,actorSession:t,actedAt:new Date().toISOString(),destinationSession:G??null,reason:q??null}),R(),s==null||s()},onError:V=>{S(Ehe(V))}})}const I=nz(C),L=((H=I.data)==null?void 0:H.destinations)??[],$=C&&I.isLoading,O=C&&(L.length>0||$),B=C&&(p||I.isError||I.isFetched&&L.length===0);return i.jsxs("div",{"data-testid":"mc-verb-actions",className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 border border-outline-variant bg-white/40 px-2 py-1.5 backdrop-blur-sm",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-800",children:"Choose response"}),i.jsx("div",{className:"mt-0.5 font-mono text-[10px] leading-relaxed text-stone-500",children:"Pick the next move for this queue item."})]}),l?i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:["Selected: ",i.jsx("span",{className:"text-stone-900",children:Kl[l].label})]}):null]}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(P=>{const G=Kl[P],q=G.icon;return i.jsxs("button",{type:"button","data-testid":`mc-verb-${P}`,onClick:()=>T(P),disabled:a.isPending,title:G.description,className:he("inline-flex min-h-[44px] items-center gap-1 border px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] transition-colors disabled:opacity-50",l===P?JL[P].active:JL[P].idle),children:[i.jsx(q,{className:"h-3 w-3",strokeWidth:1.7}),G.label]},P)})}),l&&i.jsxs("div",{className:"space-y-1 border border-stone-200 bg-stone-50 p-2",children:[i.jsx("div",{"data-testid":"mc-verb-guidance",className:"font-mono text-[10px] leading-relaxed text-stone-600",children:Kl[l].description}),C&&i.jsxs("div",{className:"space-y-1",children:[O?i.jsxs("select",{"data-testid":"mc-verb-destination-select","aria-label":"Destination session",value:p?"__manual__":f,disabled:$,onChange:P=>{if(P.target.value==="__manual__"){m(!0),d("");return}m(!1),d(P.target.value)},className:"w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs",children:[i.jsx("option",{value:"",children:$?"loading destinations...":"choose destination"}),L.map(P=>i.jsx("option",{value:P.sessionName,children:P.label},P.sessionName)),i.jsx("option",{value:"__manual__",children:"manual entry"})]}):null,B?i.jsx("input",{type:"text","data-testid":"mc-verb-destination-input",value:f,onChange:P=>d(P.target.value),placeholder:"destination session (member@rig)",className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}):null,I.isError?i.jsx("div",{className:"font-mono text-[10px] text-amber-700",children:"destination list unavailable"}):null]}),k&&i.jsx("textarea",{"data-testid":"mc-verb-annotation-input",value:x,onChange:P=>y(P.target.value),placeholder:"annotation",rows:2,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),_&&i.jsx("input",{type:"text","data-testid":"mc-verb-reason-input",value:b,onChange:P=>v(P.target.value),placeholder:`${l} reason`,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx("button",{type:"button",onClick:R,"data-testid":"mc-verb-cancel",className:"border border-stone-300 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Cancel"}),i.jsx("button",{type:"button",onClick:A,"data-testid":"mc-verb-submit",disabled:a.isPending||C&&!f||k&&!x||_&&!b,className:"border border-stone-700 bg-stone-800 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-white disabled:opacity-50",children:a.isPending?"...":`Confirm ${Kl[l].label}`})]})]}),w?i.jsx("div",{"data-testid":"mc-verb-error",role:"alert",className:"truncate border border-tertiary bg-stone-50/40 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-tertiary",title:w,children:w}):null]})}function k_({sliceName:e,relPath:t,onClose:n,testId:s="proof-image-viewer",imageTestId:r="proof-image-viewer-image",closeTestId:a="proof-image-viewer-close"}){return t?i.jsx("div",{role:"dialog","aria-label":"Screenshot preview","data-testid":s,className:"fixed bottom-0 right-0 top-14 z-[1000] flex items-center justify-center bg-stone-950/20 p-6 backdrop-blur-[2px] lg:left-[21rem]",onClick:n,children:i.jsxs("div",{className:"max-h-full max-w-[92vw] border border-white/20 bg-stone-950/70 p-2 backdrop-blur-sm",onClick:l=>l.stopPropagation(),children:[i.jsx("img",{src:cd(e,t),alt:t,"data-testid":r,className:"max-h-[78vh] max-w-full object-contain"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 font-mono text-[10px] text-stone-50",children:[i.jsx("span",{className:"truncate",children:t}),i.jsx("button",{type:"button","data-testid":a,onClick:n,className:"inline-flex h-7 w-7 items-center justify-center border border-white/30 text-stone-50 hover:bg-white/10","aria-label":"Close screenshot preview",children:i.jsx(C2,{className:"h-3.5 w-3.5",strokeWidth:1.5})})]})]})}):null}const Ahe={"action-required":"bg-tertiary",approval:"bg-warning",shipped:"bg-success",progress:"bg-secondary",observation:"bg-stone-500"},Dm={neutral:"bg-stone-500",info:"bg-secondary",success:"bg-success",warning:"bg-warning",danger:"bg-tertiary"},The={"action-required":"feed-card-action",approval:"feed-card-approval",shipped:"feed-card-shipped",progress:"feed-card-progress",observation:"feed-card-observation"},Ihe={"action-required":{label:"Your turn",tone:"danger",icon:ha},approval:{label:"Needs approval",tone:"warning",icon:ha},shipped:{label:"Shipped",tone:"success",icon:k2},progress:{label:"Progress",tone:"info",icon:Yl},observation:{label:"Observation",tone:"neutral",icon:_d}},Mhe="relative bg-stone-100/45 backdrop-blur-[10px] overflow-hidden group",Ohe={boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")};function Is(e){return typeof e=="string"&&e.length>0?e:void 0}function Lhe(e){const t=e.source.payload??{},n=Is(t.qitem_id)??Is(t.qitemId);if(!n)return null;const s=t.tags,r=Array.isArray(s)?s.filter(a=>typeof a=="string"):void 0;return{qitemId:n,source:Is(t.source_session)??Is(t.sourceSession)??Is(t.fromSession),destination:Is(t.destination)??Is(t.destination_session)??Is(t.destinationSession)??Is(t.toSession),state:Is(t.state),tags:r,createdAt:e.createdAt,body:Is(t.body)??e.body}}function Phe(e,t){const n=Lhe(e);return t?{qitemId:t.qitemId,source:t.sourceSession,destination:t.destinationSession,state:t.state,tags:t.tags??void 0,createdAt:t.tsCreated,body:t.body||(n==null?void 0:n.body)||e.body}:n}function $he(e){if(!e)return;const t=e.trim();return t.length<=520?t:`${t.slice(0,520).trimEnd()}
|
|
518
|
-
...`}const Dhe=new Set(["done","closed","completed","shipped","canceled","cancelled","denied","failed","handed-off"]);function dz(e){return e?Dhe.has(e.state.toLowerCase()):!1}function qhe(e,t,n){return!(e!=="action-required"&&e!=="approval"||n||dz(t))}function zhe(e,t){if(e!=="action-required"&&e!=="approval"||!t||!dz(t))return null;const n=t.closureReason??null,s=t.handedOffTo??t.closureTarget??null;return{verb:n==="denied"?"deny":n==="handed_off_to"?"route":n==="canceled"?"drop":"approve",actorSession:t.destinationSession,actedAt:t.tsUpdated,state:t.state,destinationSession:s,reason:n==="no-follow-on"?null:t.closureTarget??n}}function Bhe(e){return Che(e.verb,"outcome")}function eP({token:e}){return i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",Dm[e.tone])}),e.label]})}function fz({value:e}){return i.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 font-mono text-[10px] text-stone-500",children:[i.jsx(j2,{className:"h-3 w-3",strokeWidth:1.5}),B2(e)]})}function e2({session:e}){return i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 font-mono text-[10px] text-stone-600",children:[i.jsx(ym,{actor:e,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:pD(e)})]})}function hz({source:e,destination:t}){return!e&&!t?null:i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(e2,{session:e??"unknown source"}),i.jsx(gm,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(e2,{session:t??"unresolved target"})]})}function Fhe(e){switch(e.verb){case"approve":return`Approved by ${e.actorSession}.`;case"deny":return`Denied by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"route":case"handoff":return e.destinationSession?`Routed by ${e.actorSession} to ${e.destinationSession}.`:`Routed by ${e.actorSession}.`;case"hold":return`Held by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"drop":return`Dropped by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"annotate":return`Annotated by ${e.actorSession}.`}}function Hhe({outcome:e}){const t=Kl[e.verb],n=t.icon;return i.jsxs("div",{"data-testid":"feed-card-action-outcome",className:"mt-3 bg-stone-50/40 px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx("span",{"aria-hidden":"true",className:he("mt-2 inline-block w-1.5 h-1.5 rounded-full shrink-0",Dm[t.tone])}),i.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/55 text-stone-800",children:i.jsx(n,{className:"h-4 w-4",strokeWidth:1.8})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-700",children:t.outcomeLabel}),i.jsx("div",{className:"mt-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Decision recorded"})]})]}),i.jsx(fz,{value:e.actedAt})]}),i.jsx("p",{className:"mt-3 font-body text-[12px] leading-relaxed text-stone-800",children:Fhe(e)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(e2,{session:e.actorSession}),e.reason?i.jsx(pa,{tag:e.reason}):null]}),(e.verb==="route"||e.verb==="handoff")&&e.destinationSession?i.jsx("div",{className:"mt-2",children:i.jsx(hz,{source:e.actorSession,destination:e.destinationSession})}):null]})}const Uhe=.5;function Vhe({card:e,queueItem:t,proofPreview:n,actionOutcome:s,onDismiss:r,onOptimisticOutcome:a}){const[l,u]=E.useState(null),f=E.useRef(null),d=T=>{r&&T.target===T.currentTarget&&(T.key==="Backspace"||T.key==="Delete")&&(T.preventDefault(),r(e.source.seq))},p=T=>{if(!r)return;const A=T.touches[0];A&&(f.current={startX:A.clientX,pointerId:A.identifier,isTouch:!0})},m=T=>{const A=f.current;if(f.current=null,!r||!A)return;const I=T.changedTouches[0];if(!I)return;const L=I.clientX-A.startX;if(L<=0)return;const O=T.currentTarget.getBoundingClientRect();O.width<=0||L/O.width>=Uhe&&r(e.source.seq)},x=T=>{T.stopPropagation(),r&&r(e.source.seq)},y=Phe(e,t),b=$he((t==null?void 0:t.body)||e.body),v=(t==null?void 0:t.tags)??(y==null?void 0:y.tags)??[],w=(y==null?void 0:y.source)??e.authorSession,S=y==null?void 0:y.destination,C=S!=null&&S.startsWith("human")?S:"human@host",k=s??zhe(e.kind,t),_=k?Bhe(k):Ihe[e.kind],R=k?Dm[_.tone]:Ahe[e.kind];return i.jsxs("article",{"data-testid":The[e.kind],style:Ohe,className:he(Mhe,"mb-3"),...r?{tabIndex:0,onKeyDown:d,onTouchStart:p,onTouchEnd:m}:{},children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("div",{className:"px-4 py-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",R)}),_.label]}),i.jsx(eP,{token:q2(e.source.type)}),y!=null&&y.state?i.jsx(eP,{token:hD(y.state)}):null]}),i.jsx("h3",{className:"font-headline text-[16px] font-bold leading-tight text-stone-900 truncate",children:e.title})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(fz,{value:e.createdAt}),r?i.jsx("button",{type:"button","data-testid":"feed-card-dismiss","aria-label":"Dismiss card",onClick:x,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 focus:outline-none focus:ring-1 focus:ring-stone-400 transition-opacity inline-flex h-5 w-5 items-center justify-center border border-stone-300 bg-white/80 text-stone-600 hover:text-stone-900 hover:border-stone-500",children:i.jsx(C2,{className:"h-3 w-3",strokeWidth:1.8})}):null]})]}),b?i.jsx("p",{className:"mt-3 font-body text-[12px] leading-relaxed text-stone-700 whitespace-pre-line",children:b}):null,i.jsx("div",{className:"mt-3",children:i.jsx(hz,{source:w,destination:S})}),v.length>0?i.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:v.slice(0,6).map(T=>i.jsx(pa,{tag:T},T))}):null,n&&n.screenshots.length>0?i.jsxs("div",{"data-testid":`feed-card-proof-preview-${e.id}`,className:"mt-3 bg-stone-50/40 p-2",children:[i.jsx(tg,{title:`Proof packet · ${n.displayName}`,badge:n.passFailBadge}),i.jsx("div",{className:"mt-2",children:i.jsx(mD,{sliceName:n.sliceName,screenshots:n.screenshots,onSelect:u,testIdPrefix:"feed-card-proof-screenshot"})})]}):null,k?i.jsx(Hhe,{outcome:k}):null,y&&qhe(e.kind,t,k)?i.jsxs("div",{"data-testid":`feed-card-actions-${e.id}`,className:"mt-3 bg-stone-50/40 p-3",children:[i.jsx("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:i.jsxs("div",{children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",Dm.danger)}),"Your turn"]}),i.jsx("p",{className:"mt-1 max-w-xl font-body text-[12px] leading-relaxed text-stone-700",children:"Review the context, then approve, deny, or route this queue item."})]})}),i.jsx(Rhe,{qitemId:y.qitemId,actorSession:C,enabledVerbs:["approve","deny","route"],onOptimisticOutcome:a?T=>a(y.qitemId,T):void 0})]}):null,i.jsx("div",{className:"mt-3 flex items-center justify-between gap-3 font-mono text-[10px] text-stone-500",children:i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.authorSession?i.jsx(_he,{authorSession:e.authorSession,rigId:e.rigId}):i.jsx("span",{className:"truncate",children:e.source.type}),y?i.jsx(sx,{data:y,testId:`feed-card-show-context-${e.id}`,className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:"show context"}):null]})})]}),n?i.jsx(k_,{sliceName:n.sliceName,relPath:l,onClose:()=>u(null)}):null]})}function Ghe({label:e,onUndo:t,onExpire:n,durationMs:s}){const r=E.useRef(!1);E.useEffect(()=>{const l=window.setTimeout(()=>{r.current||(r.current=!0,n())},s);return()=>window.clearTimeout(l)},[s,n]);const a=()=>{r.current||(r.current=!0,t())};return i.jsxs("div",{"data-testid":"undo-toast",role:"status","aria-live":"polite",className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 border border-stone-700 bg-stone-900/95 px-4 py-2 font-mono text-[11px] uppercase tracking-wide text-stone-50 backdrop-blur-sm shadow-lg",children:[i.jsx("span",{children:e}),i.jsx("button",{type:"button","data-testid":"undo-toast-button",onClick:a,className:"border border-stone-500 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-stone-50 hover:bg-stone-800 focus:outline-none focus:ring-1 focus:ring-stone-300",children:"Undo"})]})}const kf={shipped:{stripe:"border-l-emerald-600",pill:"bg-emerald-50 border-emerald-300",ink:"text-emerald-800",label:"SHIPPED"},incident:{stripe:"border-l-red-600",pill:"bg-red-50 border-red-300",ink:"text-red-800",label:"INCIDENT"},progress:{stripe:"border-l-sky-600",pill:"bg-sky-50 border-sky-300",ink:"text-sky-800",label:"PROGRESS"},approval:{stripe:"border-l-amber-600",pill:"bg-amber-50 border-amber-300",ink:"text-amber-800",label:"APPROVAL NEEDED"},concept:{stripe:"border-l-violet-600",pill:"bg-violet-50 border-violet-300",ink:"text-violet-800",label:"CONCEPT"}},Khe={shipped:"bg-success",incident:"bg-tertiary",progress:"bg-secondary",approval:"bg-warning",concept:"bg-stone-500"},Whe={shipped:"Shipped",incident:"Incident",progress:"Progress",approval:"Approval",concept:"Concept"},Yhe={boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")};function _f({testId:e,kind:t,title:n,oneLiner:s,expanded:r,drillInHref:a,drillInLabel:l,inlineActions:u,leadingAccessory:f}){const[d,p]=E.useState(!1);return i.jsxs("article",{"data-testid":e,"data-card-kind":t,"data-expanded":d,style:Yhe,className:"relative bg-stone-100/45 backdrop-blur-[10px] overflow-hidden",children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("div",{role:"button",tabIndex:0,"data-testid":`${e}-toggle`,onClick:()=>p(m=>!m),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),p(x=>!x))},className:"flex w-full min-h-[80px] cursor-pointer items-start gap-4 px-5 py-4 text-left","aria-expanded":d,children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{"data-testid":`${e}-pill`,className:"flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.18em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:`inline-block w-1.5 h-1.5 rounded-full ${Khe[t]}`}),i.jsx("span",{children:Whe[t]})]}),i.jsxs("h3",{"data-testid":`${e}-title`,className:"mt-2 flex items-center gap-2 font-headline text-[16px] font-bold leading-tight text-stone-900",children:[f,i.jsx("span",{className:"truncate",children:n})]}),i.jsx("p",{"data-testid":`${e}-one-liner`,className:"mt-1.5 font-body text-[12px] leading-relaxed text-stone-700 line-clamp-2",children:s})]}),u&&i.jsx("div",{"data-testid":`${e}-inline-actions`,className:"flex shrink-0 items-center gap-2",onClick:m=>m.stopPropagation(),children:u})]}),d&&i.jsxs("div",{"data-testid":`${e}-expanded`,className:"border-t border-outline-variant/40 px-5 py-4",children:[r,a&&i.jsx("div",{className:"mt-3 flex justify-end",children:i.jsxs("a",{"data-testid":`${e}-drill-in`,href:a,className:"inline-flex items-center gap-1 min-h-[44px] border border-stone-700 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors",onClick:m=>m.stopPropagation(),children:[l??"Open"," →"]})})]})]})}function pz({source:e}){return i.jsx(_f,{testId:`feed-card-shipped-${e.sliceId}`,kind:"shipped",title:e.title,oneLiner:e.oneLiner,accent:kf.shipped,drillInHref:`/project/slice/${e.sliceId}`,expanded:e.sections&&e.sections.length>0?i.jsx("ol",{className:"space-y-2 text-[11px]",children:e.sections.slice(0,3).map(t=>i.jsxs("li",{"data-testid":`feed-card-shipped-${e.sliceId}-section-${t.number}`,className:"flex gap-2",children:[i.jsxs("span",{className:"font-mono text-[10px] font-bold text-stone-500",children:[t.number,"."]}),i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold text-stone-900",children:t.heading}),i.jsx("div",{className:"text-stone-700",children:t.summary})]})]},t.number))}):i.jsx("div",{className:"text-[11px] text-stone-600",children:e.oneLiner})})}const tP={success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-sky-500",muted:"bg-stone-400"};function mz({source:e}){return i.jsx(_f,{testId:`feed-card-incident-${e.sliceId}`,kind:"incident",title:e.title,oneLiner:e.oneLiner,accent:kf.incident,drillInHref:`/project/slice/${e.sliceId}`,drillInLabel:"Open timeline",leadingAccessory:i.jsx("span",{"data-testid":`feed-card-incident-${e.sliceId}-dot`,className:`inline-block h-3 w-3 rounded-full shrink-0 ${tP[e.status]}`,"aria-hidden":"true"}),expanded:e.recentEntries&&e.recentEntries.length>0?i.jsx("ul",{className:"space-y-2 text-[11px]",children:e.recentEntries.slice(0,3).map((t,n)=>i.jsxs("li",{"data-testid":`feed-card-incident-${e.sliceId}-entry-${n}`,className:"flex items-baseline gap-2",children:[i.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${tP[t.status]} shrink-0`,"aria-hidden":"true"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 shrink-0",children:t.time}),i.jsx("span",{className:"text-stone-900",children:t.title})]},n))}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No recent entries."})})}function gz({source:e,onMarkComplete:t}){const n=Math.max(0,Math.min(100,Math.round(e.percent))),s=t?i.jsx("button",{type:"button","data-testid":"progress-card-mark-complete",onClick:r=>{r.stopPropagation(),t(e.missionId)},className:"min-h-[36px] border border-stone-700 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors focus:outline-none focus:ring-1 focus:ring-stone-700",children:"Mark complete"}):void 0;return i.jsx(_f,{testId:`feed-card-progress-${e.missionId}`,kind:"progress",title:e.title,oneLiner:e.nextStep??e.oneLiner,accent:kf.progress,drillInHref:`/project/mission/${e.missionId}`,drillInLabel:"Open mission",inlineActions:s,leadingAccessory:i.jsx("div",{"data-testid":`feed-card-progress-${e.missionId}-bar`,"data-percent":n,className:"h-1.5 w-16 shrink-0 border border-outline-variant bg-stone-100 overflow-hidden","aria-label":`Progress ${n}%`,children:i.jsx("div",{"data-testid":`feed-card-progress-${e.missionId}-bar-fill`,className:"h-full bg-sky-500",style:{width:`${n}%`}})}),expanded:e.activeSlice?i.jsxs("div",{"data-testid":`feed-card-progress-${e.missionId}-active-slice`,className:"border border-outline-variant bg-stone-50 px-2 py-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Active slice"}),i.jsx("div",{className:"mt-1 text-[12px] font-semibold text-stone-900",children:e.activeSlice.label}),i.jsxs("div",{className:"mt-0.5 font-mono text-[9px] text-stone-600",children:["status: ",e.activeSlice.status]})]}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No active slice."})})}function xz({source:e}){return i.jsx(_f,{testId:`feed-card-approval-${e.qitemId}`,kind:"approval",title:e.title,oneLiner:e.oneLiner,accent:kf.approval,drillInHref:e.drillInHref,drillInLabel:"Open detail",inlineActions:i.jsxs(i.Fragment,{children:[e.onApprove&&i.jsx("button",{type:"button","data-testid":`feed-card-approval-${e.qitemId}-approve`,onClick:e.onApprove,className:"min-h-[44px] border border-success px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-success hover:bg-success hover:text-white transition-colors",children:"Approve"}),e.onDeny&&i.jsx("button",{type:"button","data-testid":`feed-card-approval-${e.qitemId}-deny`,onClick:e.onDeny,className:"min-h-[44px] border border-stone-700 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors",children:"Deny"})]}),expanded:e.bodyPreview?i.jsx("pre",{"data-testid":`feed-card-approval-${e.qitemId}-body`,className:"overflow-x-auto whitespace-pre-wrap break-words bg-stone-50 p-2 font-body text-[11px] leading-relaxed text-stone-800",children:e.bodyPreview}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No body preview."})})}function Qhe({source:e}){return i.jsx(_f,{testId:`feed-card-concept-${e.sliceId}`,kind:"concept",title:e.title,oneLiner:e.oneLiner,accent:kf.concept,drillInHref:`/project/slice/${e.sliceId}`,drillInLabel:"Open concept",expanded:e.comparePreview&&e.comparePreview.length>0?i.jsxs("table",{className:"w-full border-collapse text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600",children:"Old"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600",children:"New"})]})}),i.jsx("tbody",{children:e.comparePreview.slice(0,3).map((t,n)=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 font-mono text-[10px] font-semibold text-stone-700",children:t.label}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-700",children:t.valueOld}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-900",children:t.valueNew})]},n))})]}):i.jsx("div",{className:"text-[11px] text-stone-600",children:e.oneLiner})})}function Xhe(e,t,n,s){const r=[],a=new Set(n?Array.from(n):[]);for(const d of e??[])(d.status??"").toLowerCase()==="complete"&&a.add(d.name);const l=(e??[]).filter(d=>!a.has(d.name));for(const d of l.slice(0,2))r.push({kind:"progress",source:{missionId:d.name,title:d.name,oneLiner:`Mission at ${d.path}`,nextStep:"Open mission for live status + active slices.",percent:0}});const u=(t??[]).filter(d=>!d.missionId||!a.has(d.missionId));for(const d of u.slice(0,3)){const p=d.lastActivityAt?`Last activity ${d.lastActivityAt}`:`Slice in ${d.status??"unknown"} state`,m=d.displayName||d.name,x=d.name,y=(d.status??"").toLowerCase();y==="shipped"||y==="complete"||y==="done"?r.push({kind:"shipped",source:{sliceId:x,title:m,oneLiner:p}}):y==="blocked"||y==="danger"||y==="failed"?r.push({kind:"incident",source:{sliceId:x,title:m,oneLiner:p,status:y==="blocked"?"warning":"danger"}}):r.push({kind:"incident",source:{sliceId:x,title:m,oneLiner:p,status:"info"}})}const f=(s??[]).filter(d=>d.kind==="approval");for(const d of f.slice(0,2)){const p=d.source.payload??{},x=(typeof p.qitemId=="string"&&p.qitemId.length>0?p.qitemId:typeof p.qitem_id=="string"&&p.qitem_id.length>0?p.qitem_id:null)??d.id,y=d.authorSession?` from ${d.authorSession}`:"",b=d.body&&d.body.length>240?`${d.body.slice(0,237)}...`:d.body;r.push({kind:"approval",source:{qitemId:x,title:d.title,oneLiner:`Needs approval${y}`,bodyPreview:b,drillInHref:"/for-you"}})}return r}function Zhe({items:e,onMarkMissionComplete:t}){return e.length===0?i.jsx("div",{"data-testid":"storytelling-feed-empty",className:"border border-dashed border-outline-variant bg-white/35 p-4 font-body text-[11px] text-stone-500",children:"No items in the feed."}):i.jsx("div",{"data-testid":"storytelling-feed",className:"flex flex-col gap-4",children:e.map((n,s)=>n.kind==="shipped"?i.jsx(pz,{source:n.source},s):n.kind==="incident"?i.jsx(mz,{source:n.source},s):n.kind==="progress"?i.jsx(gz,{source:n.source,onMarkComplete:t},s):n.kind==="approval"?i.jsx(xz,{source:n.source},s):null)})}const Jhe=[{id:"all",label:"All"},{id:"action-required",label:"Action req"},{id:"approval",label:"Approvals"},{id:"shipped",label:"Shipped"},{id:"progress",label:"Progress"},{id:"observation",label:"Audit"}],epe=50,nP={all:{label:"All caught up",description:"Nothing needs you right now. New human tasks, approvals, shipped proof, and progress updates will appear here."},"action-required":{label:"No actions waiting",description:"When a queue item needs your response, it will appear here with approve, deny, and route controls."},approval:{label:"No approvals waiting",description:"Closeout and ratification requests will collect here when work needs an explicit decision."},shipped:{label:"No shipped proof yet",description:"Completed work with proof packets and screenshots will appear here when slices close."},progress:{label:"No progress cards",description:"Fresh queue movement and project updates will appear here as work advances."},observation:{label:"No audit cards",description:"Observation events are quiet right now. Turn the audit subscription on to watch more verbose activity."}};function sP(e){return typeof e=="string"&&e.length>0?e:void 0}function tpe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Dp(e){const t=e.source.payload??{};return sP(t.qitemId)??sP(t.qitem_id)??null}const npe=new Set(["approve","deny","route","handoff","hold","drop"]);function Xu(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:null}function spe(e){if(!e.qitemId)return null;const t=e.actionVerb;if(!npe.has(t))return null;const n=Xu(e.afterState,"handedOffTo")??(Xu(e.afterState,"closureReason")==="handed_off_to"?Xu(e.afterState,"closureTarget"):null);return{verb:t,actorSession:e.actorSession,actedAt:e.actedAt,state:Xu(e.afterState,"state"),destinationSession:n,reason:e.reason??Xu(e.afterState,"closureTarget")}}function rpe(e){const t=new Map;for(const n of e){if(!n.qitemId||t.has(n.qitemId))continue;const s=spe(n);s&&t.set(n.qitemId,s)}return t}function yz(e,t){const n=e.source.payload??{};return[...tpe(n.tags),...(t==null?void 0:t.tags)??[]]}function ipe(e,t,n){if(n&&(e.kind==="action-required"||e.kind==="approval"))return"approval";if(!t)return e.kind;const s=yz(e,t).join(" ").toLowerCase(),r=t.state.toLowerCase(),a=t.destinationSession.toLowerCase(),l=t.body.toLowerCase();return s.includes("approval")||s.includes("ratify")||r.includes("approval")||l.includes("approval requested")?"approval":r==="done"||r==="closed"||r==="completed"?"shipped":a==="human@host"||a.startsWith("human-")?"action-required":e.kind}function rP(e,t,n){const s=new Set(yz(e,t));for(const a of n)if(s.has(a.name))return a.name;const r=[e.title,e.body,t==null?void 0:t.body,...(t==null?void 0:t.tags)??[]].filter(a=>!!a).join(`
|
|
519
|
-
`);for(const a of n)if(r.includes(a.name))return a.name;return null}function ape(e){const t=(e==null?void 0:e.tests.proofPackets.find(n=>n.screenshots.length>0))??(e==null?void 0:e.tests.proofPackets[0]);return!e||!t||t.screenshots.length===0?null:{sliceName:e.name,displayName:e.displayName||e.name,passFailBadge:t.passFailBadge,screenshots:t.screenshots}}function ope(){var K;const{events:e}=X2(),[t,n]=E.useState("all"),s=wD(),[r,a]=E.useState(()=>new Map),l=E.useCallback((Y,J)=>{a(D=>{const F=new Map(D);return F.set(Y,J),F})},[]),u=E.useMemo(()=>yhe(e).slice(0,epe),[e]),f=E.useMemo(()=>u.map(Y=>Y.source.seq),[u]),{dismissedSeqs:d,dismiss:p,undismiss:m}=bhe(f),[x,y]=E.useState(null),b=E.useCallback(Y=>{p(Y),y(Y)},[p]),v=E.useCallback(()=>{x!==null&&m(x),y(null)},[x,m]),w=E.useCallback(()=>{y(null)},[]),S=E.useMemo(()=>u.map(Dp).filter(Y=>!!Y),[u]),C=I2(S),k=rz({limit:200}),_=E.useMemo(()=>{var Y;return rpe(((Y=k.data)==null?void 0:Y.rows)??[])},[(K=k.data)==null?void 0:K.rows]),R=E.useMemo(()=>{const J=u.map(F=>{const te=Dp(F),U=te?C.itemsById.get(te):void 0,Q=te?_.get(te):void 0,X=ipe(F,U,Q);return X===F.kind?F:{...F,kind:X}}).filter(F=>qW(F.kind,s.state));return(t==="all"?J:J.filter(F=>F.kind===t)).filter(F=>!d.has(F.source.seq))},[u,t,C.itemsById,_,s.state,d]),T=Ym("all"),A=E.useMemo(()=>!T.data||"unavailable"in T.data?[]:T.data.slices,[T.data]),I=E.useMemo(()=>{const Y=new Set;for(const J of R){if(J.kind!=="shipped")continue;const D=Dp(J),F=D?C.itemsById.get(D):void 0,te=rP(J,F,A);te&&Y.add(te)}return Array.from(Y)},[R,C.itemsById,A]),L=rD(I),$=aD(),{completedMissionIds:O,markCompleted:B}=jhe(),H=E.useMemo(()=>Array.isArray($.missions)?$.missions.map(Y=>Y.name):[],[$.missions]),{statuses:P}=She(H),G=E.useMemo(()=>(Array.isArray($.missions)?$.missions:[]).map(Y=>({...Y,status:P.get(Y.name)??null})),[$.missions,P]),q=E.useMemo(()=>Xhe(G,Array.isArray(A)?A:[],O,u),[G,A,O,u]),V=E.useCallback(Y=>{B(Y),fetch(`/api/missions/${encodeURIComponent(Y)}/complete`,{method:"POST"}).catch(()=>{})},[B]);return i.jsxs("div",{"data-testid":"for-you-feed",className:"mx-auto w-full max-w-[720px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Attention"}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:"For You"})]}),i.jsx("div",{"data-testid":"feed-lens-chips",role:"toolbar","aria-label":"Feed filters",className:"flex flex-wrap gap-1 mb-4",children:Jhe.map(Y=>i.jsx("button",{type:"button","data-testid":`feed-lens-${Y.id}`,"data-active":t===Y.id,onClick:()=>n(Y.id),className:he("px-2 py-1 border font-mono text-[9px] uppercase tracking-wide",t===Y.id?"border-stone-900 bg-stone-900 text-stone-50":"border-outline-variant text-on-surface-variant hover:bg-stone-100"),children:Y.label},Y.id))}),q.length>0&&i.jsxs("section",{"data-testid":"for-you-storytelling-preview","aria-label":"Storytelling preview",className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Storytelling preview"}),i.jsx("div",{className:"mt-2",children:i.jsx(Zhe,{items:q,onMarkMissionComplete:V})})]}),R.length===0?i.jsx(Ve,{label:nP[t].label,description:nP[t].description,variant:"card",testId:"for-you-empty"}):i.jsx("div",{"data-testid":"for-you-feed-cards",children:R.map(Y=>{const J=Dp(Y),D=J?C.itemsById.get(J):void 0,F=Y.kind==="shipped"?rP(Y,D,A):null,te=F?ape(L.itemsByName.get(F)):null,U=J?r.get(J)??_.get(J)??null:null;return i.jsx(Vhe,{card:Y,queueItem:D,proofPreview:te,actionOutcome:U,onDismiss:b,onOptimisticOutcome:l},Y.id)})}),x!==null?i.jsx(Ghe,{label:"Card dismissed",onUndo:v,onExpire:w,durationMs:5e3},x):null]})}const lpe=[{label:"+ Add spec",to:"/specs/rig",testId:"specs-toolbar-add"},{label:"Import",to:"/import",testId:"specs-toolbar-import"},{label:"Discover",to:"/search",testId:"specs-toolbar-discover"},{label:"Create rig",to:"/specs/rig",testId:"specs-toolbar-create-rig"},{label:"Generate workflow",to:"/specs/agent",testId:"specs-toolbar-gen-workflow"}];function qp(e){return e.status==="error"?{id:e.id,label:e.name,meta:e.errorMessage??"Invalid workflow YAML",status:"error"}:{id:e.id,label:e.name,entryId:e.id}}function cpe(e){return{id:e.id,label:e.name,entryId:e.id}}function upe(e){return{id:e.id,label:e.name,entryId:e.id}}function Va({id:e,title:t,rows:n,isLoading:s,emptyLabel:r}){return i.jsxs("section",{"data-testid":`library-section-${e}`,className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:t}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:s?"loading":`${n.length} items`})]}),n.length>0?i.jsx("ul",{className:"divide-y divide-outline-variant",children:n.map(a=>i.jsx("li",{children:a.entryId?i.jsx(Ue,{to:"/specs/library/$entryId",params:{entryId:a.entryId},"data-testid":`library-row-${e}-${a.id}`,className:"block px-3 py-2 hover:bg-stone-100/50",children:i.jsx(iP,{row:a})}):i.jsx("div",{"data-testid":`library-row-${e}-${a.id}`,"data-status":a.status,className:`px-3 py-2 ${a.status==="error"?"bg-red-50/40 text-red-900":""}`,children:i.jsx(iP,{row:a})})},a.id))}):i.jsx("div",{className:"px-3 py-4 font-mono text-[10px] text-stone-500",children:s?"Loading...":r??"No entries."})]})}function iP({row:e}){return i.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3 font-mono",children:[i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e.label}),e.meta?i.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:e.meta}):null]})}function dpe({plugins:e,isLoading:t}){return i.jsxs("section",{id:"library-plugins","data-testid":"library-section-plugins",className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:"Plugins"}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${e.length} plugins`})]}),e.length===0?i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ve,{label:t?"LOADING":"NO PLUGINS DISCOVERED",description:t?"Loading plugins...":"Install a Claude Code or Codex plugin (or wait for openrig-core to vendor) to see it appear here.",variant:"card",testId:"library-plugins-empty"})}):i.jsx("ul",{className:"divide-y divide-outline-variant",children:e.map(n=>i.jsx("li",{children:i.jsx(Ue,{to:"/plugins/$pluginId",params:{pluginId:n.id},"data-testid":`library-plugin-${n.id}`,className:"flex items-center gap-3 px-3 py-2 font-mono hover:bg-stone-100/50",children:i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"skill",title:`${n.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:n.name})]})})},n.id))})]})}function fpe({skills:e,isLoading:t}){return i.jsxs("section",{id:"library-skills","data-testid":"library-section-skills",className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:"Skills"}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${e.length} folders`})]}),e.length===0?i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ve,{label:t?"LOADING":"NO SKILLS FOUND",description:t?"Loading skill folders...":"No .openrig/skills or packaged OpenRig skill folders are visible through configured file roots.",variant:"card",testId:"library-skills-empty"})}):i.jsx("ul",{className:"divide-y divide-outline-variant",children:e.map(n=>i.jsx("li",{children:i.jsxs("a",{href:NW(n.id),"data-testid":`library-skill-${n.name}`,className:"flex items-center justify-between gap-3 px-3 py-2 font-mono hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"skill",title:`${n.name} skill`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:n.name})]}),i.jsxs("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[n.files.length," files"]})]})},n.id))})]})}function vz(){const{data:e=[],isLoading:t}=Ac(),{data:n=[],isLoading:s}=W2(),{data:r=[],isLoading:a}=Y2(),{data:l=[],isLoading:u}=ng(),{data:f=[],isLoading:d}=sg(),p=E.useMemo(()=>{const x=e.filter(w=>w.kind==="rig"&&!w.hasServices).map(qp),y=e.filter(w=>w.kind==="workflow").map(qp),b=e.filter(w=>w.kind==="agent").map(qp),v=e.filter(w=>w.kind==="rig"&&w.hasServices).map(qp);return{rigSpecs:x,workflowSpecs:y,agentSpecs:b,applications:v}},[e]),m=p.rigSpecs.length+p.workflowSpecs.length+p.agentSpecs.length+p.applications.length+n.length+r.length+l.length;return i.jsxs("div",{"data-testid":"specs-library-page",className:"h-full overflow-y-auto bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-5 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsx("h1",{className:"mt-1 font-headline text-2xl font-bold tracking-tight text-stone-900",children:"Library"}),i.jsx("p",{className:"mt-1 max-w-3xl text-sm text-stone-600",children:"Specs, context packs, agent images, applications, and skill folders."})]}),i.jsx("nav",{"aria-label":"Library actions",className:"flex flex-wrap justify-end gap-2",children:lpe.map(x=>i.jsx(Ue,{to:x.to,"data-testid":x.testId,className:"border border-outline-variant bg-white/25 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hard-shadow hover:bg-white/40",children:x.label},x.testId))})]}),i.jsxs("div",{className:"mb-4 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-500",children:[m," library entries visible through current sources"]}),i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsx(Va,{id:"rig-specs",title:"Rig Specs",rows:p.rigSpecs,isLoading:t,emptyLabel:"No rig specs found."}),i.jsx(Va,{id:"workspace-specs",title:"Workspace Specs",rows:[],emptyLabel:"No workspace specs source is wired yet."}),i.jsx(Va,{id:"workflow-specs",title:"Workflow Specs",rows:p.workflowSpecs,isLoading:t,emptyLabel:"No workflow specs found."}),i.jsx(Va,{id:"context-packs",title:"Context Packs",rows:n.map(cpe),isLoading:s,emptyLabel:"No context packs found."}),i.jsx(Va,{id:"agent-specs",title:"Agent Specs",rows:p.agentSpecs,isLoading:t,emptyLabel:"No agent specs found."}),i.jsx(Va,{id:"agent-images",title:"Agent Images",rows:r.map(upe),isLoading:a,emptyLabel:"No agent images found."}),i.jsx(Va,{id:"applications",title:"Applications",rows:p.applications,isLoading:t,emptyLabel:"No application specs found."})]}),i.jsxs("div",{className:"mt-4 space-y-4",children:[i.jsx(dpe,{plugins:f,isLoading:d}),i.jsx(fpe,{skills:l,isLoading:u})]})]})}async function hpe(e,t){const n=await fetch(`/api/skills/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}async function ppe(e,t){const n=await fetch(`/api/skills/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function mpe(e,t){return De({queryKey:["skill-files","list",e,t],queryFn:()=>hpe(e,t??""),enabled:!!e,staleTime:15e3})}function gpe(e,t){return De({queryKey:["skill-files","read",e,t],queryFn:()=>ppe(e,t),enabled:!!e&&!!t,staleTime:15e3})}const xpe=new Set([".md",".mdx",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".css",".html"]);function ype(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function aP(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function vpe(e,t){return e?`${e}/${t}`:t}function bz({skillToken:e,fileToken:t}){var y;const{data:n=[],isLoading:s}=ng(),r=vD(e),a=r?n.find(b=>b.id===r)??null:null,[l,u]=E.useState(""),[f,d]=E.useState(null),[p,m]=E.useState(!1);E.useEffect(()=>{if(!t||!a)return;const b=bD(t);b&&(u(aP(b)),d(b),m(!0))},[t,a]);const x=mpe((a==null?void 0:a.id)??null,l);return E.useEffect(()=>{if(p||l!==""||!x.data)return;const b=x.data.entries.find(v=>v.type==="file"&&/^skill\.md$/i.test(v.name));b&&d(b.name),m(!0)},[x.data,l,p]),s?i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ve,{label:"LOADING SKILL",description:"Loading skill files from the daemon skill library.",variant:"card",testId:"skill-detail-loading"})}):a?i.jsxs("div",{"data-testid":"skill-detail-page",className:"h-full overflow-hidden bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Skill"}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[i.jsx("h1",{className:"font-headline text-2xl font-bold tracking-tight text-stone-900",children:a.name}),i.jsx("span",{"data-testid":"skill-detail-source",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:a.source})]}),i.jsx("div",{"data-testid":"skill-detail-absolute-path",className:"mt-1 font-mono text-[10px] text-stone-500 truncate",title:a.absolutePath,children:a.absolutePath})]}),i.jsxs("div",{"data-testid":"skill-detail-docs-browser",className:"flex h-[calc(100%-5rem)] flex-col border border-outline-variant bg-white/25 hard-shadow sm:flex-row",children:[i.jsxs("aside",{"data-testid":"skill-detail-tree",className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-outline-variant bg-white/30 sm:w-64 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(bpe,{testId:"skill-detail-breadcrumbs",skillName:a.name,path:l,onNavigate:b=>{u(b),d(null)}}),x.isLoading?i.jsx("div",{"data-testid":"skill-detail-tree-loading",className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):x.isError?i.jsx("div",{"data-testid":"skill-detail-tree-error",className:"p-3 font-mono text-[10px] text-red-600",children:((y=x.error)==null?void 0:y.message)??"Error loading directory."}):!x.data||x.data.entries.length===0?i.jsx("div",{"data-testid":"skill-detail-tree-empty",className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{className:"p-1",children:[l&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"skill-detail-tree-up",onClick:()=>{u(aP(l)),d(null)},className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),x.data.entries.map(b=>{const v=vpe(l,b.name),w=b.type==="file",S=f===v;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`skill-detail-tree-entry-${v}`,"data-type":b.type,"data-active":S,onClick:()=>{w?d(v):b.type==="dir"&&(u(v),d(null))},disabled:b.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${b.type==="other"?"text-stone-400":`hover:bg-stone-100 ${S?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:b.type==="dir"?`▸ ${b.name}`:b.name})},v)})]})]}),i.jsx("main",{"data-testid":"skill-detail-viewer",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:f?i.jsx(wpe,{skillId:a.id,path:f}):i.jsx("div",{"data-testid":"skill-detail-viewer-no-selection",className:"p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree."})})]})]}):i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ve,{label:"SKILL NOT FOUND",description:"The selected skill is not discoverable through the daemon skill library.",variant:"card",testId:"skill-detail-not-found"})})}function bpe({testId:e,skillName:t,path:n,onNavigate:s}){const r=n?n.split("/"):[];return i.jsxs("nav",{"data-testid":e,className:"flex flex-wrap items-baseline gap-1 border-b border-outline-variant px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>s(""),className:"font-bold hover:underline",children:t}),r.map((a,l)=>{const u=r.slice(0,l+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>s(u),className:"hover:underline",children:a})]},u)})]})}function wpe({skillId:e,path:t}){var r;const n=gpe(e,t),s=E.useMemo(()=>ype(t),[t]);return n.isLoading?i.jsx("div",{"data-testid":"skill-detail-viewer-loading",className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}):n.isError?i.jsx("div",{"data-testid":"skill-detail-viewer-error",className:"p-4 font-mono text-[10px] text-red-600",children:((r=n.error)==null?void 0:r.message)??"Error loading file."}):n.data?i.jsxs("div",{"data-testid":"skill-detail-viewer-content",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2 font-mono text-[10px]",children:[i.jsx("div",{"data-testid":"skill-detail-viewer-path",className:"text-stone-700",children:t}),i.jsxs("div",{className:"flex items-baseline gap-3 text-stone-500",children:[i.jsxs("span",{children:[n.data.size,"b"]}),i.jsx("span",{children:n.data.mtime})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[n.data.truncated&&i.jsxs("div",{"data-testid":"skill-detail-viewer-truncated",className:"mb-3 mx-4 mt-4 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated at ",Math.round((n.data.truncatedAtBytes??0)/1024)," KB — file is"," ",Math.round((n.data.totalBytes??n.data.size)/1024)," KB total."]}),s===".md"||s===".mdx"?i.jsx("div",{className:"p-4",children:i.jsx(Zr,{content:n.data.content})}):xpe.has(s)?i.jsx("div",{className:"p-4",children:i.jsx(lg,{code:n.data.content,language:s.slice(1)})}):i.jsx("pre",{"data-testid":"skill-detail-viewer-text-fallback",className:"p-4 whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.data.content})]})]}):null}function jpe(e){return e==="workspace"?"Workspace":e==="openrig-managed"?"OpenRig managed":e}function Spe(){const{data:e=[],isLoading:t}=ng(),n=[...e].sort((s,r)=>s.name.localeCompare(r.name));return i.jsxs("div",{"data-testid":"skills-index-page",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsxs("div",{className:"mt-1 flex items-baseline justify-between",children:[i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900",children:"Skills"}),i.jsx("span",{"data-testid":"skills-index-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${n.length} ${n.length===1?"skill":"skills"}`})]})]}),t&&n.length===0?i.jsx("div",{"data-testid":"skills-index-loading",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:"Loading skills…"}):n.length===0?i.jsxs("div",{"data-testid":"skills-index-empty",className:"border border-outline-variant bg-white/25 px-4 py-6 font-mono text-xs leading-relaxed text-stone-700",children:[i.jsx("p",{className:"font-bold uppercase tracking-wide text-stone-900",children:"No skills visible"}),i.jsxs("p",{className:"mt-2",children:["Skills live under ",i.jsx("code",{className:"font-mono text-stone-900",children:".openrig/skills/"})," in your workspace, plus the built-in set shipped with OpenRig. If this list is empty, the daemon could not see either source through configured file roots."]})]}):i.jsx("ul",{"data-testid":"skills-index-rows",className:"border border-outline-variant bg-white/25 hard-shadow divide-y divide-outline-variant",children:n.map(s=>i.jsx("li",{children:i.jsxs(Ue,{to:"/specs/skills/$skillToken",params:{skillToken:rg(s.id)},"data-testid":`skills-index-row-${s.id}`,className:"flex w-full items-center justify-between gap-3 px-3 py-2 font-mono text-left hover:bg-stone-100/60 focus:outline-none focus:bg-stone-100/80",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"skill",title:`${s.name} skill`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:s.name})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-3 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx("span",{"data-testid":`skills-index-row-${s.id}-source`,children:jpe(s.source)}),i.jsxs("span",{"data-testid":`skills-index-row-${s.id}-filecount`,children:[s.files.length," ",s.files.length===1?"file":"files"]})]})]})},s.id))})]})}function Npe(){const{data:e=[],isLoading:t}=sg(),n=[...e].sort((s,r)=>s.name.localeCompare(r.name));return i.jsxs("div",{"data-testid":"plugins-index-page",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsxs("div",{className:"mt-1 flex items-baseline justify-between",children:[i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900",children:"Plugins"}),i.jsx("span",{"data-testid":"plugins-index-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${n.length} ${n.length===1?"plugin":"plugins"}`})]})]}),t&&n.length===0?i.jsx("div",{"data-testid":"plugins-index-loading",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:"Loading plugins…"}):n.length===0?i.jsxs("div",{"data-testid":"plugins-index-empty",className:"border border-outline-variant bg-white/25 px-4 py-6 font-mono text-xs leading-relaxed text-stone-700",children:[i.jsx("p",{className:"font-bold uppercase tracking-wide text-stone-900",children:"No plugins visible"}),i.jsx("p",{className:"mt-2",children:"Plugins are discovered from Claude Code's global plugin cache, Codex's plugin cache, or OpenRig's vendored set (openrig-core ships with the daemon)."})]}):i.jsx("ul",{"data-testid":"plugins-index-rows",className:"border border-outline-variant bg-white/25 hard-shadow divide-y divide-outline-variant",children:n.map(s=>i.jsx("li",{children:i.jsxs(Ue,{to:"/plugins/$pluginId",params:{pluginId:s.id},"data-testid":`plugins-index-row-${s.id}`,className:"flex w-full items-center justify-between gap-3 px-3 py-2 font-mono text-left hover:bg-stone-100/60 focus:outline-none focus:bg-stone-100/80",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Pe,{tool:"plugin",title:`${s.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:s.name})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-3 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsxs("span",{"data-testid":`plugins-index-row-${s.id}-version`,children:["v",s.version]}),i.jsx("span",{"data-testid":`plugins-index-row-${s.id}-runtimes`,className:"flex gap-1",children:s.runtimes.map(r=>i.jsx("span",{className:"border border-outline-variant px-1.5 py-0.5",children:r},r))}),i.jsxs("span",{"data-testid":`plugins-index-row-${s.id}-skillcount`,children:[s.skillCount," ",s.skillCount===1?"skill":"skills"]}),i.jsx("span",{"data-testid":`plugins-index-row-${s.id}-source`,children:s.sourceLabel})]})]})},s.id))})]})}async function kpe(e,t){const n=await fetch(`/api/plugins/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}async function _pe(e,t){const n=await fetch(`/api/plugins/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function Cpe(e,t){return De({queryKey:["plugin-files","list",e,t],queryFn:()=>kpe(e,t??""),enabled:!!e,staleTime:15e3})}function Epe(e,t){return De({queryKey:["plugin-files","read",e,t],queryFn:()=>_pe(e,t),enabled:!!e&&!!t,staleTime:15e3})}const Rpe=new Set([".md",".mdx",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".css",".html"]);function wz(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function Ape(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Tpe(e,t){return e?`${e}/${t}`:t}function Ipe(e){const t=wz(e);return t===".md"||t===".mdx"}function Mpe(e){const t=e.find(s=>s.type==="file"&&/^readme\.(md|mdx)$/i.test(s.name));if(t)return t.name;const n=e.find(s=>s.type==="file"&&Ipe(s.name));return n?n.name:null}function Ope({pluginId:e}){var v;const{data:t,isLoading:n,error:s}=wW(e),{data:r=[]}=jW(e),[a,l]=E.useState(""),[u,f]=E.useState(null),[d,p]=E.useState(!1),m=Cpe(e,a);if(E.useEffect(()=>{if(d||a!==""||!m.data)return;const w=Mpe(m.data.entries);w&&f(w),p(!0)},[m.data,a,d]),n)return i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ve,{label:"LOADING PLUGIN",description:"Loading plugin manifest from discovery service.",variant:"card",testId:"plugin-detail-loading"})});if(s||!t)return i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ve,{label:"PLUGIN NOT FOUND",description:"The selected plugin is not visible through any configured discovery source.",variant:"card",testId:"plugin-detail-not-found"})});const x=t.entry,y=x.skillCount,b=r.length;return i.jsxs("div",{"data-testid":"plugin-detail-page",className:"h-full overflow-hidden bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Plugin"}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[i.jsx("h1",{className:"font-headline text-2xl font-bold tracking-tight text-stone-900",children:x.name}),i.jsxs("span",{className:"font-mono text-sm text-stone-600",children:["v",x.version]}),x.runtimes.map(w=>i.jsx("span",{"data-testid":`plugin-detail-runtime-${w}`,className:"inline-block border border-outline-variant bg-white/30 px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700",children:w},w)),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",title:x.path,children:x.sourceLabel}),i.jsxs("span",{"data-testid":"plugin-detail-skill-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:[y," ",y===1?"skill":"skills"]}),i.jsxs("span",{"data-testid":"plugin-detail-used-by-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:["used by ",b," ",b===1?"agent":"agents"]})]}),x.description&&i.jsx("p",{className:"mt-2 max-w-3xl text-sm text-stone-600",children:x.description})]}),i.jsxs("div",{"data-testid":"plugin-detail-docs-browser",className:"flex h-[calc(100%-7rem)] flex-col border border-outline-variant bg-white/25 hard-shadow sm:flex-row",children:[i.jsxs("aside",{"data-testid":"plugin-detail-tree",className:"w-full max-h-64 shrink-0 overflow-y-auto border-b border-outline-variant bg-white/30 sm:w-72 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(Lpe,{testId:"plugin-detail-breadcrumbs",pluginName:x.name,path:a,onNavigate:w=>{l(w),f(null)}}),m.isLoading?i.jsx("div",{"data-testid":"plugin-detail-tree-loading",className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):m.isError?i.jsx("div",{"data-testid":"plugin-detail-tree-error",className:"p-3 font-mono text-[10px] text-red-600",children:((v=m.error)==null?void 0:v.message)??"Error loading directory."}):!m.data||m.data.entries.length===0?i.jsx("div",{"data-testid":"plugin-detail-tree-empty",className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{className:"p-1",children:[a&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"plugin-detail-tree-up",onClick:()=>{l(Ape(a)),f(null)},className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),m.data.entries.map(w=>{const S=Tpe(a,w.name),C=w.type==="file",k=u===S;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`plugin-detail-tree-entry-${S}`,"data-type":w.type,"data-active":k,onClick:()=>{C?f(S):w.type==="dir"&&(l(S),f(null))},disabled:w.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${w.type==="other"?"text-stone-400":`hover:bg-stone-100 ${k?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:w.type==="dir"?`▸ ${w.name}`:w.name})},S)})]})]}),i.jsx("main",{"data-testid":"plugin-detail-viewer",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:u?i.jsx(Ppe,{pluginId:e,path:u}):i.jsx("div",{"data-testid":"plugin-detail-viewer-no-selection",className:"p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree."})})]})]})}function Lpe({testId:e,pluginName:t,path:n,onNavigate:s}){const r=n?n.split("/"):[];return i.jsxs("nav",{"data-testid":e,className:"flex flex-wrap items-baseline gap-1 border-b border-outline-variant px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>s(""),className:"font-bold hover:underline",children:t}),r.map((a,l)=>{const u=r.slice(0,l+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>s(u),className:"hover:underline",children:a})]},u)})]})}function Ppe({pluginId:e,path:t}){var r;const n=Epe(e,t),s=E.useMemo(()=>wz(t),[t]);return n.isLoading?i.jsx("div",{"data-testid":"plugin-detail-viewer-loading",className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}):n.isError?i.jsx("div",{"data-testid":"plugin-detail-viewer-error",className:"p-4 font-mono text-[10px] text-red-600",children:((r=n.error)==null?void 0:r.message)??"Error loading file."}):n.data?i.jsxs("div",{"data-testid":"plugin-detail-viewer-content",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2 font-mono text-[10px]",children:[i.jsx("div",{"data-testid":"plugin-detail-viewer-path",className:"text-stone-700",children:t}),i.jsxs("div",{className:"flex items-baseline gap-3 text-stone-500",children:[i.jsxs("span",{children:[n.data.size,"b"]}),i.jsx("span",{children:n.data.mtime})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[n.data.truncated&&i.jsxs("div",{"data-testid":"plugin-detail-viewer-truncated",className:"mb-3 mx-4 mt-4 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated at ",Math.round((n.data.truncatedAtBytes??0)/1024)," KB — file is"," ",Math.round((n.data.totalBytes??n.data.size)/1024)," KB total."]}),s===".md"||s===".mdx"?i.jsx("div",{className:"p-4",children:i.jsx(Zr,{content:n.data.content})}):Rpe.has(s)?i.jsx("div",{className:"p-4",children:i.jsx(lg,{code:n.data.content,language:s.slice(1)})}):i.jsx("pre",{"data-testid":"plugin-detail-viewer-text-fallback",className:"p-4 whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.data.content})]})]}):null}async function $pe(e,t){const n=await fetch(`/api/specs/review/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:t})});if(n.status===400)return await n.json();if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function Dpe(e,t){return De({queryKey:["spec-review",e,t?t.length:0,t?t.slice(0,64):""],queryFn:()=>$pe(e,t),enabled:!!e&&!!t,staleTime:6e4})}async function qpe(){const t=new URL(window.location.href).searchParams.get("session"),n=new URLSearchParams;if(t&&n.set("sessionName",t),n.toString()==="")return null;const s=await fetch(`/api/whoami?${n.toString()}`);if(!s.ok)return null;const r=await s.json().catch(()=>null);if(!r||typeof r!="object")return null;const a=r.workspace;return!a||typeof a!="object"?null:Array.isArray(a.repos)?a:{...a,repos:[]}}function zpe(){return De({queryKey:["workspace","whoami"],queryFn:qpe,staleTime:6e4})}const Bpe={user:{label:"USER",glyph:"U",bg:"bg-violet-50",fg:"text-violet-700",border:"border-violet-200"},project:{label:"PROJECT",glyph:"P",bg:"bg-blue-50",fg:"text-blue-700",border:"border-blue-200"},knowledge:{label:"KNOW",glyph:"K",bg:"bg-emerald-50",fg:"text-emerald-700",border:"border-emerald-200"},lab:{label:"LAB",glyph:"L",bg:"bg-amber-50",fg:"text-amber-700",border:"border-amber-200"},delivery:{label:"DELIVERY",glyph:"D",bg:"bg-rose-50",fg:"text-rose-700",border:"border-rose-200"}};function Fpe({kind:e,compact:t,className:n}){const s=Bpe[e];if(!s)return null;const r=`inline-block border ${s.border} ${s.bg} ${s.fg} font-mono text-[8px] uppercase tracking-[0.14em] leading-none rounded-sm`,a=t?"px-1 py-[2px]":"px-1.5 py-0.5";return i.jsx("span",{"data-testid":`workspace-kind-badge-${e}`,title:`workspace kind: ${e}`,className:`${r} ${a} ${n??""}`.trim(),children:t?s.glyph:s.label})}function Hpe(e,t){if(!e||!t)return null;let n=null;for(const s of t.repos)oP(e,s.path)&&s.path.length>((n==null?void 0:n.len)??-1)&&(n={kind:s.kind,len:s.path.length});return n?n.kind:t.knowledgeRoot&&oP(e,t.knowledgeRoot)?"knowledge":null}function oP(e,t){return!e||!t?!1:e===t?!0:e.startsWith(t.endsWith("/")?t:t+"/")}const Upe=new Set([".md",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".sql",".css",".html"]),Vpe=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]),Gpe=new Set([".zip",".tar",".gz",".pdf",".mp4",".webm",".mov"]);function jz(e){return!!(e&&typeof e=="object"&&"unavailable"in e)}function Kpe(){const e=Qm(),t=zpe(),[n,s]=E.useState(null),[r,a]=E.useState(""),[l,u]=E.useState(null),[f,d]=E.useState(!1);return E.useEffect(()=>{if(n||!e.data||jz(e.data))return;const p=e.data.roots[0];p&&s(p.name)},[e.data,n]),E.useEffect(()=>{a(""),u(null),d(!1)},[n]),i.jsxs("div",{"data-testid":"files-workspace",className:"flex h-full flex-col lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"border-b border-stone-200 bg-stone-50 px-4 py-3",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:"Workspace"}),i.jsx("h1",{className:"font-headline text-xl font-bold tracking-tight text-stone-900",children:"Files"})]}),i.jsxs("div",{className:"flex flex-1 min-h-0 flex-col sm:flex-row",children:[i.jsxs("aside",{"data-testid":"files-tree-pane",className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-stone-200 bg-stone-50 sm:w-72 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(Wpe,{roots:e.data,isLoading:e.isLoading,selectedRoot:n,onSelect:s,workspace:t.data??null}),n&&i.jsxs(i.Fragment,{children:[i.jsx(Ype,{root:n,path:r,onNavigate:a}),i.jsx(Qpe,{root:n,path:r,onEnterDir:p=>{a(p),u(null)},onSelectFile:p=>{u(p),d(!1)},selectedFile:l})]})]}),i.jsxs("main",{"data-testid":"files-content-pane",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:[!n&&i.jsx("div",{className:"m-auto p-4 font-mono text-[10px] text-stone-400",children:"Select an allowlist root to browse."}),n&&!l&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"files-no-selection",children:"Select a file from the tree."}),n&&l&&i.jsx(Xpe,{root:n,path:l,editMode:f,onToggleEditMode:()=>d(p=>!p)})]})]})]})}function Wpe({roots:e,isLoading:t,selectedRoot:n,onSelect:s,workspace:r}){return t?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading roots…"}):e?jz(e)?i.jsxs("div",{"data-testid":"files-roots-unavailable",className:"p-3 font-mono text-[10px] text-stone-500",children:[i.jsx("div",{children:"Files routes unavailable."}),e.hint&&i.jsx("div",{className:"mt-1 text-stone-400",children:e.hint})]}):e.roots.length===0?i.jsxs("div",{"data-testid":"files-roots-empty",className:"p-3 font-mono text-[10px] text-stone-500",children:[i.jsx("div",{children:"No allowlist roots configured."}),e.hint&&i.jsx("div",{className:"mt-1 text-stone-400",children:e.hint})]}):i.jsxs("div",{"data-testid":"files-root-selector",className:"border-b border-stone-200 p-2",children:[i.jsx("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Roots"}),i.jsx("ul",{children:e.roots.map(a=>{const l=Hpe(a.path,r);return i.jsx("li",{children:i.jsxs("button",{type:"button","data-testid":`files-root-${a.name}`,"data-active":n===a.name,onClick:()=>s(a.name),className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left font-mono text-[10px] hover:bg-stone-100 ${n===a.name?"bg-stone-200/80 text-stone-900":"text-stone-700"}`,title:a.path,children:[i.jsx("span",{className:"truncate",children:a.name}),l&&i.jsx(Fpe,{kind:l,compact:!0})]})},a.name)})})]}):null}function Ype({root:e,path:t,onNavigate:n}){const s=t?t.split("/"):[];return i.jsxs("nav",{"data-testid":"files-breadcrumbs",className:"flex flex-wrap items-baseline gap-1 border-b border-stone-200 px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>n(""),className:"font-bold hover:underline",children:e}),s.map((r,a)=>{const l=s.slice(0,a+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>n(l),className:"hover:underline",children:r})]},l)})]})}function Qpe({root:e,path:t,onEnterDir:n,onSelectFile:s,selectedFile:r}){var l;const a=iD(e,t);return a.isLoading?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):a.isError?i.jsx("div",{"data-testid":"files-list-error",className:"p-3 font-mono text-[10px] text-red-600",children:((l=a.error)==null?void 0:l.message)??"Error loading directory."}):!a.data||a.data.entries.length===0?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{"data-testid":"files-directory-tree",className:"p-1",children:[t&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"files-up",onClick:()=>n(sme(t)),className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),a.data.entries.map(u=>{const f=t?`${t}/${u.name}`:u.name,d=u.type==="file",p=r===f;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`files-entry-${f}`,"data-type":u.type,onClick:()=>d?s(f):u.type==="dir"?n(f):void 0,disabled:u.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${u.type==="other"?"text-stone-400":`hover:bg-stone-100 ${p?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:u.type==="dir"?`▸ ${u.name}`:u.name})},f)})]})}function Xpe({root:e,path:t,editMode:n,onToggleEditMode:s}){var a;const r=Xm(e,t);return i.jsxs("div",{"data-testid":"files-content-panel",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px]",children:[i.jsxs("div",{className:"text-stone-700","data-testid":"files-content-path",children:[e,"/",t]}),i.jsxs("div",{className:"flex items-center gap-3 text-stone-500",children:[r.data&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{"data-testid":"files-content-size",children:[r.data.size,"b"]}),i.jsx("span",{"data-testid":"files-content-mtime",children:r.data.mtime})]}),i.jsx("button",{type:"button","data-testid":"files-edit-toggle","data-active":n,onClick:s,className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${n?"border-amber-400 bg-amber-50 text-amber-900":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:n?"editing":"edit"})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[r.isLoading&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}),r.isError&&i.jsx("div",{"data-testid":"files-read-error",className:"p-4 font-mono text-[10px] text-red-600",children:((a=r.error)==null?void 0:a.message)??"Error loading file."}),r.data&&(n?i.jsx(tme,{root:e,path:t,read:r.data}):i.jsx(Zpe,{root:e,path:t,read:r.data}))]})]})}function Zpe({root:e,path:t,read:n}){const s=nme(t),r=Jpe(t);return Vpe.has(s)?i.jsxs("div",{"data-testid":"files-image-view",className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx("img",{src:NN(e,t),alt:t,className:"max-w-full border border-stone-200"})]}):s===".md"?i.jsxs("div",{className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx(Zr,{content:n.content})]}):Upe.has(s)?i.jsxs("div",{"data-testid":"files-code-view",className:"p-4",children:[i.jsx(zp,{read:n}),r&&i.jsx(eme,{kind:r,yaml:n.content}),i.jsx(lg,{code:n.content,language:s.slice(1)})]}):Gpe.has(s)?i.jsx("div",{"data-testid":"files-download-only",className:"p-4 font-mono text-[10px] text-stone-700",children:i.jsxs("a",{href:NN(e,t),download:!0,className:"text-blue-700 underline",children:["Download ",t]})}):i.jsxs("div",{"data-testid":"files-text-fallback",className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.content})]})}function zp({read:e}){if(!e.truncated)return null;const t=Math.round((e.totalBytes??e.size)/1024);return i.jsxs("div",{"data-testid":"files-truncation-marker","data-truncated-at-bytes":e.truncatedAtBytes??"","data-total-bytes":e.totalBytes??"",className:"mb-3 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated by file viewer at ",Math.round((e.truncatedAtBytes??0)/1024)," KB — file is ",t," KB total. Use an external editor for full content."]})}function Jpe(e){const t=e.toLowerCase();return t.endsWith("/rig.yaml")||t==="rig.yaml"||t.endsWith("/rig.yml")||t==="rig.yml"?"rig":t.endsWith("/agent.yaml")||t==="agent.yaml"||t.endsWith("/agent.yml")||t==="agent.yml"?"agent":null}function eme({kind:e,yaml:t}){var a;const n=Dpe(e,t);if(n.isLoading)return i.jsxs("div",{"data-testid":"files-spec-validation-loading",className:"mb-3 border border-stone-300 bg-stone-50 px-3 py-2 font-mono text-[10px] text-stone-500",children:["Validating ",e,".yaml…"]});if(n.isError)return i.jsxs("div",{"data-testid":"files-spec-validation-error",className:"mb-3 border border-red-400 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:["Validation failed to run: ",((a=n.error)==null?void 0:a.message)??"unknown error"]});if(!n.data)return null;const s=n.data.errors??[],r=s.length===0;return i.jsxs("div",{"data-testid":"files-spec-validation-panel","data-spec-kind":e,"data-valid":r,className:`mb-3 border px-3 py-2 font-mono text-[10px] ${r?"border-emerald-400 bg-emerald-50 text-emerald-900":"border-red-400 bg-red-50 text-red-900"}`,children:[i.jsx("div",{className:"mb-1 font-bold uppercase tracking-[0.10em]",children:r?`✓ Valid ${e==="rig"?"RigSpec":"AgentSpec"}`:`✗ ${e==="rig"?"RigSpec":"AgentSpec"} validation errors`}),s.length>0&&i.jsx("ul",{className:"space-y-1",children:s.map((l,u)=>i.jsxs("li",{"data-testid":`files-spec-validation-error-${u}`,className:"text-[10px]",children:[l.field&&i.jsxs("span",{className:"font-bold",children:[l.field,": "]}),l.message]},u))})]})}function tme({root:e,path:t,read:n}){const[s,r]=E.useState(n.content),[a,l]=E.useState(null),[u,f]=E.useState(null),[d,p]=E.useState(!1),m=xK(),x=Mt();E.useEffect(()=>{r(n.content),f(null)},[n.contentHash,n.mtime,n.content]);const y=E.useMemo(()=>s!==n.content,[s,n.content]);return i.jsxs("div",{"data-testid":"files-editor",className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-stone-200 bg-amber-50 px-3 py-1.5 font-mono text-[9px]",children:[i.jsx("span",{className:"font-bold text-amber-900","data-testid":"files-editor-status",children:y?"draft (unsaved)":"no changes"}),i.jsx("button",{type:"button","data-testid":"files-editor-save",disabled:!y||m.isPending,onClick:()=>{l(null),f(null),p(!1),m.mutate({root:e,path:t,content:s,expectedMtime:n.mtime,expectedContentHash:n.contentHash,actor:"ui-files-edit-mode"},{onSuccess:b=>{"conflict"in b?f({currentMtime:b.currentMtime,currentContentHash:b.currentContentHash}):(p(!0),setTimeout(()=>p(!1),2e3))},onError:b=>{l(b instanceof Error?b.message:String(b))}})},className:"border border-emerald-500 bg-emerald-50 px-2 py-0.5 uppercase tracking-[0.10em] text-emerald-900 disabled:cursor-not-allowed disabled:opacity-50",children:"save"}),i.jsx("button",{type:"button","data-testid":"files-editor-cancel",onClick:()=>{r(n.content),l(null),f(null)},className:"border border-stone-400 bg-white px-2 py-0.5 uppercase tracking-[0.10em] text-stone-700",children:"cancel"}),d&&i.jsx("span",{"data-testid":"files-editor-saved",className:"ml-auto text-emerald-700",children:"saved"})]}),u&&i.jsxs("div",{"data-testid":"files-editor-conflict",className:"flex items-center gap-2 border-b border-red-200 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:[i.jsxs("span",{className:"flex-1",children:["File changed externally. Local mtime ",i.jsx("code",{children:n.mtime})," ≠ server ",i.jsx("code",{children:u.currentMtime}),". Click Refresh to re-read the file (your draft will be replaced with the new server content; copy it elsewhere first if you need to re-apply)."]}),i.jsx("button",{type:"button","data-testid":"files-editor-refresh",onClick:()=>{x.invalidateQueries({queryKey:["files","read",e,t]})},className:"border border-red-500 bg-white px-2 py-0.5 uppercase tracking-[0.10em] text-red-900",children:"refresh"})]}),a&&i.jsxs("div",{"data-testid":"files-editor-error",className:"border-b border-red-200 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:["Save failed: ",a]}),i.jsx("textarea",{"data-testid":"files-editor-textarea",value:s,onChange:b=>r(b.target.value),className:"flex-1 min-h-0 resize-none border-0 bg-stone-50 p-3 font-mono text-[11px] leading-relaxed text-stone-900 outline-none",spellCheck:!1})]})}function nme(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function sme(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function rx({testId:e,title:t,children:n}){return i.jsxs("div",{"data-testid":e,className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Configuration"}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:t})]}),n]})}function rme(){return i.jsx(rx,{testId:"settings-center",title:"Settings",children:i.jsx(ND,{})})}const lP="policies.claude_compaction.enabled",cP="policies.claude_compaction.threshold_percent",uP="policies.claude_compaction.pre_compact_instruction",dP="policies.claude_compaction.compact_instruction",fP="policies.claude_compaction.message_inline",hP="policies.claude_compaction.message_file_path",pP="policies.claude_compaction.post_restore_audit_instruction";function ime(e,t){return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:t}function ame(e,t){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){const n=Number(e);if(!Number.isNaN(n))return n}return t}function Zu(e){return typeof e=="string"?e:e==null?"":String(e)}function ome(){const{data:e,isLoading:t,error:n}=ba(),s=M2();return e?i.jsx(lme,{data:e.settings,setSetting:s}):i.jsxs("section",{"data-testid":"claude-compaction-policy-form",className:"border border-outline-variant p-5 bg-white/50",children:[i.jsx(it,{tone:"muted",children:"Policy"}),i.jsx("h2",{className:"font-headline text-headline-sm font-bold tracking-tight uppercase text-stone-900 mt-1",children:"Claude Auto-Compaction"}),t&&i.jsx("p",{className:"mt-4 text-sm text-on-surface-variant","data-testid":"claude-compaction-policy-loading",children:"Loading current settings…"}),n&&i.jsx("p",{className:"mt-4 text-sm text-error","data-testid":"claude-compaction-policy-error",children:n instanceof Error?n.message:String(n)})]})}function lme({data:e,setSetting:t}){const[n,s]=E.useState(()=>{var m,x,y,b,v,w,S;return{enabled:ime((m=e[lP])==null?void 0:m.value,!1),thresholdPercent:String(ame((x=e[cP])==null?void 0:x.value,80)),preCompactInstruction:Zu((y=e[uP])==null?void 0:y.value),compactInstruction:Zu((b=e[dP])==null?void 0:b.value),messageInline:Zu((v=e[fP])==null?void 0:v.value),messageFilePath:Zu((w=e[hP])==null?void 0:w.value),postRestoreAuditInstruction:Zu((S=e[pP])==null?void 0:S.value)}}),[r,a]=E.useState(null),[l,u]=E.useState(null),[f,d]=E.useState(!1);async function p(m){m.preventDefault(),d(!1),u(null);const x=n.thresholdPercent.trim(),y=Number(x);if(!/^\d+$/.test(x)||y<1||y>100){a("Threshold must be an integer between 1 and 100.");return}a(null);const b=[{key:lP,value:n.enabled?"true":"false"},{key:cP,value:String(y)},{key:uP,value:n.preCompactInstruction},{key:dP,value:n.compactInstruction},{key:fP,value:n.messageInline},{key:hP,value:n.messageFilePath},{key:pP,value:n.postRestoreAuditInstruction}];try{for(const v of b)await t.mutateAsync(v);d(!0)}catch(v){u(v instanceof Error?v.message:String(v))}}return i.jsxs("section",{"data-testid":"claude-compaction-policy-form",className:"border border-outline-variant p-5 bg-white/50",children:[i.jsx(it,{tone:"muted",children:"Policy"}),i.jsx("h2",{className:"font-headline text-headline-sm font-bold tracking-tight uppercase text-stone-900 mt-1",children:"Claude Auto-Compaction"}),i.jsxs("p",{className:"mt-2 text-sm text-on-surface-variant max-w-prose",children:["When a Claude seat's context usage crosses the configured threshold, OpenRig first sends a preparation message, then sends",i.jsx("code",{className:"font-mono text-[12px]",children:" /compact"})," on the next eligible observation. After compaction, OpenRig sends one restore prompt that points the seat at its restore packet, followed by a read-depth audit prompt."]}),i.jsxs("form",{className:"mt-4 flex flex-col gap-5",onSubmit:p,"data-testid":"claude-compaction-policy-form-element",children:[i.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-stone-900",children:[i.jsx("input",{type:"checkbox","data-testid":"claude-compaction-enabled",checked:n.enabled,onChange:m=>s(x=>({...x,enabled:m.target.checked}))}),i.jsx("span",{children:"Enable automatic pre-compaction trigger"})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-threshold",className:"text-sm font-medium text-stone-900",children:"Threshold percentage"}),i.jsx("input",{id:"claude-compaction-threshold","data-testid":"claude-compaction-threshold",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:n.thresholdPercent,onChange:m=>s(x=>({...x,thresholdPercent:m.target.value})),className:"border border-outline-variant px-2 py-1 w-32 font-mono text-sm","aria-describedby":"claude-compaction-threshold-hint"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Preparation starts when context usage is at-or-above this percentage (1–100)."}),r&&i.jsx("span",{className:"text-xs text-error","data-testid":"claude-compaction-threshold-error",children:r})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-pre-compact-instruction",className:"text-sm font-medium text-stone-900",children:"Pre-compaction prep message"}),i.jsx("textarea",{id:"claude-compaction-pre-compact-instruction","data-testid":"claude-compaction-pre-compact-instruction",rows:4,value:n.preCompactInstruction,onChange:m=>s(x=>({...x,preCompactInstruction:m.target.value})),placeholder:"Read the claude-compaction-restore skill and prepare for compaction.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"OpenRig wraps this with the current context usage, threshold, and operator-authorized user-channel framing."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-compact-instruction",className:"text-sm font-medium text-stone-900",children:"Compaction instruction"}),i.jsx("textarea",{id:"claude-compaction-compact-instruction","data-testid":"claude-compaction-compact-instruction",rows:3,value:n.compactInstruction,onChange:m=>s(x=>({...x,compactInstruction:m.target.value})),placeholder:"Optional. Sent as /compact <instruction> when OpenRig triggers compaction.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Optional advanced override. Leave blank to rely on Claude's native compaction summary; OpenRig still appends a trust-channel note."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-inline",className:"text-sm font-medium text-stone-900",children:"Post-compaction restore instruction (inline)"}),i.jsx("textarea",{id:"claude-compaction-inline","data-testid":"claude-compaction-message-inline",rows:4,value:n.messageInline,onChange:m=>s(x=>({...x,messageInline:m.target.value})),placeholder:"Optional override. Leave blank to use the instruction file path below.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Default asks Claude to read the claude-compaction-restore skill. OpenRig wraps this with marker, transcript, and current-task framing."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-file",className:"text-sm font-medium text-stone-900",children:"Post-compaction restore instruction (file path)"}),i.jsx("input",{id:"claude-compaction-file","data-testid":"claude-compaction-message-file-path",type:"text",value:n.messageFilePath,onChange:m=>s(x=>({...x,messageFilePath:m.target.value})),placeholder:"Path read at hook-fire time for extra restore instructions.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Default points at a user-owned placeholder file. Put mission-specific reading lists or extra restore notes there without changing the canonical skill."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-post-restore-audit",className:"text-sm font-medium text-stone-900",children:"Post-restore audit message"}),i.jsx("textarea",{id:"claude-compaction-post-restore-audit","data-testid":"claude-compaction-post-restore-audit-instruction",rows:4,value:n.postRestoreAuditInstruction,onChange:m=>s(x=>({...x,postRestoreAuditInstruction:m.target.value})),placeholder:"Read the claude-compaction-restore skill and audit restore read depth.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"OpenRig wraps this with the required FULL/PARTIAL/NOT_READ table and no-token-conservation language."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"submit","data-testid":"claude-compaction-policy-submit",disabled:t.isPending,className:"border border-outline px-4 py-2 bg-stone-900 text-white font-medium text-sm disabled:opacity-60",children:t.isPending?"Saving…":"Save policy"}),f&&i.jsx("span",{className:"text-sm text-success","data-testid":"claude-compaction-policy-saved",children:"Saved."}),l&&i.jsx("span",{className:"text-sm text-error","data-testid":"claude-compaction-policy-submit-error",children:l})]})]})]})}function cme(){return i.jsxs(rx,{testId:"settings-page-policies",title:"Policies",children:[i.jsx("p",{className:"mb-6 text-sm text-on-surface-variant max-w-prose",children:"Opt-in policies that affect agent runtime behavior. Each policy ships disabled by default and can be turned on independently."}),i.jsx("div",{className:"flex flex-col gap-6",children:i.jsx(ome,{})})]})}const ume=["summary","body","detail","message","title","text","description"],dme=new Set(["ts","ts_created","ts_updated","ts_emitted","created_at","updated_at","received_at","stream_sort_key","audit_pointer"]);function t2(e,t=40){return e.length<=t?e:e.slice(0,t-1)+"…"}function fme(e){if(e==null)return null;if(typeof e=="string"){const t=e.trim();return t.length>0?t2(t):null}return typeof e=="number"||typeof e=="boolean"?String(e):null}function mP(e){if(!e||typeof e!="object")return"—";const t=e;for(const s of ume){const r=t[s];if(typeof r=="string"&&r.trim().length>0)return t2(r.trim(),200)}const n=[];for(const[s,r]of Object.entries(t)){if(dme.has(s))continue;const a=fme(r);if(a!==null&&(n.push(`${s}=${a}`),n.length>=4))break}if(n.length>0)return n.join(" · ");try{const s=JSON.stringify(t);return t2(s,200)}catch{return"—"}}function hme(){const{events:e}=X2();return i.jsx(rx,{testId:"settings-page-log",title:"Log",children:e.length===0?i.jsx(Ve,{label:"LOG IS QUIET",description:"Activity events from rigs will stream here.",variant:"card",testId:"settings-log-empty"}):i.jsx("ul",{"data-testid":"settings-log-stream",className:"divide-y divide-outline-variant border border-outline-variant max-h-[60vh] overflow-y-auto",children:e.slice(0,100).map(t=>i.jsxs("li",{className:"px-3 py-2 flex items-baseline gap-3 font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant text-[10px] uppercase tracking-wide w-32 shrink-0 truncate",children:t.type}),i.jsx("span",{className:"text-stone-900 truncate",title:mP(t.payload),children:mP(t.payload)})]},t.seq))})})}const gP={active:"bg-success",running:"bg-success",stopped:"bg-stone-400",warning:"bg-warning",error:"bg-tertiary",info:"bg-secondary"},pme={active:"border-success text-success",running:"border-success text-success",stopped:"border-stone-400 text-stone-500",warning:"border-warning text-warning",error:"border-tertiary text-tertiary",info:"border-secondary text-secondary"};function qm({status:e,label:t,variant:n="dot",className:s,labelClassName:r,testId:a}){const l=t??e;return n==="pill"?i.jsxs("span",{"data-testid":a,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",pme[e],s),role:"status","aria-label":l,children:[i.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",gP[e]),"aria-hidden":"true"}),i.jsx("span",{className:r,children:l})]}):i.jsxs("span",{"data-testid":a,className:he("inline-flex items-center gap-1.5",s),role:"status","aria-label":l,children:[i.jsx("span",{className:he("w-2 h-2 rounded-full",gP[e]),"aria-hidden":"true"}),t?i.jsx("span",{className:he("font-mono text-[9px] uppercase tracking-wide text-on-surface-variant",r),children:t}):null]})}async function mme(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function gme(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function xme(){var x;const e=De({queryKey:["daemon","health"],queryFn:mme,refetchInterval:1e4,retry:!1}),t=De({queryKey:["daemon","cmux"],queryFn:gme,refetchInterval:3e4,retry:!1}),{data:n,isLoading:s,error:r}=dr(),{data:a}=Wm(),l=e.isSuccess,u=l?((x=t.data)==null?void 0:x.available)??null:null,f=(n==null?void 0:n.length)??0,d=(a==null?void 0:a.filter(y=>y.runningCount>0).length)??0,p=l?"active":e.isError?"error":e.isLoading?"info":"stopped",m=u===!0?"active":u===!1?"warning":"info";return i.jsxs("div",{"data-testid":"settings-status-panel",className:"space-y-4",children:[i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Daemon"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Reachable"}),i.jsx(qm,{status:p,label:l?"OK":e.isError?"ERROR":e.isLoading?"LOADING":"DISCONNECTED",variant:"pill",testId:"status-daemon"})]})]}),i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Cmux control"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Adapter"}),i.jsx(qm,{status:m,label:u===!0?"AVAILABLE":u===!1?"UNAVAILABLE":"UNKNOWN",variant:"pill",testId:"status-cmux"})]}),i.jsx("div",{className:"mt-1 font-mono text-[10px] text-on-surface-variant",children:"OpenRig can control cmux surfaces for node open-or-focus."})]}),i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Rigs"}),i.jsxs("div",{className:"mt-2 space-y-1.5 font-mono text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Total"}),i.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-total",children:f})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Running"}),i.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-running",children:d})]})]})]})]})}function yme(){return i.jsx(rx,{testId:"settings-page-status",title:"Status",children:i.jsx(xme,{})})}function __({tabs:e,active:t,onSelect:n,testIdPrefix:s="topology-view-mode",trailing:r}){const a=i.jsx("div",{role:"tablist","aria-label":"Topology view modes","data-testid":`${s}-tabs`,className:"flex gap-6 items-center",children:e.map(l=>i.jsx("button",{type:"button",role:"tab","aria-selected":t===l.id,"data-testid":`${s}-tab-${l.id}`,"data-active":t===l.id,onClick:()=>n(l.id),className:he("py-3 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2",t===l.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:l.label},l.id))});return r?i.jsxs("div",{"data-testid":`${s}-tab-bar`,className:"flex items-center",children:[a,i.jsx("div",{"data-testid":`${s}-trailing`,className:"ml-auto",children:r})]}):a}const vme=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"}],Sz=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"},{id:"overview",label:"Overview"}];/**
|
|
520
|
-
* table-core
|
|
521
|
-
*
|
|
522
|
-
* Copyright (c) TanStack
|
|
523
|
-
*
|
|
524
|
-
* This source code is licensed under the MIT license found in the
|
|
525
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
526
|
-
*
|
|
527
|
-
* @license MIT
|
|
528
|
-
*/function ia(e,t){return typeof e=="function"?e(t):e}function ls(e,t){return n=>{t.setState(s=>({...s,[e]:ia(n,s[e])}))}}function ix(e){return e instanceof Function}function bme(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function wme(e,t){const n=[],s=r=>{r.forEach(a=>{n.push(a);const l=t(a);l!=null&&l.length&&s(l)})};return s(e),n}function Oe(e,t,n){let s=[],r;return a=>{let l;n.key&&n.debug&&(l=Date.now());const u=e(a);if(!(u.length!==s.length||u.some((p,m)=>s[m]!==p)))return r;s=u;let d;if(n.key&&n.debug&&(d=Date.now()),r=t(...u),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug&&n!=null&&n.debug()){const p=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-d)*100)/100,x=m/16,y=(b,v)=>{for(b=String(b);b.length<v;)b=" "+b;return b};console.info(`%c⏱ ${y(m,5)} /${y(p,5)} ms`,`
|
|
529
|
-
font-size: .6rem;
|
|
530
|
-
font-weight: bold;
|
|
531
|
-
color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return r}}function Le(e,t,n,s){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[t]},key:!1,onChange:s}}function jme(e,t,n,s){const r=()=>{var l;return(l=a.getValue())!=null?l:e.options.renderFallbackValue},a={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(s),renderValue:r,getContext:Oe(()=>[e,n,t,a],(l,u,f,d)=>({table:l,column:u,row:f,cell:d,getValue:d.getValue,renderValue:d.renderValue}),Le(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(a,n,t,e)},{}),a}function Sme(e,t,n,s){var r,a;const u={...e._getDefaultColumnDef(),...t},f=u.accessorKey;let d=(r=(a=u.id)!=null?a:f?typeof String.prototype.replaceAll=="function"?f.replaceAll(".","_"):f.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:f&&(f.includes(".")?p=x=>{let y=x;for(const v of f.split(".")){var b;y=(b=y)==null?void 0:b[v]}return y}:p=x=>x[u.accessorKey]),!d)throw new Error;let m={id:`${String(d)}`,accessorFn:p,parent:s,depth:n,columnDef:u,columns:[],getFlatColumns:Oe(()=>[!0],()=>{var x;return[m,...(x=m.columns)==null?void 0:x.flatMap(y=>y.getFlatColumns())]},Le(e.options,"debugColumns")),getLeafColumns:Oe(()=>[e._getOrderColumnsFn()],x=>{var y;if((y=m.columns)!=null&&y.length){let b=m.columns.flatMap(v=>v.getLeafColumns());return x(b)}return[m]},Le(e.options,"debugColumns"))};for(const x of e._features)x.createColumn==null||x.createColumn(m,e);return m}const xn="debugHeaders";function xP(e,t,n){var s;let a={id:(s=n.id)!=null?s:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],u=f=>{f.subHeaders&&f.subHeaders.length&&f.subHeaders.map(u),l.push(f)};return u(a),l},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(a,e)}),a}const Nme={createTable:e=>{e.getHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>{var a,l;const u=(a=s==null?void 0:s.map(m=>n.find(x=>x.id===m)).filter(Boolean))!=null?a:[],f=(l=r==null?void 0:r.map(m=>n.find(x=>x.id===m)).filter(Boolean))!=null?l:[],d=n.filter(m=>!(s!=null&&s.includes(m.id))&&!(r!=null&&r.includes(m.id)));return Bp(t,[...u,...d,...f],e)},Le(e.options,xn)),e.getCenterHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>(n=n.filter(a=>!(s!=null&&s.includes(a.id))&&!(r!=null&&r.includes(a.id))),Bp(t,n,e,"center")),Le(e.options,xn)),e.getLeftHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,s)=>{var r;const a=(r=s==null?void 0:s.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Bp(t,a,e,"left")},Le(e.options,xn)),e.getRightHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,s)=>{var r;const a=(r=s==null?void 0:s.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Bp(t,a,e,"right")},Le(e.options,xn)),e.getFooterGroups=Oe(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Le(e.options,xn)),e.getLeftFooterGroups=Oe(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Le(e.options,xn)),e.getCenterFooterGroups=Oe(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Le(e.options,xn)),e.getRightFooterGroups=Oe(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Le(e.options,xn)),e.getFlatHeaders=Oe(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Le(e.options,xn)),e.getLeftFlatHeaders=Oe(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Le(e.options,xn)),e.getCenterFlatHeaders=Oe(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Le(e.options,xn)),e.getRightFlatHeaders=Oe(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Le(e.options,xn)),e.getCenterLeafHeaders=Oe(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Le(e.options,xn)),e.getLeftLeafHeaders=Oe(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Le(e.options,xn)),e.getRightLeafHeaders=Oe(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Le(e.options,xn)),e.getLeafHeaders=Oe(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,s)=>{var r,a,l,u,f,d;return[...(r=(a=t[0])==null?void 0:a.headers)!=null?r:[],...(l=(u=n[0])==null?void 0:u.headers)!=null?l:[],...(f=(d=s[0])==null?void 0:d.headers)!=null?f:[]].map(p=>p.getLeafHeaders()).flat()},Le(e.options,xn))}};function Bp(e,t,n,s){var r,a;let l=0;const u=function(x,y){y===void 0&&(y=1),l=Math.max(l,y),x.filter(b=>b.getIsVisible()).forEach(b=>{var v;(v=b.columns)!=null&&v.length&&u(b.columns,y+1)},0)};u(e);let f=[];const d=(x,y)=>{const b={depth:y,id:[s,`${y}`].filter(Boolean).join("_"),headers:[]},v=[];x.forEach(w=>{const S=[...v].reverse()[0],C=w.column.depth===b.depth;let k,_=!1;if(C&&w.column.parent?k=w.column.parent:(k=w.column,_=!0),S&&(S==null?void 0:S.column)===k)S.subHeaders.push(w);else{const R=xP(n,k,{id:[s,y,k.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${v.filter(T=>T.column===k).length}`:void 0,depth:y,index:v.length});R.subHeaders.push(w),v.push(R)}b.headers.push(w),w.headerGroup=b}),f.push(b),y>0&&d(v,y-1)},p=t.map((x,y)=>xP(n,x,{depth:l,index:y}));d(p,l-1),f.reverse();const m=x=>x.filter(b=>b.column.getIsVisible()).map(b=>{let v=0,w=0,S=[0];b.subHeaders&&b.subHeaders.length?(S=[],m(b.subHeaders).forEach(k=>{let{colSpan:_,rowSpan:R}=k;v+=_,S.push(R)})):v=1;const C=Math.min(...S);return w=w+C,b.colSpan=v,b.rowSpan=w,{colSpan:v,rowSpan:w}});return m((r=(a=f[0])==null?void 0:a.headers)!=null?r:[]),f}const C_=(e,t,n,s,r,a,l)=>{let u={id:t,index:s,original:n,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:f=>{if(u._valuesCache.hasOwnProperty(f))return u._valuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return u._valuesCache[f]=d.accessorFn(u.original,s),u._valuesCache[f]},getUniqueValues:f=>{if(u._uniqueValuesCache.hasOwnProperty(f))return u._uniqueValuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(u._uniqueValuesCache[f]=d.columnDef.getUniqueValues(u.original,s),u._uniqueValuesCache[f]):(u._uniqueValuesCache[f]=[u.getValue(f)],u._uniqueValuesCache[f])},renderValue:f=>{var d;return(d=u.getValue(f))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>wme(u.subRows,f=>f.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let f=[],d=u;for(;;){const p=d.getParentRow();if(!p)break;f.push(p),d=p}return f.reverse()},getAllCells:Oe(()=>[e.getAllLeafColumns()],f=>f.map(d=>jme(e,u,d,d.id)),Le(e.options,"debugRows")),_getAllCellsByColumnId:Oe(()=>[u.getAllCells()],f=>f.reduce((d,p)=>(d[p.column.id]=p,d),{}),Le(e.options,"debugRows"))};for(let f=0;f<e._features.length;f++){const d=e._features[f];d==null||d.createRow==null||d.createRow(u,e)}return u},kme={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Nz=(e,t,n)=>{var s,r;const a=n==null||(s=n.toString())==null?void 0:s.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(a))};Nz.autoRemove=e=>zs(e);const kz=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};kz.autoRemove=e=>zs(e);const _z=(e,t,n)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(n==null?void 0:n.toLowerCase())};_z.autoRemove=e=>zs(e);const Cz=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};Cz.autoRemove=e=>zs(e);const Ez=(e,t,n)=>!n.some(s=>{var r;return!((r=e.getValue(t))!=null&&r.includes(s))});Ez.autoRemove=e=>zs(e)||!(e!=null&&e.length);const Rz=(e,t,n)=>n.some(s=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(s)});Rz.autoRemove=e=>zs(e)||!(e!=null&&e.length);const Az=(e,t,n)=>e.getValue(t)===n;Az.autoRemove=e=>zs(e);const Tz=(e,t,n)=>e.getValue(t)==n;Tz.autoRemove=e=>zs(e);const E_=(e,t,n)=>{let[s,r]=n;const a=e.getValue(t);return a>=s&&a<=r};E_.resolveFilterValue=e=>{let[t,n]=e,s=typeof t!="number"?parseFloat(t):t,r=typeof n!="number"?parseFloat(n):n,a=t===null||Number.isNaN(s)?-1/0:s,l=n===null||Number.isNaN(r)?1/0:r;if(a>l){const u=a;a=l,l=u}return[a,l]};E_.autoRemove=e=>zs(e)||zs(e[0])&&zs(e[1]);const zr={includesString:Nz,includesStringSensitive:kz,equalsString:_z,arrIncludes:Cz,arrIncludesAll:Ez,arrIncludesSome:Rz,equals:Az,weakEquals:Tz,inNumberRange:E_};function zs(e){return e==null||e===""}const _me={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:ls("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);return typeof s=="string"?zr.includesString:typeof s=="number"?zr.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?zr.equals:Array.isArray(s)?zr.arrIncludes:zr.weakEquals},e.getFilterFn=()=>{var n,s;return ix(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?n:zr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,s,r;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(s=>s.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,s;return(n=(s=t.getState().columnFilters)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(s=>{const r=e.getFilterFn(),a=s==null?void 0:s.find(p=>p.id===e.id),l=ia(n,a?a.value:void 0);if(yP(r,l,e)){var u;return(u=s==null?void 0:s.filter(p=>p.id!==e.id))!=null?u:[]}const f={id:e.id,value:l};if(a){var d;return(d=s==null?void 0:s.map(p=>p.id===e.id?f:p))!=null?d:[]}return s!=null&&s.length?[...s,f]:[f]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),s=r=>{var a;return(a=ia(t,r))==null?void 0:a.filter(l=>{const u=n.find(f=>f.id===l.id);if(u){const f=u.getFilterFn();if(yP(f,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var n,s;e.setColumnFilters(t?[]:(n=(s=e.initialState)==null?void 0:s.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function yP(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Cme=(e,t,n)=>n.reduce((s,r)=>{const a=r.getValue(e);return s+(typeof a=="number"?a:0)},0),Eme=(e,t,n)=>{let s;return n.forEach(r=>{const a=r.getValue(e);a!=null&&(s>a||s===void 0&&a>=a)&&(s=a)}),s},Rme=(e,t,n)=>{let s;return n.forEach(r=>{const a=r.getValue(e);a!=null&&(s<a||s===void 0&&a>=a)&&(s=a)}),s},Ame=(e,t,n)=>{let s,r;return n.forEach(a=>{const l=a.getValue(e);l!=null&&(s===void 0?l>=l&&(s=r=l):(s>l&&(s=l),r<l&&(r=l)))}),[s,r]},Tme=(e,t)=>{let n=0,s=0;if(t.forEach(r=>{let a=r.getValue(e);a!=null&&(a=+a)>=a&&(++n,s+=a)}),n)return s/n},Ime=(e,t)=>{if(!t.length)return;const n=t.map(a=>a.getValue(e));if(!bme(n))return;if(n.length===1)return n[0];const s=Math.floor(n.length/2),r=n.sort((a,l)=>a-l);return n.length%2!==0?r[s]:(r[s-1]+r[s])/2},Mme=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Ome=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Lme=(e,t)=>t.length,DS={sum:Cme,min:Eme,max:Rme,extent:Ame,mean:Tme,median:Ime,unique:Mme,uniqueCount:Ome,count:Lme},Pme={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:ls("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(s=>s!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,s;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);if(typeof s=="number")return DS.sum;if(Object.prototype.toString.call(s)==="[object Date]")return DS.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return ix(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?n:DS[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,s;e.setGrouping(t?[]:(n=(s=e.initialState)==null?void 0:s.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const s=t.getColumn(n);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[n]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=n.subRows)!=null&&r.length)}}};function $me(e,t,n){if(!(t!=null&&t.length)||!n)return e;const s=e.filter(a=>!t.includes(a.id));return n==="remove"?s:[...t.map(a=>e.find(l=>l.id===a)).filter(Boolean),...s]}const Dme={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:ls("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Oe(n=>[gd(t,n)],n=>n.findIndex(s=>s.id===e.id),Le(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var s;return((s=gd(t,n)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=n=>{var s;const r=gd(t,n);return((s=r[r.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Oe(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,s)=>r=>{let a=[];if(!(t!=null&&t.length))a=r;else{const l=[...t],u=[...r];for(;u.length&&l.length;){const f=l.shift(),d=u.findIndex(p=>p.id===f);d>-1&&a.push(u.splice(d,1)[0])}a=[...a,...u]}return $me(a,n,s)},Le(e.options,"debugTable"))}},qS=()=>({left:[],right:[]}),qme={getInitialState:e=>({columnPinning:qS(),...e}),getDefaultOptions:e=>({onColumnPinningChange:ls("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const s=e.getLeafColumns().map(r=>r.id).filter(Boolean);t.setColumnPinning(r=>{var a,l;if(n==="right"){var u,f;return{left:((u=r==null?void 0:r.left)!=null?u:[]).filter(m=>!(s!=null&&s.includes(m))),right:[...((f=r==null?void 0:r.right)!=null?f:[]).filter(m=>!(s!=null&&s.includes(m))),...s]}}if(n==="left"){var d,p;return{left:[...((d=r==null?void 0:r.left)!=null?d:[]).filter(m=>!(s!=null&&s.includes(m))),...s],right:((p=r==null?void 0:r.right)!=null?p:[]).filter(m=>!(s!=null&&s.includes(m)))}}return{left:((a=r==null?void 0:r.left)!=null?a:[]).filter(m=>!(s!=null&&s.includes(m))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(m=>!(s!=null&&s.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var r,a,l;return((r=s.columnDef.enablePinning)!=null?r:!0)&&((a=(l=t.options.enableColumnPinning)!=null?l:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(u=>u.id),{left:s,right:r}=t.getState().columnPinning,a=n.some(u=>s==null?void 0:s.includes(u)),l=n.some(u=>r==null?void 0:r.includes(u));return a?"left":l?"right":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();return r?(n=(s=t.getState().columnPinning)==null||(s=s[r])==null?void 0:s.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,s,r)=>{const a=[...s??[],...r??[]];return n.filter(l=>!a.includes(l.column.id))},Le(t.options,"debugRows")),e.getLeftVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,s)=>(s??[]).map(a=>n.find(l=>l.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Le(t.options,"debugRows")),e.getRightVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,s)=>(s??[]).map(a=>n.find(l=>l.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Le(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,s;return e.setColumnPinning(t?qS():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:qS())},e.getIsSomeColumnsPinned=t=>{var n;const s=e.getState().columnPinning;if(!t){var r,a;return!!((r=s.left)!=null&&r.length||(a=s.right)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e.getLeftLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Le(e.options,"debugColumns")),e.getRightLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Le(e.options,"debugColumns")),e.getCenterLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s)=>{const r=[...n??[],...s??[]];return t.filter(a=>!r.includes(a.id))},Le(e.options,"debugColumns"))}};function zme(e){return e||(typeof document<"u"?document:null)}const Fp={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},zS=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Bme={getDefaultColumnDef:()=>Fp,getInitialState:e=>({columnSizing:{},columnSizingInfo:zS(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:ls("columnSizing",e),onColumnSizingInfoChange:ls("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,s,r;const a=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Fp.minSize,(s=a??e.columnDef.size)!=null?s:Fp.size),(r=e.columnDef.maxSize)!=null?r:Fp.maxSize)},e.getStart=Oe(n=>[n,gd(t,n),t.getState().columnSizing],(n,s)=>s.slice(0,e.getIndex(n)).reduce((r,a)=>r+a.getSize(),0),Le(t.options,"debugColumns")),e.getAfter=Oe(n=>[n,gd(t,n),t.getState().columnSizing],(n,s)=>s.slice(e.getIndex(n)+1).reduce((r,a)=>r+a.getSize(),0),Le(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:s,...r}=n;return r})},e.getCanResize=()=>{var n,s;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const s=r=>{if(r.subHeaders.length)r.subHeaders.forEach(s);else{var a;n+=(a=r.column.getSize())!=null?a:0}};return s(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const s=t.getColumn(e.column.id),r=s==null?void 0:s.getCanResize();return a=>{if(!s||!r||(a.persist==null||a.persist(),BS(a)&&a.touches&&a.touches.length>1))return;const l=e.getSize(),u=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[s.id,s.getSize()]],f=BS(a)?Math.round(a.touches[0].clientX):a.clientX,d={},p=(S,C)=>{typeof C=="number"&&(t.setColumnSizingInfo(k=>{var _,R;const T=t.options.columnResizeDirection==="rtl"?-1:1,A=(C-((_=k==null?void 0:k.startOffset)!=null?_:0))*T,I=Math.max(A/((R=k==null?void 0:k.startSize)!=null?R:0),-.999999);return k.columnSizingStart.forEach(L=>{let[$,O]=L;d[$]=Math.round(Math.max(O+O*I,0)*100)/100}),{...k,deltaOffset:A,deltaPercentage:I}}),(t.options.columnResizeMode==="onChange"||S==="end")&&t.setColumnSizing(k=>({...k,...d})))},m=S=>p("move",S),x=S=>{p("end",S),t.setColumnSizingInfo(C=>({...C,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},y=zme(n),b={moveHandler:S=>m(S.clientX),upHandler:S=>{y==null||y.removeEventListener("mousemove",b.moveHandler),y==null||y.removeEventListener("mouseup",b.upHandler),x(S.clientX)}},v={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),m(S.touches[0].clientX),!1),upHandler:S=>{var C;y==null||y.removeEventListener("touchmove",v.moveHandler),y==null||y.removeEventListener("touchend",v.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),x((C=S.touches[0])==null?void 0:C.clientX)}},w=Fme()?{passive:!1}:!1;BS(a)?(y==null||y.addEventListener("touchmove",v.moveHandler,w),y==null||y.addEventListener("touchend",v.upHandler,w)):(y==null||y.addEventListener("mousemove",b.moveHandler,w),y==null||y.addEventListener("mouseup",b.upHandler,w)),t.setColumnSizingInfo(S=>({...S,startOffset:f,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?zS():(n=e.initialState.columnSizingInfo)!=null?n:zS())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0}}};let Hp=null;function Fme(){if(typeof Hp=="boolean")return Hp;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Hp=e,Hp}function BS(e){return e.type==="touchstart"}const Hme={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:ls("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,s;const r=e.columns;return(n=r.length?r.some(a=>a.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?n:!0},e.getCanHide=()=>{var n,s;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Oe(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(s=>s.column.getIsVisible()),Le(t.options,"debugRows")),e.getVisibleCells=Oe(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,s,r)=>[...n,...s,...r],Le(t.options,"debugRows"))},createTable:e=>{const t=(n,s)=>Oe(()=>[s(),s().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Le(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var s;e.setColumnVisibility(n?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=n=>{var s;n=(s=n)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,a)=>({...r,[a.id]:n||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var s;e.toggleAllColumnsVisible((s=n.target)==null?void 0:s.checked)}}};function gd(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ume={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Vme={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:ls("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const s=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,s,r,a;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>zr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:s}=e.options;return ix(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[s])!=null?t:zr[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Gme={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:ls("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var r,a;e.setExpanded(s?{}:(r=(a=e.initialState)==null?void 0:a.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const l=a.split(".");s=Math.max(s,l.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(s=>{var r;const a=s===!0?!0:!!(s!=null&&s[e.id]);let l={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=s,n=(r=n)!=null?r:!a,!a&&n)return{...l,[e.id]:!0};if(a&&!n){const{[e.id]:u,...f}=l;return f}return s})},e.getIsExpanded=()=>{var n;const s=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var n,s,r;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((s=t.options.enableExpanding)!=null?s:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let n=!0,s=e;for(;n&&s.parentId;)s=t.getRow(s.parentId,!0),n=s.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},n2=0,s2=10,FS=()=>({pageIndex:n2,pageSize:s2}),Kme={getInitialState:e=>({...e,pagination:{...FS(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:ls("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=s=>{const r=a=>ia(s,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=s=>{var r;e.setPagination(s?FS():(r=e.initialState.pagination)!=null?r:FS())},e.setPageIndex=s=>{e.setPagination(r=>{let a=ia(s,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,l)),{...r,pageIndex:a}})},e.resetPageIndex=s=>{var r,a;e.setPageIndex(s?n2:(r=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?r:n2)},e.resetPageSize=s=>{var r,a;e.setPageSize(s?s2:(r=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?r:s2)},e.setPageSize=s=>{e.setPagination(r=>{const a=Math.max(1,ia(s,r.pageSize)),l=r.pageSize*r.pageIndex,u=Math.floor(l/a);return{...r,pageIndex:u,pageSize:a}})},e.setPageCount=s=>e.setPagination(r=>{var a;let l=ia(s,(a=e.options.pageCount)!=null?a:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=Oe(()=>[e.getPageCount()],s=>{let r=[];return s&&s>0&&(r=[...new Array(s)].fill(null).map((a,l)=>l)),r},Le(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:s<r-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},HS=()=>({top:[],bottom:[]}),Wme={getInitialState:e=>({rowPinning:HS(),...e}),getDefaultOptions:e=>({onRowPinningChange:ls("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,s,r)=>{const a=s?e.getLeafRows().map(f=>{let{id:d}=f;return d}):[],l=r?e.getParentRows().map(f=>{let{id:d}=f;return d}):[],u=new Set([...l,e.id,...a]);t.setRowPinning(f=>{var d,p;if(n==="bottom"){var m,x;return{top:((m=f==null?void 0:f.top)!=null?m:[]).filter(v=>!(u!=null&&u.has(v))),bottom:[...((x=f==null?void 0:f.bottom)!=null?x:[]).filter(v=>!(u!=null&&u.has(v))),...Array.from(u)]}}if(n==="top"){var y,b;return{top:[...((y=f==null?void 0:f.top)!=null?y:[]).filter(v=>!(u!=null&&u.has(v))),...Array.from(u)],bottom:((b=f==null?void 0:f.bottom)!=null?b:[]).filter(v=>!(u!=null&&u.has(v)))}}return{top:((d=f==null?void 0:f.top)!=null?d:[]).filter(v=>!(u!=null&&u.has(v))),bottom:((p=f==null?void 0:f.bottom)!=null?p:[]).filter(v=>!(u!=null&&u.has(v)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:s,enablePinning:r}=t.options;return typeof s=="function"?s(e):(n=s??r)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:s,bottom:r}=t.getState().rowPinning,a=n.some(u=>s==null?void 0:s.includes(u)),l=n.some(u=>r==null?void 0:r.includes(u));return a?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();if(!r)return-1;const a=(n=r==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(l=>{let{id:u}=l;return u});return(s=a==null?void 0:a.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,s;return e.setRowPinning(t?HS():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:HS())},e.getIsSomeRowsPinned=t=>{var n;const s=e.getState().rowPinning;if(!t){var r,a;return!!((r=s.top)!=null&&r.length||(a=s.bottom)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e._getPinnedRows=(t,n,s)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(n??[]).map(l=>{const u=e.getRow(l,!0);return u.getIsAllParentsExpanded()?u:null}):(n??[]).map(l=>t.find(u=>u.id===l))).filter(Boolean).map(l=>({...l,position:s}))},e.getTopRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Le(e.options,"debugRows")),e.getBottomRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Le(e.options,"debugRows")),e.getCenterRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,s)=>{const r=new Set([...n??[],...s??[]]);return t.filter(a=>!r.has(a.id))},Le(e.options,"debugRows"))}},Yme={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:ls("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...n},r=e.getPreGroupedRowModel().flatRows;return t?r.forEach(a=>{a.getCanSelect()&&(s[a.id]=!0)}):r.forEach(a=>{delete s[a.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),r={...n};return e.getRowModel().rows.forEach(a=>{r2(r,a.id,s,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?US(e,n):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getFilteredSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?US(e,n):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getGroupedSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?US(e,n):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let s=!!(t.length&&Object.keys(n).length);return s&&t.some(r=>r.getCanSelect()&&!n[r.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:n}=e.getState();let s=!!t.length;return s&&t.some(r=>!n[r.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,s)=>{const r=e.getIsSelected();t.setRowSelection(a=>{var l;if(n=typeof n<"u"?n:!r,e.getCanSelect()&&r===n)return a;const u={...a};return r2(u,e.id,n,(l=s==null?void 0:s.selectChildren)!=null?l:!0,t),u})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return R_(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return i2(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return i2(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return s=>{var r;n&&e.toggleSelected((r=s.target)==null?void 0:r.checked)}}}},r2=(e,t,n,s,r)=>{var a;const l=r.getRow(t,!0);n?(l.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),l.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(a=l.subRows)!=null&&a.length&&l.getCanSelectSubRows()&&l.subRows.forEach(u=>r2(e,u.id,n,s,r))};function US(e,t){const n=e.getState().rowSelection,s=[],r={},a=function(l,u){return l.map(f=>{var d;const p=R_(f,n);if(p&&(s.push(f),r[f.id]=f),(d=f.subRows)!=null&&d.length&&(f={...f,subRows:a(f.subRows)}),p)return f}).filter(Boolean)};return{rows:a(t.rows),flatRows:s,rowsById:r}}function R_(e,t){var n;return(n=t[e.id])!=null?n:!1}function i2(e,t,n){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let r=!0,a=!1;return e.subRows.forEach(l=>{if(!(a&&!r)&&(l.getCanSelect()&&(R_(l,t)?a=!0:r=!1),l.subRows&&l.subRows.length)){const u=i2(l,t);u==="all"?a=!0:(u==="some"&&(a=!0),r=!1)}}),r?"all":a?"some":!1}const a2=/([0-9]+)/gm,Qme=(e,t,n)=>Iz(xa(e.getValue(n)).toLowerCase(),xa(t.getValue(n)).toLowerCase()),Xme=(e,t,n)=>Iz(xa(e.getValue(n)),xa(t.getValue(n))),Zme=(e,t,n)=>A_(xa(e.getValue(n)).toLowerCase(),xa(t.getValue(n)).toLowerCase()),Jme=(e,t,n)=>A_(xa(e.getValue(n)),xa(t.getValue(n))),ege=(e,t,n)=>{const s=e.getValue(n),r=t.getValue(n);return s>r?1:s<r?-1:0},tge=(e,t,n)=>A_(e.getValue(n),t.getValue(n));function A_(e,t){return e===t?0:e>t?1:-1}function xa(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Iz(e,t){const n=e.split(a2).filter(Boolean),s=t.split(a2).filter(Boolean);for(;n.length&&s.length;){const r=n.shift(),a=s.shift(),l=parseInt(r,10),u=parseInt(a,10),f=[l,u].sort();if(isNaN(f[0])){if(r>a)return 1;if(a>r)return-1;continue}if(isNaN(f[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return n.length-s.length}const Ju={alphanumeric:Qme,alphanumericCaseSensitive:Xme,text:Zme,textCaseSensitive:Jme,datetime:ege,basic:tge},nge={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:ls("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const r of n){const a=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Ju.datetime;if(typeof a=="string"&&(s=!0,a.split(a2).length>1))return Ju.alphanumeric}return s?Ju.text:Ju.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,s;if(!e)throw new Error;return ix(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?n:Ju[e.columnDef.sortingFn]},e.toggleSorting=(n,s)=>{const r=e.getNextSortingOrder(),a=typeof n<"u"&&n!==null;t.setSorting(l=>{const u=l==null?void 0:l.find(y=>y.id===e.id),f=l==null?void 0:l.findIndex(y=>y.id===e.id);let d=[],p,m=a?n:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&s?u?p="toggle":p="add":l!=null&&l.length&&f!==l.length-1?p="replace":u?p="toggle":p="replace",p==="toggle"&&(a||r||(p="remove")),p==="add"){var x;d=[...l,{id:e.id,desc:m}],d.splice(0,d.length-((x=t.options.maxMultiSortColCount)!=null?x:Number.MAX_SAFE_INTEGER))}else p==="toggle"?d=l.map(y=>y.id===e.id?{...y,desc:m}:y):p==="remove"?d=l.filter(y=>y.id!==e.id):d=[{id:e.id,desc:m}];return d})},e.getFirstSortDir=()=>{var n,s;return((n=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var s,r;const a=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==a&&((s=t.options.enableSortingRemoval)==null||s)&&(!(n&&(r=t.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":a},e.getCanSort=()=>{var n,s;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,s;return(n=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const s=(n=t.getState().sorting)==null?void 0:n.find(r=>r.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,s;return(n=(s=t.getState().sorting)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return s=>{n&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,s;e.setSorting(t?[]:(n=(s=e.initialState)==null?void 0:s.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},sge=[Nme,Hme,Dme,qme,kme,_me,Ume,Vme,nge,Pme,Gme,Kme,Wme,Yme,Bme];function rge(e){var t,n;const s=[...sge,...(t=e._features)!=null?t:[]];let r={_features:s};const a=r._features.reduce((x,y)=>Object.assign(x,y.getDefaultOptions==null?void 0:y.getDefaultOptions(r)),{}),l=x=>r.options.mergeOptions?r.options.mergeOptions(a,x):{...a,...x};let f={...{},...(n=e.initialState)!=null?n:{}};r._features.forEach(x=>{var y;f=(y=x.getInitialState==null?void 0:x.getInitialState(f))!=null?y:f});const d=[];let p=!1;const m={_features:s,options:{...a,...e},initialState:f,_queue:x=>{d.push(x),p||(p=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();p=!1}).catch(y=>setTimeout(()=>{throw y})))},reset:()=>{r.setState(r.initialState)},setOptions:x=>{const y=ia(x,r.options);r.options=l(y)},getState:()=>r.options.state,setState:x=>{r.options.onStateChange==null||r.options.onStateChange(x)},_getRowId:(x,y,b)=>{var v;return(v=r.options.getRowId==null?void 0:r.options.getRowId(x,y,b))!=null?v:`${b?[b.id,y].join("."):y}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(x,y)=>{let b=(y?r.getPrePaginationRowModel():r.getRowModel()).rowsById[x];if(!b&&(b=r.getCoreRowModel().rowsById[x],!b))throw new Error;return b},_getDefaultColumnDef:Oe(()=>[r.options.defaultColumn],x=>{var y;return x=(y=x)!=null?y:{},{header:b=>{const v=b.header.column.columnDef;return v.accessorKey?v.accessorKey:v.accessorFn?v.id:null},cell:b=>{var v,w;return(v=(w=b.renderValue())==null||w.toString==null?void 0:w.toString())!=null?v:null},...r._features.reduce((b,v)=>Object.assign(b,v.getDefaultColumnDef==null?void 0:v.getDefaultColumnDef()),{}),...x}},Le(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Oe(()=>[r._getColumnDefs()],x=>{const y=function(b,v,w){return w===void 0&&(w=0),b.map(S=>{const C=Sme(r,S,w,v),k=S;return C.columns=k.columns?y(k.columns,C,w+1):[],C})};return y(x)},Le(e,"debugColumns")),getAllFlatColumns:Oe(()=>[r.getAllColumns()],x=>x.flatMap(y=>y.getFlatColumns()),Le(e,"debugColumns")),_getAllFlatColumnsById:Oe(()=>[r.getAllFlatColumns()],x=>x.reduce((y,b)=>(y[b.id]=b,y),{}),Le(e,"debugColumns")),getAllLeafColumns:Oe(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(x,y)=>{let b=x.flatMap(v=>v.getLeafColumns());return y(b)},Le(e,"debugColumns")),getColumn:x=>r._getAllFlatColumnsById()[x]};Object.assign(r,m);for(let x=0;x<r._features.length;x++){const y=r._features[x];y==null||y.createTable==null||y.createTable(r)}return r}function ige(){return e=>Oe(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},s=function(r,a,l){a===void 0&&(a=0);const u=[];for(let d=0;d<r.length;d++){const p=C_(e,e._getRowId(r[d],d,l),r[d],d,a,void 0,l==null?void 0:l.id);if(n.flatRows.push(p),n.rowsById[p.id]=p,u.push(p),e.options.getSubRows){var f;p.originalSubRows=e.options.getSubRows(r[d],d),(f=p.originalSubRows)!=null&&f.length&&(p.subRows=s(p.originalSubRows,a+1,p))}}return u};return n.rows=s(t),n},Le(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function age(e,t,n){return n.options.filterFromLeafRows?oge(e,t,n):lge(e,t,n)}function oge(e,t,n){var s;const r=[],a={},l=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(f,d){d===void 0&&(d=0);const p=[];for(let x=0;x<f.length;x++){var m;let y=f[x];const b=C_(n,y.id,y.original,y.index,y.depth,void 0,y.parentId);if(b.columnFilters=y.columnFilters,(m=y.subRows)!=null&&m.length&&d<l){if(b.subRows=u(y.subRows,d+1),y=b,t(y)&&!b.subRows.length){p.push(y),a[y.id]=y,r.push(y);continue}if(t(y)||b.subRows.length){p.push(y),a[y.id]=y,r.push(y);continue}}else y=b,t(y)&&(p.push(y),a[y.id]=y,r.push(y))}return p};return{rows:u(e),flatRows:r,rowsById:a}}function lge(e,t,n){var s;const r=[],a={},l=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(f,d){d===void 0&&(d=0);const p=[];for(let x=0;x<f.length;x++){let y=f[x];if(t(y)){var m;if((m=y.subRows)!=null&&m.length&&d<l){const v=C_(n,y.id,y.original,y.index,y.depth,void 0,y.parentId);v.subRows=u(y.subRows,d+1),y=v}p.push(y),r.push(y),a[y.id]=y}}return p};return{rows:u(e),flatRows:r,rowsById:a}}function cge(){return e=>Oe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,s)=>{if(!t.rows.length||!(n!=null&&n.length)&&!s){for(let x=0;x<t.flatRows.length;x++)t.flatRows[x].columnFilters={},t.flatRows[x].columnFiltersMeta={};return t}const r=[],a=[];(n??[]).forEach(x=>{var y;const b=e.getColumn(x.id);if(!b)return;const v=b.getFilterFn();v&&r.push({id:x.id,filterFn:v,resolvedValue:(y=v.resolveFilterValue==null?void 0:v.resolveFilterValue(x.value))!=null?y:x.value})});const l=(n??[]).map(x=>x.id),u=e.getGlobalFilterFn(),f=e.getAllLeafColumns().filter(x=>x.getCanGlobalFilter());s&&u&&f.length&&(l.push("__global__"),f.forEach(x=>{var y;a.push({id:x.id,filterFn:u,resolvedValue:(y=u.resolveFilterValue==null?void 0:u.resolveFilterValue(s))!=null?y:s})}));let d,p;for(let x=0;x<t.flatRows.length;x++){const y=t.flatRows[x];if(y.columnFilters={},r.length)for(let b=0;b<r.length;b++){d=r[b];const v=d.id;y.columnFilters[v]=d.filterFn(y,v,d.resolvedValue,w=>{y.columnFiltersMeta[v]=w})}if(a.length){for(let b=0;b<a.length;b++){p=a[b];const v=p.id;if(p.filterFn(y,v,p.resolvedValue,w=>{y.columnFiltersMeta[v]=w})){y.columnFilters.__global__=!0;break}}y.columnFilters.__global__!==!0&&(y.columnFilters.__global__=!1)}}const m=x=>{for(let y=0;y<l.length;y++)if(x.columnFilters[l[y]]===!1)return!1;return!0};return age(t.rows,m,e)},Le(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function uge(){return e=>Oe(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const s=e.getState().sorting,r=[],a=s.filter(f=>{var d;return(d=e.getColumn(f.id))==null?void 0:d.getCanSort()}),l={};a.forEach(f=>{const d=e.getColumn(f.id);d&&(l[f.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const u=f=>{const d=f.map(p=>({...p}));return d.sort((p,m)=>{for(let y=0;y<a.length;y+=1){var x;const b=a[y],v=l[b.id],w=v.sortUndefined,S=(x=b==null?void 0:b.desc)!=null?x:!1;let C=0;if(w){const k=p.getValue(b.id),_=m.getValue(b.id),R=k===void 0,T=_===void 0;if(R||T){if(w==="first")return R?-1:1;if(w==="last")return R?1:-1;C=R&&T?0:R?w:-w}}if(C===0&&(C=v.sortingFn(p,m,b.id)),C!==0)return S&&(C*=-1),v.invertSorting&&(C*=-1),C}return p.index-m.index}),d.forEach(p=>{var m;r.push(p),(m=p.subRows)!=null&&m.length&&(p.subRows=u(p.subRows))}),d};return{rows:u(n.rows),flatRows:r,rowsById:n.rowsById}},Le(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
532
|
-
* react-table
|
|
533
|
-
*
|
|
534
|
-
* Copyright (c) TanStack
|
|
535
|
-
*
|
|
536
|
-
* This source code is licensed under the MIT license found in the
|
|
537
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
538
|
-
*
|
|
539
|
-
* @license MIT
|
|
540
|
-
*/function vP(e,t){return e?dge(e)?E.createElement(e,t):e:null}function dge(e){return fge(e)||typeof e=="function"||hge(e)}function fge(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function hge(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function pge(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=E.useState(()=>({current:rge(t)})),[s,r]=E.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...s,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),n.current}const Mz=E.forwardRef(({className:e,testId:t,...n},s)=>i.jsx("input",{ref:s,"data-testid":t,className:he("block w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs text-stone-900","hover:bg-stone-50 focus:border-stone-900 focus:bg-white focus:outline-none","disabled:bg-stone-100 disabled:text-stone-400 disabled:cursor-not-allowed",e),...n}));Mz.displayName="VellumInput";async function mge(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function gge(e){return e==="running"||e==="ready"?"running":e==="active"?"active":e==="stopped"?"stopped":e==="attention_required"||e==="warning"?"warning":e==="failed"||e==="error"?"error":"info"}function xge({row:e}){const t=N_();return i.jsxs("button",{type:"button","data-testid":`topology-table-cmux-${e.logicalId}`,onClick:n=>{n.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},"aria-busy":t.isPending||void 0,"aria-label":`${t.isPending?"Opening":"Open"} ${e.logicalId} in cmux`,title:t.isPending?"Opening in cmux":"Open in cmux",disabled:t.isPending,className:"inline-flex h-7 w-7 items-center justify-center border border-outline-variant bg-white/65 text-stone-700 shadow-[1px_1px_0_rgba(46,52,46,0.12)] transition-colors hover:bg-stone-100 hover:text-stone-950 focus:outline-none focus:ring-2 focus:ring-stone-900/20 disabled:cursor-wait disabled:opacity-60",children:[i.jsx(Pe,{tool:"cmux",size:"sm"}),i.jsx("span",{className:"sr-only",children:"CMUX"})]})}const Oz=E.memo(function({status:t,activityState:n}){const s=gge(t),r=t==="running"||t==="ready",a=r&&n==="active",u=a?"active":r&&!a?"idle":t,f=a?"topology-table-active-shimmer":"";return i.jsx("span",{"data-testid":`topology-table-status-${n??"unknown"}`,"data-activity-state":n??null,children:i.jsx(qm,{status:s,label:u,variant:"pill",labelClassName:f})})});Oz.displayName="StatusCell";const Lz=E.memo(function({row:t}){const n=t.contextUsage,s=(n==null?void 0:n.availability)==="known"&&typeof n.usedPercentage=="number";return i.jsx("span",{"data-testid":`topology-table-context-${t.logicalId}`,className:`font-mono text-xs font-bold ${oq(n==null?void 0:n.usedPercentage,n==null?void 0:n.fresh,n==null?void 0:n.availability)}`,title:s?(n==null?void 0:n.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:s?`${n.usedPercentage}%`:"--"})},(e,t)=>{const n=e.row.contextUsage,s=t.row.contextUsage;return e.row.logicalId===t.row.logicalId&&(n==null?void 0:n.availability)===(s==null?void 0:s.availability)&&(n==null?void 0:n.usedPercentage)===(s==null?void 0:s.usedPercentage)&&(n==null?void 0:n.fresh)===(s==null?void 0:s.fresh)});Lz.displayName="ContextCell";const Pz=E.memo(function({row:t}){const n=t.contextUsage,s=ma(n==null?void 0:n.totalInputTokens,n==null?void 0:n.totalOutputTokens),r=yf(s),a=Og(n==null?void 0:n.totalInputTokens,n==null?void 0:n.totalOutputTokens);return i.jsx("span",{"data-testid":`topology-table-tokens-${t.logicalId}`,className:`font-mono text-xs font-bold ${r?"text-stone-500":"text-stone-300"}`,title:a??"Token sample unavailable",children:r??"--"})},(e,t)=>{const n=e.row.contextUsage,s=t.row.contextUsage;return e.row.logicalId===t.row.logicalId&&(n==null?void 0:n.totalInputTokens)===(s==null?void 0:s.totalInputTokens)&&(n==null?void 0:n.totalOutputTokens)===(s==null?void 0:s.totalOutputTokens)});Pz.displayName="TokenCell";function yge(){return[{accessorKey:"rigName",header:"Rig",cell:({getValue:e})=>i.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"podName",header:"Pod",cell:({getValue:e})=>i.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"logicalId",header:"Agent",cell:({row:e})=>{var t,n;return i.jsx($k,{as:"span",state:((t=e.original.activityRing)==null?void 0:t.state)??"idle",flash:((n=e.original.activityRing)==null?void 0:n.flash)??null,reducedMotion:e.original.reducedMotion,testId:`topology-table-activity-ring-${e.original.logicalId}`,className:"inline-flex rounded-sm",ringClassName:"-inset-1",children:i.jsx("span",{className:"inline-flex min-w-0 items-center gap-1.5 font-mono text-xs",children:i.jsx("span",{className:"truncate",children:e.original.logicalId})})})}},{accessorKey:"runtime",header:"Runtime",cell:({getValue:e})=>i.jsx(Kn,{runtime:String(e()??""),size:"xs",compact:!0,variant:"inline"})},{id:"context",header:"Context",sortingFn:(e,t)=>{var n,s;return(((n=e.original.contextUsage)==null?void 0:n.usedPercentage)??-1)-(((s=t.original.contextUsage)==null?void 0:s.usedPercentage)??-1)},cell:({row:e})=>i.jsx(Lz,{row:e.original})},{id:"tokens",header:"Tokens",sortingFn:(e,t)=>{var r,a,l,u;const n=ma((r=e.original.contextUsage)==null?void 0:r.totalInputTokens,(a=e.original.contextUsage)==null?void 0:a.totalOutputTokens)??-1,s=ma((l=t.original.contextUsage)==null?void 0:l.totalInputTokens,(u=t.original.contextUsage)==null?void 0:u.totalOutputTokens)??-1;return n-s},cell:({row:e})=>i.jsx(Pz,{row:e.original})},{accessorKey:"status",header:"Status",cell:({getValue:e,row:t})=>{var n;return i.jsx(Oz,{status:String(e()),activityState:(n=t.original.activityRing)==null?void 0:n.state})}},{id:"actions",header:"Actions",enableSorting:!1,cell:({row:e})=>i.jsxs("span",{className:"inline-flex items-center gap-1.5","data-testid":`topology-table-actions-${e.original.logicalId}`,children:[i.jsx(xge,{row:e.original}),e.original.rigId?i.jsx(Mg,{rigId:e.original.rigId,logicalId:e.original.logicalId,sessionName:e.original.sessionName??null,reducedMotion:!1,testIdPrefix:`topology-table-${e.original.logicalId}`,buttonClassName:"inline-flex h-7 w-7 items-center justify-center border border-outline-variant bg-white/65 text-stone-700 shadow-[1px_1px_0_rgba(46,52,46,0.12)] transition-colors hover:bg-stone-100 hover:text-stone-950 focus:outline-none focus:ring-2 focus:ring-stone-900/20"}):null]})}]}function T_({rigIdScope:e,podNameScope:t}){const n=zt(),{data:s}=dr(),r=a_(),a=E.useMemo(()=>e?(s==null?void 0:s.filter(S=>S.id===e))??[]:s??[],[s,e]),l=ef({queries:a.map(S=>({queryKey:["rig",S.id,"nodes"],queryFn:()=>mge(S.id),refetchInterval:3e4}))}),u=E.useMemo(()=>{const S=[];for(let C=0;C<a.length;C++){const k=a[C],_=l[C];if(!k||!_)continue;const R=_.data??[],T=t?R.filter(A=>(A.podNamespace??A.podId)===t):R;for(const A of T)S.push({rigId:k.id,rigName:k.name,podName:ir(A.logicalId)??"default",logicalId:A.logicalId,sessionName:A.canonicalSessionName??A.logicalId,runtime:A.runtime??"-",status:A.sessionStatus??"unknown",startupStatus:A.startupStatus??null,contextUsage:A.contextUsage??null,agentActivity:A.agentActivity??null,currentQitems:A.currentQitems??[]})}return S},[a,l,t]),f=E.useMemo(()=>Zg(u.map(S=>({nodeId:`${S.rigId}::${S.logicalId}`,rigId:S.rigId,rigName:S.rigName,logicalId:S.logicalId,canonicalSessionName:S.sessionName,agentActivity:S.agentActivity??null,currentQitems:S.currentQitems??null,startupStatus:S.startupStatus}))),[u]),d=Jg(f),p=E.useMemo(()=>u.map(S=>({...S,activityRing:d.getNodeActivity(`${S.rigId}::${S.logicalId}`,S),reducedMotion:r})),[u,d,r]),[m,x]=E.useState([]),[y,b]=E.useState(""),v=E.useMemo(()=>yge(),[]),w=pge({data:p,columns:v,state:{sorting:m,globalFilter:y},onSortingChange:x,onGlobalFilterChange:b,getCoreRowModel:ige(),getSortedRowModel:uge(),getFilteredRowModel:cge(),globalFilterFn:(S,C,k)=>{const _=String(k??"").toLowerCase();if(!_)return!0;const R=S.original;return R.rigName.toLowerCase().includes(_)||R.podName.toLowerCase().includes(_)||R.logicalId.toLowerCase().includes(_)||R.runtime.toLowerCase().includes(_)||R.status.toLowerCase().includes(_)}});return i.jsxs("div",{"data-testid":"topology-table-view",className:"space-y-3 mt-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Mz,{placeholder:"Filter agents...",value:y,onChange:S=>b(S.target.value),className:"max-w-xs",testId:"topology-table-search"}),i.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide text-on-surface-variant ml-auto",children:[w.getFilteredRowModel().rows.length," of ",p.length]})]}),i.jsx("div",{className:"border border-outline-variant overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{className:"bg-stone-50 border-b border-outline-variant",children:w.getHeaderGroups().map(S=>i.jsx("tr",{children:S.headers.map(C=>i.jsxs("th",{onClick:C.column.getToggleSortingHandler(),className:"px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant cursor-pointer select-none",children:[vP(C.column.columnDef.header,C.getContext()),{asc:" ↑",desc:" ↓"}[C.column.getIsSorted()]??null]},C.id))},S.id))}),i.jsx("tbody",{children:w.getRowModel().rows.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:v.length,className:"px-3 py-6 text-center font-mono text-xs text-on-surface-variant",children:"No agents match."})}):w.getRowModel().rows.map(S=>i.jsx("tr",{"data-testid":`topology-table-row-${S.original.logicalId}`,onClick:()=>n({to:"/topology/seat/$rigId/$logicalId",params:{rigId:S.original.rigId,logicalId:encodeURIComponent(S.original.logicalId)}}),className:"group border-b border-outline-variant last:border-b-0 hover:bg-surface-low focus-within:bg-surface-low cursor-pointer",children:S.getVisibleCells().map(C=>i.jsx("td",{className:"px-3 py-2",children:vP(C.column.columnDef.cell,C.getContext())},C.id))},S.id))})]})})]})}async function vge({rigId:e}){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/cmux/launch`,{method:"POST"});if(!t.ok){let n=null;try{n=await t.json()}catch{}const s=(n==null?void 0:n.message)??(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Error(s)}return await t.json()}const bge=6e3,wge=8e3;function jge({rigId:e}){const t=E.useRef(null),n=E.useRef(null),s=E.useRef(!1),r=E.useRef(null);E.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const a=d=>{const p=t.current;p&&(p.disabled=d,p.setAttribute("aria-busy",d?"true":"false"),p.textContent=d?"Launching...":"Launch in CMUX")},l=()=>{const d=n.current;d&&(d.hidden=!0,d.textContent="",d.removeAttribute("data-status-kind"))},u=(d,p)=>{const m=n.current;m&&(m.hidden=!1,m.textContent=p,m.setAttribute("data-status-kind",d),m.className=d==="error"?"font-mono text-[10px] text-rose-700 max-w-2xl leading-relaxed whitespace-normal break-words":"font-mono text-[10px] text-emerald-700 max-w-2xl leading-relaxed whitespace-normal break-words",r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(l,d==="success"?bge:wge))},f=()=>{s.current||(s.current=!0,a(!0),l(),vge({rigId:e}).then(d=>{const p=d.workspaces.length,m=d.workspaces.reduce((y,b)=>y+b.agents.length,0),x=d.workspaces.map(y=>y.name).join(", ");u("success",p===1?`Launched cmux workspace "${x}" with ${m} agent${m===1?"":"s"}.`:`Launched ${p} cmux workspaces (${x}) with ${m} agents total.`)}).catch(d=>{u("error",d.message)}).finally(()=>{s.current=!1,a(!1)}))};return i.jsxs("div",{"data-testid":"launch-cmux-wrapper",className:"hidden lg:inline-flex items-center gap-3 ml-auto",children:[i.jsx("button",{ref:t,type:"button","data-testid":"launch-cmux-button",onClick:f,className:"border border-stone-700 bg-white px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-stone-900 hover:bg-stone-100 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-1 focus:ring-stone-400",children:"Launch in CMUX"}),i.jsx("span",{ref:n,hidden:!0,"data-testid":"launch-cmux-status",role:"status","aria-live":"polite",className:"font-mono text-[10px] text-emerald-700 max-w-2xl leading-relaxed whitespace-normal break-words"})]})}const VS=12;function Sge(e){var t;return((t=e.agentActivity)==null?void 0:t.state)==="running"}function Nge({seat:e}){const t=e.contextUsage,n=(t==null?void 0:t.availability)==="known"&&typeof t.usedPercentage=="number";return i.jsx("span",{"data-testid":`terminal-card-context-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${oq(t==null?void 0:t.usedPercentage,t==null?void 0:t.fresh,t==null?void 0:t.availability)}`,title:n?(t==null?void 0:t.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:n?`${t.usedPercentage}%`:"--"})}function kge({seat:e}){const t=e.contextUsage,n=ma(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens),s=yf(n),r=Og(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens);return i.jsx("span",{"data-testid":`terminal-card-tokens-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${s?"text-stone-500":"text-stone-300"}`,title:r??"Token sample unavailable",children:s??"--"})}const _ge="openrig:topology-terminal-preview";function Cge({seat:e}){const t=e.canonicalSessionName??e.logicalId,n=Sge(e),s=ig(e.logicalId),r=`${e.rigId??"unknown"}:${e.logicalId}`,a=()=>{window.dispatchEvent(new CustomEvent(_ge,{detail:{key:r}}))};return i.jsxs("div",{"data-testid":`terminal-card-${e.rigId}-${e.logicalId}`,"data-active":n?"true":"false",className:he("relative border bg-white/40 p-2 flex flex-col gap-2",n?"border-secondary terminal-card-active":"border-outline-variant"),children:[i.jsx("button",{type:"button",onClick:a,"aria-label":`Open ${s} terminal preview`,className:"absolute inset-0 z-10 cursor-pointer bg-transparent focus:outline-none focus:ring-2 focus:ring-stone-900/20","data-testid":`terminal-card-trigger-${e.rigId}-${e.logicalId}`}),e.rigId?i.jsx(Mg,{rigId:e.rigId,logicalId:e.logicalId,sessionName:t,reducedMotion:!1,testIdPrefix:`terminal-grid-${e.rigId}-${e.logicalId}`,wrapperClassName:"absolute right-1 top-1 z-20",renderTrigger:!1}):null,i.jsxs("header",{className:"relative z-0 flex items-center justify-between gap-2 pointer-events-none",children:[i.jsx("span",{className:"font-mono text-[8px] font-semibold uppercase tracking-[0.10em] text-stone-900 truncate",children:s}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[i.jsx(Kn,{runtime:e.runtime,size:"xs",compact:!0,variant:"inline"}),i.jsx(Nge,{seat:e}),i.jsx(kge,{seat:e})]})]}),i.jsx("div",{className:"relative z-0 pointer-events-none",children:i.jsx(Ig,{sessionName:t,lines:20,testIdPrefix:`terminal-preview-${e.rigId}-${e.logicalId}`})})]})}function $z({seats:e,emptyLabel:t,emptyDescription:n}){const[s,r]=E.useState(!1),a=s?e:e.slice(0,VS),l=e.length>VS;return e.length===0?i.jsx(Ve,{label:t,description:n,variant:"card",testId:"topology-terminal-empty"}):i.jsxs("div",{"data-testid":"topology-terminal-grid",className:"space-y-3",children:[i.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant flex items-center justify-between",children:[i.jsxs("span",{"data-testid":"topology-terminal-count",children:["showing ",a.length," of ",e.length," terminal",e.length===1?"":"s"]}),l?i.jsx("button",{type:"button","data-testid":"topology-terminal-show-toggle",onClick:()=>r(u=>!u),className:"px-2 py-0.5 border border-outline-variant font-mono text-[9px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:s?`show first ${VS}`:`show all ${e.length}`}):null]}),i.jsx("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:a.map(u=>i.jsx(Cge,{seat:u},`${u.rigId}-${u.logicalId}`))})]})}function Ege({rigId:e,rigName:t}){const{data:n}=Q2(e),s=E.useMemo(()=>(n??[]).filter(r=>r.nodeKind!=="infrastructure"),[n]);return s.length===0?null:i.jsxs("section",{"data-testid":`topology-terminal-rig-${e}`,className:"border-t border-outline-variant pt-4 first:border-t-0 first:pt-0",children:[i.jsx(it,{tone:"muted",children:t}),i.jsx("div",{className:"mt-2",children:i.jsx($z,{seats:s,emptyLabel:"NO SEATS",emptyDescription:`No agent seats in ${t}.`})})]})}function I_({scope:e,rigId:t,podName:n}){const{data:s}=dr(),{data:r}=Q2(e!=="host"?t??null:null);if(e==="host")return!s||s.length===0?i.jsx("div",{className:"p-6",children:i.jsx(Ve,{label:"NO RIGS",description:"No rigs registered. Register a rig to see terminals at host scope.",variant:"card",testId:"topology-terminal-empty"})}):i.jsx("div",{"data-testid":"topology-terminal-host",className:"p-6 space-y-6",children:s.map(u=>i.jsx(Ege,{rigId:u.id,rigName:u.name},u.id))});const a=(r??[]).filter(u=>u.nodeKind!=="infrastructure"),l=e==="pod"&&n?a.filter(u=>(u.podNamespace??u.podId)===n):a;return i.jsx("div",{"data-testid":`topology-terminal-${e}`,className:"p-6",children:i.jsx($z,{seats:l,emptyLabel:"NO SEATS",emptyDescription:e==="pod"?`No agent seats in pod ${n}.`:"No agent seats in this rig."})})}const GS=1024;function M_(){const[e,t]=E.useState(()=>typeof window>"u"?{isWideLayout:!0,innerWidth:GS}:{isWideLayout:window.innerWidth>=GS,innerWidth:window.innerWidth});return E.useEffect(()=>{const n=()=>{t({isWideLayout:window.innerWidth>=GS,innerWidth:window.innerWidth})};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function Rge(e){return e==="running"?"running":e==="stopped"?"stopped":"warning"}function Age({data:e}){const{rigId:t,rigName:n,collapsed:s,status:r,nodeCount:a,runningCount:l,podCount:u,recentActivity:f,onToggle:d}=e;return i.jsxs("div",{"data-testid":`rig-group-node-${t}`,"data-collapsed":s?"true":"false",onClick:p=>{p.stopPropagation(),d(t)},className:he("w-full h-full relative flex flex-col cursor-pointer select-none overflow-visible",s?"border border-outline-variant bg-white/40 backdrop-blur-[8px] hard-shadow hover:bg-white/50":"border border-outline-variant/70 bg-white/40 backdrop-blur-[8px] shadow-[0_0_0_1px_rgba(84,96,115,0.06)]",f&&"rig-activity-frame-pulse"),children:[i.jsx(og,{testIdPrefix:`rig-group-${t}`}),i.jsxs("header",{className:"absolute -top-8 left-4 z-10 flex items-center gap-2 border border-outline-variant/70 bg-background px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-900 shadow-[2px_2px_0_rgba(46,52,46,0.10)]",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(lr,{className:he("h-3 w-3 text-on-surface-variant shrink-0 transition-transform",s?"":"rotate-90"),"aria-hidden":"true"}),i.jsx("span",{"data-testid":`rig-group-name-${t}`,className:"font-mono text-[11px] font-bold uppercase tracking-[0.10em] text-stone-900 truncate",children:n})]}),i.jsx(qm,{status:Rge(r),label:r,variant:"pill",testId:`rig-group-status-${t}`}),i.jsx(Ue,{to:"/topology/rig/$rigId",params:{rigId:t},onClick:p=>p.stopPropagation(),"data-testid":`rig-group-drill-${t}`,className:"shrink-0 p-0.5 text-on-surface-variant hover:text-stone-900 hover:bg-stone-200/60","aria-label":`Open ${n} rig page`,children:i.jsx(eV,{className:"h-3 w-3","aria-hidden":"true"})})]}),s?i.jsx("div",{className:"px-3 pt-8 pb-3 flex items-center justify-between gap-2 flex-1",children:i.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-wider text-on-surface-variant",children:[u!==void 0?`${u} pods / `:"",a," agent",a===1?"":"s"]}),i.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant",children:[l," active"]})]})}):i.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-2 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500","data-testid":`rig-group-expanded-counts-${t}`,children:[i.jsx("span",{children:u!==void 0?`${u} pods`:""}),u!==void 0?i.jsx("span",{children:"/"}):null,i.jsxs("span",{children:[a," agents"]}),i.jsx("span",{children:"/"}),i.jsxs("span",{children:[l," active"]})]}),i.jsx(Sn,{type:"target",position:ye.Top,className:"opacity-0 pointer-events-none"}),i.jsx(Sn,{type:"source",position:ye.Bottom,className:"opacity-0 pointer-events-none"})]})}const Dz=E.memo(Age,(e,t)=>{const n=e.data,s=t.data;return n.rigId===s.rigId&&n.rigName===s.rigName&&n.collapsed===s.collapsed&&n.status===s.status&&n.nodeCount===s.nodeCount&&n.runningCount===s.runningCount&&n.podCount===s.podCount&&n.recentActivity===s.recentActivity&&n.onToggle===s.onToggle});Dz.displayName="RigGroupNode";function Tge(e){return e==="architect"||e==="lead"||e==="orchestrator"}function Ige(e,t){if(typeof e!="number")return"text-stone-300";const n=e>=80?"text-red-600":e>=60?"text-amber-600":"text-green-700";return t===!1?`${n} opacity-50`:n}function Mge({data:e}){const t=e.podDisplayName??e.podNamespace??ir(e.logicalId??null)??e.podId??"pod";return i.jsxs("div",{"data-testid":"hybrid-pod-group-node",className:"relative h-full w-full border border-dashed border-stone-400/55 bg-stone-50/25",children:[i.jsxs("div",{className:"absolute left-2 top-2 flex items-center gap-2 font-mono text-[9px] lowercase tracking-[0.02em] text-stone-600",children:[i.jsx("span",{children:t}),typeof e.agentCount=="number"?i.jsx("span",{className:"text-stone-400",children:e.agentCount}):null]}),i.jsx(Sn,{type:"target",position:ye.Left,className:"opacity-0 pointer-events-none"}),i.jsx(Sn,{type:"source",position:ye.Right,className:"opacity-0 pointer-events-none"})]})}const qz=E.memo(Mge,(e,t)=>{const n=e.data,s=t.data;return n.podDisplayName===s.podDisplayName&&n.podNamespace===s.podNamespace&&n.podId===s.podId&&n.logicalId===s.logicalId&&n.agentCount===s.agentCount});qz.displayName="HybridPodGroupNode";function Oge({data:e}){var S,C;const t=N_(),n=Tge(e.role),s=e.nodeKind==="infrastructure",r=A2(e.agentActivity),a=T2(r),l=eD(r),u=tD(r),f=nD(e.agentActivity),d=lq({activityRing:e.activityRing,activityState:r}),p=e.runtime||e.model?oD(e.runtime,e.model):null,m=e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number",x=ma(e.contextTotalInputTokens,e.contextTotalOutputTokens),y=yf(x),b=Og(e.contextTotalInputTokens,e.contextTotalOutputTokens),v="inline-flex h-6 w-6 items-center justify-center border border-outline-variant bg-white/90 text-stone-700 opacity-0 shadow-[1px_1px_0_rgba(46,52,46,0.14)] transition-opacity hover:bg-stone-100 hover:text-stone-950 focus:!opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-stone-900/20 group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",w=i.jsxs("div",{"data-testid":"hybrid-agent-node",title:[e.canonicalSessionName,`activity: ${a}${f?" (stale)":""}`,p,b].filter(Boolean).join(`
|
|
541
|
-
`),"data-activity-card-state":d.state,"data-activity-card-flash":d.flash??"none",className:he("group relative h-full w-full select-none border bg-white/40 backdrop-blur-[8px] hard-shadow transition-[background-color,border-color,box-shadow] duration-300",cq({state:d.state,flash:d.flash,reducedMotion:e.reducedMotion}),e.startupStatus==="failed"?"border-red-700":e.startupStatus==="attention_required"?"border-amber-700":"border-stone-900"),children:[i.jsx(Sn,{type:"target",position:ye.Left,className:"opacity-0"}),i.jsxs("div",{className:he("flex items-center justify-between gap-1 px-2 py-1 font-mono text-[8px]",s?"bg-stone-500 text-white border-b border-stone-900":n?"bg-stone-900 text-white":"border-b border-stone-900 bg-stone-200 text-stone-900"),children:[i.jsx("span",{className:"truncate font-bold",children:ig(e.logicalId)}),i.jsx("span",{className:he("inline-flex h-2 w-2 shrink-0 rounded-full border border-white/60",l,u),"data-testid":`hybrid-activity-dot-${e.logicalId}`,"data-activity-state":r,"aria-label":`activity: ${a}`})]}),e.rigId?i.jsx(Mg,{rigId:e.rigId,logicalId:e.logicalId,sessionName:e.canonicalSessionName??null,reducedMotion:e.reducedMotion,testIdPrefix:`hybrid-${e.logicalId}`,wrapperClassName:"absolute right-8 top-6 z-20",buttonClassName:v}):null,e.rigId?i.jsx("button",{type:"button","data-testid":`hybrid-cmux-open-${e.logicalId}`,"aria-busy":t.isPending||void 0,"aria-label":`${t.isPending?"Opening":"Open"} ${e.logicalId} in cmux`,title:t.isPending?"Opening in cmux":"Open in cmux",disabled:t.isPending,onClick:k=>{k.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},className:he("absolute right-1.5 top-6 z-10 disabled:cursor-wait disabled:opacity-60",v),children:i.jsx(Pe,{tool:"cmux",size:"sm"})}):null,i.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[i.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(Kn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!p&&(e.resolvedSpecName||e.profile)?i.jsx("span",{className:"ml-1 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-400",children:e.resolvedSpecName||e.profile}):null]}),i.jsxs("div",{className:"flex items-end justify-between gap-2 pt-0.5",children:[i.jsx("div",{className:he("font-mono text-[14px] font-bold leading-none",Ige(e.contextUsedPercentage,e.contextFresh)),"data-testid":"hybrid-context-badge",children:m?`${e.contextUsedPercentage}%`:"--"}),i.jsx("div",{className:he("font-mono text-[13px] font-bold leading-none tracking-[0.02em]",y?"text-stone-500":"text-stone-300"),"data-testid":"hybrid-token-total",title:b??"Token sample unavailable",children:y??"--"})]})]}),i.jsx(Sn,{type:"source",position:ye.Right,className:"opacity-0"})]});return i.jsx($k,{state:((S=e.activityRing)==null?void 0:S.state)??"idle",flash:((C=e.activityRing)==null?void 0:C.flash)??null,reducedMotion:e.reducedMotion,testId:`hybrid-activity-ring-${e.logicalId}`,className:"h-full w-full rounded-none",children:w})}const zz=E.memo(Oge,(e,t)=>{var r,a,l,u,f,d;const n=e.data,s=t.data;return n.logicalId===s.logicalId&&n.role===s.role&&n.runtime===s.runtime&&n.model===s.model&&n.status===s.status&&n.nodeKind===s.nodeKind&&n.startupStatus===s.startupStatus&&n.canonicalSessionName===s.canonicalSessionName&&n.resolvedSpecName===s.resolvedSpecName&&n.profile===s.profile&&n.contextUsedPercentage===s.contextUsedPercentage&&n.contextFresh===s.contextFresh&&n.contextAvailability===s.contextAvailability&&n.contextTotalInputTokens===s.contextTotalInputTokens&&n.contextTotalOutputTokens===s.contextTotalOutputTokens&&n.agentActivity===s.agentActivity&&(((r=n.currentQitems)==null?void 0:r.length)??0)===(((a=s.currentQitems)==null?void 0:a.length)??0)&&n.rigId===s.rigId&&((l=n.activityRing)==null?void 0:l.state)===((u=s.activityRing)==null?void 0:u.state)&&((f=n.activityRing)==null?void 0:f.flash)===((d=s.activityRing)==null?void 0:d.flash)&&n.reducedMotion===s.reducedMotion});zz.displayName="HybridAgentNode";async function Lge(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}const Pge={rigGroup:Dz,podGroup:qz,rigNode:zz},$ge={hotPotato:uq},Dge=!0,qge=.03,zge=2,Bz=.08;function Fz(){const e=zt(),{data:t}=Wm(),n=a_(),{expandedRigs:s,setRigExpanded:r}=xk(),a=E.useCallback(_=>s.get(_)??Dge,[s]),l=E.useCallback(_=>{r(_,!a(_))},[a,r]),u=t??[],f=ef({queries:u.map(_=>({queryKey:["rig",_.rigId,"graph"],queryFn:()=>Lge(_.rigId),enabled:a(_.rigId),refetchInterval:3e4}))}),d=E.useMemo(()=>u.filter(_=>a(_.rigId)).length,[u,a]),p=E.useCallback(()=>{for(const _ of u)r(_.rigId,!0)},[u,r]),m=E.useCallback(()=>{for(const _ of u)r(_.rigId,!1)},[u,r]),{mergedNodes:x,mergedEdges:y}=E.useMemo(()=>{var I,L;const _=[];for(let $=0;$<u.length;$++){const O=u[$],B=a(O.rigId),H=f[$];let P=[],G=[],q=d9,V=WN,K;const Y=((I=H==null?void 0:H.data)==null?void 0:I.nodes)??[],J=((L=H==null?void 0:H.data)==null?void 0:L.edges)??[],D=Lle({rigId:O.rigId,rigName:O.name,nodes:Y,edges:J,collapsed:!B});q=D.width,V=D.height,B&&(P=D.nodes,G=D.edges,K=D.podCount),_.push({rigId:O.rigId,rigName:O.name,status:O.status,nodeCount:O.nodeCount,runningCount:O.runningCount,podCount:K,isExpanded:B,childNodes:P,childEdges:G,width:q,height:V})}const R=Ple(_.map($=>({rigId:$.rigId,width:$.width,height:$.height}))),T=[],A=[];for(let $=0;$<_.length;$++){const O=_[$],B=R[$],H={rigId:O.rigId,rigName:O.rigName,collapsed:!O.isExpanded,status:O.status,nodeCount:O.nodeCount,runningCount:O.runningCount,podCount:O.podCount,onToggle:l};T.push({id:`rig-${O.rigId}`,type:"rigGroup",position:B.position,data:H,style:{width:B.width,height:B.height},draggable:!1,zIndex:0}),O.isExpanded&&(T.push(...O.childNodes),A.push(...O.childEdges))}return{mergedNodes:T,mergedEdges:A}},[u,a,f]),b=E.useMemo(()=>Zg(x.filter(_=>_.type==="rigNode").map(_=>{const R=_.data;return{nodeId:_.id,rigId:(R==null?void 0:R.rigId)??null,rigName:(R==null?void 0:R.rigName)??null,logicalId:(R==null?void 0:R.logicalId)??null,canonicalSessionName:(R==null?void 0:R.canonicalSessionName)??null,agentActivity:(R==null?void 0:R.agentActivity)??null,currentQitems:(R==null?void 0:R.currentQitems)??null,startupStatus:(R==null?void 0:R.startupStatus)??null}})),[x]),v=Jg(b),w=E.useMemo(()=>x.map(_=>{if(_.type==="rigGroup"){const T=_.data;return{..._,data:{...T,recentActivity:v.isRigRecentlyActive(T.rigId)}}}if(_.type!=="rigNode")return _;const R=_.data;return{..._,data:{..._.data??{},activityRing:v.getNodeActivity(_.id,R),reducedMotion:n}}}),[x,v,n]),S=E.useMemo(()=>h9(y,v.packets,{reducedMotion:n}),[y,v.packets,n]),C=E.useMemo(()=>x.map(_=>{const R=_.style;return[_.id,Math.round(_.position.x),Math.round(_.position.y),(R==null?void 0:R.width)??"",(R==null?void 0:R.height)??"",_.parentId??""].join(":")}).join("|"),[x]),k=(_,R)=>{const T=R.data,A=T==null?void 0:T.rigId;if(A&&R.type!=="rigGroup"){if(R.type==="podGroup"||R.type==="group"){const I=(T==null?void 0:T.podNamespace)??(T==null?void 0:T.podId);if(!I)return;e({to:"/topology/pod/$rigId/$podName",params:{rigId:A,podName:I}});return}T!=null&&T.logicalId&&e({to:"/topology/seat/$rigId/$logicalId",params:{rigId:A,logicalId:encodeURIComponent(T.logicalId)}})}};return u.length===0?i.jsxs("div",{"data-testid":"host-multi-rig-graph-empty",className:"flex flex-col items-center justify-center h-full font-mono text-[10px] text-on-surface-variant",children:["No rigs registered. Run ",i.jsx("code",{className:"ml-1 text-stone-700",children:"rig up"})," to start one."]}):i.jsx("div",{"data-testid":"host-multi-rig-graph",className:"w-full h-full relative",children:i.jsxs(gf,{nodes:w,edges:S,nodeTypes:Pge,edgeTypes:$ge,onNodeClick:k,nodesDraggable:!1,fitView:!0,fitViewOptions:{padding:Bz,includeHiddenNodes:!1},minZoom:qge,maxZoom:zge,proOptions:{hideAttribution:!0},children:[i.jsx(Bge,{layoutSignature:C}),i.jsx(pf,{position:"top-right",className:"!m-3",children:i.jsxs("div",{className:"flex items-center gap-1 border border-outline-variant bg-background/80 px-1.5 py-1 shadow-[2px_2px_0_rgba(46,52,46,0.10)] backdrop-blur-sm",children:[i.jsxs("button",{type:"button","data-testid":"topology-expand-all-rigs",onClick:p,disabled:d===u.length,title:"Expand all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[i.jsx(OV,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Expand all"]}),i.jsxs("button",{type:"button","data-testid":"topology-collapse-all-rigs",onClick:m,disabled:d===0,title:"Collapse all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[i.jsx($V,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Collapse all"]})]})}),i.jsx(xf,{position:"bottom-right",showInteractive:!1,className:"!bg-white/40 !border !border-outline-variant"})]})})}function Bge({layoutSignature:e}){const{fitView:t}=Ag(),n=E.useRef(null);return E.useEffect(()=>{if(!e||n.current===e)return;n.current=e;const s=window.setTimeout(()=>{t({padding:Bz,includeHiddenNodes:!1,duration:250})},50);return()=>window.clearTimeout(s)},[t,e]),null}function O_(e){const{setMode:t}=xk();E.useEffect(()=>(t(e==="graph"?"overlay":"opaque"),()=>{t("opaque")}),[e,t])}function L_({tabsNav:e,children:t}){return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"relative z-30 px-6 pt-4",style:{marginLeft:"var(--header-anchor-offset, 0px)"},children:e}),i.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:t})]})}function Fge(){const[e,t]=E.useState("graph"),{data:n}=dr(),{isWideLayout:s}=M_();O_(e);const r=!s&&e==="graph"?"table":e;return i.jsxs(L_,{eyebrow:"Topology · Host",title:"localhost",tabsNav:i.jsx(__,{tabs:vme,active:e,onSelect:t,testIdPrefix:"topology-host"}),children:[r==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(Fz,{})}):null,r==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!s&&e==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(T_,{})]}):null,r==="terminal"?i.jsx(I_,{scope:"host"}):null]})}function Hge(){const{rigId:e}=kn({from:"/topology/rig/$rigId"}),{data:t}=dr(),n=t==null?void 0:t.find(u=>u.id===e),[s,r]=E.useState("graph"),{isWideLayout:a}=M_();O_(s);const l=!a&&s==="graph"?"table":s;return i.jsxs(L_,{eyebrow:"Topology · Rig",title:(n==null?void 0:n.name)??e,tabsNav:i.jsx(__,{tabs:Sz,active:s,onSelect:r,testIdPrefix:"topology-rig",trailing:i.jsx(jge,{rigId:e})}),children:[l==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(o_,{rigId:e,rigName:(n==null?void 0:n.name)??null,showDiscovered:!1})}):null,l==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!a&&s==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(T_,{rigIdScope:e})]}):null,l==="terminal"?i.jsx(I_,{scope:"rig",rigId:e}):null,s==="overview"?i.jsx(Uge,{rigId:e,rigName:(n==null?void 0:n.name)??null}):null]})}function Uge({rigId:e,rigName:t}){const{data:n=[],isLoading:s}=Ac("rig"),r=t?n.filter(d=>d.name===t):[],a=r.length===1?r[0].id:null,{data:l,isLoading:u}=K2(a);if(s||u)return i.jsx("div",{className:"p-6",children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading rig spec…"})});if(r.length===0)return i.jsx("div",{className:"p-6",children:i.jsx(Ve,{label:"NO RIG SPEC",description:`No rig spec entry found for "${t??e}". Author one via /specs.`,variant:"card",testId:"topology-rig-overview-no-spec"})});if(r.length>1)return i.jsx("div",{className:"p-6",children:i.jsx(Ve,{label:"AMBIGUOUS RIG SPEC",description:`${r.length} rig spec entries match "${t??e}". Disambiguate at /specs.`,variant:"card"})});if(!l||l.kind!=="rig")return i.jsx("div",{className:"p-6",children:i.jsx(Ve,{label:"RIG SPEC UNAVAILABLE",description:"Rig spec failed to load.",variant:"card"})});const f=l;return i.jsx("div",{className:"px-6 pb-6","data-testid":"topology-rig-overview",children:i.jsx(w_,{review:f,yaml:f.raw,testIdPrefix:"topology-rig-overview-"})})}function Vge(){const{rigId:e,podName:t}=kn({from:"/topology/pod/$rigId/$podName"}),[n,s]=E.useState("graph"),{isWideLayout:r}=M_();O_(n);const a=!r&&n==="graph"?"table":n;return i.jsxs(L_,{eyebrow:"Topology · Pod",title:`${e} / ${t}`,tabsNav:i.jsx(__,{tabs:Sz,active:n,onSelect:s,testIdPrefix:"topology-pod"}),children:[a==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(o_,{rigId:e,rigName:null,showDiscovered:!1,podScope:t})}):null,a==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!r&&n==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(T_,{rigIdScope:e,podNameScope:t})]}):null,a==="terminal"?i.jsx(I_,{scope:"pod",rigId:e,podName:t}):null,n==="overview"?i.jsx("div",{className:"p-6",children:i.jsx(Ve,{label:"POD OVERVIEW",description:"Pod detail (Phase 5).",variant:"card"})}):null]})}function Gge(){const{rigId:e,logicalId:t}=kn({from:"/topology/seat/$rigId/$logicalId"}),n=decodeURIComponent(t);return i.jsx("div",{"data-testid":"seat-scope-page",className:"flex flex-col h-full",children:i.jsx(sz,{rigId:e,logicalId:n})})}function bP(e){const t=e.toLowerCase();return t.includes("complete")||t.includes("shipped")||t.includes("handed_off")||t.includes("merged")||t.includes("done")?"success":t.includes("fail")||t.includes("error")||t.includes("blocked")||t.includes("rejected")?"danger":t.includes("warn")||t.includes("attention")||t.includes("flagged")?"warning":t.includes("created")||t.includes("started")||t.includes("in_progress")||t.includes("in-progress")||t.includes("transition")||t.includes("edited")||t.includes("updated")?"info":"muted"}const Kge={success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-sky-500",muted:"bg-stone-300"},wP=["bg-amber-100 text-amber-800 border-amber-300","bg-violet-100 text-violet-800 border-violet-300","bg-emerald-100 text-emerald-800 border-emerald-300","bg-sky-100 text-sky-800 border-sky-300","bg-rose-100 text-rose-800 border-rose-300","bg-fuchsia-100 text-fuchsia-800 border-fuchsia-300","bg-cyan-100 text-cyan-800 border-cyan-300","bg-orange-100 text-orange-800 border-orange-300"],Wge="bg-stone-100 text-stone-700 border-stone-300",Up=12;function Hz({events:e,phaseDefinitions:t,queueItemsById:n,timelineMarkdown:s}){const[r,a]=E.useState(0),l=E.useMemo(()=>{const y=new Map;return t&&t.forEach((b,v)=>{y.set(b.id,{label:b.label,colorClass:wP[v%wP.length],token:{label:b.label,tone:["warning","info","success","neutral"][v%4]}})}),y},[t]),u=E.useMemo(()=>[...e].sort((y,b)=>jP(b.ts)-jP(y.ts)),[e]),f=Math.max(1,Math.ceil(u.length/Up)),d=Math.min(r,f-1),p=u.slice(d*Up,d*Up+Up),m=typeof s=="string"&&s.trim().length>0,x=e.length>0;return!x&&!m?i.jsxs("div",{"data-testid":"story-empty",className:"border border-dashed border-outline-variant bg-white/35 p-4 font-body text-[11px] leading-relaxed text-stone-500",children:[i.jsx("div",{className:"mb-1 font-mono uppercase tracking-[0.12em] text-stone-400",children:"No timeline yet"}),i.jsxs("div",{className:"text-stone-700",children:["Author one at ",i.jsx("span",{className:"font-mono text-stone-900",children:"<slice-dir>/timeline.md"})," with frontmatter",i.jsx("span",{className:"font-mono text-stone-900",children:" kind: incident-timeline"})," and a ",i.jsx("span",{className:"font-mono text-stone-900",children:"```timeline```"})," fenced block."]})]}):i.jsxs("div",{"data-testid":"story-tab",className:"space-y-3",children:[m&&i.jsx("div",{"data-testid":"story-timeline-markdown",className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:i.jsx(Zr,{content:s,hideFrontmatter:!0,hideRawToggle:!0})}),x&&i.jsx("div",{"data-testid":"story-step-tree","data-order":"newest-first",className:"relative border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:p.map((y,b)=>i.jsx(Xge,{event:y,phaseMeta:l,isLast:b===p.length-1,queueItem:y.qitemId?n==null?void 0:n.get(y.qitemId):void 0},`${y.ts}-${y.kind}-${b}`))}),f>1?i.jsxs("div",{className:"mt-3 flex items-center justify-between border border-outline-variant bg-white/35 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-600",children:[i.jsx("button",{type:"button","data-testid":"story-page-prev",disabled:d===0,onClick:()=>a(y=>Math.max(0,y-1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Newer"}),i.jsxs("span",{"data-testid":"story-page-status",children:["Page ",d+1," / ",f]}),i.jsx("button",{type:"button","data-testid":"story-page-next",disabled:d>=f-1,onClick:()=>a(y=>Math.min(f-1,y+1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Older"})]}):null]})}function jP(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function Hd(e,t){if(!e)return null;for(const n of t){const s=e[n];if(typeof s=="string"&&s.length>0)return s}return null}function o2(e){const t=Hd(e.detail,["fromSession","sourceSession","source","actorSession"])??e.actorSession,n=Hd(e.detail,["toSession","destinationSession","targetSession","target"]);return{source:t,target:n}}function Uz(e,t){const n=Hd(e.detail,["body","content","message"]);return(t==null?void 0:t.body)??n??e.summary}function Yge(e,t){return{qitemId:e.qitemId??(t==null?void 0:t.qitemId)??"",source:(t==null?void 0:t.sourceSession)??o2(e).source??void 0,destination:(t==null?void 0:t.destinationSession)??o2(e).target??void 0,state:(t==null?void 0:t.state)??Hd(e.detail,["state","toState","fromState"])??void 0,tags:(t==null?void 0:t.tags)??void 0,createdAt:(t==null?void 0:t.tsCreated)??e.ts,body:(t==null?void 0:t.body)??Uz(e,t)}}function Qge(e,t=12){const n=e.split(`
|
|
542
|
-
`);return n.length<=t?e:`${n.slice(0,t).join(`
|
|
543
|
-
`)}
|
|
544
|
-
... ${n.length-t} more lines`}function Xge({event:e,phaseMeta:t,isLast:n,queueItem:s}){var v;const r=e.phase?t.get(e.phase):void 0,a=(r==null?void 0:r.label)??e.phase??"untagged",l=(r==null?void 0:r.colorClass)??Wge,u=(r==null?void 0:r.token)??{label:a,tone:"neutral"},f=o2(e),d=Hd(e.detail,["sliceLabel","sliceName"]),p=Uz(e,s),m=!!(s!=null&&s.body),y=q2(e.kind).icon,b=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{"data-testid":`story-row-phase-${e.kind}`,"data-phase-id":e.phase??"untagged",className:`sr-only ${l}`,children:a}),i.jsx(Un,{token:u,compact:!0}),d?i.jsx(Un,{token:{label:d,tone:"neutral"},compact:!0}):null,i.jsx(F2,{kind:e.kind,compact:!0}),i.jsx(Rc,{value:e.ts})]}),i.jsx("pre",{"data-testid":`story-row-body-${e.kind}`,"data-source":m?"qitem":"event",className:"mt-2 whitespace-pre-wrap break-words font-body text-[12px] leading-relaxed text-stone-950",children:Qge(p)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.qitemId?i.jsx(pa,{tag:e.qitemId}):null,(v=s==null?void 0:s.tags)==null?void 0:v.slice(0,4).map(w=>i.jsx(pa,{tag:w},w))]}),m&&e.summary!==p?i.jsx("div",{"data-testid":`story-row-summary-${e.kind}`,className:"mt-2 truncate font-mono text-[9px] text-stone-500",children:e.summary}):null,(f.source||f.target)&&i.jsx("div",{"data-testid":`story-step-flow-${e.kind}`,className:"mt-2",children:i.jsx(eg,{source:f.source,destination:f.target,muted:!0})})]});return i.jsxs("div",{className:"relative pl-9 pb-3 last:pb-0",children:[!n&&i.jsx("div",{"data-testid":`story-step-connector-${e.kind}`,className:"absolute left-[14px] top-7 bottom-0 w-px bg-outline-variant"}),i.jsx("div",{"data-testid":`story-step-dot-${e.kind}`,"data-dot-status":bP(e.kind),className:`absolute left-[5px] top-3.5 flex h-5 w-5 items-center justify-center border border-outline-variant text-white shadow-[1px_1px_0_rgba(46,52,46,0.12)] ${Kge[bP(e.kind)]}`,children:y?i.jsx(y,{className:"h-3 w-3",strokeWidth:1.7}):null}),e.qitemId?i.jsx(sx,{data:Yge(e,s),testId:`story-row-${e.kind}`,className:"block w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm hover:bg-white/60",children:b}):i.jsx("div",{"data-testid":`story-row-${e.kind}`,className:"w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm",children:b}),e.detail&&i.jsxs("details",{className:"mt-1",children:[i.jsx("summary",{className:"cursor-pointer font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Event detail"}),i.jsx("pre",{"data-testid":`story-row-detail-${e.kind}`,className:"mt-1 overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:JSON.stringify(e.detail,null,2)})]})]})}function Zge(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?!0:s.startsWith(n+"/")}function Jge(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?"":s.startsWith(n+"/")?s.slice(n.length+1):s}function exe(e,t){const n=e.find(a=>a.path.replace(/\/+$/,"")===t.replace(/\/+$/,""));if(n)return{rootName:n.name,relPath:""};const r=e.filter(a=>Zge(a.path,t)).sort((a,l)=>l.path.length-a.path.length)[0];return r?{rootName:r.name,relPath:Jge(r.path,t)}:null}function zm(e,t){const n=Qm(),s=n.data,r=s&&"roots"in s?s.roots:null,a=e&&r?exe(r,e):null,l=a?a.relPath?`${a.relPath}/${t}`:t:null,u=Xm(a?a.rootName:null,l);return e?n.isLoading?{content:null,isLoading:!0,unavailable:!1,mtime:null,resolved:null}:a?u.isLoading?{content:null,isLoading:!0,unavailable:!1,mtime:null,resolved:a}:u.isError||!u.data?{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:a}:{content:u.data.content??null,isLoading:!1,unavailable:!1,mtime:u.data.mtime??null,resolved:a}:{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:null}:{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:null}}function txe(e){return zm(e,"timeline.md")}function nxe({path:e,root:t,readPath:n,absolutePath:s,kind:r,children:a,className:l,style:u,testId:f}){const d={path:e,...t!==void 0?{root:t}:{},...n!==void 0?{readPath:n}:{},...s!==void 0?{absolutePath:s}:{},...r!==void 0?{kind:r}:{}};return i.jsx(Nf,{data:d,className:l,style:u,testId:f??"file-link",children:a??e})}async function sxe(e){const t=await fetch(`/api/missions/${encodeURIComponent(e)}`);if(t.status===503){const n=await t.json().catch(()=>({}));return{unavailable:!0,error:n.error??"missions_route_unavailable",hint:n.hint}}if(t.status===404)return{unavailable:!0,error:"mission_not_found"};if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function rxe(e){return De({queryKey:["mission","detail",e],queryFn:()=>sxe(e),enabled:!!e,staleTime:3e4,refetchOnWindowFocus:!0})}const ixe=["all","active","done","blocked"];function axe({acceptance:e}){const{totalItems:t,doneItems:n,percentage:s,items:r,closureCallout:a,currentStep:l}=e,[u,f]=E.useState("all"),d=E.useMemo(()=>cxe(r,u),[r,u]);return i.jsxs("div",{"data-testid":"acceptance-tab",className:"p-4",children:[l&&i.jsx(oxe,{currentStep:l}),i.jsxs("header",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-baseline justify-between",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Acceptance"}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500",children:[n," / ",t," (",s,"%)"]})]}),i.jsx("div",{className:"mt-2 h-2 w-full bg-stone-100","data-testid":"acceptance-progress-bar",children:i.jsx("div",{className:"h-2 bg-emerald-500 transition-all","data-testid":"acceptance-progress-fill","data-percentage":s,style:{width:`${s}%`}})}),a&&i.jsx("div",{"data-testid":"acceptance-closure-callout",className:"mt-3 border border-emerald-300 bg-emerald-50 px-3 py-2 font-mono text-[10px] text-emerald-900",children:a}),r.length>0&&i.jsx("div",{className:"mt-3 flex gap-1","data-testid":"acceptance-filter-row",children:ixe.map(p=>i.jsx("button",{type:"button","data-testid":`acceptance-filter-${p}`,"data-active":u===p,onClick:()=>f(p),className:`border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] ${u===p?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:p},p))})]}),r.length===0?i.jsx("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-empty",children:"No acceptance items found in slice docs (looks for `[ ]` / `[x]` checkbox lines in README / IMPLEMENTATION-PRD / PROGRESS / IMPLEMENTATION)."}):d.length===0?i.jsxs("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-filter-empty",children:["No items match filter '",u,"'."]}):i.jsx("ul",{className:"space-y-1","data-testid":"acceptance-list",children:d.map((p,m)=>i.jsx(lxe,{item:p,idx:m},`${p.source.file}:${p.source.line}`))})]})}function oxe({currentStep:e}){return i.jsxs("section",{"data-testid":"acceptance-current-step","data-step-id":e.stepId,className:"mb-6 border border-stone-300 bg-stone-50 p-3",children:[i.jsxs("div",{className:"flex items-baseline justify-between",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Current step"}),i.jsxs("div",{className:"font-mono text-[9px] text-stone-500",children:["hop ",e.hopCount," · ",e.instanceStatus]})]}),i.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[i.jsx("span",{"data-testid":"acceptance-current-step-id",className:"font-mono text-[12px] font-bold text-stone-900",children:e.stepId}),i.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:["role: ",e.role]})]}),e.objective&&i.jsx("div",{"data-testid":"acceptance-current-step-objective",className:"mt-2 whitespace-pre-line font-mono text-[10px] text-stone-700",children:e.objective}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[i.jsxs("div",{"data-testid":"acceptance-current-step-allowed-exits",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed exits"}),i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedExits.length===0?i.jsx("span",{className:"font-mono text-[9px] text-stone-400",children:"(none)"}):e.allowedExits.map(t=>i.jsx("span",{className:"border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-700",children:t},t))})]}),i.jsxs("div",{"data-testid":"acceptance-current-step-allowed-next-steps",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed next steps"}),i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedNextSteps.length===0?i.jsxs("span",{className:"inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:[i.jsx(Pe,{tool:"terminal",size:"xs"}),"terminal"]}):e.allowedNextSteps.map(t=>i.jsx("span",{"data-testid":`acceptance-next-step-${t.stepId}`,className:"border border-emerald-300 bg-emerald-50 px-1.5 py-0.5 font-mono text-[9px] text-emerald-900",title:`role: ${t.role}`,children:t.stepId},t.stepId))})]})]})]})}function lxe({item:e,idx:t}){const[n,s]=E.useState(!1),{pillClass:r,pillIcon:a,pillLabel:l}=uxe(e.done);return i.jsxs("li",{"data-testid":`acceptance-item-${t}`,"data-done":e.done,className:"border-b border-stone-100",children:[i.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"data-testid":`acceptance-item-${t}-toggle`,className:"flex w-full items-start gap-2 py-1.5 text-left hover:bg-stone-50",children:[i.jsxs("span",{"data-testid":`acceptance-pill-${t}`,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${r}`,"aria-label":l,children:[i.jsx("span",{"aria-hidden":"true",children:a}),i.jsx("span",{children:l})]}),i.jsx("span",{className:"flex-1 font-mono text-[10px] text-stone-800",children:e.text}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-400",title:`${e.source.file}:${e.source.line}`,children:[e.source.file,":",e.source.line]})]}),n&&i.jsxs("div",{"data-testid":`acceptance-item-${t}-detail`,className:"ml-2 mt-1 border-l-2 border-stone-300 bg-stone-50 px-3 py-2 font-mono text-[9px] text-stone-700",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-bold",children:"Source:"})," ",i.jsxs("span",{"data-testid":`acceptance-item-${t}-citation`,children:[e.source.file,":",e.source.line]})]}),i.jsxs("div",{className:"mt-1",children:[i.jsx("span",{className:"font-bold",children:"Status:"})," ",l]}),i.jsx("div",{className:"mt-2 whitespace-pre-line text-stone-800",children:e.text})]})]})}function cxe(e,t){return t==="all"?e:t==="done"?e.filter(n=>n.done):t==="active"?e.filter(n=>!n.done):t==="blocked"?e.filter(n=>/\b(blocked|blocker|parked|park)\b/i.test(n.text)):e}function uxe(e){return e?{pillClass:"border-emerald-400 bg-emerald-50 text-emerald-900",pillIcon:"✓",pillLabel:"done"}:{pillClass:"border-stone-400 bg-stone-50 text-stone-700",pillIcon:"◯",pillLabel:"active"}}function dxe({sliceName:e,tree:t}){var l,u,f;const n=((l=t.find(d=>d.type==="file"&&d.name==="README.md"))==null?void 0:l.relPath)??((u=t.find(d=>d.type==="file"&&d.name==="IMPLEMENTATION-PRD.md"))==null?void 0:u.relPath)??((f=t.find(d=>d.type==="file"))==null?void 0:f.relPath)??null,[s,r]=E.useState(n),a=oK(e,s);return i.jsxs("div",{"data-testid":"docs-tab",className:"flex h-full flex-col sm:flex-row",children:[i.jsxs("aside",{className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-stone-200 bg-stone-50 p-2 sm:w-56 sm:max-h-none sm:border-b-0 sm:border-r","data-testid":"docs-tree",children:[t.length===0&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Empty slice folder."}),t.map(d=>i.jsx("button",{type:"button","data-testid":`docs-tree-${d.relPath}`,"data-selected":d.relPath===s,disabled:d.type==="dir",onClick:()=>d.type==="file"&&r(d.relPath),className:`block w-full text-left font-mono text-[10px] ${d.type==="dir"?"py-1 text-stone-400":`cursor-pointer py-1 hover:bg-stone-100 ${d.relPath===s?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,style:{paddingLeft:`${(d.relPath.split("/").length-1)*.75+.25}rem`},children:i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[d.type==="dir"?i.jsx(Pe,{tool:"folder",size:"xs",decorative:!0}):i.jsx(Pe,{tool:d.name,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:d.name})]})},d.relPath))]}),i.jsxs("main",{className:"flex-1 min-w-0 overflow-y-auto bg-white","data-testid":"docs-viewer",children:[!s&&i.jsx("div",{className:"m-auto p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree"}),s&&a.isLoading&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}),s&&a.isError&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-red-600",children:"Error loading doc."}),s&&a.data&&i.jsx("div",{"data-testid":"docs-viewer-content",className:"p-4",children:s.toLowerCase().endsWith(".md")?i.jsx(Zr,{content:a.data.content}):i.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-stone-800",children:a.data.content})})]})]})}function fxe({rows:e}){const[t,n]=E.useState("all"),[s,r]=E.useState("all"),[a,l]=E.useState(""),u=E.useMemo(()=>{const p=new Set(e.map(m=>m.verb));return["all",...Array.from(p).sort()]},[e]),f=E.useMemo(()=>{const p=new Set(e.map(m=>m.actor));return["all",...Array.from(p).sort()]},[e]),d=E.useMemo(()=>{const p=a.trim().toLowerCase();return e.filter(m=>t!=="all"&&m.verb!==t||s!=="all"&&m.actor!==s?!1:p?m.verb.toLowerCase().includes(p)||m.qitemId.toLowerCase().includes(p)||(m.reason??"").toLowerCase().includes(p):!0)},[e,t,s,a]);return e.length===0?i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"decisions-empty",children:"No mission_control_actions rows found for this slice's qitem chain."}):i.jsxs("div",{"data-testid":"decisions-tab",className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex flex-wrap gap-2 border-b border-stone-200 bg-stone-50 p-3","data-testid":"decisions-filters",children:[i.jsx("select",{"data-testid":"decisions-verb-filter",value:t,onChange:p=>n(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:u.map(p=>i.jsx("option",{value:p,children:p},p))}),i.jsx("select",{"data-testid":"decisions-actor-filter",value:s,onChange:p=>r(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:f.map(p=>i.jsx("option",{value:p,children:p},p))}),i.jsx("input",{"data-testid":"decisions-search",type:"text",placeholder:"search verb / qitem / reason",value:a,onChange:p=>l(p.target.value),className:"flex-1 min-w-32 border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]"}),i.jsxs("span",{className:"font-mono text-[10px] text-stone-500","data-testid":"decisions-result-count",children:[d.length," / ",e.length]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"decisions-list",children:d.map(p=>i.jsx(hxe,{row:p},p.actionId))})]})}function hxe({row:e}){const[t,n]=E.useState(!1);return i.jsxs("div",{className:"border-b border-stone-100 px-4 py-2 hover:bg-stone-50",children:[i.jsxs("button",{type:"button","data-testid":`decision-row-${e.actionId}`,onClick:()=>n(s=>!s),className:"w-full text-left",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.ts.slice(0,19)}),i.jsx("span",{className:"font-mono text-[10px] font-bold text-stone-900 shrink-0",children:e.verb}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.actor}),i.jsx("span",{className:"font-mono text-[9px] text-stone-400 truncate",children:e.qitemId})]}),e.reason&&i.jsx("div",{className:"ml-[120px] font-mono text-[10px] text-stone-700",children:e.reason})]}),t&&i.jsxs("div",{className:"ml-[120px] mt-1 grid grid-cols-2 gap-2","data-testid":`decision-row-detail-${e.actionId}`,children:[i.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[i.jsx("div",{className:"text-stone-500",children:"before:"}),e.beforeState??"null"]}),i.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[i.jsx("div",{className:"text-stone-500",children:"after:"}),e.afterState??"null"]})]})]})}const pxe={pass:"text-emerald-900",fail:"text-red-900",partial:"text-amber-900",unknown:"text-stone-700"};function mxe({sliceName:e,tests:t,qitemCount:n,docsCount:s,lastActivityAt:r}){return t.proofPackets.length===0?i.jsxs("div",{className:"border border-outline-variant bg-white/20 p-4 font-mono","data-testid":"tests-empty",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.14em] text-stone-500",children:"No proof packet matched"}),i.jsx("p",{"data-testid":"tests-empty-reason",className:"mt-2 max-w-2xl text-[11px] leading-relaxed text-stone-700",children:"The proof matcher did not find a dogfood-evidence directory whose name contains this slice id. Evidence may still exist under the configured evidence root or under a related mission folder."}),i.jsxs("div",{"data-testid":"tests-empty-diagnostics",className:"mt-3 grid gap-2 text-[10px] text-stone-600 sm:grid-cols-3",children:[i.jsx(KS,{label:"Qitems",value:n??0}),i.jsx(KS,{label:"Indexed files",value:s??0}),i.jsx(KS,{label:"Last activity",value:gxe(r??null)})]}),i.jsxs("ul",{"data-testid":"tests-empty-next-steps",className:"mt-3 list-disc space-y-1 pl-4 text-[10px] leading-relaxed text-stone-600",children:[i.jsx("li",{children:"Check Artifacts for slice-local files and commit refs."}),i.jsx("li",{children:"Check the evidence root for dogfood screenshots or proof notes with related names."}),i.jsx("li",{children:"When a proof packet is added with a matching directory name, this tab will render it inline."})]})]}):i.jsxs("div",{"data-testid":"tests-tab",className:"p-4 space-y-4",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:[i.jsx(Pe,{tool:"proof",size:"xs"}),"Tests / Verification"]}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"tests-aggregate",children:[t.aggregate.passCount," pass, ",t.aggregate.failCount," fail"," · ",t.proofPackets.length," packet",t.proofPackets.length===1?"":"s"]})]}),t.proofPackets.map(a=>i.jsx(xxe,{sliceName:e,packet:a},a.dirName))]})}function KS({label:e,value:t}){return i.jsxs("div",{className:"border border-outline-variant bg-white/30 px-2 py-1",children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e}),i.jsx("div",{className:"mt-0.5 truncate text-stone-900",children:t})]})}function gxe(e){if(!e)return"unknown";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function xxe({sliceName:e,packet:t}){const[n,s]=E.useState(null);return i.jsxs("article",{className:"border border-stone-200 bg-white","data-testid":`tests-packet-${t.dirName}`,children:[i.jsx("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:i.jsx("div",{className:`min-w-0 flex-1 ${pxe[t.passFailBadge]}`,"data-testid":`tests-packet-badge-${t.dirName}`,children:i.jsx(tg,{title:t.dirName,badge:t.passFailBadge})})}),i.jsxs("div",{className:"p-3 space-y-3",children:[t.primaryMarkdown&&i.jsxs("div",{"data-testid":`tests-packet-primary-md-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx(Pe,{tool:t.primaryMarkdown.relPath,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),t.primaryMarkdown.relPath]}),i.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:t.primaryMarkdown.content})]}),t.screenshots.length>0&&i.jsxs("section",{"data-testid":`tests-packet-screenshots-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx(Pe,{tool:"screenshot",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Screenshots (",t.screenshots.length,")"]}),i.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:t.screenshots.map(r=>i.jsxs("figure",{className:"border border-stone-200",children:[i.jsx("button",{type:"button","data-testid":`tests-packet-screenshot-open-${r}`,onClick:()=>s(r),className:"block w-full text-left",children:i.jsx("img",{"data-testid":`tests-packet-screenshot-${r}`,src:cd(e,r),alt:r,loading:"lazy",className:"block w-full bg-stone-100"})}),i.jsxs("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:[i.jsx(Pe,{tool:r,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),r]})]},r))})]}),i.jsx(k_,{sliceName:e,relPath:n,onClose:()=>s(null),testId:"tests-screenshot-viewer",imageTestId:"tests-screenshot-viewer-image",closeTestId:"tests-screenshot-viewer-close"}),t.videos.length>0&&i.jsxs("section",{"data-testid":`tests-packet-videos-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx(Pe,{tool:"video",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Videos (",t.videos.length,")"]}),i.jsx("div",{className:"space-y-3",children:t.videos.map(r=>i.jsxs("figure",{className:"border border-stone-200",children:[i.jsx("video",{"data-testid":`tests-packet-video-${r}`,src:cd(e,r),controls:!0,preload:"metadata",className:"block w-full bg-black"}),i.jsx("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:r})]},r))})]}),t.traces.length>0&&i.jsxs("section",{"data-testid":`tests-packet-traces-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx(Pe,{tool:"trace",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Traces (download)"]}),i.jsx("ul",{className:"font-mono text-[10px]",children:t.traces.map(r=>i.jsx("li",{children:i.jsxs("a",{href:cd(e,r),download:!0,className:"inline-flex items-center gap-1 text-blue-700 hover:underline",children:[i.jsx(Pe,{tool:r,size:"xs",decorative:!0}),r]})},r))})]}),t.additionalMarkdown.length>0&&i.jsxs("details",{children:[i.jsxs("summary",{className:"cursor-pointer font-mono text-[10px] text-stone-700","data-testid":`tests-packet-additional-md-toggle-${t.dirName}`,children:["Additional markdown (",t.additionalMarkdown.length,")"]}),i.jsx("div",{className:"mt-2 space-y-2",children:t.additionalMarkdown.map(r=>i.jsxs("div",{children:[i.jsxs("div",{className:"inline-flex items-center gap-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx(Pe,{tool:r.relPath,size:"xs",decorative:!0}),r.relPath]}),i.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:r.content})]},r.relPath))})]})]})]})}const lm=200,cm=112,yxe={sliceWorkflowStep:wxe};function vxe({specGraph:e}){const{nodes:t,edges:n}=E.useMemo(()=>bxe(e),[e]);return i.jsxs("section",{"data-testid":"topology-spec-graph","data-spec-name":e.specName,"data-spec-version":e.specVersion,"data-layout":"react-flow-dagre",className:"border border-outline-variant bg-white/20",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-outline-variant bg-white/20 px-3 py-2",children:[i.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:["Workflow graph - ",e.specName," v",e.specVersion]}),i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-400",children:[e.nodes.length," steps / ",e.edges.length," edges"]})]}),i.jsx("div",{"data-testid":"slice-workflow-graph",className:"h-[420px] bg-[radial-gradient(circle_at_1px_1px,rgba(87,83,78,0.22)_1px,transparent_0)] [background-size:18px_18px]",children:i.jsxs(gf,{nodes:t,edges:n,nodeTypes:yxe,fitView:!0,minZoom:.2,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Pk,{gap:18,size:.5,color:"#d6d3cd"}),i.jsx(xf,{showInteractive:!1})]})}),i.jsx("div",{className:"sr-only","data-testid":"slice-workflow-edge-metadata",children:e.edges.map(s=>i.jsxs("span",{"data-testid":`spec-edge-${s.fromStepId}-${s.toStepId}`,"data-routing-type":s.routingType,"data-is-loop-back":s.isLoopBack,children:[s.fromStepId," to ",s.toStepId]},`${s.fromStepId}-${s.toStepId}`))})]})}function bxe(e){const t=new Pm.graphlib.Graph;t.setDefaultEdgeLabel(()=>({})),t.setGraph({rankdir:"LR",nodesep:80,ranksep:110,marginx:24,marginy:24}),e.nodes.forEach(r=>{t.setNode(r.stepId,{width:lm,height:cm})}),e.edges.forEach(r=>{t.setEdge(r.fromStepId,r.toStepId)}),Pm.layout(t);const n=e.nodes.map(r=>{const a=t.node(r.stepId);return{id:r.stepId,type:"sliceWorkflowStep",position:{x:((a==null?void 0:a.x)??0)-lm/2,y:((a==null?void 0:a.y)??0)-cm/2},data:{step:r},sourcePosition:ye.Right,targetPosition:ye.Left,width:lm,height:cm}}),s=e.edges.map(r=>({id:`spec-edge-${r.fromStepId}-${r.toStepId}`,source:r.fromStepId,target:r.toStepId,type:"smoothstep",markerEnd:{type:Nc.ArrowClosed,color:r.isLoopBack?"#b45309":"#57534e"},style:{stroke:r.isLoopBack?"#b45309":"#57534e",strokeWidth:r.isLoopBack?1.5:1.25,strokeDasharray:r.isLoopBack?"6 5":void 0},label:r.isLoopBack?"loop":r.routingType,labelStyle:{fill:r.isLoopBack?"#b45309":"#78716c",fontSize:9,fontFamily:"monospace",textTransform:"uppercase"}}));return{nodes:n,edges:s}}function wxe({data:e}){const t=e.step;return i.jsxs("div",{"data-testid":`spec-node-${t.stepId}`,"data-is-current":t.isCurrent,"data-is-entry":t.isEntry,"data-is-terminal":t.isTerminal,style:{width:lm,height:cm},className:`relative border border-outline-variant bg-white/30 p-3 font-mono hard-shadow ${t.isCurrent?"ring-2 ring-emerald-500/50 bg-emerald-50/60":""}`,children:[i.jsx(og,{testIdPrefix:`slice-workflow-${t.stepId}`}),i.jsx(Sn,{type:"target",position:ye.Left,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),i.jsx(Sn,{type:"source",position:ye.Right,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.04em] text-stone-950",children:t.stepId}),i.jsx("div",{className:"mt-0.5 text-[9px] uppercase tracking-[0.10em] text-stone-500",children:t.role})]}),i.jsxs("div",{className:"flex flex-col items-end gap-1",children:[t.isEntry&&i.jsx("span",{"data-testid":`spec-node-${t.stepId}-entry-badge`,className:"border border-blue-300 bg-blue-50 px-1 text-[8px] uppercase tracking-[0.10em] text-blue-900",children:"entry"}),t.isCurrent&&i.jsx("span",{"data-testid":`spec-node-${t.stepId}-current-badge`,className:"border border-emerald-400 bg-emerald-100 px-1 text-[8px] uppercase tracking-[0.10em] text-emerald-900",children:"current"}),t.isTerminal&&i.jsxs("span",{"data-testid":`spec-node-${t.stepId}-terminal-badge`,className:"inline-flex items-center gap-1 border border-stone-300 bg-stone-100 px-1 text-[8px] uppercase tracking-[0.10em] text-stone-700",children:[i.jsx(Pe,{tool:"terminal",size:"xs"}),"terminal"]})]})]}),i.jsx("div",{className:"mt-3 text-[10px] leading-4 text-stone-800",children:t.label}),t.preferredTarget&&i.jsx("div",{className:"mt-2 truncate text-[9px] text-stone-500",children:t.preferredTarget})]})}function P_({topology:e}){const{affectedRigs:t,totalSeats:n,specGraph:s}=e,r=s??jxe(t);return t.length>0||s!==null?i.jsxs("div",{"data-testid":"topology-tab",className:"p-4 space-y-4",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Topology"}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"topology-aggregate",children:[n," seat",n===1?"":"s"," · ",t.length," rig",t.length===1?"":"s",s&&i.jsxs(i.Fragment,{children:[" · spec ",i.jsx("span",{"data-testid":"topology-spec-name",children:s.specName})," v",s.specVersion]})]})]}),r&&i.jsx(vxe,{specGraph:r}),t.length>0&&i.jsxs("div",{"data-testid":"topology-rig-listing",className:"space-y-3",children:[r&&i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:"Active seats"}),t.map(l=>i.jsxs("section",{"data-testid":`topology-rig-${l.rigName}`,className:"border border-stone-200 bg-white",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:[i.jsx("div",{className:"font-mono text-[10px] font-bold text-stone-900",children:l.rigName}),i.jsx(Ue,{to:"/rigs/$rigId",params:{rigId:l.rigId},"data-testid":`topology-rig-${l.rigName}-open`,className:"font-mono text-[9px] uppercase tracking-[0.10em] text-blue-700 hover:underline",children:"Open topology →"})]}),i.jsx("ul",{className:"divide-y divide-stone-100",children:l.sessionNames.map(u=>i.jsx(Sxe,{session:u},u))})]},l.rigName))]})]}):i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"topology-empty",children:"No seats found for this slice's qitem chain."})}function jxe(e){if(e.length===0)return null;const t=e.map((n,s)=>({stepId:n.rigName||n.rigId||`rig-${s+1}`,label:n.rigName||n.rigId||`Rig ${s+1}`,role:`${n.sessionNames.length} seat${n.sessionNames.length===1?"":"s"}`,preferredTarget:n.sessionNames[0]??null,isEntry:s===0,isCurrent:s===e.length-1,isTerminal:s===e.length-1}));return{specName:"runtime-handoff-map",specVersion:"derived",nodes:t,edges:t.slice(0,-1).map((n,s)=>({fromStepId:n.stepId,toStepId:t[s+1].stepId,routingType:"direct",isLoopBack:!1}))}}function Sxe({session:e}){const[t,n]=E.useState(!1);return i.jsxs("li",{"data-testid":`topology-seat-${e}`,"data-open":t?"true":"false",className:"px-3 py-1",children:[i.jsxs("button",{type:"button","data-testid":`topology-seat-${e}-toggle`,onClick:()=>n(s=>!s),className:"flex w-full items-baseline gap-2 text-left font-mono text-[10px] text-stone-700 hover:bg-stone-50 -mx-3 px-3 py-0.5",children:[i.jsx("span",{className:"flex-1 truncate",children:e}),i.jsx("span",{className:"text-stone-400 shrink-0",children:t?"▾":"▸"})]}),t&&i.jsx("div",{"data-testid":`topology-seat-${e}-preview`,className:"mt-1",children:i.jsx(Ig,{sessionName:e,testIdPrefix:`topology-preview-${e}`})})]})}function Vz(e){return fD[e==="neutral"?"success":e]}function Nxe({rows:e,detailsByName:t,isLoading:n}){const s=e.map(r=>{const a=t.get(r.name),l=a==null?void 0:a.acceptance;return{name:r.name,displayName:r.displayName,status:r.status,items:(l==null?void 0:l.items)??[],doneItems:(l==null?void 0:l.doneItems)??0,totalItems:(l==null?void 0:l.totalItems)??0,percentage:(l==null?void 0:l.percentage)??0}});return n&&s.length===0?i.jsx(Ve,{label:"LOADING PROGRESS",description:"Reading mission slice acceptance.",variant:"card",testId:"mission-progress-heatmap-loading"}):s.length===0?i.jsx(Ve,{label:"NO MISSION SLICES",description:"Mission has no scoped slices to render a heat-map.",variant:"card",testId:"mission-progress-heatmap-empty"}):i.jsxs("section",{"data-testid":"mission-progress-heatmap",className:"border border-outline-variant bg-white/35 p-4 backdrop-blur-sm",children:[i.jsxs("header",{className:"mb-3 flex items-center justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsx("h3",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Acceptance heat-map"}),i.jsxs("span",{className:"font-mono text-[10px] text-stone-600",children:[s.length," slice",s.length===1?"":"s"," ·"," ","one cell per acceptance item"]})]}),i.jsx("div",{className:"space-y-2",children:s.map(r=>i.jsx(kxe,{row:r},r.name))}),i.jsx(Cxe,{})]})}function kxe({row:e}){const t=tf(e.status);return i.jsxs("article",{"data-testid":`mission-progress-heatmap-row-${e.name}`,"data-status":e.status,"data-tone":t,className:"grid grid-cols-[minmax(8rem,16rem)_1fr_auto] items-center gap-3",children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsx(Ue,{to:"/project/slice/$sliceId",params:{sliceId:e.name},className:"block truncate font-mono text-[11px] uppercase tracking-[0.12em] text-stone-900 hover:underline",title:e.displayName,"aria-label":`${e.displayName} (${e.doneItems}/${e.totalItems} acceptance items)`,children:e.displayName}),i.jsx(Un,{token:{label:e.status,tone:t},compact:!0})]}),i.jsx(_xe,{row:e}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-700 tabular-nums whitespace-nowrap",children:[e.doneItems,"/",e.totalItems||0,e.totalItems>0?` (${e.percentage}%)`:""]})]})}function _xe({row:e}){if(e.items.length===0)return i.jsx("div",{"data-testid":`mission-progress-heatmap-cells-${e.name}`,"data-cell-state":"empty",className:"font-mono text-[10px] italic text-stone-500",children:"No acceptance items declared yet."});const t=tf(e.status),n=Vz(t);return i.jsx("div",{"data-testid":`mission-progress-heatmap-cells-${e.name}`,className:"flex flex-wrap gap-[3px]",children:e.items.map((s,r)=>i.jsx("span",{"data-testid":`mission-progress-heatmap-cell-${e.name}-${r}`,"data-done":s.done?"true":"false","aria-label":`${s.text} (${s.done?"done":"not done"})`,title:s.text,className:s.done?`h-4 w-4 border ${n}`:"h-4 w-4 border border-outline-variant bg-white/35"},r))})}function Cxe(){return i.jsxs("footer",{"data-testid":"mission-progress-heatmap-legend",className:"mt-3 flex flex-wrap items-center gap-3 border-t border-outline-variant pt-2 font-mono text-[10px] text-stone-600",children:[i.jsx(ed,{label:"done (active)",tone:"info",testId:"legend-active"}),i.jsx(ed,{label:"done (complete)",tone:"success",testId:"legend-complete"}),i.jsx(ed,{label:"done (warning)",tone:"warning",testId:"legend-warning"}),i.jsx(ed,{label:"done (blocked)",tone:"danger",testId:"legend-blocked"}),i.jsx(ed,{label:"not done",notDone:!0,testId:"legend-not-done"})]})}function ed({label:e,tone:t,notDone:n,testId:s}){const r=n?"border-outline-variant bg-white/35":Vz(t);return i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{"aria-hidden":"true","data-testid":`mission-progress-heatmap-${s}`,className:`inline-block h-3 w-3 border ${r}`}),i.jsx("span",{children:e})]})}const Gz=[{id:"overview",label:"Overview"},{id:"story",label:"Story"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}],WS=[{id:"story",label:"Story"},{id:"overview",label:"Overview"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}];function Exe({tabs:e,active:t,onSelect:n}){return i.jsx("div",{role:"tablist","data-testid":"project-tab-nav",className:"flex gap-1 border-b border-outline-variant mb-6 overflow-x-auto",children:e.map(s=>i.jsx("button",{type:"button",role:"tab","aria-selected":t===s.id,"data-testid":`project-tab-${s.id}`,"data-active":t===s.id,onClick:()=>n(s.id),className:he("px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2 -mb-px shrink-0",t===s.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:s.label},s.id))})}function xd({eyebrow:e,title:t,tabs:n,active:s,onSelect:r,children:a}){return i.jsxs("div",{className:"mx-auto w-full max-w-[1200px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:e}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:t})]}),i.jsx(Exe,{tabs:n,active:s,onSelect:r}),i.jsx("div",{role:"tabpanel","data-testid":"project-tab-panel",children:a})]})}function $_({label:e,description:t}){return i.jsx(Ve,{label:e,description:t??"Phase 5 polish.",variant:"card",testId:`project-tab-placeholder-${e.toLowerCase()}`})}function Rxe(e){return e<=0?"no recent activity":new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Axe(e){return e.missionId??e.railItem??"unsorted"}function Txe(e,t){return t?e.filter(n=>Axe(n)===t):e}function Kz(e,t){const n=Ym("all"),s=E.useMemo(()=>!n.data||"unavailable"in n.data?[]:Txe(n.data.slices,e),[n.data,e]),r=rD(t?s.map(u=>u.name):[]),a=E.useMemo(()=>{const u=new Set;for(const f of r.itemsByName.values())Array.isArray(f.qitemIds)&&f.qitemIds.forEach(d=>u.add(d));return Array.from(u).sort()},[r.itemsByName]),l=I2(t?a:[]);return{list:n,rows:s,details:r,qitemIds:a,queueItems:l}}function Wz({rows:e,detailsByName:t,isLoading:n}){return n&&e.length===0?i.jsx($_,{label:"LOADING PROGRESS",description:"Reading scoped slice progress."}):e.length===0?i.jsx(Ve,{label:"NO SCOPED SLICES",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-progress-empty"}):i.jsx("div",{"data-testid":"scope-progress-rollup",className:"space-y-3",children:e.map(s=>{const r=t.get(s.name);return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:i.jsxs("div",{className:"min-w-0",children:[i.jsx(Ue,{to:"/project/slice/$sliceId",params:{sliceId:s.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:s.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Un,{token:z2(),compact:!0}),i.jsx(Un,{token:{label:s.status,tone:Jm(s.status)},compact:!0}),i.jsx(Rc,{value:s.lastActivityAt})]})]})}),i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[i.jsx(js,{label:"Qitems",value:(r==null?void 0:r.qitemIds.length)??s.qitemCount}),i.jsx(js,{label:"Proof",value:r?r.tests.proofPackets.length:s.hasProofPacket?1:0}),i.jsx(js,{label:"Progress",value:r?`${r.acceptance.percentage}%`:"unknown"}),i.jsx(js,{label:"Last activity",value:nB(s.lastActivityAt)})]})]},s.name)})})}function Yz({qitemIds:e,queueItemsById:t,isFetching:n}){const s=[...e].sort((r,a)=>{const l=t.get(r),u=t.get(a),f=(l==null?void 0:l.tsCreated)??r,d=(u==null?void 0:u.tsCreated)??a;return f===d?0:f<d?1:-1});return s.length===0?i.jsx(Ve,{label:"NO QITEMS",description:"No queue items are indexed for this scope.",variant:"card",testId:"scope-queue-empty"}):i.jsxs("div",{"data-testid":"scope-queue-rollup",children:[n?i.jsx("div",{className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,i.jsx("ul",{className:"divide-y divide-outline-variant border border-outline-variant",children:s.map(r=>{const a=t.get(r);return i.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:i.jsxs(sx,{data:eB(r,a),testId:`scope-queue-trigger-${r}`,className:"block w-full px-3 py-2 text-left font-mono text-xs transition-colors hover:bg-white/55",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[a!=null&&a.state?i.jsx(H2,{state:a.state,compact:!0}):i.jsx(F2,{kind:"queue.item",compact:!0}),i.jsx(Rc,{value:a==null?void 0:a.tsCreated})]}),i.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:tB(r,a)}),a?i.jsxs("span",{className:"mt-2 block space-y-2",children:[i.jsx(eg,{source:a.sourceSession,destination:a.destinationSession,muted:!0}),i.jsx("span",{className:"flex flex-wrap gap-1.5",children:(a.tags??[]).slice(0,5).map(l=>i.jsx(pa,{tag:l},l))})]}):null]})},r)})})]})}function Qz({rows:e,detailsByName:t}){return e.length===0?i.jsx(Ve,{label:"NO ARTIFACTS",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-artifacts-empty"}):i.jsx("div",{"data-testid":"scope-artifacts-rollup",className:"space-y-3",children:e.map(n=>{const s=t.get(n.name),r=(s==null?void 0:s.tests.proofPackets.length)??(n.hasProofPacket?1:0),a=(s==null?void 0:s.tests.proofPackets.reduce((l,u)=>l+u.screenshots.length,0))??0;return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx(Ue,{to:"/project/slice/$sliceId",params:{sliceId:n.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:n.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Un,{token:z2(),compact:!0}),i.jsx(Un,{token:{label:n.status,tone:Jm(n.status)},compact:!0})]}),i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[i.jsx(js,{label:"Files",value:(s==null?void 0:s.docs.tree.length)??"unknown"}),i.jsx(js,{label:"Commits",value:(s==null?void 0:s.commitRefs.length)??"unknown"}),i.jsx(js,{label:"Proof packets",value:r}),i.jsx(js,{label:"Screenshots",value:a})]})]},n.name)})})}function Xz({rows:e,detailsByName:t,queueItemsById:n,isFetching:s}){const r=E.useMemo(()=>new Map(e.map(l=>[l.name,l])),[e]),a=E.useMemo(()=>Array.from(t.values()).flatMap(l=>{const u=r.get(l.name),f=(u==null?void 0:u.displayName)??l.displayName??l.name;return Zz(l).map(d=>({...d,detail:{...d.detail??{},sliceLabel:f,sliceName:l.name}}))}),[t,r]);return s&&a.length===0?i.jsx($_,{label:"LOADING STORY",description:"Reading scoped story events."}):a.length===0?i.jsx(Ve,{label:"NO STORY EVENTS",description:"No story events are indexed for this scope.",variant:"card",testId:"scope-story-empty"}):i.jsx("div",{"data-testid":"scope-story-rollup",children:i.jsx(Hz,{events:a,phaseDefinitions:null,queueItemsById:n})})}function Zz(e){const t=new Set(e.qitemIds);return e.story.events.filter(n=>!n.qitemId||t.has(n.qitemId))}function Jz({rows:e,detailsByName:t,isFetching:n}){const[s,r]=E.useState(null),l=e.map(u=>({row:u,detail:t.get(u.name)})).filter(({detail:u})=>u&&u.tests.proofPackets.length>0);return n&&t.size===0?i.jsx($_,{label:"LOADING TESTS",description:"Reading scoped proof packets."}):l.length===0?i.jsx(Ve,{label:"NO PROOF PACKETS",description:"No proof evidence is indexed for this scope.",variant:"card",testId:"scope-tests-empty"}):i.jsxs("div",{"data-testid":"scope-tests-rollup",className:"space-y-3",children:[l.map(({row:u,detail:f})=>{if(!f)return null;const d=f.tests.proofPackets.reduce((p,m)=>p+m.screenshots.length,0);return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx(Ue,{to:"/project/slice/$sliceId",params:{sliceId:u.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:u.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Un,{token:z2(),compact:!0}),i.jsx(Un,{token:{label:`${f.tests.proofPackets.length} packets`,tone:"info"},compact:!0}),i.jsx(Un,{token:{label:`${d} screenshots`,tone:"success"},compact:!0})]})]}),i.jsx(Rc,{value:u.lastActivityAt})]}),i.jsx("div",{className:"mt-3 space-y-3",children:f.tests.proofPackets.map(p=>{var m;return i.jsxs("div",{className:"border border-outline-variant bg-white/30 p-2 backdrop-blur-sm",children:[i.jsx(tg,{title:p.dirName,badge:p.passFailBadge}),(m=p.primaryMarkdown)!=null&&m.content?i.jsx("p",{className:"mt-2 line-clamp-3 font-body text-[11px] leading-relaxed text-stone-700",children:p.primaryMarkdown.content}):null,p.screenshots.length>0?i.jsx("div",{className:"mt-2",children:i.jsx(mD,{sliceName:f.name,screenshots:p.screenshots,onSelect:x=>r({sliceName:f.name,relPath:x}),testIdPrefix:`scope-proof-screenshot-${f.name}`})}):null]},p.dirName)})})]},u.name)}),i.jsx(k_,{sliceName:(s==null?void 0:s.sliceName)??"",relPath:(s==null?void 0:s.relPath)??null,onClose:()=>r(null)})]})}function Ixe(e){const t=new Map;for(const s of e.values())if(!(!s.topology||!Array.isArray(s.topology.affectedRigs)))for(const r of s.topology.affectedRigs){const a=r.rigName||r.rigId;t.has(a)||t.set(a,{rigId:r.rigId,rigName:r.rigName,sessionNames:new Set});const l=t.get(a);r.sessionNames.forEach(u=>l.sessionNames.add(u))}const n=Array.from(t.values()).map(s=>({rigId:s.rigId,rigName:s.rigName,sessionNames:Array.from(s.sessionNames).sort()}));return{affectedRigs:n,totalSeats:n.reduce((s,r)=>s+r.sessionNames.length,0),specGraph:null}}function Mxe({detailsByName:e}){return i.jsx("div",{"data-testid":"scope-topology-rollup",children:i.jsx(P_,{topology:Ixe(e)})})}function Oxe(){const{data:e,isLoading:t}=Ym("all"),n=E.useMemo(()=>{if(!e||"unavailable"in e)return[];const a=new Map;for(const l of e.slices){const u=gD(l),f=u.missionId??u.railItem??"unsorted";a.has(f)||a.set(f,[]),a.get(f).push(u)}return Array.from(a.entries()).map(([l,u])=>({id:l,label:l==="unsorted"?"Unsorted":l,status:Xp(u),slices:u}))},[e]),s=E.useMemo(()=>xD(n),[n]);if(t)return i.jsx(Ve,{label:"LOADING WORKSPACE",description:"Reading slice index.",variant:"card",testId:"workspace-overview-loading"});if(e&&"unavailable"in e)return i.jsx(Ve,{label:"WORKSPACE INDEX UNAVAILABLE",description:e.hint??"Slice index is not available from the configured workspace.",variant:"card",testId:"workspace-overview-unavailable"});const r=(a,l)=>i.jsxs("article",{"data-testid":`workspace-overview-mission-${a.id}`,"data-mission-bucket":l,className:"border border-outline-variant bg-white/20 px-3 py-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 truncate",children:a.label}),i.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[a.slices.length," slice",a.slices.length===1?"":"s"," ·"," ",Rxe(kN(a))]})]}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:a.status})]}),i.jsx("ul",{className:"mt-2 space-y-1",children:a.slices.map(u=>{const f=G2(u);return i.jsx("li",{children:i.jsxs(Ue,{to:"/project/slice/$sliceId",params:{sliceId:u.name},"data-testid":`workspace-overview-slice-${u.name}`,title:`${u.displayName} — ${f}`,"aria-label":`${u.displayName} (${f})`,className:"flex items-start gap-2 px-2 py-1 font-mono text-[11px] text-on-surface hover:bg-surface-low hover:text-stone-900",children:[i.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words leading-snug",children:u.displayName}),i.jsxs("span",{"data-testid":`workspace-overview-slice-${u.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(U2,{count:u.qitemCount,testId:`workspace-overview-slice-${u.name}-qitems`}),i.jsx(V2,{tone:tf(u.status),label:u.status,testId:`workspace-overview-slice-${u.name}-status`})]})]})},u.name)})})]},a.id);return i.jsxs("div",{"data-testid":"workspace-overview-panel",className:"grid gap-4 lg:grid-cols-2",children:[i.jsxs("section",{"data-testid":"workspace-overview-current",className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[i.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Current Work"}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.current.length})]}),s.current.length>0?s.current.map(a=>r(a,"current")):i.jsx(Ve,{label:"NO CURRENT WORK",description:"No live qitem-backed or recent active slices are indexed.",variant:"card",testId:"workspace-overview-current-empty"})]}),i.jsxs("section",{"data-testid":"workspace-overview-archive",className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[i.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Archive"}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.archive.length})]}),s.archive.length>0?s.archive.map(a=>r(a,"archive")):i.jsx(Ve,{label:"NO ARCHIVE",description:"No archived slices are indexed.",variant:"card",testId:"workspace-overview-archive-empty"})]})]})}function Lxe(){const[e,t]=E.useState("overview"),n=O2(),s=Kz(null,e!=="overview");return!n.isLoading&&n.name===null?i.jsx("div",{className:"mx-auto w-full max-w-[960px] px-6 py-12",children:i.jsx(Ve,{label:"NO WORKSPACE CONNECTED",description:"Configure a workspace root to browse missions and slices in this destination.",variant:"card",testId:"workspace-scope-no-workspace",action:{label:"Open settings",href:"/settings"}})}):i.jsxs(xd,{eyebrow:"Workspace",title:n.name??"loading…",tabs:Gz,active:e,onSelect:r=>t(r),children:[e==="overview"?i.jsx(Oxe,{}):null,e==="story"?i.jsx(Xz,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="progress"?i.jsx(Wz,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}):null,e==="artifacts"?i.jsx(Qz,{rows:s.rows,detailsByName:s.details.itemsByName}):null,e==="tests"?i.jsx(Jz,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,e==="queue"?i.jsx(Yz,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="topology"?i.jsx("div",{"data-testid":"workspace-topology-hostmultirig",className:"flex-1 min-h-0 relative h-[60vh]",children:i.jsx(Fz,{})}):null]})}function Pxe(){const{missionId:e}=kn({from:"/project/mission/$missionId"}),[t,n]=E.useState("overview"),s=Kz(e,t!=="overview"),r=rxe(e),a=r.data&&"missionPath"in r.data?r.data.missionPath:null,l=zm(a,"README.md"),u=zm(a,"PROGRESS.md");return i.jsxs(xd,{eyebrow:"Mission",title:e,tabs:Gz,active:t,onSelect:f=>n(f),children:[t==="overview"?i.jsxs("div",{"data-testid":"mission-overview-panel",className:"space-y-6",children:[l.content&&i.jsx("section",{"data-testid":"mission-overview-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Zr,{content:l.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsx("div",{className:"space-y-3",children:s.rows.length>0?s.rows.map(f=>{const d=G2(f);return i.jsx("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Ue,{to:"/project/slice/$sliceId",params:{sliceId:f.name},"data-testid":`mission-overview-slice-${f.name}`,title:`${f.displayName} — ${d}`,"aria-label":`${f.displayName} (${d})`,className:"min-w-0 flex-1 whitespace-normal break-words font-mono text-[12px] uppercase leading-snug tracking-[0.12em] text-stone-900 hover:underline",children:f.displayName}),i.jsxs("span",{"data-testid":`mission-overview-slice-${f.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(U2,{count:f.qitemCount,testId:`mission-overview-slice-${f.name}-qitems`}),i.jsx(V2,{tone:tf(f.status),label:f.status,testId:`mission-overview-slice-${f.name}-status`})]})]})},f.name)}):i.jsx(Ve,{label:"NO SLICES",description:"No indexed slices are attached to this mission.",variant:"card",testId:"mission-overview-empty"})})]}):null,t==="story"?i.jsx(Xz,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="progress"?i.jsxs("div",{"data-testid":"mission-progress-panel",className:"space-y-6",children:[i.jsx(Nxe,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}),u.content&&i.jsx("section",{"data-testid":"mission-progress-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Zr,{content:u.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsx(Wz,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching})]}):null,t==="artifacts"?i.jsx(Qz,{rows:s.rows,detailsByName:s.details.itemsByName}):null,t==="tests"?i.jsx(Jz,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,t==="queue"?i.jsx(Yz,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="topology"?(()=>{const f=r.data&&"topology"in r.data?r.data.topology:null;return f!=null&&f.specGraph?i.jsx(P_,{topology:{affectedRigs:[],totalSeats:0,specGraph:f.specGraph}}):i.jsx(Mxe,{detailsByName:s.details.itemsByName})})():null]})}function eB(e,t){return{qitemId:e,source:t==null?void 0:t.sourceSession,destination:t==null?void 0:t.destinationSession,state:t==null?void 0:t.state,tags:(t==null?void 0:t.tags)??void 0,createdAt:t==null?void 0:t.tsCreated,body:t==null?void 0:t.body}}function tB(e,t){if(!(t!=null&&t.body))return e;const n=t.body.split(`
|
|
545
|
-
`);return n.length<=8?t.body:`${n.slice(0,8).join(`
|
|
546
|
-
`)}
|
|
547
|
-
... ${n.length-8} more lines`}function $xe({qitemIds:e,queueItemsById:t,queueItemsFetching:n}){return e.length===0?i.jsx(Ve,{label:"NO QITEMS",description:"No queue items associated with this slice.",variant:"card",testId:"slice-queue-empty"}):i.jsxs("div",{children:[n?i.jsx("div",{"data-testid":"slice-queue-fetching",className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,i.jsx("ul",{"data-testid":"slice-queue-list",className:"divide-y divide-outline-variant border border-outline-variant",children:e.map(s=>{const r=t.get(s);return i.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:i.jsxs(sx,{data:eB(s,r),testId:`slice-queue-trigger-${s}`,className:"block w-full px-3 py-2 text-left hover:bg-white/55 transition-colors font-mono text-xs",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r!=null&&r.state?i.jsx(H2,{state:r.state,compact:!0}):i.jsx(F2,{kind:"queue.item",compact:!0}),i.jsx(Rc,{value:r==null?void 0:r.tsCreated})]}),i.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:tB(s,r)}),r?i.jsxs("span",{"data-testid":`slice-queue-meta-${s}`,className:"mt-2 block space-y-2 text-[10px] text-stone-500",children:[i.jsx(eg,{source:r.sourceSession,destination:r.destinationSession,muted:!0}),i.jsxs("span",{className:"flex flex-wrap gap-1.5",children:[i.jsx(pa,{tag:s}),(r.tags??[]).slice(0,5).map(a=>i.jsx(pa,{tag:a},a))]})]}):null]})},s)})})]})}function nB(e){return B2(e)}function js({label:e,value:t}){return i.jsxs("div",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.14em] text-on-surface-variant",children:e}),i.jsx("div",{className:"mt-1 font-mono text-sm font-bold text-stone-900",children:t})]})}function Dxe({detail:e}){const t=e.docs.tree,n=e.tests.proofPackets;return i.jsxs("div",{"data-testid":"slice-artifacts-tab",className:"space-y-6",children:[i.jsxs("section",{"data-testid":"slice-artifacts-files",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Files"}),t.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:t.map(s=>{const r=s.type==="file",a=`${e.slicePath}/${s.relPath}`;return i.jsxs("li",{className:"grid grid-cols-[1fr_auto_auto] gap-3 px-3 py-2 font-mono text-[10px]",children:[r?i.jsxs(nxe,{path:s.relPath,absolutePath:a,className:"inline-flex min-w-0 items-center gap-1.5 text-stone-900 hover:underline text-left",testId:`slice-artifacts-file-${s.relPath}`,children:[i.jsx(Pe,{tool:s.relPath,size:"xs"}),i.jsx("span",{className:"truncate",children:s.relPath})]}):i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-stone-500",children:[i.jsx(Pe,{tool:"folder",size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:s.relPath})]}),i.jsx("span",{className:"uppercase tracking-[0.10em] text-stone-500",children:s.type}),i.jsx("span",{className:"text-stone-400",children:s.size==null?"-":`${s.size}b`})]},s.relPath)})}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No slice files indexed."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-commits",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Commits"}),e.commitRefs.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:e.commitRefs.map(s=>i.jsx("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-900",children:i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[i.jsx(Pe,{tool:"commit",size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:s})]})},s))}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No commit refs indexed for this slice."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-proof",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Proof Packets"}),n.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:n.map(s=>i.jsxs("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[i.jsx(tg,{title:s.dirName,badge:s.passFailBadge}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-stone-500",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Pe,{tool:"screenshot",size:"xs",decorative:!0}),s.screenshots.length," screenshots"]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Pe,{tool:"video",size:"xs",decorative:!0}),s.videos.length," videos"]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Pe,{tool:"trace",size:"xs",decorative:!0}),s.traces.length," traces"]})]})]},s.dirName))}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No proof packets indexed."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-docs",children:[i.jsx(it,{tone:"muted",children:"Docs Browser"}),i.jsx("div",{className:"mt-2 border border-outline-variant",children:i.jsx(dxe,{sliceName:e.name,tree:t})})]}),i.jsxs("section",{"data-testid":"slice-artifacts-decisions",children:[i.jsx(it,{tone:"muted",children:"Decisions"}),i.jsx("div",{className:"mt-2 border border-outline-variant",children:i.jsx(fxe,{rows:e.decisions.rows})})]})]})}function qxe({detail:e}){const t=e.acceptance.currentStep,n=zm(e.slicePath??null,"README.md");return i.jsxs("div",{"data-testid":"slice-overview-tab",className:"space-y-6",children:[i.jsxs("section",{"data-testid":"slice-overview-summary",className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(js,{label:"Status",value:e.status}),i.jsx(js,{label:"Progress",value:`${e.acceptance.percentage}%`}),i.jsx(js,{label:"Qitems",value:e.qitemIds.length}),i.jsx(js,{label:"Last Activity",value:nB(e.lastActivityAt)})]}),n.content&&i.jsx("section",{"data-testid":"slice-overview-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Zr,{content:n.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsxs("section",{"data-testid":"slice-overview-current-step",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Current Step"}),t?i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Step"}),i.jsx("div",{className:"font-bold text-stone-900",children:t.stepId})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Role"}),i.jsx("div",{className:"font-bold text-stone-900",children:t.role})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Objective"}),i.jsx("div",{children:t.objective??"No objective declared."})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Allowed exits"}),i.jsx("div",{children:t.allowedExits.join(", ")||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Hop count"}),i.jsx("div",{children:t.hopCount})]})]}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No workflow step is currently bound."})]}),i.jsxs("section",{"data-testid":"slice-overview-readiness",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Readiness"}),i.jsxs("div",{className:"mt-3 space-y-2 font-mono text-[10px] text-stone-700",children:[i.jsxs("div",{children:[e.acceptance.doneItems," of ",e.acceptance.totalItems," acceptance items complete."]}),i.jsxs("div",{children:[e.tests.aggregate.passCount," proof packets passing / ",e.tests.aggregate.failCount," failing."]}),e.acceptance.closureCallout&&i.jsx("div",{className:"border border-amber-300 bg-amber-50 px-2 py-1 text-amber-800",children:e.acceptance.closureCallout}),e.workflowBinding&&i.jsxs("div",{className:"text-stone-500",children:["Workflow: ",e.workflowBinding.workflowName," v",e.workflowBinding.workflowVersion]})]})]})]})}function zxe(){var f,d;const{sliceId:e}=kn({from:"/project/slice/$sliceId"}),[t,n]=E.useState("overview"),s=iK(e),r=I2(((f=s.data)==null?void 0:f.qitemIds)??[]),a=E.useMemo(()=>r.itemsById,[r.itemsById]),l=txe(((d=s.data)==null?void 0:d.slicePath)??null);if(s.isLoading)return i.jsx(xd,{eyebrow:"Slice",title:e,tabs:WS,active:t,onSelect:p=>n(p),children:i.jsx(Ve,{label:"LOADING",description:`Fetching /api/slices/${e}…`,variant:"card",testId:"slice-scope-loading"})});if(s.isError||!s.data)return i.jsx(xd,{eyebrow:"Slice",title:e,tabs:WS,active:t,onSelect:p=>n(p),children:i.jsx(Ve,{label:"SLICE NOT AVAILABLE",description:s.error instanceof Error?s.error.message:`Could not load slice "${e}". The slices indexer may not be configured (rig config get workspace.slices_root).`,variant:"card",testId:"slice-scope-error"})});const u=s.data;return i.jsxs(xd,{eyebrow:"Slice",title:u.displayName||u.name,tabs:WS,active:t,onSelect:p=>n(p),children:[t==="story"?i.jsx(Hz,{events:Zz(u),phaseDefinitions:u.story.phaseDefinitions,queueItemsById:a,timelineMarkdown:l.content??void 0}):null,t==="overview"?i.jsx(qxe,{detail:u}):null,t==="progress"?i.jsx(axe,{acceptance:u.acceptance}):null,t==="artifacts"?i.jsx(Dxe,{detail:u}):null,t==="tests"?i.jsx(mxe,{sliceName:u.name,tests:u.tests,qitemCount:u.qitemIds.length,docsCount:u.docs.tree.length,lastActivityAt:u.lastActivityAt}):null,t==="queue"?i.jsx($xe,{qitemIds:u.qitemIds,queueItemsById:a,queueItemsFetching:r.isFetching}):null,t==="topology"?i.jsx(P_,{topology:u.topology}):null]})}const Bxe={neutral:"border-stone-300 bg-white/65 text-stone-700",info:"border-sky-300 bg-sky-50/70 text-sky-800",success:"border-emerald-300 bg-emerald-50/70 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/75 text-rose-800"},da=[{label:"Queue created",tone:"info",icon:I$},{label:"Handoff",tone:"neutral",icon:Km},{label:"Claimed",tone:"warning",icon:_d},{label:"Completed",tone:"success",icon:kd},{label:"Human action",tone:"danger",icon:ha},{label:"Shipped",tone:"success",icon:k2}],sB=[{label:"idea-ledger",tone:"neutral"},{label:"cycle-4",tone:"info"},{label:"proof",tone:"success"},{label:"urgent",tone:"danger"},{label:"human-review",tone:"warning"}];function sr({token:e,compact:t=!1}){const n=e.icon;return i.jsxs("span",{className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",Bxe[e.tone]),children:[n?i.jsx(n,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function yo({kind:e,label:t,muted:n}){const s=e==="human"?iG:sV;return i.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",n?"border-stone-200 bg-white/45 text-stone-600":"border-stone-300 bg-white/45 text-stone-800"),children:[i.jsx(s,{className:"h-3 w-3 shrink-0",strokeWidth:1.5}),i.jsx("span",{className:"truncate",children:t})]})}function rB({label:e}){return i.jsxs("span",{className:"inline-flex items-center gap-1 border border-stone-200 bg-white/55 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[i.jsx(j2,{className:"h-3 w-3",strokeWidth:1.5}),e]})}function Fxe(){return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(yo,{kind:"agent",label:"orch.lead@openrig-velocity"}),i.jsx(gm,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(yo,{kind:"agent",label:"driver@openrig-velocity"}),i.jsx(gm,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(yo,{kind:"human",label:"human@host"})]})}function Hxe(){return i.jsx("div",{className:"grid grid-cols-3 gap-2",children:["for-you-human-and-shipped.png","project-overview-missions.png","project-triage-slice.png"].map(e=>i.jsxs("div",{className:"border border-stone-200 bg-stone-100/80",children:[i.jsx("div",{className:"flex aspect-[4/3] items-center justify-center bg-white/65 text-stone-400",children:i.jsx(bV,{className:"h-7 w-7",strokeWidth:1.2})}),i.jsx("div",{className:"truncate border-t border-stone-200 px-1 py-0.5 font-mono text-[8px] text-stone-600",children:e})]},e))})}function YS({label:e,description:t,children:n}){return i.jsx(wm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:i.jsx("span",{className:"uppercase tracking-[0.16em]",children:e}),children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsx("p",{className:"font-mono text-[10px] leading-relaxed text-stone-700",children:t}),n]})})}function SP({dense:e=!1}){return i.jsxs("article",{className:he("border border-outline-variant bg-white/60 backdrop-blur-sm hard-shadow",e?"p-3":"p-4"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(sr,{token:{label:"Action required",tone:"danger",icon:ha},compact:e}),i.jsx("h3",{className:"font-mono text-sm text-stone-950",children:"Review demo-seed triage proof packet"})]}),i.jsx(rB,{label:"Today 4:18 PM"})]}),i.jsx("p",{className:"mt-3 whitespace-pre-line font-mono text-[11px] leading-relaxed text-stone-700",children:"Review the proof packet screenshots, confirm the shipped slice is ready, then approve or route back with notes."}),i.jsx("div",{className:"mt-3",children:i.jsx(Fxe,{})}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:sB.slice(0,4).map(t=>i.jsx(sr,{token:t,compact:!0},t.label))})]})}function Uxe(){return i.jsxs("article",{className:"relative border border-outline-variant bg-white/60 p-4 hard-shadow backdrop-blur-sm",children:[i.jsx("div",{className:"absolute left-5 top-12 bottom-5 w-px bg-stone-300"}),i.jsx("div",{className:"relative space-y-5 pl-8",children:[{token:da[5],title:"Slice shipped with proof packet",body:"The triage slice closed with screenshots, queue context, and verification notes attached."},{token:da[3],title:"Implementation completed",body:"Driver finished the UI pass and handed verification to guard and QA."},{token:da[1],title:"Work routed for review",body:"The queue item moved from driver to guard with targeted checks."}].map(e=>{const t=e.token.icon??Yl;return i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute -left-[38px] top-0 flex h-5 w-5 items-center justify-center border border-stone-300 bg-white text-stone-700",children:i.jsx(t,{className:"h-3 w-3",strokeWidth:1.5})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(sr,{token:e.token,compact:!0}),i.jsx(rB,{label:"12 min ago"})]}),i.jsx("h4",{className:"mt-2 font-mono text-[12px] text-stone-950",children:e.title}),i.jsx("p",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]},e.title)})})]})}function Vxe(){return i.jsx("div",{className:"divide-y divide-outline-variant border border-outline-variant bg-white/55 backdrop-blur-sm",children:[{token:da[4],title:"Approval needed",body:"Review proof screenshots and approve release-readiness.",actor:"human@host"},{token:da[2],title:"Claimed by QA",body:"VM verification is in progress with current worktree source.",actor:"velocity-qa"},{token:da[1],title:"Route to guard",body:"Run narrow advisory on UI-only diff and source scans.",actor:"redo3-guard-3"}].map(e=>i.jsxs("div",{className:"grid gap-3 p-3 sm:grid-cols-[auto_1fr_auto]",children:[i.jsx(sr,{token:e.token,compact:!0}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-[12px] text-stone-950",children:e.title}),i.jsx("div",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]}),i.jsx(yo,{kind:e.actor.includes("human")?"human":"agent",label:e.actor,muted:!0})]},e.title))})}function Gxe(){return i.jsx("div",{className:"paper-grid min-h-full p-8",children:i.jsxs("div",{className:"mx-auto max-w-7xl space-y-8",children:[i.jsxs("header",{className:"border border-outline-variant bg-white/60 p-4 font-mono backdrop-blur-sm hard-shadow",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-stone-600",children:"Project graphics package preview"}),i.jsx("h1",{className:"mt-2 text-xl uppercase tracking-[0.14em] text-stone-950",children:"Queue, story, and proof card language"}),i.jsx("p",{className:"mt-2 max-w-3xl text-[11px] leading-relaxed text-stone-700",children:"Hidden preview route for choosing metadata badges, action chips, flow arrows, and proof-card density before applying the system to For You, Story, Queue, and scope rollups."})]}),i.jsxs("section",{className:"grid gap-4 lg:grid-cols-3",children:[i.jsxs(YS,{label:"A / Compact Ledger",description:"Small pills and restrained icons. Best when density matters and queue cards need to scan like a work ledger.",children:[i.jsx(SP,{dense:!0}),i.jsx(Vxe,{})]}),i.jsxs(YS,{label:"B / Narrative Rail",description:"Story-first layout with event icons on a vertical rail. Best for showing how work moved from idea to proof.",children:[i.jsx(Uxe,{}),i.jsx(Hxe,{})]}),i.jsxs(YS,{label:"C / Action Board",description:"Bolder cards with explicit status, actors, and proof thumbnails. Best for For You and approval surfaces.",children:[i.jsx(SP,{}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:da.map(e=>i.jsx(sr,{token:e},e.label))})]})]}),i.jsxs("section",{className:"grid gap-4 lg:grid-cols-[1.2fr_0.8fr]",children:[i.jsx(wm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"EVENT BADGE VOCABULARY",children:i.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 lg:grid-cols-3",children:da.map(e=>i.jsxs("div",{className:"border border-outline-variant bg-white/55 p-3",children:[i.jsx(sr,{token:e}),i.jsxs("div",{className:"mt-2 font-mono text-[10px] leading-relaxed text-stone-700",children:[e.label==="Queue created"?"A work item entered the system.":null,e.label==="Handoff"?"Ownership moved from one actor to another.":null,e.label==="Claimed"?"An actor is actively working the item.":null,e.label==="Completed"?"The assigned work item closed.":null,e.label==="Human action"?"A person needs to approve, deny, or route.":null,e.label==="Shipped"?"The slice closed with evidence attached.":null]})]},e.label))})}),i.jsx(wm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"SUPPORTING CHIPS",children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Tags"}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:sB.map(e=>i.jsx(sr,{token:e},e.label))})]}),i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Actors"}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.jsx(yo,{kind:"human",label:"human@host"}),i.jsx(yo,{kind:"agent",label:"driver@openrig-velocity"}),i.jsx(yo,{kind:"agent",label:"guard@openrig-velocity",muted:!0})]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Scope"}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.jsx(sr,{token:{label:"Workspace",tone:"neutral",icon:P$}}),i.jsx(sr,{token:{label:"Mission",tone:"info",icon:_V}}),i.jsx(sr,{token:{label:"Slice",tone:"success",icon:Gm}})]})]})]})})]})]})})}function Kxe(){return i.jsxs("div",{className:"mx-auto max-w-5xl space-y-10 px-6 py-10","data-testid":"card-previews-lab",children:[i.jsxs("header",{className:"space-y-2",children:[i.jsx("h1",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-stone-500",children:"/lab/card-previews"}),i.jsx("p",{className:"font-mono text-[11px] text-stone-700",children:"Visual gallery of for-you card kind variants. Each section renders the same card component the live feed uses, with sample data."})]}),i.jsx(Pl,{title:"Shipped",description:"A slice merged + summary view. Used when a slice closes successfully and the feed surfaces it to operators downstream."}),i.jsx(pz,{source:{sliceId:"first-conveyor-run",title:"First Conveyor Run — shipped",oneLiner:"Slice merged at b71cddf. 4 commits + 1 proof packet.",sections:[{number:1,heading:"Lint parses + validates entries",summary:"12 tests pass; UTF-8 edge cases handled."},{number:2,heading:"Reviewer accepted with one concern",summary:"Combining-character edge addressed mid-flight."},{number:3,heading:"Proof packet captured",summary:"CLI output screenshot + diff render."}]}}),i.jsx(Pl,{title:"Incident / Action Required",description:"A timeline-shaped surface for an in-flight or recent incident. Use status='warning' or 'danger' to surface attention; 'info' for informational; 'muted' for resolved."}),i.jsx(mz,{source:{sliceId:"auth-bearer-tailscale-trust",title:"Auth bearer tailscale trust — concerning",oneLiner:"Reviewer flagged loopback-only default at fix-1; remediated at fix-2.",status:"warning",recentEntries:[{time:"13:42",title:"Reviewer BLOCKING-CONCERN raised",status:"danger"},{time:"14:01",title:"Driver forward-fix scoped",status:"info"},{time:"14:38",title:"Forward-fix landed; gates green",status:"success"}]}}),i.jsx(Pl,{title:"Progress",description:"A mission-level progress card with percent + active-slice context. Used during a mission lifecycle to keep operators informed without requiring them to open the mission page."}),i.jsx(gz,{source:{missionId:"release-0.3.1",title:"Release 0.3.1 — in flight",oneLiner:"Wave 3a + 3b dispatches; multiple slices in review.",percent:62,nextStep:"design-reviewer audit on slice 21 narrative voice",activeSlice:{id:"slice-21-onboarding-conveyor",label:"slice-21-onboarding-conveyor",status:"in-progress"}}}),i.jsx(Pl,{title:"Approval / Action Required",description:"An operator-decision-needed surface. Renders the qitem context + the two action paths (Approve / Deny) the operator picks between."}),i.jsx(xz,{source:{qitemId:"qitem-20260511201234-abcdef01",title:"Auth bearer tailscale trust — approve merge?",oneLiner:"All gates green; merge requires operator sign-off.",bodyPreview:"Triple-guard CLEAR. velocity-qa VM walk PASS. Ready for merge to main.",drillInHref:"/project/slice/auth-bearer-tailscale-trust",onApprove:()=>{},onDeny:()=>{}}}),i.jsx(Pl,{title:"Concept / Observation",description:"A discovery / lab / scratch-pad surface. Used for not-yet-actionable observations, draft ideas, or comparison previews."}),i.jsx(Qhe,{source:{sliceId:"concept-storytelling-primitives",title:"Storytelling primitives — concept",oneLiner:"Could replace one-off card components with kind-frame primitives.",comparePreview:[{label:"Card kinds",valueOld:"5 components",valueNew:"1 kind-frame + 5 sources"},{label:"Visual variance",valueOld:"drift over time",valueNew:"centralized accent tokens"},{label:"Maintenance",valueOld:"edit each component",valueNew:"edit kind-frame once"}]}}),i.jsx(Pl,{title:"Empty state",description:"What the for-you feed shows when no events qualify. Reusable across surfaces; the EmptyState primitive is the canonical pattern."}),i.jsx(Ve,{label:"ALL CAUGHT UP",description:"No new events. Spin up a rig or declare a slice to populate this feed.",variant:"card",testId:"card-previews-empty-state"})]})}function Pl({title:e,description:t}){return i.jsxs("div",{className:"space-y-1 pt-4",children:[i.jsx("h2",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-900",children:e}),i.jsx("p",{className:"font-mono text-[10px] text-stone-600 max-w-3xl",children:t})]})}function ax({backLayerOverride:e,vellumSheetOverride:t}={}){return i.jsxs("div",{"data-testid":"vellum-lab",className:"relative min-h-screen overflow-hidden",children:[e,t,i.jsx(az,{}),i.jsx(oz,{}),i.jsx(lz,{})]})}function Wxe(){return i.jsx(ax,{backLayerOverride:i.jsx(t0e,{}),vellumSheetOverride:i.jsx(Jxe,{})})}function Yxe(){return i.jsx(ax,{backLayerOverride:i.jsx(n0e,{}),vellumSheetOverride:i.jsx(e0e,{})})}function Qxe(){return i.jsx(ax,{backLayerOverride:i.jsx(Zxe,{}),vellumSheetOverride:i.jsx(Xxe,{})})}function Xxe(){return i.jsx("div",{"data-testid":"vellum-sheet-heavy-diffuse","aria-hidden":"true",className:"absolute inset-0 z-[5] bg-white/25 backdrop-blur-[8px] pointer-events-none"})}function Zxe(){const r=Math.ceil(27.5)+2,a=(u,f,d=0)=>u/1280*Math.PI*2*f+d,l=[];for(let u=0;u<r;u++){const f=u*40-40;let d=`M 0 ${f.toFixed(2)}`;for(let p=0;p<=2560;p+=32){const m=Math.sin(a(p,2,u*.3))*36,x=Math.sin(a(p,5,u*.5))*9,y=Math.sin(a(p,3,u*.18))*14,b=m+x+y;d+=` L ${p} ${(f+b).toFixed(2)}`}l.push(d)}return i.jsx("div",{"data-testid":"back-layer-scrolling-topo","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:i.jsx("svg",{className:"absolute top-0 left-0 h-full vellum-scroll-x",style:{width:"200%"},viewBox:"0 0 2560 1100",preserveAspectRatio:"xMidYMid slice",children:l.map((u,f)=>i.jsx("path",{d:u,stroke:"#1c1917",strokeWidth:"1.0",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},f))})})}function Jxe(){return i.jsx("div",{"data-testid":"vellum-sheet-diffuse","aria-hidden":"true",className:"absolute top-[14px] bottom-[12px] left-[16px] right-[14px] z-[5] bg-white/35 backdrop-blur-[14px] pointer-events-none"})}function e0e(){return i.jsx("div",{"data-testid":"vellum-sheet-more-diffuse","aria-hidden":"true",className:"absolute top-[14px] bottom-[12px] left-[16px] right-[14px] z-[5] bg-white/45 backdrop-blur-[22px] pointer-events-none"})}function t0e(){const s=Math.ceil(27.5)+2,r=[];for(let a=0;a<s;a++){const l=a*40-40;let u=`M -50 ${l.toFixed(2)}`;for(let f=0;f<=1380;f+=40){const d=f/1280,p=Math.sin(d*Math.PI*2.2+a*.28)*36,m=Math.sin(d*Math.PI*5.8+a*.47)*9,x=Math.sin(d*Math.PI*3.6+a*.13+Math.sin(a*.5)*2)*16,y=p+m+x;u+=` L ${f.toFixed(0)} ${(l+y).toFixed(2)}`}r.push(u)}return i.jsx("div",{"data-testid":"back-layer-topo","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:i.jsx("svg",{className:"w-full h-full",viewBox:"0 0 1280 1100",preserveAspectRatio:"xMidYMid slice",children:r.map((a,l)=>i.jsx("path",{d:a,stroke:"#1c1917",strokeWidth:"1.2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},l))})})}function n0e(){const e=[{type:"cube",size:220,pos:"top-[2%] -left-6"},{type:"spool",size:200,pos:"top-[4%] left-[24%]"},{type:"x-prism",size:220,pos:"top-[2%] left-[50%]"},{type:"cube-frame",size:240,pos:"top-[1%] -right-8"},{type:"arc-stripes",size:200,pos:"top-[28%] left-[4%]"},{type:"donut-dots",size:220,pos:"top-[26%] left-[28%]"},{type:"hex-prism",size:220,pos:"top-[26%] left-[54%]"},{type:"cylinder-stripes",size:200,pos:"top-[28%] right-[4%]"},{type:"wedge",size:230,pos:"top-[52%] -left-4"},{type:"stairs-iso",size:240,pos:"top-[50%] left-[24%]"},{type:"barrel",size:220,pos:"top-[52%] left-[50%]"},{type:"pacman",size:240,pos:"top-[50%] -right-6"},{type:"cube-stack",size:260,pos:"bottom-[-4%] left-[5%]"},{type:"L-prism",size:260,pos:"bottom-[-2%] left-[36%]"},{type:"cube-ports",size:260,pos:"bottom-[-4%] right-[4%]"}];return i.jsx("div",{"data-testid":"back-layer-isometric","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:e.map((t,n)=>i.jsx(s0e,{...t},n))})}function s0e({type:e,size:t,pos:n}){return i.jsx("div",{className:`absolute ${n}`,style:{width:t,height:t},children:i.jsx(r0e,{type:e})})}function r0e({type:e}){const t={fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"};switch(e){case"cube":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 52,20 52,44 30,56 8,44 8,20"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"32"}),i.jsx("line",{x1:"30",y1:"32",x2:"8",y2:"20"}),i.jsx("line",{x1:"30",y1:"32",x2:"52",y2:"20"})]});case"cylinder-v":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"14",rx:"14",ry:"5"}),i.jsx("line",{x1:"16",y1:"14",x2:"16",y2:"46"}),i.jsx("line",{x1:"44",y1:"14",x2:"44",y2:"46"}),i.jsx("path",{d:"M 16 46 A 14 5 0 0 0 44 46"})]});case"triangle-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,46 30,12 46,46"}),i.jsx("polygon",{points:"46,46 30,12 38,8 54,42"}),i.jsx("line",{x1:"14",y1:"46",x2:"54",y2:"42"})]});case"rod":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("line",{x1:"12",y1:"48",x2:"48",y2:"12",strokeWidth:"1.5"}),i.jsx("circle",{cx:"12",cy:"48",r:"4"}),i.jsx("circle",{cx:"48",cy:"12",r:"4"})]});case"cube-frame":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 52,20 52,44 30,56 8,44 8,20"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"32"}),i.jsx("line",{x1:"30",y1:"32",x2:"8",y2:"20"}),i.jsx("line",{x1:"30",y1:"32",x2:"52",y2:"20"}),i.jsx("rect",{x:"22",y:"28",width:"16",height:"16"})]});case"stairs":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polyline",{points:"8,52 18,52 18,42 28,42 28,32 38,32 38,22 48,22 48,12 56,12"})});case"spool":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"36",cy:"30",rx:"14",ry:"6"}),i.jsx("path",{d:"M 22 30 L 8 30",strokeWidth:"1.5"}),i.jsx("line",{x1:"36",y1:"14",x2:"36",y2:"22"})]});case"arc-c":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("path",{d:"M 44 12 A 20 20 0 1 0 44 48",strokeWidth:"1.5"})});case"diamond-row":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,30 14,24 20,30 14,36"}),i.jsx("polygon",{points:"20,30 26,24 32,30 26,36"}),i.jsx("polygon",{points:"32,30 38,24 44,30 38,36"}),i.jsx("polygon",{points:"44,30 50,24 56,30 50,36"})]});case"plus":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polygon",{points:"24,8 36,8 36,24 52,24 52,36 36,36 36,52 24,52 24,36 8,36 8,24 24,24"})});case"cylinder-h":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"14",cy:"30",rx:"5",ry:"14"}),i.jsx("line",{x1:"14",y1:"16",x2:"46",y2:"16"}),i.jsx("line",{x1:"14",y1:"44",x2:"46",y2:"44"}),i.jsx("path",{d:"M 46 16 A 5 14 0 0 1 46 44"})]});case"wave":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 8 16 Q 18 8 28 16 T 48 16",strokeWidth:"1.2"}),i.jsx("path",{d:"M 8 30 Q 18 22 28 30 T 48 30",strokeWidth:"1.2"}),i.jsx("path",{d:"M 8 44 Q 18 36 28 44 T 48 44",strokeWidth:"1.2"})]});case"x-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,8 24,8 30,18 36,8 46,8 36,22 46,36 36,36 30,26 24,36 14,36 24,22"}),i.jsx("line",{x1:"14",y1:"36",x2:"20",y2:"40"}),i.jsx("line",{x1:"46",y1:"36",x2:"52",y2:"40"})]});case"tri-stack":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"12,40 18,28 24,40"}),i.jsx("polygon",{points:"24,40 30,28 36,40"}),i.jsx("polygon",{points:"36,40 42,28 48,40"})]});case"L-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,28 28,18 48,28 28,38"}),i.jsx("polygon",{points:"28,38 48,28 48,44 28,54"}),i.jsx("polygon",{points:"8,28 8,44 28,54 28,38"})]});case"arc-stripes":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 12 50 A 22 22 0 0 1 48 14",strokeWidth:"1"}),i.jsx("path",{d:"M 16 50 A 18 18 0 0 1 48 18",strokeWidth:"1"}),i.jsx("path",{d:"M 20 50 A 14 14 0 0 1 48 22",strokeWidth:"1"}),i.jsx("path",{d:"M 24 50 A 10 10 0 0 1 48 26",strokeWidth:"1"})]});case"hex-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 48,18 48,38 30,48 12,38 12,18"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"48"}),i.jsx("line",{x1:"12",y1:"18",x2:"30",y2:"28"}),i.jsx("line",{x1:"48",y1:"18",x2:"30",y2:"28"})]});case"dot-circle":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:Array.from({length:16}).map((n,s)=>{const r=s/16*Math.PI*2,a=30+Math.cos(r)*22,l=30+Math.sin(r)*22;return i.jsx("circle",{cx:a,cy:l,r:"1.8"},s)})});case"wedge":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 30 30 L 30 8 A 22 22 0 0 1 52 30 Z",fill:"currentColor"}),i.jsx("path",{d:"M 30 30 L 8 30 A 22 22 0 0 1 30 8"}),i.jsx("line",{x1:"30",y1:"30",x2:"14",y2:"44"}),i.jsx("line",{x1:"30",y1:"30",x2:"22",y2:"50"}),i.jsx("line",{x1:"30",y1:"30",x2:"34",y2:"52"})]});case"down-arrows":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"20,8 40,8 30,22"}),i.jsx("polygon",{points:"20,22 40,22 30,36"}),i.jsx("polygon",{points:"20,36 40,36 30,50"})]});case"donut-dots":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("circle",{cx:"30",cy:"30",r:"22"}),i.jsx("circle",{cx:"30",cy:"30",r:"10"}),i.jsx("g",{fill:"currentColor",children:Array.from({length:24}).map((n,s)=>{const r=s/24*Math.PI*2+.08,a=16;return i.jsx("circle",{cx:30+Math.cos(r)*a,cy:30+Math.sin(r)*a,r:"0.9"},s)})})]});case"bowtie":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"8,18 22,30 8,42"}),i.jsx("polygon",{points:"52,18 38,30 52,42"}),i.jsx("circle",{cx:"30",cy:"30",r:"3"})]});case"dot-grid":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:Array.from({length:6}).map((n,s)=>Array.from({length:6}).map((r,a)=>i.jsx("circle",{cx:10+a*8,cy:10+s*8,r:"1.4"},`${s}-${a}`)))});case"arc-half":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("path",{d:"M 8 38 A 22 22 0 0 1 52 38",strokeWidth:"1.5"})});case"cylinder-stripes":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"14",rx:"14",ry:"5"}),i.jsx("line",{x1:"16",y1:"14",x2:"16",y2:"46"}),i.jsx("line",{x1:"44",y1:"14",x2:"44",y2:"46"}),i.jsx("path",{d:"M 16 46 A 14 5 0 0 0 44 46"}),i.jsx("line",{x1:"22",y1:"18",x2:"22",y2:"44",strokeDasharray:"2 2"}),i.jsx("line",{x1:"30",y1:"19",x2:"30",y2:"45",strokeDasharray:"2 2"}),i.jsx("line",{x1:"38",y1:"18",x2:"38",y2:"44",strokeDasharray:"2 2"})]});case"dot-cloud":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:[[22,18],[30,14],[38,18],[16,24],[24,24],[32,22],[40,24],[46,28],[18,32],[26,32],[34,32],[42,32],[22,38],[30,38],[38,38],[28,44],[36,44]].map(([n,s],r)=>i.jsx("circle",{cx:n,cy:s,r:"1.5"},r))});case"pacman":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 30 30 L 52 18 A 22 22 0 1 1 52 42 Z",fill:"currentColor"}),i.jsx("line",{x1:"20",y1:"20",x2:"14",y2:"14"}),i.jsx("line",{x1:"20",y1:"40",x2:"14",y2:"46"}),i.jsx("line",{x1:"12",y1:"30",x2:"6",y2:"30"})]});case"down-triangles":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"22,12 38,12 30,24"}),i.jsx("polygon",{points:"22,28 38,28 30,40"})]});case"cube-inset":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,4 50,16 50,36 30,48 10,36 10,16"}),i.jsx("line",{x1:"30",y1:"4",x2:"30",y2:"48"}),i.jsx("line",{x1:"10",y1:"16",x2:"30",y2:"28"}),i.jsx("line",{x1:"50",y1:"16",x2:"30",y2:"28"}),i.jsx("rect",{x:"22",y:"46",width:"16",height:"10"})]});case"hex-small":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polygon",{points:"30,18 42,24 42,38 30,44 18,38 18,24"})});case"cylinder-disc":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"34",cy:"30",rx:"14",ry:"5"}),i.jsx("path",{d:"M 20 30 A 14 5 0 0 1 48 30"}),i.jsx("line",{x1:"20",y1:"30",x2:"20",y2:"36",strokeWidth:"1.5"}),i.jsx("ellipse",{cx:"20",cy:"36",rx:"3",ry:"1.4"}),i.jsx("path",{d:"M 20 30 L 14 32"})]});case"triangle-solid":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:i.jsx("polygon",{points:"30,16 46,44 14,44"})});case"stairs-iso":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,40 16,36 24,40 16,44"}),i.jsx("polygon",{points:"16,36 24,32 32,36 24,40"}),i.jsx("polygon",{points:"24,32 32,28 40,32 32,36"}),i.jsx("polygon",{points:"32,28 40,24 48,28 40,32"}),i.jsx("polygon",{points:"40,24 48,20 56,24 48,28"})]});case"coin":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"26",rx:"14",ry:"6"}),i.jsx("path",{d:"M 16 26 L 16 34 A 14 6 0 0 0 44 34 L 44 26"}),i.jsx("line",{x1:"22",y1:"26",x2:"22",y2:"34"}),i.jsx("line",{x1:"30",y1:"32",x2:"30",y2:"38"}),i.jsx("line",{x1:"38",y1:"26",x2:"38",y2:"34"})]});case"cube-ports":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,6 52,18 52,42 30,54 8,42 8,18"}),i.jsx("line",{x1:"30",y1:"6",x2:"30",y2:"30"}),i.jsx("line",{x1:"30",y1:"30",x2:"8",y2:"18"}),i.jsx("line",{x1:"30",y1:"30",x2:"52",y2:"18"}),i.jsx("circle",{cx:"20",cy:"20",r:"2.5",fill:"currentColor"}),i.jsx("circle",{cx:"40",cy:"20",r:"2.5",fill:"currentColor"}),i.jsx("circle",{cx:"30",cy:"42",r:"2.5",fill:"currentColor"})]});case"arc-bridge":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 8 44 Q 30 8 52 44",strokeWidth:"1.5"}),i.jsx("circle",{cx:"30",cy:"44",r:"3",fill:"currentColor"})]});case"zigzag-v":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polyline",{points:"24,8 36,16 24,24 36,32 24,40 36,48",strokeWidth:"1.5"}),i.jsx("polyline",{points:"20,12 32,20 20,28 32,36 20,44 32,52",strokeWidth:"1.5"})]});case"x-flat":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:i.jsx("polygon",{points:"14,14 22,14 30,22 38,14 46,14 36,28 46,46 38,46 30,34 22,46 14,46 24,28"})});case"cube-stack":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,30 22,26 30,30 22,34"}),i.jsx("polygon",{points:"22,34 30,30 30,38 22,42"}),i.jsx("polygon",{points:"14,30 14,38 22,42 22,34"}),i.jsx("polygon",{points:"30,22 38,18 46,22 38,26"}),i.jsx("polygon",{points:"38,26 46,22 46,30 38,34"}),i.jsx("polygon",{points:"30,22 30,30 38,34 38,26"})]});case"back-arrows":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"42,16 42,44 24,30"}),i.jsx("polygon",{points:"28,16 28,44 10,30"})]});case"barrel":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"44",cy:"30",rx:"6",ry:"14"}),i.jsx("line",{x1:"44",y1:"16",x2:"14",y2:"20"}),i.jsx("line",{x1:"44",y1:"44",x2:"14",y2:"40"}),i.jsx("ellipse",{cx:"14",cy:"30",rx:"4",ry:"10"}),i.jsx("line",{x1:"20",y1:"20",x2:"20",y2:"40",strokeDasharray:"2 2"}),i.jsx("line",{x1:"28",y1:"19",x2:"28",y2:"41",strokeDasharray:"2 2"}),i.jsx("line",{x1:"36",y1:"18",x2:"36",y2:"42",strokeDasharray:"2 2"})]});case"wave-s":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 22 8 Q 32 18 22 28 T 22 48",strokeWidth:"1.5"}),i.jsx("path",{d:"M 38 8 Q 28 18 38 28 T 38 48",strokeWidth:"1.5"})]})}}const Ie=ZH({component:()=>i.jsx(zU,{client:VU,children:i.jsx(HX,{children:i.jsx(d$,{})})})}),i0e=Me({getParentRoute:()=>Ie,path:"/",component:uhe}),a0e=Me({getParentRoute:()=>Ie,path:"/topology",component:Fge}),o0e=Me({getParentRoute:()=>Ie,path:"/topology/rig/$rigId",component:Hge}),l0e=Me({getParentRoute:()=>Ie,path:"/topology/pod/$rigId/$podName",component:Vge}),c0e=Me({getParentRoute:()=>Ie,path:"/topology/seat/$rigId/$logicalId",component:Gge}),u0e=Me({getParentRoute:()=>Ie,path:"/for-you",component:ope}),d0e=Me({getParentRoute:()=>Ie,path:"/project",component:Lxe}),f0e=Me({getParentRoute:()=>Ie,path:"/project/mission/$missionId",component:Pxe}),h0e=Me({getParentRoute:()=>Ie,path:"/project/slice/$sliceId",component:zxe}),p0e=Me({getParentRoute:()=>Ie,path:"/specs",component:vz}),m0e=Me({getParentRoute:()=>Ie,path:"/specs/applications",component:vz}),g0e=Me({getParentRoute:()=>Ie,path:"/specs/skills",component:Spe}),x0e=Me({getParentRoute:()=>Ie,path:"/specs/skills/$skillToken",component:()=>{const{skillToken:e}=kn({from:"/specs/skills/$skillToken"});return i.jsx(bz,{skillToken:e})}}),y0e=Me({getParentRoute:()=>Ie,path:"/specs/skills/$skillToken/file/$fileToken",component:()=>{const{skillToken:e,fileToken:t}=kn({from:"/specs/skills/$skillToken/file/$fileToken"});return i.jsx(bz,{skillToken:e,fileToken:t})}}),v0e=Me({getParentRoute:()=>Ie,path:"/specs/plugins",component:Npe}),b0e=Me({getParentRoute:()=>Ie,path:"/files",component:Kpe}),w0e=Me({getParentRoute:()=>Ie,path:"/plugins/$pluginId",component:()=>{const{pluginId:e}=kn({from:"/plugins/$pluginId"});return i.jsx(Ope,{pluginId:e})}}),j0e=Me({getParentRoute:()=>Ie,path:"/specs/$specKind/$specName",component:()=>{const{specName:e}=kn({from:"/specs/$specKind/$specName"});return i.jsx(Eo,{to:"/specs/library/$entryId",params:{entryId:e}})}}),S0e=Me({getParentRoute:()=>Ie,path:"/settings",component:rme}),N0e=Me({getParentRoute:()=>Ie,path:"/settings/policies",component:cme}),k0e=Me({getParentRoute:()=>Ie,path:"/settings/log",component:hme}),_0e=Me({getParentRoute:()=>Ie,path:"/settings/status",component:yme}),C0e=Me({getParentRoute:()=>Ie,path:"/search",component:Qfe}),E0e=Me({getParentRoute:()=>Ie,path:"/lab/project-graphics-preview",component:Gxe}),R0e=Me({getParentRoute:()=>Ie,path:"/lab/card-previews",component:Kxe}),A0e=Me({getParentRoute:()=>Ie,path:"/lab/vellum-lab",component:ax}),T0e=Me({getParentRoute:()=>Ie,path:"/lab/vellum-bg/a-large",component:Wxe}),I0e=Me({getParentRoute:()=>Ie,path:"/lab/vellum-bg/b-small",component:Yxe}),M0e=Me({getParentRoute:()=>Ie,path:"/lab/vellum-bg/c-allover",component:Qxe});function O0e(){var s;const{rigId:e}=kn({from:"/rigs/$rigId"}),{data:t}=dr(),n=(s=t==null?void 0:t.find(r=>r.id===e))==null?void 0:s.name;return i.jsx("div",{className:"flex flex-col flex-1 h-full",children:i.jsx("div",{className:"flex-1 min-h-[400px] relative",children:i.jsx(o_,{rigId:e,rigName:n??null,showDiscovered:!1})})})}const L0e=Me({getParentRoute:()=>Ie,path:"/rigs/$rigId",component:O0e}),P0e=Me({getParentRoute:()=>Ie,path:"/rigs/$rigId/nodes/$logicalId",component:()=>{const{rigId:e,logicalId:t}=kn({from:"/rigs/$rigId/nodes/$logicalId"});return i.jsx(sz,{rigId:e,logicalId:decodeURIComponent(t)})}}),$0e=Me({getParentRoute:()=>Ie,path:"/import",component:fce}),D0e=Me({getParentRoute:()=>Ie,path:"/packages",component:yce}),q0e=Me({getParentRoute:()=>Ie,path:"/packages/install",component:Nce}),z0e=Me({getParentRoute:()=>Ie,path:"/packages/$packageId",component:mde}),B0e=Me({getParentRoute:()=>Ie,path:"/bootstrap",component:Nde}),F0e=Me({getParentRoute:()=>Ie,path:"/agents/validate",component:kde}),H0e=Me({getParentRoute:()=>Ie,path:"/specs/rig",component:Dde}),U0e=Me({getParentRoute:()=>Ie,path:"/specs/agent",component:zde}),V0e=Me({getParentRoute:()=>Ie,path:"/specs/library/$entryId",component:()=>{const{entryId:e}=kn({from:"/specs/library/$entryId"});return i.jsx(Yde,{entryId:e})}}),G0e=Me({getParentRoute:()=>Ie,path:"/discovery",component:()=>i.jsx("div",{className:"flex h-full w-full items-center justify-center p-8",children:i.jsx(Ve,{label:"DISCOVERY",description:"Discovery surface preserved; redesign deferred per code-map.",variant:"card",testId:"discovery-placeholder"})})}),K0e=Me({getParentRoute:()=>Ie,path:"/discovery/inventory",component:Hfe}),W0e=Me({getParentRoute:()=>Ie,path:"/bundles/inspect",component:Hde}),Y0e=Me({getParentRoute:()=>Ie,path:"/bundles/install",component:Ude}),Q0e=Me({getParentRoute:()=>Ie,path:"/context",component:()=>i.jsx(Eo,{to:"/topology"})}),X0e=Me({getParentRoute:()=>Ie,path:"/mission-control",component:()=>i.jsx(Eo,{to:"/for-you"})}),Z0e=Me({getParentRoute:()=>Ie,path:"/slices",component:()=>i.jsx(Eo,{to:"/project"})}),J0e=Me({getParentRoute:()=>Ie,path:"/slices/$name",component:()=>{const{name:e}=kn({from:"/slices/$name"});return i.jsx(Eo,{to:"/project/slice/$sliceId",params:{sliceId:e}})}}),eye=Me({getParentRoute:()=>Ie,path:"/progress",component:()=>i.jsx(Eo,{to:"/project"})}),tye=Me({getParentRoute:()=>Ie,path:"/steering",component:()=>i.jsx(Eo,{to:"/project"})}),nye=Ie.addChildren([i0e,a0e,o0e,l0e,c0e,u0e,d0e,f0e,h0e,p0e,m0e,g0e,v0e,x0e,y0e,w0e,b0e,j0e,S0e,N0e,k0e,_0e,C0e,E0e,R0e,A0e,T0e,I0e,M0e,L0e,P0e,$0e,D0e,q0e,z0e,B0e,F0e,H0e,U0e,V0e,G0e,K0e,W0e,Y0e,Q0e,X0e,Z0e,J0e,eye,tye]),sye=cU({routeTree:nye});function rye(){return i.jsx(fU,{router:sye})}const NP=document.getElementById("root");NP&&w7.createRoot(NP).render(i.jsx(E.StrictMode,{children:i.jsx(rye,{})}));
|