fix(office-ui): resolve blank/frozen office canvas and add sidebar collapse

Office canvas fixes:
- Lazy-create the Phaser game via ResizeObserver on the first non-zero
  layout instead of creating it inside the display:none office page with
  inline px fallback sizes. Phaser's RESIZE-mode 500ms parent poll has no
  zero guard, so the old path shrank the canvas to 0x0 (blue-black screen)
  and later restored it to a stale wrong size (clipped office).
- On unhide, re-measure with scale.getParentBounds() before scale.refresh();
  plain scale.resize() is clobbered by the stale cached parentSize in
  RESIZE mode.
- Fix whole-game freeze when clicking an office card: camera effects
  resolve ease names via EaseMap, which has no 'Cubic.Out' key, leaving
  effect.ease undefined and killing the RAF loop with a per-frame
  TypeError. Use 'Cubic.easeOut' for cam.pan in panToOffice/resetCameraView.
- Bound GameBridge queues (latest snapshot supersedes, event queue capped)
  since game creation is now deferred until the Office page is first opened.

Sidebar:
- Add a collapse/expand handle on the canvas/sidebar boundary with a 220ms
  grid transition; state persists in localStorage. The canvas follows the
  column change automatically through the ResizeObserver path. Stacked
  (<=1024px) layout collapses the bottom panel and moves the handle to the
  bottom edge.

README:
- Add Simplified Chinese translation (README.zh-CN.md) with a language
  switcher in both files; fix stale TOC entries in the English README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
LZH-YS1998andClaude Fable 5 committed 2026-07-07 11:47:04 +08:00
1 parent 137e382097
commit ee79331d48
12 files changed
+1087 -202

No files matched your search

+5 -1
View File
@@ -1,5 +1,9 @@
<h1 align="center" style="font-size: 1.75em;">OpenOPC: Build Your Personal AI-Native Company — Self-Built, Self-Run, Self-Grown</h1>
<p align="center">
<b>English</b> | <a href="README.zh-CN.md">简体中文</a>
</p>
🏗️ **Self-Built** — Fully automated to recruit role-specific AI employees and build the org.
⚙️ **Self-Run** — Fully automated to assign tasks, drive handoffs, and keep moving toward your goal.
@@ -19,8 +23,8 @@
## Table Of Contents
- [Real-World Applications](#real-world-applications)
- [When To Use OpenOPC](#when-to-use-openopc)
- [Demos](#demos)
- [How OpenOPC Works](#how-openopc-works)
- [Quick Start](#quick-start)
- [Office UI Guide](#office-ui-guide)
+792
View File
@@ -0,0 +1,792 @@
<h1 align="center" style="font-size: 1.75em;">OpenOPC:打造你的个人 AI 原生公司 — 自建、自营、自成长</h1>
<p align="center">
<a href="README.md">English</a> | <b>简体中文</b>
</p>
🏗️ **自建(Self-Built)** — 全自动招募各岗位的 AI 员工,搭建组织架构。
⚙️ **自营(Self-Run)** — 全自动分派任务、驱动交接,持续朝你的目标推进。
🌱 **自成长(Self-Grown)** — 从每个任务中学习,沉淀组织记忆,交付越来越聪明。
<p align="center">
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white">
<img alt="Office UI" src="https://img.shields.io/badge/Office%20UI-React%20%2B%20Phaser-14b8a6?style=flat-square">
<img alt="CLI and UI" src="https://img.shields.io/badge/interface-CLI%20%2B%20Office%20UI-64748b?style=flat-square">
<img alt="License MIT" src="https://img.shields.io/badge/license-MIT-111827?style=flat-square">
<a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/Feishu-Group-E9DBFC?style=flat-square&logo=feishu&logoColor=white" alt="Feishu" /></a>
<a href="https://github.com/HKUDS/.github/blob/main/profile/README.md"><img src="https://img.shields.io/badge/WeChat-Group-C5EAB4?style=flat-square&logo=wechat&logoColor=white" alt="WeChat" /></a>
</p>
![OpenOPC hero banner](docs/assets/chat.png)
## 目录
- [何时使用 OpenOPC](#何时使用-openopc)
- [演示](#演示)
- [OpenOPC 如何工作](#openopc-如何工作)
- [快速开始](#快速开始)
- [Office UI 指南](#office-ui-指南)
- [CLI 指南](#cli-指南)
- [配置](#配置)
- [生态与分享](#生态与分享)
- [路线图](#路线图)
- [致谢](#致谢)
## 何时使用 OpenOPC
**OpenOPC** 覆盖九大核心垂直领域 — 从 AI 开发、软件工程到金融、销售、媒体、电商与教育。无论哪个行业,OpenOPC 都会组建合适的团队并端到端交付。
<table>
<tr>
<td width="33%" valign="top">
<br><strong>🤖 AI 技术与研究</strong>
<br><sub>模型训练与评估、Agent 开发、LLM 应用与 AI 基础设施</sub>
</td>
<td width="33%" valign="top">
<br><strong>💻 软件开发</strong>
<br><sub>Android 应用、SaaS MVP、网站、小程序与游戏开发</sub>
</td>
<td width="33%" valign="top">
<br><strong>📈 金融投资</strong>
<br><sub>投资备忘录、市场图谱、尽职调查与投决会材料</sub>
</td>
</tr>
<tr>
<td valign="top">
<strong>🚀 销售增长</strong>
<br><sub>外呼销售、交易策略、方案书与渠道拓展</sub>
</td>
<td valign="top">
<strong>🎬 内容与媒体</strong>
<br><sub>视频制作、短视频内容、脚本、分镜与多平台剪辑</sub>
</td>
<td valign="top">
<strong>🤝 行业助理</strong>
<br><sub>客服、房产、法律咨询、HR 入职、零售等场景的 Copilot</sub>
</td>
</tr>
<tr>
<td valign="top">
<strong>🧾 会计与财务</strong>
<br><sub>记账、财务报告、税务合规、预算与风险审查</sub>
</td>
<td valign="top">
<strong>🛍️ 品牌与电商</strong>
<br><sub>品牌规划、选品、店铺运营、用户增长与留存</sub>
</td>
<td valign="top">
<strong>🎓 教育与培训</strong>
<br><sub>课程设计、知识库、学员管理与内容生产</sub>
</td>
</tr>
</table>
## 演示
<table>
<tr>
<td width="33%" align="center" valign="top">
<a href="https://youtu.be/XqQeTt6XvPQ">
<img src="https://img.youtube.com/vi/XqQeTt6XvPQ/maxresdefault.jpg" alt="OpenOPC 视频制作演示" width="100%">
</a>
<br><br>
<strong>🎬 视频制作</strong>
</td>
<td width="33%" align="center" valign="top">
<a href="https://drive.google.com/drive/folders/1T1Nl6CCE-cmbGy6sKrYML7_UnP8XID88?usp=drive_link">
<img src="docs/assets/vc-research-package.svg" alt="OpenOPC VC 投资研究演示" width="100%">
</a>
<br><br>
<strong>📈 投资研究</strong>
</td>
<td width="33%" align="center" valign="top">
<a href="https://youtu.be/SVc9BvE5ohY">
<img src="https://img.youtube.com/vi/SVc9BvE5ohY/maxresdefault.jpg" alt="OpenOPC 游戏原型演示" width="100%">
</a>
<br><br>
<strong>🎮 游戏原型</strong>
</td>
</tr>
</table>
## OpenOPC 如何工作
OpenOPC 围绕复杂的真实任务组建一家 AI 公司 — 通过三个紧密耦合的机制:**自建**负责组织配员,**自营**负责执行工作,**自成长**负责从结果中学习。
<p align="center">
<img src="docs/assets/video.png" alt="一家 OpenOPC 公司:角色、汇报关系,以及每个角色配备的员工" width="100%">
</p>
**1. 自建 — 为组织配员**
在任何工作开始之前,必须先把合适的人放到合适的位置。给定一个目标,OpenOPC 会:
- 🌿 起草组织架构图 — 从任务需求推导出所需的角色与汇报结构。
- 🎯 填补每个角色 — 由招聘 Agent 在「复用现有员工(带着以往项目塑造的经验)」与「从人才池中招募新人」之间做出选择。
💡 有经验的员工携带积累的上下文;当角色需要时,新员工则提供一张白纸。
**⚙️ 2. 自营 — 执行工作**
团队组建完成后,自营机制协调成员产出最终交付物。核心挑战不在于单纯执行,而在于不确定性下的高效协作,具体体现为两个问题。
🔀 动态协作编排。真实工作无法完全提前规划。OpenOPC 通过工作项状态机来解决,每个工作项所处的阶段决定:
- 📋 它在看板的哪一列 — 处于工作流的哪个位置。
- 👑 它的负责人 — 该阶段由哪个角色负责。
- ✅ 它的可执行性 — 是否已经具备推进条件。
管理者负责拆解工作项、分派并评审结果 — 接受、返工或上报 — 覆盖五种模式:执行(execute)、委派(delegate)、评审(review)、集成(integrate)与返工(rework)。拆解定义了一个依赖 DAG,因此:
- ⚡ 相互独立的工作项并行推进。
- ⏳ 有依赖的工作项等待前置项完成。
🔗 依赖解除与驳回都作为结构化的阶段转换传播,消除了临时的人为协调。
🛡️ 处理运行中途出现的阻塞。并非所有障碍都能提前预见。OpenOPC 在两个层面解决:
- 💬 团队内部 — 一条阻塞消息会暂停发送者,并激活最适合解决该问题的角色。
- 📡 团队之外 — 当阻塞超出团队权限时,运行时会上报给人类所有者,在真正需要时引入人类判断。
🖥️ 看板与办公室视图实时呈现这一编排过程。
**🌱 3. 自成长 — 从运行中学习**
执行产生原始经验;自成长把它转化为持久的改进,遵循两条原则。
🏅 把结果归因到正确的角色。把功劳记给整个公司学不到任何东西。因此 OpenOPC:
- 🔍 将用户反馈解析为针对每位员工的评估。
- 🎯 只更新负责了相关工作项的角色 — 功与过都落到应得之处。
📖 把执行轨迹提炼为知识。执行轨迹噪声太大,无法直接学习。因此 OpenOPC:
- 💡 把每个角色的任务提炼为高信号的经验教训,存入其私有经验档案。
- 📚 把反复出现的经验提升为共享的作业手册(playbook),新员工从入职起即可继承 — 让组织知识随时间复利增长。
<details>
<summary><strong>这些机制如何对应到 UI</strong></summary>
- `Org -> Team` 编辑公司架构与角色。
- `Org -> Employees` 为空缺角色招募人才。
- `Team Roster -> Deploy` 把已录用的员工变成办公室中可见的 Agent。
- Workspace 输入框可选择 Task 模式的执行 Agent。
- 角色检查器可为 Company 模式的角色设置运行时策略与偏好的外部 Agent。
- 执行期间,Workspace 的 `Agents` 页签与 Execution Progress 面板会显示哪个角色处于活动状态、它负责哪个工作项、以及由哪个执行 Agent 完成具体工作。
</details>
## 快速开始
推荐使用 `uv` 来安装 OpenOPC。它可以安装/管理 Python、创建项目虚拟环境,并在该环境中运行命令,而不会把 OpenOPC 的依赖混入全局 Python。
OpenOPC 要求 Python `>=3.10`;下面的示例使用 Python `3.12`。
对于直接的一次性工作,OpenOPC 还提供 Task 模式 — 一个类 LobeChat 的单 Agent 工作台,可使用 OpenOPC Native、Codex、Claude Code、Cursor 或 OpenCode。
<details open>
<summary><strong>推荐:uv 环境搭建</strong></summary>
**macOS**
```bash
# 使用 Homebrew 安装 uv,或使用官方独立安装脚本。
brew install uv
# curl -LsSf https://astral.sh/uv/install.sh | sh
cd /path/to/OpenOPC
uv python install 3.12
uv venv --python 3.12
source .venv/bin/activate
```
**Linux**
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
source "$HOME/.local/bin/env"
cd /path/to/OpenOPC
uv python install 3.12
uv venv --python 3.12
source .venv/bin/activate
```
**Windows PowerShell**
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
cd C:\path\to\OpenOPC
uv python install 3.12
uv venv --python 3.12
.\.venv\Scripts\Activate.ps1
```
**Windows 命令提示符**
```bat
winget install --id=astral-sh.uv -e
:: 或在 cmd 中运行独立安装脚本:
:: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
cd C:\path\to\OpenOPC
uv python install 3.12
uv venv --python 3.12
.venv\Scripts\activate.bat
```
</details>
```bash
# 将 OpenOPC 安装到 uv 管理的环境中
uv pip install -e .
# 可选但推荐:安装浏览器工具所需的 Chromium
uv run python -m playwright install chromium
# 初始化本地配置、记忆、技能、项目与工作区目录
uv run opc init
# 在 .opc/config/llm_config.yaml 中填入 API key,
# 或配置 llm.api_key_env 指定的环境变量。
# 启动浏览器 UI
uv run opc ui
```
默认打开 `http://localhost:8765`。
```bash
# 交互式 CLI
uv run opc chat -p demo
# 一次性 Task 模式
uv run opc chat -p demo --mode task --agent codex "Refactor this module and run focused tests"
# 使用内置 Corporate 架构的 Company 模式
uv run opc chat -p demo --mode company --company-profile corporate "Plan, implement, review, and document this feature"
# 非交互脚本 / CI 风格用法
uv run opc exec -p demo --mode task --agent native --json "Summarize the current repo status"
```
<details>
<summary><strong>安装说明</strong></summary>
- Python:`>=3.10`。当前必需依赖并非全部提供兼容 Python 3.9 的版本。
- 本地开发与发布测试推荐使用 `uv`。如果你偏好经典 pip,请创建并激活一个 Python `>=3.10` 的虚拟环境,然后运行 `python -m pip install -e .`。
- 如果虚拟环境激活被阻止,可以不激活,直接用 `uv run ...` 运行命令。
- 关于其他包管理器与托管 Python 的细节,参见官方 [`uv` 安装文档](https://docs.astral.sh/uv/getting-started/installation/) 与 [Python 管理文档](https://docs.astral.sh/uv/guides/install-python/)。
- Node.js:需要构建 Office UI 前端时要求 `>=18`。
- `opc ui` 会自动安装缺失的 `aiohttp` / `aiosqlite`,并在需要时自动构建前端。
- 如果你尚未安装外部 Agent CLI,运行 `opc init --no-external-agent-preflight` 可跳过首次运行的外部 Agent 检查。
- 浏览器工具基于原生 Playwright。在让 Agent 浏览网页之前,先用 `python -m playwright install chromium` 安装 Chromium。
</details>
<details>
<summary><b>开发环境搭建(从源码构建)</b></summary>
```bash
python -m pip install -e .
python -m pytest
cd opc/plugins/office_ui/frontend_src
npm install
npm run typecheck
npm run build
```
前端构建产物从 `opc/plugins/office_ui/frontend_dist/` 提供服务。
</details>
## Office UI 指南
<details>
<summary><b>展开 Office UI 指南 — 视觉导览、工作台、Company 模式、看板、办公室、组织</b></summary>
启动方式:
```bash
opc ui
opc ui --port 9000 --project demo
opc ui --rebuild
```
### 视觉导览
横向滚动浏览 Office UI 演示。每张截图都附有简短的说明文字。
<div style="overflow-x:auto; padding:8px 0 18px;">
<div style="display:flex; gap:18px; min-width:5520px;">
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig1.png" alt="Workspace 的项目、聊天、模式、组织与 Agent 控件" width="900">
<figcaption><strong>工作台与初始设置。</strong>选择或创建项目,点击 <code>New Chat</code>,然后选择 <code>Company</code> 或 <code>Task</code> 以及对应的组织或 Agent。在 Company 模式下,可以指定角色员工与执行 Agent,也可以让 OpenOPC 自动招募。</figcaption>
</figure>
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig2.png" alt="Execution Progress 面板显示角色状态与执行记录" width="900">
<figcaption><strong>执行进度。</strong>跟踪每个角色的状态,点击角色或工作项即可查看详细的执行记录、工具活动、交接、评审与运行时元数据。</figcaption>
</figure>
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig3.png" alt="看板展示 Agent 的工作项与状态" width="900">
<figcaption><strong>看板。</strong>监督每个 Agent 的具体任务与工作项,观察它们在规划、执行、评审、阻塞与完成之间流转。</figcaption>
</figure>
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig4.png" alt="组织编辑器,可调整现有组织或新建组织" width="900">
<figcaption><strong>组织管理。</strong>调整现有组织、修改角色与汇报关系、查看运行时策略,或创建一个新组织。</figcaption>
</figure>
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig5.png" alt="人才市场,可浏览并招募员工" width="900">
<figcaption><strong>人才市场。</strong>浏览人才模板,查看候选人详情,在公司需要更多能力时把员工招募到空缺角色上。</figcaption>
</figure>
<figure style="flex:0 0 900px; width:900px; margin:0;">
<img src="docs/assets/fig6.png" alt="动画办公室视图,展示每个角色正在做什么" width="900">
<figcaption><strong>办公室视图。</strong>以动画办公室的形式观察整个组织,每个角色/Agent 都会显示状态、当前任务、正在使用的工具、座位与运行时活动。</figcaption>
</figure>
</div>
</div>
Office UI 有三个主要页面:
| 页面 | 在这里做什么 |
|---|---|
| **Workspace** | 主要工作界面:会话列表、看板、聊天、任务详情、角色进度、通讯与团队驾驶舱。 |
| **Office** | 可视化办公室地图:Agent 以角色形象出现,可以选中、移动、分配座位与查看详情。 |
| **Org** | 公司架构:切换 Corporate/已保存的组织、创建新组织、编辑角色、招募人才、应用架构预设、导入/导出配置。 |
### 工作台(Workspace)
Workspace 页面是默认界面。
| 区域 | 关注点 |
|---|---|
| 左侧边栏 | 项目会话、活动、未读计数与新建聊天。 |
| 中间看板 | 看板卡片。Task 模式下,一张卡片通常对应一个任务型聊天会话。Company 模式下,看板跟随所选的运行时会话,展示已委派的工作项。 |
| 右侧面板 | 上下文面板,包含 `Chat`、`Agents`、`Info`、`Comms`、`Team` 等页签。工作运行期间可以折叠、调整大小或最大化。 |
| 输入框 | 发送消息、附加文件、选择模式、选择公司架构;在 Task 模式下选择执行 Agent。 |
### 从 UI 开始工作
1. 在顶部项目选择器中创建或选择一个项目。
2. 在 Workspace 中点击 `New Chat`。
3. 在输入框中选择 `Task` 或 `Company`。
4. Task 模式下选择 Agent:`OpenOPC Native`、`Codex`、`Claude Code`、`Cursor` 或 `OpenCode`。
5. Company 模式下选择 `Corporate` 或一个已保存的组织架构。
6. 发送任务简报。
第一条消息发出后,该聊天的模式与任务 Agent 即被锁定。若需换用其他模式,可通过锁定模式的弹出提示在新聊天中继续。
### UI 中的 Company 模式
Company 模式把一份简报变成一个运行时会话加一组由角色负责的工作项。
| 页签 | 展示内容 |
|---|---|
| `Chat` | 父级对话、最终回复、运行时进度卡片、检查点回复、停止/继续/完成控件,以及跳转到工作项执行的链接。 |
| `Agents` | 角色汇总:活动/等待/待定/完成的角色、当前工具、角色工作项、筛选、搜索,以及详细执行进度的链接。 |
| `Info` | 状态、负责人、角色身份、员工分配、所选执行 Agent、时间信息与开发者详情。 |
| `Comms` | 角色收件箱、未读/已读/已发消息、会议、决策与最近的通讯故障。 |
| `Team` | 运行时驾驶舱:团队、座位、审批、未读通讯、恢复状态与当前运行的停止控件。 |
要查看某个角色的详细工作流,打开一个 Company 模式会话,在 `Chat` 进度卡片或 `Agents` 页签中点击角色/工作项。Execution Progress 面板会展示每个工作项及其状态、活动分区、工具进度、交接、评审对象与执行轮次元数据。
### 看板(Kanban)
- Task 模式:看板是项目级面板。可以在 `Todo` 中快速创建任务、启动任务,并从右侧面板查看每个任务。
- Company 模式:当前面板跟随所选运行时会话。卡片代表公司工作项,按照后端运行时状态在规划/执行/评审/完成之间流转。
- 当运行时掌管状态时,跨状态列的手动拖拽会被有意限制。同列内重新排序在适用时是支持的。
### 办公室(Office)
当你想以可视化方式查看运行中的团队时,使用 Office 页面。
- 点击 Agent 角色形象或列表行,查看状态、当前工具、当前任务、角色、办公室与座位。
- 使用办公室/座位控件移动 Agent。
- 子 Agent 可以显示或隐藏。
- 由员工或模板创建的 Agent 会出现在办公室中,并持久化在 `.opc/ui_state.db`。
### 组织(Org)
Org 页面是公司结构变得可运行的地方。
| 子页签 | 用途 |
|---|---|
| `Team` | 查看/编辑角色图谱、表格、角色检查器、花名册、已保存组织选择器、导出打包流程,并把已录用员工部署到办公室。 |
| `Runtime` | 调整运行时团队、座位、最终决策者、委派策略与运行时策略。Corporate 为只读;已保存的组织可编辑。 |
| `Architecture` | 浏览内置架构预设、预览/应用包、管理已安装的包、导入/导出 YAML。 |
| `Employees` | 搜索人才模板、查看详情、招募到空缺角色、为公司配员。 |
创建新公司:打开 `Org`,点击 `New organization`,输入名称,添加至少两名带职责与汇报关系的成员,检查并创建。OpenOPC 会自动保存,并把输入框切换为 `Company / <你的组织>`。
招募:先导入人才模板,然后打开 `Org -> Employees`,搜索模板,点击 `Hire`,选择一个空缺角色;若希望员工出现在 Office 页面,再从 `Team Roster` 部署。
```bash
opc talent import /path/to/agency-agents
```
<details>
<summary><strong>项目文件的位置</strong></summary>
OpenOPC 把运行时/配置状态与交付物工作区文件分开存放。
| 路径 | 含义 |
|---|---|
| `.opc/config/` | 由 `opc init` 从 `config/` 复制而来的本地配置。 |
| `.opc/memory/` | 全局与项目级 Markdown 记忆。 |
| `.opc/projects/<project>/` | 项目运行时元数据与任务存储。 |
| `.opc/ui_state.db` | Office UI 的聊天、频道与可视化 Agent 状态。 |
| `../OpenOPC_workplace/<project>/` | 默认项目工作区。Agent 应把持久的项目文件写到这里。 |
| `../OpenOPC_workplace/<project>/.opc-comms/` | Company 模式内部通讯信箱、会议与工具结果暂存区。 |
若希望配置与运行时状态放在仓库之外,设置 `OPC_HOME=/path/to/opc-home`。
</details>
</details>
## CLI 指南
<details>
<summary><b>展开 CLI 指南 — 常用命令与交互式斜杠命令</b></summary>
OpenOPC 同时提供高层的自然语言命令与更底层的 UI/服务命令。
概念上 OpenOPC 有两种执行模式:`task` 与 `company`。部分底层 CLI/服务命令仍将 `org` 作为「Company 模式 + 已保存组织架构」的兼容选择器;在 UI 中这表现为 Company 加一个架构选择。
### 常用命令
```bash
# 聊天
opc chat
opc chat -p demo --mode task --agent native "Inspect the failing tests"
opc chat -p demo --mode company --company-profile corporate "Ship this change with review"
# 可脚本化执行
opc exec -p demo --mode task --agent codex --stream-json "Run the migration check"
opc exec -p demo --mode company --company-profile corporate "Draft the research report"
# 项目生命周期
opc project list
opc project create demo
opc project switch demo
# 会话
opc session list -p demo
opc session create "New feature" -p demo --mode company
opc session send <task_id> "Continue with implementation" -p demo
opc session stop <task_id> -p demo
opc session continue <task_id> "Proceed after review" -p demo
# 运行时检查
opc runtime status -p demo
opc runtime logs <task_id> -p demo
opc work-item list -p demo
opc work-item show <work_item_id> -p demo
opc comms state <task_id> -p demo
# 招募
opc talent import /path/to/agency-agents
opc talent hire <template_id> <role_id> -p demo
```
### 交互式斜杠命令
运行 `opc chat`,然后使用斜杠命令:
```text
/status
/mode task
/mode company corporate
/agent codex
/project switch demo
/session list
/runtime --full
/logs <task_id> --full
/comms <task_id> --full
/org
/talent list
/market list
```
完整命令表见 [`docs/cli-chat-slash.md`](docs/cli-chat-slash.md)。
<details>
<summary><strong>CLI 命令分组</strong></summary>
| 分组 | 示例 |
|---|---|
| `opc project` | `list`、`show`、`create`、`switch`、`rename`、`delete --yes` |
| `opc session` | `list`、`create`、`show`、`config`、`send`、`rename`、`delete --yes`、`stop`、`continue`、`resume`、`complete` |
| `opc mode` | `show`、`set task`、`set company --profile corporate`、以及用于已保存组织公司运行的 `set org --org <id>` |
| `opc kanban` | `view`、`task create`、`task update`、`task move`、`task assign`、`task status`、`task delete --yes` |
| `opc agent` | `list`、`create`、`create-from-template`、`import-employee`、`detail`、`move`、`delete --yes` |
| `opc org` | `info`、`export`、`import`、`saved list/save/load/delete`、`role add/update/bulk-add/delete`、`policy update`、`strategy update`、`reset --yes` |
| `opc talent` | `list`、`employees`、`import`、`hire`、`scan`、`import-selected`、`employee-detail`、`import-agent` |
| `opc market` | `presets`、`browse`、`preview`、`apply-preset`、`export`、`install`、`list`、`uninstall --yes` |
| `opc runtime` | `status`、`checkpoints`、`logs`、`run` |
| `opc recovery` | `scan`、`resume`、`cancel --yes`、`retry` |
| `opc channels` | `status`、`login`、`start`、`stop` |
大多数服务类命令都支持 `--project/-p` 与 `--json`。
对于已保存的组织架构,部分 CLI/服务命令目前将 `org` 作为兼容选择器使用,尽管概念上的运行时仍是 Company 模式:
```bash
opc exec -p demo --mode org --org hku_research_lab "Draft the research report"
opc session create "Research sprint" -p demo --mode org --org hku_research_lab
```
</details>
</details>
## 配置
在仓库根目录运行一次 `opc init`。它会创建 `.opc/`、从 `config/` 复制模板配置、创建记忆/技能/日志目录,并可选地创建第一个项目。
<details>
<summary><b>展开配置 — 配置文件、LLM 密钥、外部 Agent、频道、浏览器/MCP、故障排查</b></summary>
| 文件 | 用途 |
|---|---|
| `.opc/config/llm_config.yaml` | 默认模型、兼容 LiteLLM/OpenRouter 的 API base、API key、环境变量间接引用、路由、回退、temperature、token 限制。 |
| `.opc/config/system_config.yaml` | 运行时行为、浏览器工具、原生运行时、压缩、验证、权限、沙箱与安全设置。 |
| `.opc/config/agent_config.yaml` | 外部 Agent 命令路径、优先顺序、模型参数、会话模式、超时、审批模式与原生子 Agent 配置。 |
| `.opc/config/channel_config.yaml` | 外部消息提供方与凭据。入站发送者列表默认拒绝。 |
| `.opc/config/company_corporate_config.yaml` | 内置 Corporate 公司架构模板。 |
| `.opc/config/company_orgs/org_<id>_config.yaml` | Company 模式使用的自定义公司架构。 |
| `.opc/config/org_index.yaml` | 当前生效的已保存公司架构选择器。 |
### LLM 密钥
运行 `opc init` 后,编辑仓库本地 OPC home 中的 `.opc/config/llm_config.yaml`。如果设置了 `OPC_HOME`,则改为编辑 `$OPC_HOME/config/llm_config.yaml`。
模板中的密钥留空。直接把 key 写入文件:
```yaml
llm:
default_model: "openai/gpt-5.4"
api_base: "https://openrouter.ai/api/v1"
api_key: "sk-or-v1-..." # 你的 OpenRouter(或其他提供方)API key
max_tokens: 32768 # 每次请求的最大输出 token;如果你的模型
# 输出上限更小,请调低
# context_window: 128000 # 总输入窗口。通常由 litellm 自动检测;
# 未收录的模型回退为 128000。仅当回退值
# 不适合你的模型时才取消注释并设置。
```
然后用 `opc status` 验证。
如果不想把密钥存在文件里,可以将 `api_key` 留空,并把 `api_key_env` 设置为持有密钥的环境变量名(例如 `api_key_env: "OPENROUTER_API_KEY"`)。
### 审批与 Agent 权限
`.opc/config/system_config.yaml` 的 `autonomy` 部分控制 Agent 无需询问即可执行多少操作。关键旋钮是 `max_auto_approve_risk` — 可被自动批准的最高风险等级:
```yaml
autonomy:
max_auto_approve_risk: medium # low | medium | high | critical
allow_native_tool_auto_approval: true
tool_first_use_approval: true # 每个工具首次使用时总是询问
```
每次原生工具调用在运行前都会做风险分级:已知的破坏性命令(`rm -rf`、`drop table`、force-push 等)与敏感关键词(凭据、部署等)为 `high`/`critical`,总是上报给人类;白名单中的安全前缀(`ls`、`git status` 等)为 `low`;其余为 `medium`,在自动批准前会经过 LLM 审查。
- `medium`(默认):平衡 — 普通命令无提示运行;危险命令上报。
- `low`:严格 — 不在安全白名单中的任何操作都需要审批。推荐用于共享或生产机器。
- `high`/`critical`:宽松 — 仅用于可随时丢弃的沙箱。
每个工具首次使用时总会提示(除非该工具在 `tool_approval_exemptions` 中),你的「始终允许」选择会累积到项目级白名单。
### 外部 Agent
Task 模式可以显式选择执行 Agent:
```bash
opc chat -p demo --mode task --agent codex "Implement the change"
```
可用值有 `native`、`codex`、`claude_code`、`cursor` 与 `opencode`。在 `.opc/config/agent_config.yaml` 中配置命令名、参数、超时、会话复用与审批行为。
在 Company 模式下,角色可以通过角色配置或 Org 角色检查器指定偏好的外部 Agent。角色的执行策略可以是 `auto`、`native` 或 `external`,并可选地指定偏好的外部 Agent。
### 飞书接入
```bash
pip install -e .[channels-feishu]
opc init
opc channels login feishu
```
编辑 `.opc/config/channel_config.yaml`:
```yaml
channels:
feishu:
enabled: true
app_id: "cli_xxx"
app_secret: "..."
encrypt_key: ""
verification_token: ""
react_emoji: THUMBSUP
allow_from:
- "ou_xxx"
```
然后:
```bash
opc channels status
opc channels start -p demo
# 或运行常驻引擎 + 频道运行时:
opc run -p demo
```
飞书使用 `lark-oapi` WebSocket 客户端。`app_id` 与 `app_secret` 为必填;`encrypt_key` 与 `verification_token` 为可选,除非你的租户/应用配置要求。请保持 `allow_from` 显式配置;空列表会拒绝所有入站消息。
<details>
<summary><strong>其他频道提供方</strong></summary>
| 提供方 | 安装 extra | 运行方式 | 必填字段 |
|---|---|---|---|
| Telegram | `channels-telegram` | polling | `token` |
| Slack | `channels-slack` | socket | `bot_token`、`app_token` |
| Discord | `channels-discord` | socket | `token` |
| 钉钉 | `channels-dingtalk` | socket | `client_id`、`client_secret` |
| 邮件 | `channels-email` | polling | IMAP/SMTP 字段、`consent_granted` |
| Matrix | `channels-matrix` | sync/polling | `homeserver`、`access_token`、`user_id` |
| QQ | `channels-qq` | socket | `app_id`、`secret` |
| WhatsApp | `channels-whatsapp` | bridge | `bridge_url` |
| Mochat | `channels-mochat` | bridge | `base_url`、`claw_token`、`agent_user_id` |
常用命令:
```bash
opc channels login slack
opc channels status
opc channels start -p demo
opc channels stop
opc run -p demo
```
参见 [`docs/channels.md`](docs/channels.md) 与 [`docs/channel-bridges.md`](docs/channel-bridges.md)。
</details>
<details>
<summary><strong>浏览器工具与 MCP 服务器</strong></summary>
浏览器工具:
```bash
python -m playwright install chromium
```
在 `.opc/config/system_config.yaml` 中配置启动行为:
```yaml
system:
browser:
mode: embedded # embedded | chrome | auto
headless: true
chrome_channel: chrome
user_data_dir: ""
```
原生浏览器工具包括 `browser_navigate`、`browser_snapshot`、`browser_click`、`browser_type`、`browser_wait_for`、`browser_scroll`、`browser_select_option`、`browser_evaluate`、`browser_take_screenshot` 与 `browser_close`。
MCP 服务器可添加到 `system_config.yaml` 的 `mcp_servers` 下。本地服务器使用 stdio 命令;远程服务器使用 HTTP/SSE 风格的 URL。发现的工具会以服务器前缀注册,避免命名冲突。
</details>
### 故障排查
<details>
<summary><strong>Office UI 无法打开或界面陈旧</strong></summary>
```bash
opc ui --rebuild
```
如果浏览器仍显示陈旧的 UI 状态,强制刷新页面。如果之前的进程在运行中途崩溃,先重启 `opc ui` 以释放内存中的锁。
</details>
<details>
<summary><strong>任务看起来卡住了</strong></summary>
先重启服务器并强制刷新浏览器。如果持久化的任务状态仍然异常,使用重置工具:
```bash
python scripts/reset_stuck_task.py --project <project> --session <session_id> --apply
python scripts/reset_stuck_task.py --all --apply
```
</details>
<details>
<summary><strong>外部 Agent 不可用</strong></summary>
运行:
```bash
opc status
```
检查 `.opc/config/agent_config.yaml` 中的命令名,例如 `codex`、`claude`、`cursor-agent` 与 `opencode`。禁用或调整你未安装的 Agent 的优先级。
</details>
<details>
<summary><strong>频道提供方收不到消息</strong></summary>
检查:
- 已安装对应的 extra,例如 `pip install -e .[channels-feishu]`。
- 该提供方为 `enabled: true`。
- 必填凭据已填写。
- `allow_from` 包含你期望的发送者 ID。
- `opc channels status` 显示该提供方已配置且可用。
</details>
</details>
## 生态与分享
OpenOPC 构建的一切都归你所有,可以保留、复用与分享 — 组织、员工、人才模板、技能与频道都只是文件。你可以导入一个流行的人才库、跨项目复用一个团队,或者把整个公司打包成可分享的 `.opcpkg`。
```bash
# 从人才库(例如 agency-agents)招募到某个角色
opc talent import /path/to/agency-agents
opc talent hire <template_id> <role_id> -p demo
# 复用或分享整个组织
opc org export --json > my-org.yaml
opc market export --id hku_lab --name "HKU Lab" --output-dir packages
opc market install packages/hku_lab.opcpkg
```
## 路线图
OpenOPC 正在快速迭代。以下领域反映当前的开发重点 — 每一项都源自早期使用中发现的真实缺口。
| 领域 | 计划方向 |
|---|---|
| **角色级技能** | 角色配置已支持 `skill_refs`,Org UI 目前也展示技能元数据。下一步是让用户直接在 Org 页面选择哪些技能挂载到哪些角色 — 汇入更广泛的自演化技能生态。 |
| **秘书设置** | 秘书将成长为更强的配置与记忆管家:负责 OPC 系统记忆、分析与对比项目,并为 OpenOPC YAML 配置提供引导式设置。 |
| **Company 模式频道** | 外部频道将从简单的聊天入口演进为更丰富的 Company 模式工作流 — 支持角色感知的通知、结构化审批与跨平台协作。 |
| **CLI 对齐** | CLI 目前可用,但 Office UI 仍是更完整的界面。后续工作聚焦于从终端进行组织编辑、Company 模式检查、故障恢复与长时运行时控制。 |
| **TUI** | CLI 对齐成熟后将考虑完整的终端 UI。在此期间 Office UI 仍是主要界面。 |
| **市场与预设** | 更多架构预设、可招募的人才包、导入/导出工作流,以及用于分享与发现社区组件的包市场。 |
| **运行时打磨** | 持续改进恢复、检查点、执行进度可见性与可视化文档 — 让长时间的公司运行更可观察、更有韧性。 |
## 致谢
OpenOPC 的 Agent 设计、技能结构与人才模板生态受益于多个开源项目,在此致谢:
- [openai/codex](https://github.com/openai/codex/) 启发了实用的编码 Agent 工作流与执行模式。
- [BloopAI/vibe-kanban](https://github.com/BloopAI/vibe-kanban) 启发了以看板为中心的 Agent 工作管理与任务可见性。
- [msitarzewski/agency-agents](https://github.com/msitarzewski/agency-agents) 提供了人才模板的基础。本仓库包含的所有人才模板均导入自 `agency-agents`。
- [HKUDS/nanobot](https://github.com/HKUDS/nanobot) 启发了面向技能的 Agent 设计与 `SKILL.md` 风格的组织方式。
- [pixel-agents-hq/pixel-agents](https://github.com/pixel-agents-hq/pixel-agents) 启发了以像素动画办公室可视化 Agent 活动的方式。
---
<p align="center">
<em> ❤️ 感谢访问 ✨ OpenOPC!</em><br><br>
<img src="https://visitor-badge.laobi.icu/badge?page_id=HKUDS.OpenOPC&style=for-the-badge&color=00d4ff"
alt="Views">
</p>
@@ -1 +1 @@
.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{strokLine truncated
.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{strokLine truncated
@@ -0,0 +1,155 @@
import{g as Zo,r as R3}from"./phaser-DFK5Ua9d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Wp={exports:{}},pc={};var lk;function A3(){if(lk)return pc;lk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var u in i)u!=="key"&&(o[u]=i[u])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:o}}return pc.Fragment=t,pc.jsx=n,pc.jsxs=n,pc}var ck;function M3(){return ck||(ck=1,Wp.exports=A3()),Wp.exports}var c=M3(),Yp={exports:{}},_t={};var uk;function D3(){if(uk)return _t;uk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function y(G){return G===null||typeof G!="object"?null:(G=g&&G[g]||G["@@iterator"],typeof G=="function"?G:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function _(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}_.prototype.isReactComponent={},_.prototype.setState=function(G,J){if(typeof G!="object"&&typeof G!="function"&&G!=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,G,J,"setState")},_.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function k(){}k.prototype=_.prototype;function C(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}var N=C.prototype=new k;N.constructor=C,w(N,_.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function I(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function L(G,J,P){var X=P.ref;return{$$typeof:e,type:G,key:J,ref:X!==void 0?X:null,props:P}}function A(G,J){return L(G.type,J,G.props)}function M(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function $(G){var J={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(P){return J[P]})}var W=/\/+/g;function B(G,J){return typeof G=="object"&&G!==null&&G.key!=null?$(""+G.key):J.toString(36)}function U(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(I,I):(G.status="pending",G.then(function(J){G.status==="pending"&&(G.status="fulfilled",G.value=J)},function(J){G.status==="pending"&&(G.status="rejected",G.reason=J)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function H(G,J,P,X,ee){var te=typeof G;(te==="undefined"||te==="boolean")&&(G=null);var re=!1;if(G===null)re=!0;else switch(te){case"bigint":case"string":case"number":re=!0;break;case"object":switch(G.$$typeof){case e:case t:re=!0;break;case p:return re=G._init,H(re(G._payload),J,P,X,ee)}}if(re)return ee=ee(G),re=X===""?"."+B(G,0):X,O(ee)?(P="",re!=null&&(P=re.replace(W,"$&/")+"/"),H(ee,J,P,"",function(se){return se})):ee!=null&&(M(ee)&&(ee=A(ee,P+(ee.key==null||G&&G.key===ee.key?"":(""+ee.key).replace(W,"$&/")+"/")+re)),J.push(ee)),1;re=0;var oe=X===""?".":X+":";if(O(G))for(var de=0;de<G.length;de++)X=G[de],te=oe+B(X,de),re+=H(X,J,P,te,ee);else if(de=y(G),typeof de=="function")for(G=de.call(G),de=0;!(X=G.next()).done;)X=X.value,te=oe+B(X,de++),re+=H(X,J,P,te,ee);else if(te==="object"){if(typeof G.then=="function")return H(U(G),J,P,X,ee);throw J=String(G),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return re}function V(G,J,P){if(G==null)return G;var X=[],ee=0;return H(G,X,"","",function(te){return J.call(P,te,ee++)}),X}function Y(G){if(G._status===-1){var J=G._result;J=J(),J.then(function(P){(G._status===0||G._status===-1)&&(G._status=1,G._result=P)},function(P){(G._status===0||G._status===-1)&&(G._status=2,G._result=P)}),G._status===-1&&(G._status=0,G._result=J)}if(G._status===1)return G._reLine truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+we+s+Ce}var Ge=!1;function Ye(s,l){if(!s||Ge)return"";Ge=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(l){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(ye){var xe=ye}Reflect.construct(s,[],Ie)}else{try{Ie.call()}catch(ye){xe=ye}s.call(Ie.prototype)}}else{try{throw Error()}catch(ye){xe=ye}(Ie=s())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(ye){if(ye&&xe&&typeof ye.stack=="string")return[ye.stack,xe.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=x.DetermineComponentFrameRoot(),F=j[0],K=j[1];if(F&&K){var ie=F.split(`
`),pe=K.split(`
`);for(b=x=0;x<ie.length&&!ie[x].includes("DetermineComponentFrameRoot");)x++;for(;b<pe.length&&!pe[b].includes("DetermineComponentFrameRoot");)b++;if(x===ie.length||b===pe.length)for(x=ie.length-1,b=pe.length-1;1<=x&&0<=b&&ie[x]!==pe[b];)b--;for(;1<=x&&0<=b;x--,b--)if(ie[x]!==pe[b]){if(x!==1||b!==1)do if(x--,b--,0>b||ie[x]!==pe[b]){var _e=`
`+ie[x].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=x&&0<=b);break}}}finally{Ge=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Be(f):""}function yt(s,l){switch(s.tag){case 26:case 27:case 5:return Be(s.type);case 16:return Be("Lazy");case 13:return s.child!==l&&l!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ye(s.type,!1);case 11:return Ye(s.type.render,!1);case 1:return Ye(s.type,!0);case 31:return Be("Activity");default:return""}}function Vt(s){try{var l="",f=null;do l+=yt(s,f),f=s,s=s.return;while(s);return l}catch(x){return`
Error generating stack: `+x.message+`
`+x.stack}}var bt=Object.prototype.hasOwnProperty,vt=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,rt=e.unstable_requestPaint,Qe=e.unstable_now,Je=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,Fe=e.unstable_LowPriority,$e=e.unstable_IdlePriority,Ut=e.log,rn=e.unstable_setDisableYieldValue,ke=null,Te=null;function Pe(s){if(typeof Ut=="function"&&rn(s),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(ke,s)}catch{}}var Ve=Math.clz32?Math.clz32:Mn,qe=Math.log,et=Math.LN2;function Mn(s){return s>>>=0,s===0?32:31-(qe(s)/et|0)|0}var Tn=256,Dn=262144,yn=4194304;function Wt(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Zt(s,l,f){var x=s.pendingLanes;if(x===0)return 0;var b=0,j=s.suspendedLanes,F=s.pingedLanes;s=s.warmLanes;var K=x&134217727;return K!==0?(x=K&~j,x!==0?b=Wt(x):(F&=K,F!==0?b=Wt(F):f||(f=K&~s,f!==0&&(b=Wt(f))))):(K=x&~j,K!==0?b=Wt(K):F!==0?b=Wt(F):f||(f=x&~s,f!==0&&(b=Wt(f)))),b===0?0:l!==0&&l!==b&&(l&j)===0&&(j=b&-b,f=l&-l,j>=f||j===32&&(f&4194048)!==0)?l:b}function Et(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function wt(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 tt(){var s=yn;return yn<<=1,(yn&62914560)===0&&(yn=4194304),s}function it(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function sn(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Qt(s,l,f,x,b,j){var F=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var K=s.entanglements,ie=s.expirationTimes,pe=s.hiddenUpdates;for(f=F&~f;0<f;){var _e=31-Ve(f),Ie=1<<_e;K[_e]=0,ie[_e]=-1;var xe=pe[_e];if(xe!==null)for(pe[_e]=null,_e=0;_e<xe.length;_e++){var ye=xe[_e];ye!==null&&(ye.lane&=-536870913)}f&=~Ie}x!==0&&mt(s,x,0),j!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=j&~(F&~l))}function mt(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var x=31-Ve(l);s.entangledLanes|=l,s.entanglements[x]=s.entanglements[x]|1073741824|f&261930}function Bt(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var x=31-Ve(f),b=1<<x;b&l|s[x]&l&&(s[x]|=l),f&=~b}}function On(s,l){var f=l&-l;return f=(f&42)!==0?1:vn(f),(f&(s.suspendedLanes|l))!==0?0:f}function vn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Rn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ve(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:tk(s.type))}function Re(s,l){var f=V.p;try{return V.p=s,l()}finally{V.p=f}}var Xe=Math.random().toString(36).slice(2),He="__reactFiber$"+Xe,Tt="__reactProps$"+Xe,ft="__reactContainer$"+Xe,$n="__reactEvents$"+Xe,Ae="__reactListeners$"+Xe,Dt="__reactHandles$"+Xe,kn="__reactResources$"+Xe,nr="__reactMarker$"+Xe;function Sn(s){delete s[He],delete s[Tt],delete s[$n],delete s[Ae],delete s[Dt]}function We(s){var l=s[He];if(l)return l;for(var f=s.parentNode;f;){if(l=f[ft]||f[He]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=B_(s);s!==null;){if(f=s[He])return f;s=B_(s)}return l}s=f,f=s.parentNode}return null}function ar(s){if(s=s[He]||s[ft]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function lr(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(r(33))}function mn(s){var l=s[kn];return l||(l=s[kn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function zt(s){s[nr]=!0}var Qn=new Set,wn={};function ht(s,l){Tr(s,l),Tr(s+"Capture",l)}function Tr(s,l){for(wn[s]=l,s=0;s<l.length;s++)Qn.add(l[s])}var wr=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(JA,"")}function I_(s,l){return l=N_(l),N_(s)===l}function dn(s,l,f,x,b,j){switch(f){case"children":typeof x=="string"?l==="body"||l==="textarea"&&x===""||Es(s,x):(typeof x=="number"||typeof x=="bigint")&&l!=="body"&&Es(s,""+x);break;case"className":It(s,"class",x);break;case"tabIndex":It(s,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":It(s,f,x);break;case"style":Au(s,x,j);break;case"data":if(l!=="object"){It(s,"data",x);break}case"src":case"href":if(x===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=ea(""+x),s.setAttribute(f,x);break;case"action":case"formAction":if(typeof x=="function"){s.setAttribute(f,"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 j=="function"&&(f==="formAction"?(l!=="input"&&dn(s,l,"name",b.name,b,null),dn(s,l,"formEncType",b.formEncType,b,null),dn(s,l,"formMethod",b.formMethod,b,null),dn(s,l,"formTarget",b.formTarget,b,null)):(dn(s,l,"encType",b.encType,b,null),dn(s,l,"method",b.method,b,null),dn(s,l,"target",b.target,b,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=ea(""+x),s.setAttribute(f,x);break;case"onClick":x!=null&&(s.onclick=ii);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"multiple":s.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":s.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){s.removeAttribute("xlink:href");break}f=ea(""+x),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""+x):s.removeAttribute(f);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":x&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":x===!0?s.setAttribute(f,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,x):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?s.setAttribute(f,x):s.removeAttribute(f);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?s.removeAttribute(f):s.setAttribute(f,x);break;case"popover":At("beforetoggle",s),At("toggle",s),on(s,"popover",x);break;case"xlinkActuate":pr(s,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":pr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":pr(s,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":pr(s,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":pr(s,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":pr(s,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":pr(s,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":pr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":pr(s,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":on(s,"is",x);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=Mu.get(f)||f,on(s,f,x))}}function Ip(s,l,f,x,b,j){switch(f){case"style":Au(s,x,j);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"children":typeof x=="string"?Es(s,x):(typeof x=="number"||typeof x=="bigint")&&Es(s,""+x);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"onClick":x!=null&&(s.onclick=ii);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),oe=h.map(([de,se])=>` [${de}, ${se}],`).join(`
`);return`const MAP_STR: string[] = [
${re}
]
const SEATS: [number, number][] = [
${oe}
]`})(),J=()=>I(te=>Math.min(te+.25,3)),P=()=>I(te=>Math.max(te-.25,.5)),X=m.flat().filter(te=>te===1).length,ee=m.flat().filter(te=>te===0).length;return c.jsxs("div",{className:"collision-editor",children:[c.jsxs("div",{className:"ce-toolbar",children:[c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("span",{className:"ce-title",children:"Map Editor"}),c.jsx("select",{className:"ce-office-select",value:a,onChange:te=>M(te.target.value),children:i.map(te=>c.jsx("option",{value:te.id,children:te.name},te.id))})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsxs("button",{className:`ce-mode-btn ${y==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[c.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[c.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[c.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:"ce-btn",onClick:P,children:"-"}),c.jsxs("span",{className:"ce-zoom-label",children:[Math.round(O*100),"%"]}),c.jsx("button",{className:"ce-btn",onClick:J,children:"+"}),c.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>T(te=>!te),children:"Grid"})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:`ce-btn apply${C?" success":""}`,onClick:Y,children:C?"Applied":"Apply"}),c.jsx("button",{className:`ce-btn${_?" active":""}`,onClick:Z,children:"Export"}),c.jsx("button",{className:"ce-btn danger",onClick:q,children:"Reset"})]}),c.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[c.jsxs("span",{children:["Walls: ",X]}),c.jsxs("span",{children:["Floor: ",ee]}),c.jsxs("span",{children:["Seats: ",h.length]})]})]}),c.jsxs("div",{className:"ce-body",children:[c.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:c.jsx("canvas",{ref:t,style:{width:L*R*O,height:A*R*O,imageRendering:"pixelated",cursor:y==="seat"?"crosshair":"cell"},onMouseDown:U,onMouseMove:H,onMouseUp:V,onMouseLeave:V})}),_&&c.jsxs("div",{className:"ce-export-panel",children:[c.jsxs("div",{className:"ce-export-header",children:[c.jsx("span",{children:"Export — copy to source code"}),c.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(G),children:"Copy"})]}),c.jsx("textarea",{className:"ce-export-textarea",value:G,readOnly:!0,rows:20})]})]})]})}let GM=0;function tr(e,t,n={}){return{event_id:`test-${++GM}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function En(e){return new Promise(t=>setTimeout(t,e))}async function qM(e){const t=[],n=e.getScene();if(!n)return t.push({name:"scene-ready",pass:!1,detail:"OfficeScene not initialized"}),t;console.log("%c[EventTest] Starting full event test suite (multi-office)...","color: #6366f1; font-weight: bold");for(const M of[...n.agents.keys()])n.removeAgent(M);await En(100);const r=Bn();t.push({name:"offices-loaded",pass:r.length>=3,detail:`${r.length} offices loaded: ${r.map(M=>M.name).join(", ")}`});const i=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const M of i)e.pushEvent(tr("agent_active",M));await En(300);const o=new Set;let a=!1;for(const M of i){const $=n.getAgent(M);$&&$.seatId&&(o.has($.seatId)&&(a=!0),o.add($.seatId))}t.push({name:"desk-assignment-unique",pass:!a&&o.size===i.length,detail:`Assigned ${o.size} unique seats to ${i.length} agents. IDs: [${[...o].join(", ")}]`});const u=i.every(M=>n.getAgent(M)?.officeId!=null);t.push({name:"agents-have-officeId",pass:u,detail:i.map(M=>`${M}=${n.getAgent(M)?.officeId}`).join(", ")}),e.pushEvent(tr("tool_start","agent-A",{tool_name:"shell"})),await En(200);const d=n.getAgent("agent-A");t.push({name:"tool_start-state",pass:d.isActive===!0&&d.currentTool==="shell",detail:`isActive=${d.isActive}, currentTool=${d.currentTool}`}),e.pushEvent(tr("tool_done","agent-A",{tool_name:"shell"})),await En(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let M=0;M<20&&d.agentState==="celebrate";M++)await En(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(tr("waiting","agent-B")),await En(200);const m=n.getAgent("agent-B");t.push({name:"waiting-state",pass:m.isActive===!1&&(m.agentState==="walk"||m.agentState==="idle"||m.agentState==="coffee"),detail:`isActive=${m.isActive}, state=${m.agentState}`}),e.pushEvent(tr("reflect_start","agent-C")),await En(200);const p=n.getAgent("agent-C");t.push({name:"reflect_start-state",pass:p.currentTool==="Reflect"&&(p.agentState==="walk"||p.agentState==="reflect"),detail:`currentTool=${p.currentTool}, state=${p.agentState}`}),e.pushEvent(tr("reflect_done","agent-C")),await En(100),t.push({name:"reflect_done-celebrate",pass:p.agentState==="celebrate",detail:`staLine truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return a.updateDeps=u=>{r=u},a}function Pk(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const r4=(e,t)=>Math.abs(e-t)<1.01,i4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Bk=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},s4=e=>e,o4=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},a4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=a=>{const{width:u,height:d}=a;t({width:Math.round(u),height:Math.round(d)})};if(i(Bk(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(a=>{const u=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Bk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},$k={passive:!0},Hk=typeof window>"u"?!0:"onscrollend"in window,l4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&Hk?()=>{}:i4(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=p=>()=>{const{horizontal:h,isRtl:g}=e.options;i=h?n.scrollLeft*(g&&-1||1):n.scrollTop,o(),t(i,p)},u=a(!0),d=a(!1);n.addEventListener("scroll",u,$k);const m=e.options.useScrollendEvent&&Hk;return m&&n.addEventListener("scrollend",d,$k),()=>{n.removeEventListener("scroll",u),m&&n.removeEventListener("scrollend",d)}},c4=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},u4=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const a=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class d4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const a=()=>{const u=o.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:s4,rangeExtractor:o4,onChange:()=>{},measureElement:c4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=La(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)} Line truncated
The error may be correlated with this previous error:
${te.current.stack}
`),we}Mf(()=>{te.current=void 0,P.current=void 0,G.current=de});const se=E.useMemo(()=>E.createElement(S,{...de,ref:L}),[L,S,de]);return E.useMemo(()=>v?E.createElement(M.Provider,{value:q},se):se,[M,se,q])}const I=E.memo(N);if(I.WrappedComponent=S,I.displayName=N.displayName=k,d){const T=E.forwardRef(function(A,M){return E.createElement(I,{...A,reactReduxForwardedRef:M})});return T.displayName=k,T.WrappedComponent=S,ky(T,S)}return ky(I,S)}}var Qj=X5;function K5(e){const{children:t,context:n,serverState:r,store:i}=e,o=E.useMemo(()=>{const d=Xj(i);return{store:i,subscription:d,getServerState:r?()=>r:void 0}},[i,r]),a=E.useMemo(()=>i.getState(),[i]);Mf(()=>{const{subscription:d}=o;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),a!==i.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[o,a]);const u=n||Zj;return E.createElement(u.Provider,{value:o},t)}var Z5=K5,Q5="Invariant failed";function J5(e,t){throw new Error(Q5)}var Ei=function(t){var n=t.top,r=t.right,i=t.bottom,o=t.left,a=r-o,u=i-n,d={top:n,right:r,bottom:i,left:o,width:a,height:u,x:o,y:n,center:{x:(r+o)/2,y:(i+n)/2}};return d},S0=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},fS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},eD=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},ug={top:0,right:0,bottom:0,left:0},w0=function(t){var n=t.borderBox,r=t.margin,i=r===void 0?ug:r,o=t.border,a=o===void 0?ug:o,u=t.padding,d=u===void 0?ug:u,m=Ei(S0(n,i)),p=Ei(fS(n,a)),h=Ei(fS(p,d));return{marginBox:m,borderBox:Ei(n),paddingBox:p,contentBox:h,margin:i,border:a,padding:d}},pi=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var i=Number(n);return isNaN(i)&&J5(),i},tD=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Df=function(t,n){var r=t.borderBox,i=t.border,o=t.margin,a=t.padding,u=eD(r,n);return w0({borderBox:u,border:i,margin:o,padding:a})},Of=function(t,n){return n===void 0&&(n=tD()),Df(t,n)},Jj=function(t,n){var r={top:pi(n.marginTop),right:pi(n.marginRight),bottom:pi(n.marginBottom),left:pi(n.marginLeft)},i={top:pi(n.paddingTop),right:pi(n.paddingRight),bottom:pi(n.paddingBottom),left:pi(n.paddingLeft)},o={top:pi(n.borderTopWidth),right:pi(n.borderRightWidth),bottom:pi(n.borderBottomWidth),left:pi(n.borderLeftWidth)};return w0({borderBox:t,margin:r,padding:i,border:o})},eE=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Jj(n,r)},Jc=function(t){var n=[],r=null,i=function(){for(var a=arguments.length,u=new Array(a),d=0;d<a;d++)u[d]=arguments[d];n=u,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return i.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},i};function Lf(){return Lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lf.apply(null,arguments)}function tE(e,t){}tE.bind(null,"warn");tE.bind(null,"error");function ao(){}function nD(e,t){return{...e,...t}}function vi(e,t,n){const r=t.map(i=>{const o=nD(n,i.options);return e.addEventListener(i.eventName,i.fn,o),function(){e.removeEventListener(i.eventName,i.fn,o)}});return function(){r.forEach(o=>{o()})}}const rD="Invariant failed";class zf extends Error{}zf.prototype.toString=function(){return this.message};function Le(e,t){throw new zf(rD)}let iD=class extends St.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=ao,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof zf&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=vi(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof zf){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const sD=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,Pf=e=>e+1,oD=e=>`
You have lifted an item in position ${Pf(e.source.index)}
`,nE=(e,t)=>{const n=e.droppableId===t.droppableId,r=Pf(e.index),i=Pf(t.index);return n?`
You have moved the item from position ${r}
to position ${i}
`:`
You have moved the item from position ${r}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${i}
`},rE=(e,t,n)=>t.droppableId===n.droppableId?`
The item ${e}
has been combined with ${n.draggableId}`:`
The item ${e}
in list ${t.droppableId}
has been combined with ${n.draggableId}
in list ${n.droppableId}
`,aD=e=>{const t=e.destination;if(t)return nE(e.source,t);const n=e.combine;return n?rE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},mS=e=>`
The item has returned to its starting position
of ${Pf(e.index)}
`,lD=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${mS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${nE(e.source,t)}
`:n?`
You have dropped the item.
${rE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${mS(e.source)}
`},xf={dragHandleUsageInstructions:sD,onDragStart:oD,onDragUpdate:aD,onDragEnd:lD};function cD(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function iE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!cD(e[n],t[n]))return!1;return!0}function $t(e,t){const n=E.useState(()=>({inputs:t,result:e()}))[0],r=E.useRef(!0),i=E.useRef(n),a=r.current||!!(t&&i.current.inputs&&iE(t,i.current.inputs))?i.current:{inputs:t,result:e()};return E.useEffect(()=>{r.current=!1,i.current=a},[a]),a.result}function st(e,t){return $t(()=>e,t)}const or={x:0,y:0},mr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Qr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),lo=(e,t)=>e.x===t.x&&e.y===t.y,kl=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Fo=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},eu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),hS=(e,t)=>Math.min(...t.map(n=>eu(e,n))),sE=e=>t=>({x:e(t.x),y:e(t.y)});var uD=(e,t)=>{const n=Ei({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const vu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),pS=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],dD={top:0,right:0,bottom:0,left:0},fD=(e,t)=>t?vu(e,t.scroll.diff.displacement):e,mD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,hD=(e,t)=>t&&t.shouldClipSubject?uD(t.pageMarginBox,e):Ei(e);var ol=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const i=fD(e.marginBox,r),o=mD(i,n,t),a=hD(o,r);return{page:e,withPlaceholder:t,active:a}},C0=(e,t)=>{e.frame||Le();const n=e.frame,r=Qr(t,n.scroll.initial),i=kl(r),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:i},max:n.scroll.max}},a=ol({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function sr(e,t=iE){let n=null;function r(...i){if(n&&n.lastThis===this&&t(i,n.lastArgs))return n.lastResult;const o=e.apply(this,i);return n={lastResult:o,lastArgs:i,lastThis:this},o}return r.clear=function(){n=null},r}const oE=sr(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),aE=sr(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),vm=sr(e=>Object.values(e)),pD=sr(e=>Object.values(e));var Sl=sr((e,t)=>pD(t).filter(r=>e===r.descriptor.droppableId).sort((r,i)=>r.descriptor.index-i.descriptor.index));function j0(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function bm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var _m=sr((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),gD=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:i})=>{if(!n.isCombineEnabled||!j0(i))return null;function a(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...i,at:v}}const u=i.displaced.all,d=u.length?u[0]:null;if(e)return d?a(d):null;const m=_m(t,r);if(!d){if(!m.length)return null;const y=m[m.length-1];return a(y.descriptor.id)}const p=m.findIndex(y=>y.descriptor.id===d);p===-1&&Le();const h=p-1;if(h<0)return null;const g=m[h];return a(g.descriptor.id)},wl=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const lE={point:or,value:0},tu={invisible:{},visible:{},all:[]},xD={displaced:tu,displacedBy:lE,at:null};var bi=(e,t)=>n=>e<=n&&n<=t,cE=e=>{const t=bi(e.top,e.bottom),n=bi(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const o=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(o&&a)return!0;const d=r.top<e.top&&r.bottom>e.bottom,m=r.left<e.left&&r.right>e.right;return d&&m?!0:d&&a||m&&o}},yD=e=>{const t=bi(e.top,e.bottom),n=bi(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const E0={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},uE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var vD=e=>t=>{const n=bi(t.top,t.bottom),r=bi(t.left,t.right);return i=>e===E0?n(i.top)&&n(i.bottom):r(i.left)&&r(i.right)};const bD=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:or;return vu(e,n)},_D=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,kD=(e,t,n)=>n(t)(e),N0=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:i})=>{const o=r?bD(e,t):e;return _D(o,t,i)&&kD(o,n,i)},SD=e=>N0({...e,isVisibleThroughFrameFn:cE}),dE=e=>N0({...e,isVisibleThroughFrameFn:yD}),wD=e=>N0({...e,isVisibleThroughFrameFn:vD(e.destination.axis)}),CD=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:i}=t;if(r[e])return!1;const o=i[e];return o?o.shouldAnimate:!0};function jD(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Ei(S0(n,r))}function nu({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:i,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(ll.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:u,dragging:EL,dropAnimating:u}}})(),r=(()=>{const u=`
transition: ${Fc.outOfTheWay};
`;return{selector:t(Ey.contextId),styles:{dragging:u,dropAnimating:u,userCancel:u}}})(),i={selector:t(CL.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,i,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:bc(a,"always"),resting:bc(a,"resting"),dragging:bc(a,"dragging"),dropAnimating:bc(a,"dropAnimating"),userCancel:bc(a,"userCancel")}};const ei=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?E.useLayoutEffect:E.useEffect,pg=()=>{const e=document.querySelector("head");return e||Le(),e},IS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function IL(e,t){const n=$t(()=>NL(e),[e]),r=E.useRef(null),i=E.useRef(null),o=st(sr(h=>{const g=i.current;g||Le(),g.textContent=h}),[]),a=st(h=>{const g=r.current;g||Le(),g.textContent=h},[]);ei(()=>{!r.current&&!i.current||Le();const h=IS(t),g=IS(t);return r.current=h,i.current=g,h.setAttribute(`${al}-always`,e),g.setAttribute(`${al}-dynamic`,e),pg().appendChild(h),pg().appendChild(g),a(n.always),o(n.resting),()=>{const y=v=>{const w=v.current;w||Le(),pg().removeChild(w),v.current=null};y(r),y(i)}},[t,a,o,n.always,n.resting,e]);const u=st(()=>o(n.dragging),[o,n.dragging]),d=st(h=>{if(h==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=st(()=>{i.current&&o(n.resting)},[o,n.resting]);return $t(()=>({dragging:u,dropping:d,resting:m}),[u,d,m])}function PE(e,t){return Array.from(e.querySelectorAll(t))}var BE=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Sm(e){return e instanceof BE(e).HTMLElement}function TL(e,t){const n=`[${ll.contextId}="${e}"]`,r=PE(document,n);if(!r.length)return null;const i=r.find(o=>o.getAttribute(ll.draggableId)===t);return!i||!Sm(i)?null:i}function RL(e){const t=E.useRef({}),n=E.useRef(null),r=E.useRef(null),i=E.useRef(!1),o=st(function(g,y){const v={id:g,focus:y};return t.current[g]=v,function(){const S=t.current;S[g]!==v&&delete S[g]}},[]),a=st(function(g){const y=TL(e,g);y&&y!==document.activeElement&&y.focus()},[e]),u=st(function(g,y){n.current===g&&(n.current=y)},[]),d=st(function(){r.current||i.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const g=n.current;g&&a(g)}))},[a]),m=st(function(g){n.current=null;const y=document.activeElement;y&&y.getAttribute(ll.draggableId)===g&&(n.current=g)},[]);return ei(()=>(i.current=!0,function(){i.current=!1;const g=r.current;g&&cancelAnimationFrame(g)}),[]),$t(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:u}),[o,m,d,u])}function AL(){const e={draggables:{},droppables:{}},t=[];function n(h){return t.push(h),function(){const y=t.indexOf(h);y!==-1&&t.splice(y,1)}}function r(h){t.length&&t.forEach(g=>g(h))}function i(h){return e.draggables[h]||null}function o(h){const g=i(h);return g||Le(),g}const a={register:h=>{e.draggables[h.descriptor.id]=h,r({type:"ADDITION",value:h})},update:(h,g)=>{const y=e.draggables[g.descriptor.id];y&&y.uniqueId===h.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[h.descriptor.id]=h)},unregister:h=>{const g=h.descriptor.id,y=i(g);y&&h.uniqueId===y.uniqueId&&(delete e.draggables[g],e.droppables[h.descriptor.droppableId]&&r({type:"REMOVAL",value:h}))},getById:o,findById:i,exists:h=>!!i(h),getAllByType:h=>Object.values(e.draggables).filter(g=>g.descriptor.type===h)};function u(h){return e.droppables[h]||null}function d(h){const g=u(h);return g||Le(),g}const m={register:h=>{e.droppables[h.descriptor.id]=h},unregister:h=>{const g=u(h.descriptor.id);g&&h.uniqueId===g.uniqueId&&delete e.droppables[h.descriptor.id]},getById:d,findById:u,exists:h=>!!u(h),getAllByType:h=>Object.values(e.droppables).filter(g=>g.descriptor.type===h)};function p(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:m,subscribe:n,clean:p}}function ML(){const e=$t(AL,[]);return E.useEffect(()=>function(){e.clean()},[e]),e}var B0=St.createContext(null),$f=()=>{const e=document.body;return e||Le(),e};const DL={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},OL=e=>`rfd-announcement-${e}`;function LL(e){const t=$t(()=>OL(e),[e]),n=E.useRef(null);return E.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),Lf(o.style,DL),$f().appendChild(o),function(){setTimeout(function(){const d=$f();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),st(i=>{const o=n.current;if(o){o.textContent=i;return}},[])}const zL={separator:"::"};function $0(e,t=zL){const n=St.useId();return $t(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function PL({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function BL({contextId:e,text:t}){const n=$0("hidden-text",{separator:"-"}),r=$t(()=>PL({contextId:e,uniqueId:n}),[n,e]);return E.useEffect(function(){const o=document.createElement("div");return o.id=r,o.textContent=t,o.style.display="none",$f().appendChild(o),function(){const u=$f();u.contains(o)&&u.removeChild(o)}},[r,t]),r}var wm=St.c Line truncated
`,m="/",p="*",h="",g="comment",y="declaration";function v(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var k=1,C=1;function N(B){var U=B.match(t);U&&(k+=U.length);var H=B.lastIndexOf(d);C=~H?B.length-H:C+B.length}function O(){var B={line:k,column:C};return function(U){return U.position=new I(B),L(),U}}function I(B){this.start=B,this.end={line:k,column:C},this.source=_.source}I.prototype.content=S;function D(B){var U=new Error(_.source+":"+k+":"+C+": "+B);if(U.reason=B,U.filename=_.source,U.line=k,U.column=C,U.source=S,!_.silent)throw U}function T(B){var U=B.exec(S);if(U){var H=U[0];return N(H),S=S.slice(H.length),U}}function L(){T(n)}function A(B){var U;for(B=B||[];U=M();)U!==!1&&B.push(U);return B}function M(){var B=O();if(!(m!=S.charAt(0)||p!=S.charAt(1))){for(var U=2;h!=S.charAt(U)&&(p!=S.charAt(U)||m!=S.charAt(U+1));)++U;if(U+=2,h===S.charAt(U-1))return D("End of comment missing");var H=S.slice(2,U-2);return C+=2,N(H),S=S.slice(U),C+=2,B({type:g,comment:H})}}function $(){var B=O(),U=T(r);if(U){if(M(),!T(i))return D("property missing ':'");var H=T(o),V=B({type:y,property:w(U[0].replace(e,h)),value:H?w(H[0].replace(e,h)):h});return T(a),V}}function W(){var B=[];A(B);for(var U;U=$();)U!==!1&&(B.push(U),A(B));return B}return L(),W()}function w(S){return S?S.replace(u,h):h}return wg=v,wg}var WS;function sz(){if(WS)return Ba;WS=1;var e=Ba&&Ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.default=n;const t=e(iz());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),u=typeof i=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:p}=d;u?i(m,p,d):p&&(o=o||{},o[m]=p)}),o}return Ba}var wc={},YS;function oz(){if(YS)return wc;YS=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},a=function(m,p){return p.toUpperCase()},u=function(m,p){return"".concat(p,"-")},d=function(m,p){return p===void 0&&(p={}),o(m)?m:(m=m.toLowerCase(),p.reactCompat?m=m.replace(i,u):m=m.replace(r,u),m.replace(t,a))};return wc.camelCase=d,wc}var Cc,XS;function az(){if(XS)return Cc;XS=1;var e=Cc&&Cc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(sz()),n=oz();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(u,d){u&&d&&(a[(0,n.camelCase)(u,o)]=d)}),a}return r.default=r,Cc=r,Cc}var lz=az();const cz=Zo(lz),dN=fN("end"),q0=fN("start");function fN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function uz(e){const t=q0(e),n=dN(e);if(t&&n)return{start:t,end:n}}function Vc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?KS(e.position):"start"in e||"end"in e?KS(e):"line"in e||"column"in e?Ay(e):""}function Ay(e){return ZS(e&&e.line)+":"+ZS(e&&e.column)}function KS(e){return Ay(e&&e.start)+"-"+Ay(e&&e.end)}function ZS(e){return e&&typeof e=="number"?e:1}class Sr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?o.ruleId=r:(o.source=r.slice(0,d),o.ruleId=r.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Vc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Sr.prototype.file="";Sr.prototype.name="";Sr.prototype.reason="";Sr.prototype.message="";Sr.prototype.stack="";Sr.prototype.column=void 0;Sr.prototype.line=void 0;Sr.prototype.ancestors=void 0;Sr.prototype.cause=void 0;Sr.prototype.fatal=void 0;Sr.prototype.place=void 0;Sr.prototype.ruleId=void 0;Sr.prototype.source=void 0;const W0={}.hasOwnProperty,dz=new Map,fz=/[A-Z]/g,mz=new Set(["table","tbody","thead","tfoot","tr"]),hz=new Set(["td","th"]),mN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pz(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.j Line truncated
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function SB(e){const r={constructs:yN([vB,...(e||{}).extensions||[]]),content:i(Pz),defined:[],document:i($z),flow:i(iB),lazy:{},string:i(aB),text:i(lB)};return r;function i(o){return a;function a(u){return bB(r,o,u)}}}function wB(e){for(;!SN(e););return e}const aw=/[\0\t\n\r]/g;function CB(){let e=1,t="",n=!0,r;return i;function i(o,a,u){const d=[];let m,p,h,g,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),h=0,t="",n&&(o.charCodeAt(0)===65279&&h++,n=void 0);h<o.length;){if(aw.lastIndex=h,m=aw.exec(o),g=m&&m.index!==void 0?m.index:o.length,y=o.charCodeAt(g),!m){t=o.slice(h);break}if(y===10&&h===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),h<g&&(d.push(o.slice(h,g)),e+=g-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const jB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EB(e){return e.replace(jB,NB)}function NB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return vN(n.slice(o?2:1),o?16:10)}return Z0(n)||e}const IN={}.hasOwnProperty;function IB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),TB(n)(wB(SB(n).document().write(CB()(e,t,!0))))}function TB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(bt),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Ge),blockQuote:o(se),characterEscape:L,characterReference:L,codeFenced:o(je),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(je,a),codeText:o(we,a),codeTextData:L,data:L,codeFlowValue:L,definition:o(Ce),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Be),hardBreakEscape:o(Ye),hardBreakTrailing:o(Ye),htmlFlow:o(yt,a),htmlFlowData:L,htmlText:o(yt,a),htmlTextData:L,image:o(Vt),label:a,link:o(bt),listItem:o(me),listItemValue:g,listOrdered:o(vt,h),listUnordered:o(vt),paragraph:o(Oe),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ge),strong:o(rt),thematicBreak:o(Je)},exit:{atxHeading:d(),atxHeadingSequence:O,autolink:d(),autolinkEmail:de,autolinkProtocol:oe,blockQuote:d(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:te,characterReference:re,codeFenced:d(S),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:A,codeIndented:d(_),codeText:d(U),codeTextData:A,data:A,definition:d(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:C,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(W),htmlFlowData:A,htmlText:d(B),htmlTextData:A,image:d(V),label:Z,labelText:Y,lineEnding:M,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:X,resourceDestinationString:q,resourceTitleString:G,resource:J,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:I,strong:d(),thematicBreak:d()}};TN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(fe){let be={type:"root",children:[]};const Me={stack:[be],tokenStack:[],config:t,enter:u,exit:m,buffer:a,resume:p,data:n},Fe=[];let $e=-1;for(;++$e<fe.length;)if(fe[$e][1].type==="listOrdered"||fe[$e][1].type==="listUnordered")if(fe[$e][0]==="enter")Fe.push($e);else{const Ut=Fe.pop();$e=i(fe,Ut,$e)}for($e=-1;++$e<fe.length;){const Ut=t[fe[$e][0]];IN.call(Ut,fe[$e][1].type)&&Ut[fe[$e][1].type].call(Object.assign({sliceSerialize:fe[$e][2].sliceSerialize},Me),fe[$e][1])}if(Me.tokenStack.length>0){const Ut=Me.tokenStack[Me.tokenStack.length-1];(Ut[1]||lw).call(Me,void 0,Ut[0])}for(be.position={start:to(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:to(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)be=t.transforms[$e](be)||be;return be}function i(fe,be,Me){let Fe=be-1,$e=-1,Ut=!1,rn,ke,Te,Pe;for(;++Fe<=Me;){const Ve=fe[Fe];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?$e++:$e--,Pe=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(rn&&!Pe&&!$e&&!Te&&(Te=Fe),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!$e&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||$e===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(rn){let qe=Fe;for(ke=void 0;qe--;){const et=fe[qe];if(et[1].type==="lineEnding"||et[1].type==="lineEndingBlank"){if(et[0]==="exit")continue;ke&&(fe[ke][1].type="lineEndingBlank",Ut=!0),et[1].type="lineEnding",ke=qe}else if(!(et[1].type==="linePrefix"||et[1].type==="blockQuotePrefix"||et[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function OB(e,t){const n=t.value?t.value+`
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function LB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=jl(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,u+=1,e.footnoteCounts.set(r,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function BB(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $B(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function RN(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function HB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return RN(e,t);const i={src:jl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function FB(e,t){const n={src:jl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function VB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function UB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return RN(e,t);const i={href:jl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function GB(e,t){const n={href:jl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qB(e,t,n){const r=e.all(t),i=n?WB(n):AN(t),o={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(i||u!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!i?a.push(...p.children):a.push(p)}const d=r[r.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`});const m={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,m),e.applyData(t,m)}function WB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=AN(n[r])}return t}function AN(e){const t=e.spread;return t??e.children.length>1}function YB(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function XB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ZB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QB(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=q0(t.children[1]),d=dN(t.children[t.children.length-1]);u&&d&&(a.position={start:u,end:d}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function JB(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,u=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const h=t.children[d],g={},y=a?a[d]:void 0;y&&(g.align=y);let v={type:"element",tagName:o,properties:g,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),m.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,p),e.applyData(t,p)}function e9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const cw=9,uw=32;function t9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(dw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(dw(t.slice(i),i>0,!1)),o.join("")}function dw(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===cw||o===uw;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===cw||o===uw;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function n9(e,t){const n={type:"text",value:t9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const i9={blockquote:MB,break:DB,code:OB,delete:LB,emphasis:zB,footnoteReference:PB,heading:BB,html:$B,imageReference:HB,image:FB,inlineCode:VB,linkReference:UB,link:GB,listItem:qB,list:YB,paragraph:XB,root:KB,strong:ZB,table:QB,tableCell:e9,tableRow:JB,text:n9,thematicBreak:r9,toml:Ud,yaml:Ud,definition:Ud,footnoteDefinition:Ud};function Ud(){}const MN=-1,Tm=0,Gc=1,qf=2,J0=3,ev=4,tv=5,nv=6,DN=7,ON=8,fw=typeof self=="object"?self:globalThis,s9=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case Tm:case MN:return n(a,i);case Gc:{const u=n([],i);for(const d of a)u.push(r(d));return u}case qf:{const u=n({},i);for(const[d,m]of a)u[r(d)]=r(m);return u}case J0:return n(new Date(a),i);case ev:{const{source:u,flags:d}=a;return n(new RegExp(u,d),i)}case tv:{const u=n(new Map,i);for(const[d,m]of a)u.set(r(d),r(m));return u}case nv:{const u=n(new Set,i);for(const d of a)u.add(r(d));return u}case DN:{const{name:u,message:d}=a;return n(new fw[u](d),i)}case ON:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new fw[o](a),i)};return r},mw=e=>s9(new Map,e)(0),$a="",{toString:o9}={},{keys:a9}=Object,Ec=e=>{const t=typeof e;if(t!=="object"||!e)return[Tm,t];const n=o9.call(e).slice(8,-1);switch(n){case"Array":return[Gc,$a];case"Object":return[qf,$a];case"Date":return[J0,$a];case"RegExp":return[ev,$a];case"Map":return[tv,$a];case"Set":return[nv,$a];case"DataView":return[Gc,n]}return n.includes("Array")?[Gc,n]:n.includes("Error")?[DN,n]:[qf,n]},Gd=([e,t])=>e===Tm&&(t==="function"||t==="symbol"),l9=(e,t,n,r)=>{const i=(a,u)=>{const d=r.push(a)-1;return n.set(u,d),d},o=a=>{if(n.has(a))return n.get(a);let[u,d]=Ec(a);switch(u){case Tm:{let p=a;switch(d){case"bigint":u=ON,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return i([MN],a)}return i([u,p],a)}case Gc:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array( Line truncated
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
`}]}}const Rm=(function(e){if(e==null)return p9;if(typeof e=="function")return Am(e);if(typeof e=="object")return Array.isArray(e)?f9(e):m9(e);if(typeof e=="string")return h9(e);throw new Error("Expected function, string, or object as test")});function f9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rm(e[n]);return Am(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function m9(e){const t=e;return Am(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function h9(e){return Am(t);function t(n){return n&&n.type===e}}function Am(e){return t;function t(n,r,i){return!!(g9(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function p9(){return!0}function g9(e){return e!==null&&typeof e=="object"&&"type"in e}const LN=[],x9=!0,Oy=!1,y9="skip";function zN(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Rm(i),a=r?-1:1;u(e,void 0,[])();function u(d,m,p){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=LN,v,w,S;if((!t||o(d,m,p[p.length-1]||void 0))&&(y=v9(n(d,p)),y[0]===Oy))return y;if("children"in d&&d.children){const _=d;if(_.children&&y[0]!==y9)for(w=(r?_.children.length:-1)+a,S=p.concat(_);w>-1&&w<_.children.length;){const k=_.children[w];if(v=u(k,w,S)(),v[0]===Oy)return v;w=typeof v[1]=="number"?v[1]:w+a}}return y}}}function v9(e){return Array.isArray(e)?e:typeof e=="number"?[x9,e]:e==null?LN:[e]}function rv(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),zN(e,o,u,i);function u(d,m){const p=m[m.length-1],h=p?p.children.indexOf(d):void 0;return a(d,h,p)}}const Ly={}.hasOwnProperty,b9={};function _9(e,t){const n=t||b9,r=new Map,i=new Map,o=new Map,a={...i9,...n.handlers},u={all:m,applyData:S9,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:k9,wrap:C9};return rv(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),u;function d(p,h){const g=p.type,y=u.handlers[g];if(Ly.call(u.handlers,g)&&y)return y(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(g)){if("children"in p){const{children:w,...S}=p,_=Wf(S);return _.children=u.all(p),_}return Wf(p)}return(u.options.unknownHandler||w9)(u,p,h)}function m(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const v=u.one(g[y],p);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=pw(v.value)),!Array.isArray(v)&&v.type==="element")){const w=v.children[0];w&&w.type==="text"&&(w.value=pw(w.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function k9(e,t){e.position&&(t.position=uz(e))}function S9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,Wf(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function w9(e,t){const n=t.data||{},r="value"in t&&!(Ly.call(n,"hProperties")||Ly.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function C9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function pw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gw(e,t){const n=_9(e,t),r=n.one(e,void 0),i=d9(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
`},i),o}function j9(e,t){return e&&"run"in e?async function(n,r){const i=gw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return gw(n,{file:r,...e||t})}}function xw(e){if(e)throw e}var Ng,yw;function E9(){if(yw)return Ng;yw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var p=e.call(m,"constructor"),h=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!p&&!h)return!1;var g;for(g in m);return typeof g>"u"||e.call(m,g)},a=function(m,p){n&&p.name==="__proto__"?n(m,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):m[p.name]=p.newValue},u=function(m,p){if(p==="__proto__")if(e.call(m,p)){if(r)return r(m,p).value}else return;return m[p]};return Ng=function d(){var m,p,h,g,y,v,w=arguments[0],S=1,_=arguments.length,k=!1;for(typeof w=="boolean"&&(k=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<_;++S)if(m=arguments[S],m!=null)for(p in m)h=u(w,p),g=u(m,p),w!==g&&(k&&g&&(o(g)||(y=i(g)))?(y?(y=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},a(w,{name:p,newValue:d(k,v,g)})):typeof g<"u"&&a(w,{name:p,newValue:g}));return w},Ng}var N9=E9();const Ig=Zo(N9);function zy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function I9(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);u(null,...i);function u(d,...m){const p=e[++o];let h=-1;if(d){a(d);return}for(;++h<i.length;)(m[h]===null||m[h]===void 0)&&(m[h]=i[h]);i=m,p?T9(p,u)(...m):a(null,...m)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function T9(e,t){let n;return r;function r(...a){const u=e.length>a.length;let d;u&&a.push(i);try{d=e.apply(this,a)}catch(m){const p=m;if(u&&n)throw p;return i(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(a,...u){n||(n=!0,t(a,...u))}function o(a){i(null,a)}}const Hi={basename:R9,dirname:A9,extname:M9,join:D9,sep:"/"};function R9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Su(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function A9(e){if(Su(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function M9(e){Su(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const u=e.codePointAt(t);if(u===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function D9(...e){let t=-1,n;for(;++t<e.length;)Su(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":O9(n)}function O9(e){Su(e);const t=e.codePointAt(0)===47;let n=L9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function L9(e,t){let n="",r=0,i=-1,o=0,a=-1,u,d;for(;++a<=e.length;){if(a<e.length)u=e.codePointAt(a);else{if(u===47)break;u=47}if(u===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else u===46&&o>-1?o++:o=-1}return n}function Su(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const z9={cwd:P9};function P9(){return"/"}function Py(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function B9(e){if(typeof e=="string")e=new URL(e);else if(!Py(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $9(e)}function $9(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?HN:T$))),m(),d}}function T$(e,t,n){return t===0?e:HN(e,t,n)}function HN(e,t,n){return(n?"":" ")+e}const R$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];FN.peek=L$;function A$(){return{canContainEols:["delete"],enter:{strikethrough:D$},exit:{strikethrough:O$}}}function M$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:R$}],handlers:{delete:FN}}}function D$(e){this.enter({type:"delete",children:[]},e)}function O$(e){this.exit(e)}function FN(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function L$(){return"~"}function z$(e){return e.length}function P$(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||z$,o=[],a=[],u=[],d=[];let m=0,p=-1;for(;++p<e.length;){const w=[],S=[];let _=-1;for(e[p].length>m&&(m=e[p].length);++_<e[p].length;){const k=B$(e[p][_]);if(n.alignDelimiters!==!1){const C=i(k);S[_]=C,(d[_]===void 0||C>d[_])&&(d[_]=C)}w.push(k)}a[p]=w,u[p]=S}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<m;)o[h]=Cw(r[h]);else{const w=Cw(r);for(;++h<m;)o[h]=w}h=-1;const g=[],y=[];for(;++h<m;){const w=o[h];let S="",_="";w===99?(S=":",_=":"):w===108?S=":":w===114&&(_=":");let k=n.alignDelimiters===!1?1:Math.max(1,d[h]-S.length-_.length);const C=S+"-".repeat(k)+_;n.alignDelimiters!==!1&&(k=S.length+k+_.length,k>d[h]&&(d[h]=k),y[h]=k),g[h]=C}a.splice(1,0,g),u.splice(1,0,y),p=-1;const v=[];for(;++p<a.length;){const w=a[p],S=u[p];h=-1;const _=[];for(;++h<m;){const k=w[h]||"";let C="",N="";if(n.alignDelimiters!==!1){const O=d[h]-(S[h]||0),I=o[h];I===114?C=" ".repeat(O):I===99?O%2?(C=" ".repeat(O/2+.5),N=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),N=C):N=" ".repeat(O)}n.delimiterStart!==!1&&!h&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||h)&&_.push(" "),n.alignDelimiters!==!1&&_.push(C),_.push(k),n.alignDelimiters!==!1&&_.push(N),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||h!==m-1)&&_.push("|")}v.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return v.join(`
`)}function B$(e){return e==null?"":String(e)}function Cw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function $$(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),H$);return i(),a}function H$(e,t,n){return">"+(n?"":" ")+e}function F$(e,t){return jw(e,t.inConstruct,!0)&&!jw(e,t.notInConstruct,!1)}function jw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Ew(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&F$(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function V$(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function U$(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function G$(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function q$(e,t,n,r){const i=G$(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(U$(e,n)){const h=n.enter("codeIndented"),g=n.indentLines(o,W$);return h(),g}const u=n.createTracker(r),d=i.repeat(Math.max(V$(o,i)+1,3)),m=n.enter("codeFenced");let p=u.move(d);if(e.lang){const h=n.enter(`codeFencedLang${a}`);p+=u.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${a}`);p+=u.move(" "),p+=u.move(n.safe(e.meta,{before:p,after:`
`,encode:["`"],...u.current()})),h()}return p+=u.move(`
`),o&&(p+=u.move(o+`
`)),p+=u.move(d),m(),p}function W$(e,t,n){return(n?"":" ")+e}function sv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Y$(e,t,n,r){const i=sv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("[");return m+=d.move(n.safe(n.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),a(),m}function X$(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function lu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Yf(e,t,n){const r=dl(e),i=dl(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}VN.peek=K$;function VN(e,t,n,r){const i=X$(n),o=n.enter("emphasis"),a=n.createTracker(r),u=a.move(i);let d=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const m=d.charCodeAt(0),p=Yf(r.before.charCodeAt(r.before.length-1),m,i);p.inside&&(d=lu(m)+d.slice(1));const h=d.charCodeAt(d.length-1),g=Yf(r.after.charCodeAt(0),h,i);g.inside&&(d=d.slice(0,-1)+lu(h));const y=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},u+d+y}function K$(e,t,n){return n.options.emphasis||"*"}function Z$(e,t){let n=!1;return rv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Oy}),!!((!e.depth||e.depth<3)&&K0(e)&&(t.options.setext||n))}function Q$(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Z$(e,n)){const p=n.enter("headingSetext"),h=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return h(),p(),g+`
`+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(i),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=lu(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),u(),m}UN.peek=J$;function UN(e){return e.value||""}function J$(){return"<"}GN.peek=e7;function GN(e,t,n,r){const i=sv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("![");return m+=d.move(n.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),m+=d.move(")"),a(),m}function e7(){return"!"}qN.peek=t7;function qN(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("![");const m=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function t7(){return"!"}WN.peek=n7;function WN(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],u=n.compilePattern(a);let d;if(a.atBreak)for(;d=u.exec(r);){let m=d.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(d.index+1)}}return i+r+i}function n7(){return"`"}function YN(e,t){const n=K0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}XN.peek=r7;function XN(e,t,n,r){const i=sv(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,d;if(YN(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),d=n.enter("label");let m=a.move("[");return m+=a.move(n.containerPhrasing(e,{before:m,after:"](",...a.current()})),m+=a.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=a.move("<"),m+=a.move(n.safe(e.url,{before:m,after:">",...a.current()})),m+=a.move(">")):(d=n.enter("destinationRaw"),m+=a.move(n.safe(e.url,{before:m,after:e.title?" ":")",...a.current()}))),d(),e.title&&(d=n.enter(`title${o}`),m+=a.move(" "+i),m+=a.move(n.safe(e.title,{before:m,after:i,...a.current()})),m+=a.move(i),d()),m+=a.move(")"),u(),m}function r7(e,t,n){return YN(e,n)?"<":"["}KN.peek=i7;function KN(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function i7(){return"["}function ov(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function s7(e){const t=ov(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function o7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ZN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function a7(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?o7(n):ov(n);const u=e.ordered?a==="."?")":".":s7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),ZN(n)===a&&p){let h=-1;for(;++h<e.chilLine truncated
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:d,tableRow:u}};function a(y,v,w,S){return m(p(y,w,S),y.align)}function u(y,v,w,S){const _=h(y,w,S),k=m([_]);return k.slice(0,k.indexOf(`
`))}function d(y,v,w,S){const _=w.enter("tableCell"),k=w.enter("phrasing"),C=w.containerPhrasing(y,{...S,before:o,after:o});return k(),_(),C}function m(y,v){return P$(y,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function p(y,v,w){const S=y.children;let _=-1;const k=[],C=v.enter("table");for(;++_<S.length;)k[_]=h(S[_],v,w);return C(),k}function h(y,v,w){const S=y.children;let _=-1;const k=[],C=v.enter("tableRow");for(;++_<S.length;)k[_]=d(S[_],y,v,w);return C(),k}function g(y,v,w){let S=JN.inlineCode(y,v,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function C7(){return{exit:{taskListCheckValueChecked:Iw,taskListCheckValueUnchecked:Iw,paragraph:E7}}}function j7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:N7}}}function Iw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function E7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function N7(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let d=JN.listItem(e,t,n,{...r,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(p){return p+a}}function I7(){return[a$(),N$(),A$(),y7(),C7()]}function T7(e){return{extensions:[l$(),I$(e),M$(),w7(e),j7()]}}const R7={tokenize:z7,partial:!0},eI={tokenize:P7,partial:!0},tI={tokenize:B7,partial:!0},nI={tokenize:$7,partial:!0},A7={tokenize:H7,partial:!0},rI={name:"wwwAutolink",tokenize:O7,previous:sI},iI={name:"protocolAutolink",tokenize:L7,previous:oI},Cs={name:"emailAutolink",tokenize:D7,previous:aI},Zi={};function M7(){return{text:Zi}}let Mo=48;for(;Mo<123;)Zi[Mo]=Cs,Mo++,Mo===58?Mo=65:Mo===91&&(Mo=97);Zi[43]=Cs;Zi[45]=Cs;Zi[46]=Cs;Zi[95]=Cs;Zi[72]=[Cs,iI];Zi[104]=[Cs,iI];Zi[87]=[Cs,rI];Zi[119]=[Cs,rI];function D7(e,t,n){const r=this;let i,o;return a;function a(h){return!By(h)||!aI.call(r,r.previous)||av(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return By(h)?(e.consume(h),u):h===64?(e.consume(h),d):n(h)}function d(h){return h===46?e.check(A7,p,m)(h):h===45||h===95||kr(h)?(o=!0,e.consume(h),d):p(h)}function m(h){return e.consume(h),i=!0,d}function p(h){return o&&i&&Ir(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function O7(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!sI.call(r,r.previous)||av(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(R7,e.attempt(eI,e.attempt(tI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function L7(e,t,n){const r=this;let i="",o=!1;return a;function a(h){return(h===72||h===104)&&oI.call(r,r.previous)&&!av(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Ir(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(h),d}return n(h)}function d(h){return h===47?(e.consume(h),o?m:(o=!0,d)):n(h)}function m(h){return h===null||Gf(h)||gn(h)||Uo(h)||Nm(h)?n(h):e.attempt(eI,e.attempt(tI,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function z7(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function P7(e,t,n){let r,i,o;return a;function a(m){return m===46||m===95?e.check(nI,d,u)(m):m===null||gn(m)||Uo(m)||m!==45&&Nm(m)?d(m):(o=!0,e.consume(m),a)}function u(m){return m===95?r=!0:(i=r,r=void 0),e.consume(m),a}function d(m){return i||r||!o?n(m):t(m)}}function B7(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(nI,t,o)(a):a===null||gn(a)||Uo(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function $7(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||gn(u)||Uo(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||gn(u)||Uo(u)?t(u):r(u)}function o(u){return Ir(u)?a(u):n(u)}function a(u){re Line truncated
`),m=d.length>dH,p=m?d.length-$g*2:0,h=E.useCallback(()=>{navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1500)},[a]);return c.jsxs("div",{className:"code-block-wrap",children:[c.jsxs("div",{className:"code-block-header",children:[c.jsxs("span",{className:"code-block-lang",children:[u||"code",m?` (${d.length} lines)`:""]}),c.jsx("button",{className:"code-block-copy",onClick:h,children:n?c.jsxs(c.Fragment,{children:[c.jsx(_l,{})," ",c.jsx("span",{children:"Copied"})]}):c.jsxs(c.Fragment,{children:[c.jsx(pm,{})," ",c.jsx("span",{children:"Copy"})]})})]}),c.jsx("pre",{children:c.jsx("code",{className:e,children:m&&!i?c.jsxs(c.Fragment,{children:[d.slice(0,$g).join(`
`)+`
`,c.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",p," lines (click to expand)"]}),`
`+d.slice(-$g).join(`
`)]}):a})}),m&&i&&c.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const mH={code({className:e,children:t,...n}){return e?.startsWith("language-")?c.jsx(fH,{className:e,children:t}):c.jsx("code",{className:e,...n,children:t})}},hH=3e3,pH=60,Hg=800;function Rw(e){if(e.length>hH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=pH)return!0;return!1}function gH(e){const t=e.lastIndexOf(`
`,Hg);return e.slice(0,t>Hg/2?t:Hg)}const ir=St.memo(function({content:t,className:n="msg-content-agent",collapseMode:r="auto"}){const i=r!=="never"&&Rw(t),[o,a]=E.useState(i);E.useEffect(()=>{a(r!=="never"&&Rw(t))},[r,t]);const u=o?gH(t):t,d=t.split(`
`).length,m=t.length;return c.jsxs("div",{className:n,children:[c.jsx(Z9,{remarkPlugins:[uH],components:mH,children:u}),i&&o&&c.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),i&&!o&&c.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),Aw={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},cu="codex",Fg="native",xH=["codex","native","claude_code","cursor","opencode"],yH=["native","codex","claude_code","cursor","opencode"];function lI(e){if(!e)return{kind:"fallback"};if(e.kind==="employee"){const t=String(e.id??e.employee_id??"").trim();return t?{kind:"employee",id:t}:{kind:"fallback"}}if(e.kind==="template"){const t=String(e.id??e.template_id??"").trim();return t?{kind:"template",id:t}:{kind:"fallback"}}return{kind:"fallback"}}function cI(e){const t=lI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function vH(e,t,n){const r=String(e.role_id??"").trim(),i=String(e.role_label??"").trim(),o=`${r} ${i} ${e.role_responsibility??""}`.toLowerCase(),a=new Set((e.same_role_employee_ids??[]).map(m=>String(m??"").trim()).filter(Boolean)),u=t.map(m=>{const p=String(m.employee_id??"").trim(),h=String(m.employee_name??p).trim()||p,g=String(m.role_id??"").trim(),y=String(m.category??"").trim(),v=[g,y].filter(Boolean).join(" · ")||p;return{kind:"employee",id:p,name:h,subtitle:v,category:y,searchText:`${p} ${h} ${g} ${y} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),rank:a.has(p)||g===r?0:2}}).filter(m=>m.id).sort((m,p)=>m.rank-p.rank||m.name.localeCompare(p.name)),d=n.map(m=>{const p=String(m.template_id??"").trim(),h=String(m.template_name??p).trim()||p,g=String(m.category??"").trim(),y=[g,p].filter(Boolean).join(" · ")||p,v=`${p} ${h} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),w=o.split(/[^a-z0-9]+/).filter(S=>S.length>=3).reduce((S,_)=>S+(v.includes(_)?1:0),0);return{kind:"template",id:p,name:h,subtitle:y,category:g,searchText:v,rank:w}}).filter(m=>m.id).sort((m,p)=>p.rank-m.rank||m.name.localeCompare(p.name));return[...u,...d,{kind:"fallback",id:"",name:"Fallback role-only",subtitle:"No employee override",category:"fallback",searchText:"fallback role only no employee override"}]}function bH(e,t){const n=cI(t);return e.find(r=>`${r.kind}:${r.id}`===n)??e[0]}function _H(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(r=>e.searchText.includes(r))}function kH(e){return e.map(t=>{const n=String(t.role_id??"").trim(),r=String(t.existing_employee?.employee_id??"").trim(),i=String(t.candidate?.template_id??"").trim(),o=r?{kind:"employee",id:r}:i?{kind:"template",id:i}:{kind:"fallback"};return{role_id:n,role_label:t.role_labels?.[0]??n,role_responsibility:"",default_selection:o,same_role_employee_ids:t.existing_employee_ids??[],fallback_available:!0,default_agent:t.default_agent??cu,selected_agent:t.selected_agent??t.default_agent??cu,default_source:"recruitment"}}).filter(t=>t.role_id)}function SH(e,t){return t.kind==="template"&&e?.candidate?.template_id===t.id?e.candidate.proposed_name||e.candidate.template_name||t.name:t.kind==="employee"&&e?.existing_employee?.employee_id===t.id&&e.existing_employee.employee_name||t.name}function Mw(e,t){const n={},r=e.staffing_selections??{};for(const i of t){const o=String(i.role_id??"").trim();o&&(n[o]=lI(r[o]??i.default_selection))}return n}function Dw(e,t){const n=e.recruitment_role_agents??{},r={};for(const i of t){const o=String(i.role_id??"").trim();o&&(r[o]=n[o]??i.selected_agent??i.default_agent??cu)}return r}function wH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const uI=St.memo(function({meta:t,onReply:n,responded:r}){const i=t.proposals??[],o=E.useMemo(()=>{const L={};for(const A of i){const M=String(A.role_id??"").trim();M&&(L[M]=A)}return L},[i]),a=E.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:kH(i),[t.staffing_roles,i]),u=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],p=E.useMemo(()=>{const L={};for(const A of a){const M=String(A.role_id??"").trim();M&&(L[M]=vH(A,u,d))}return L},[u,a,d]),[h,g]=E.useState({}),[y,v]=E.useState(""),[w,S]=E.useState(()=>Mw(t,a)),[_,k]=E.useState(()=>Dw(t,a)),[C,N]=E.useState(t.recruitment_agent??Fg),O=r;E.useEffect(()=>{!O||!wH(t)||(S(Mw(t,a)),k(Dw(t,a)),N(t.recruitment_agent??Fg))},[O,t,a]),E.useEffect(()=>{N(t.recruitment_agent??Fg)},[t.recruitment_agent]);const I=E.useCallback(L=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const M=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:A,response_to_checkpoint_type:M||"company_recruitment_confirmation",checkpoint_reply_kind:L,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function MH(e){switch(e){case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const Xf=St.memo(function({meta:t,onReply:n,responded:r}){const i=r,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=MH(o),u=String(t.prompt??t.summary??""),d=E.useMemo(()=>u.split(`
`).map(k=>k.trim()).filter(Boolean),[u]),m=AH(u).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",p=d.slice(1).join(`
`).trim(),h=String(t.summary??"").trim(),g=(t.options??[]).filter(k=>!!k?.id),y=E.useMemo(()=>(t.active_subagents??[]).filter(k=>!!k&&typeof k=="object"),[t.active_subagents]),v=E.useMemo(()=>(t.permission_requests??[]).filter(k=>!!k&&typeof k=="object"),[t.permission_requests]),w=String(t.worktree_path??"").trim(),S=y.length>0||v.length>0||!!w,_=E.useCallback(k=>{i||n(k.label||k.id)},[i,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),c.jsx("path",{d:"M8 5.5V9"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),h&&h!==m&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ir,{content:h,className:"ckpt-markdown"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(ir,{content:p,className:"ckpt-markdown"})]}),S&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[w&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:w})]}),y.length>0&&c.jsxs("div",{children:["Active subagents: ",y.length]}),v.length>0&&c.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!i&&g.length>0&&c.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(k=>c.jsx("button",{className:`ckpt-btn ${k.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}`,onClick:()=>_(k),children:k.label||k.id},k.id))}),!i&&t.default_action&&c.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",c.jsx("code",{children:t.default_action})]})]})});function DH(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function OH(e){switch(e){case"ignored":return"Ignored";case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"superseded":return"Superseded";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const pI=St.memo(function({meta:t,onReply:n,responded:r}){const i=r,[o,a]=E.useState(""),[u,d]=E.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),p=OH(m),h=String(t.prompt??t.summary??"").trim(),y=`${String(t.work_item_projection_title??DH(h)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),w=E.useMemo(()=>(t.active_subagents??[]).filter(T=>!!T&&typeof T=="object"),[t.active_subagents]),S=E.useMemo(()=>(t.permission_requests??[]).filter(T=>!!T&&typeof T=="object"),[t.permission_requests]),_=String(t.worktree_path??"").trim(),k=w.length>0||S.length>0||!!_,C=i||u!==null,N=E.useCallback((T,L="")=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const M={response_to_checkpoint_id:A,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:T};return(T==="approve"||T==="feedback")&&(M.self_evolution_trigger=!0,M.human_feedback_text=L),M},[t.checkpoint_id]),O=E.useCallback(()=>{if(C)return;const T=N("approve");d("approve"),n("I fully agree with this delivery.",T)},[C,N,n]),I=E.useCallback(()=>{const T=o.trim();if(C||!T)return;const L=N("feedback",T);d("feedback"),n(T,L),a("")},[C,N,o,n]),D=E.useCallback(()=>{if(C)return;const T=N("ignore");d("ignore"),n("Ignore this self-evolution review.",T)},[C,N,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14 5v4.5c0 2.25-1.8 4.25-6 5-4.2-.75-6-2.75-6-5V5L8 1.5Z"}),c.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),c.jsx("div",{className:"ckpt-title",children:y}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:p})]}),v&&v!==y&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ir,{content:v,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),c.jsx(ir,{content:h,className:"ckpt-markdown"})]}),k&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[_&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:_})]}),w.length>0&&c.jsxs("div",{children:["Active subagents: ",w.length]}),S.length>0&&c.jsxs("div",{children:["Pending permission records: ",S.length]})]})]}),!i&&c.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:O,disabled:C,children:"Fully Agree"}),c.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:C,children:"Ignore"}),c.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:T=>a(T.target.value),disabled:C,rows:2}),c.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:I,disabled:C||!o.trim(),children:"Send Feedback"})]})]})}),Yd="__other__",LH=["A","B","C"];function Fi(e){return String(e??"").trim()}function zH(e,t){const n=Fi(e.question),r=Fi(e.header);if(!n&&!r)return null;const i=(e.options??[]).slice(0,3).map((o,a)=>({id:Fi(o.id)||String.fromCharCode(97+a),label:Fi(o.label),description:Fi(o.description)})).filter(o=>o.label);return{id:Fi(e.id)||`question_${t+1}`,header:r,question:n||r,options:i,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const gI=St.memo(function({meta:t,onReply:n,responded:r}){const[i,o]=E.useState(""),[a,u]=E.useState({}),d=r,m=String(t.work_item_projection_title??t.work_item_projection_id??"Input Needed").trim()||"Input Needed",p=String(t.summary??"").trim(),h=String(t.prompt??"").trim(),g=String(t.context_note??"").trim(),y=String(t.resume_hint??"").trim(),v=E.useMemo(()=>(t.questions??[]).map(V=>String(V).trim()).filter(Boolean),[t.questions]),w=E.useMemo(()=>(t.input_questions??[]).map((V,Y)=>zH(V,Y)).filter(V=>V!==null),[t.input_questions]),S=w.some(V=>(V.options??[]).length>0),_=E.useMemo(()=>(t.required_fields??[]).map(V=>String(V).trim()).filter(Boolean),[t.required_fields]),k=E.useMemo(()=>(t.active_subagents??[]).filter(V=>!!V&&typeof V=="object"),[t.active_subagents]),C=E.useMemo(( Line truncated
`),{user_input_answers:V})},[a,B,w,d,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),c.jsx("path",{d:"M5.5 6h5"}),c.jsx("path",{d:"M5.5 8h3.5"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ir,{content:p,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(ir,{content:h,className:"ckpt-markdown"})]}),S?c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("div",{className:"ckpt-choice-list",children:w.map(V=>{const Y=a[V.id]??{freeformText:""},Z=V.options??[],q=V.allow_freeform!==!1,G=q&&(Z.length===0||Y.selectedOptionId===Yd);return c.jsxs("div",{className:"ckpt-choice-question",children:[V.header&&c.jsx("div",{className:"ckpt-question-header",children:V.header}),c.jsx(ir,{content:V.question,className:"ckpt-markdown"}),Z.length>0&&c.jsxs("div",{className:"ckpt-choice-grid",children:[Z.map((J,P)=>{const X=Y.selectedOptionId===J.id;return c.jsxs("button",{className:`ckpt-choice-option${X?" is-selected":""}`,onClick:()=>M(V.id,J.id),children:[c.jsx("span",{className:"ckpt-choice-letter",children:LH[P]??"?"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:J.label}),J.description&&c.jsx("span",{className:"ckpt-choice-desc",children:J.description})]})]},J.id)}),q&&c.jsxs("button",{className:`ckpt-choice-option${Y.selectedOptionId===Yd?" is-selected":""}`,onClick:()=>M(V.id,Yd),children:[c.jsx("span",{className:"ckpt-choice-letter",children:"D"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:"Other"}),c.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),G&&c.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:Y.freeformText,onChange:J=>$(V.id,J.target.value),rows:3})]},V.id)})})]}):v.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("ul",{className:"ckpt-task-list",children:v.map(V=>c.jsx("li",{children:V},V))})]}),_.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),c.jsx("div",{className:"ckpt-task-tags",children:_.map(V=>c.jsx("span",{className:"ckpt-field-tag",children:V},V))})]}),g&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Context"}),c.jsx(ir,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),y&&c.jsx("div",{className:"ckpt-escalation-hint",children:y}),A&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[O&&c.jsxs("div",{children:["Requester: ",c.jsx("code",{children:O})]}),D&&c.jsxs("div",{children:["Work item: ",c.jsx("code",{children:D})]}),I&&c.jsxs("div",{children:["Task: ",c.jsx("code",{children:I})]}),T&&c.jsxs("div",{children:["Seat: ",c.jsx("code",{children:T})]}),N&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:N})]}),k.length>0&&c.jsxs("div",{children:["Active subagents: ",k.length]}),C.length>0&&c.jsxs("div",{children:["Pending permission records: ",C.length]})]})]}),!d&&c.jsxs("div",{className:"ckpt-feedback-area",children:[S?null:c.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:i,onChange:V=>o(V.target.value),rows:3}),c.jsx("div",{className:"ckpt-feedback-btns",children:c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:S?H:U,disabled:S?!B:!i.trim(),children:"Send Reply"})})]})]})}),Hy={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function Ug(e,t){if(t&&t in Hy)return t;switch(e){case"active":return"in_progress";case"waiting":return"in_review";case"done":return"done";case"failed":return"done";case"pending":return"todo";default:return"todo"}}function Xd(e){return Hy[e]??Hy.todo}const Bw={active:0,waiting:1,failed:2,done:3,pending:4};function PH(e){if(e.length===0)return"pending";let t=e[0],n=Bw[t]??99;for(const r of e){const i=Bw[r]??99;i<n&&(t=r,n=i)}return t}const BH={native:"Native",codex:"Codex",claude_code:"Claude Code",cursor Line truncated
`)[0].slice(0,140),tone:"danger"};const o=t.match(/^\[Company:([^\]]+)\]\s*(.+)$/);if(o){const d=o[1].split("::"),m=d[0]||"company",p=o[2].trim(),h=p.toLowerCase(),g=h.includes("completed")||h.includes("done")?"success":h.includes("blocked")||h.includes("failed")?"warning":"info";return{kind:"company_event",label:`${m.toUpperCase()} · ${d[1]??""}`.replace(/ · $/,""),summary:p,tone:g}}const a=t.match(/^(Review needed|Status digest|Blocked|Completion):\s*(.+)$/i);if(a){const d=a[1].replace(/\b\w/g,p=>p.toUpperCase()),m=qc(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const u=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return u?{kind:"company_event",label:"Delegation check",summary:qc(u[1]).slice(0,180),tone:"info"}:null}function pF(e,t){const{isCompanyRuntime:n,detailMode:r}=t;if(!n||r==="full"||Qc(e.metadata))return null;const i=yI(e.content);if(!i)return null;const o=e.sender==="system"||e.metadata?.type==="system",a=i.kind==="company_event"||e.content.startsWith("[Company:");return!o&&!a?null:{msg:e,classification:i}}function gF(e,t={}){const{isCompanyRuntime:n=!1,detailMode:r="summary"}=t,i=[];let o=[],a=0;const u=new Set,d=new Set,m=()=>{if(o.length===0)return;const p=o[0].msg,h=o[o.length-1].msg;i.push({kind:"ops-bundle",id:`ops:${p.id}:${o.length}:${h.id}`,timestamp:p.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((p,h)=>{const g=h*2+1,y=pF(p,{isCompanyRuntime:n,detailMode:r});if(y){o.length===0&&(a=g),o.push(y);return}const v=r==="summary"?xI(p.content):null;if(v){const w=[p.sender,Math.round(p.timestamp/1e3),v.kind,qc(v.summary||v.acceptanceSummary||"").slice(0,500),v.verdict??"",v.deliverables.map(S=>`${S.name}:${S.path}`).join("|").slice(0,800)].join("");if(u.has(w))return;u.add(w)}if(r==="summary"){const w=qc(iF(p.content)).slice(0,1200);if(w){const S=sF(p)?["result",w].join(""):[p.sender,Math.round(p.timestamp/1e3),w].join("");if(d.has(S))return;d.add(S)}}m(),i.push({kind:"message",id:p.id,timestamp:p.timestamp,msg:p,sortOrder:g})}),m(),i}const xF=St.memo(function({msg:t,showDate:n,dateStr:r,classification:i}){const[o,a]=E.useState(!1),u=t.content.trim()!==`[${i.label}] ${i.summary}`.trim()&&t.content.trim().length>i.summary.length+4;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("div",{className:`msg-ops-row msg-ops-tone-${i.tone}${o?" expanded":""}`,onClick:u?()=>a(d=>!d):void 0,role:u?"button":void 0,tabIndex:u?0:-1,children:[c.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),c.jsx("span",{className:"msg-ops-label",children:i.label}),i.summary&&c.jsx("span",{className:"msg-ops-summary",title:i.summary,children:i.summary}),c.jsx("span",{className:"msg-ops-time",title:Yi(t.timestamp),children:Ss(t.timestamp)}),u&&c.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:c.jsx(_s,{down:o})})]}),u&&o&&c.jsx("div",{className:"msg-ops-details",children:c.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),yF=St.memo(function({events:t,showDate:n,dateStr:r}){const[i,o]=E.useState(!1);if(t.length===0)return null;const a=t[0].msg,u=t[t.length-1].msg,d=t.reduce((h,g)=>{const y=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return h[y]=(h[y]??0)+1,h},{}),m=Object.entries(d).map(([h,g])=>`${g} ${h}`).join(" · "),p=`${t.length} technical event${t.length===1?"":"s"} hidden`;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("button",{type:"button",className:`msg-ops-bundle${i?" expanded":""}`,onClick:()=>o(h=>!h),title:`${Yi(a.timestamp)} - ${Yi(u.timestamp)}`,children:[c.jsx("span",{className:"msg-ops-bundle-dot"}),c.jsx("span",{className:"msg-ops-bundle-title",children:p}),c.jsx("span",{className:"msg-ops-bundle-summary",children:m}),c.jsx("span",{className:"msg-ops-bundle-time",children:Ss(a.timestamp)}),c.jsx("span",{className:"msg-ops-bundle-chevron",children:c.jsx(_s,{down:i})})]}),i&&c.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:h,classification:g})=>c.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[c.jsx("span",{className:"msg-ops-dot"}),c.jsx("span",{className:"msg-ops-label",children:g.label}),c.jsx("span",{className:"msg-ops-summary",children:g.summary}),c.jsx("span",{className:"msg-ops-time",title:Yi(h.timestamp),children:Ss(h.timestamp)})]},h.id))})]})});function vF(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const bF=St.memo(function({msg:t,payload:n,showDate:r,dateStr:i,isCopied:o,onCopy:a}){const u=lv(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=vF(n),p=n.summary||n.acceptanceSummary||m;return c.jsxs("div",{children:[r&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("spa Line truncated
Set up at least one role before running a task.
Go to Org tab now?`)&&n?.(),!1;if(a.length>1&&!u)return confirm(`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(r.map(y=>y.role_id));o.runtimeTeams.filter(y=>y.member_role_ids.some(v=>m.has(v))||y.manager_role_id&&m.has(y.manager_role_id)).length===0&&d.push("No runtime teams defined — the system will auto-generate from your roles");const h=new Set(i.map(y=>y.role_id)),g=r.filter(y=>!h.has(y.role_id));if(g.length>0){const y=g.map(v=>v.name).join(", ");d.push(`${g.length} role(s) have no employees: ${y}`)}return d.length>0?confirm(`Before running this task:
`+d.map(y=>"• "+y).join(`
`)+`
Run anyway?`):!0}function eV(e){if(!e)return!1;const t=Em(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function nC(e,t){const n=!!t?.childDetail;return e?n?"full":e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function rC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function tV({boardColor:e,title:t,onCommit:n}){const[r,i]=E.useState(!1),[o,a]=E.useState(t),u=E.useRef(null);E.useEffect(()=>{r||a(t)},[t,r]);const d=E.useCallback(()=>{const p=o.trim();p&&p!==t?n(p):a(t),i(!1)},[o,t,n]),m=E.useCallback(()=>{a(t),i(!0),setTimeout(()=>u.current?.select(),0)},[t]);return c.jsx("div",{className:"board-selector",children:c.jsx("div",{className:"board-tabs",children:c.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[c.jsx("span",{className:"board-tab-dot",style:{background:e}}),r?c.jsx("input",{ref:u,className:"board-tab-title-input",value:o,onChange:p=>a(p.target.value),onBlur:d,onKeyDown:p=>{p.key==="Enter"&&d(),p.key==="Escape"&&(a(t),i(!1))}}):c.jsx("span",{className:"board-tab-title",onClick:m,title:"Click to edit session title",children:t})]})})})}function nV({boardStore:e,agents:t,officeMap:n,execMode:r,companyProfile:i,taskPreferredAgent:o,chatStore:a,sessionStore:u,projectId:d,onRunTask:m,onCreateTask:p,onMoveTask:h,onCreateSession:g,onSessionSend:y,onSecretarySend:v,onDeleteSession:w,onTitleChange:S,onSessionConfigChange:_,onSessionTaskAgentChange:k,onContinueInNewChat:C,onSessionStop:N,onSessionResume:O,onSessionComplete:I,onLoadSessionDetail:D,onOpenExecutionPanel:T,onCollabSync:L,orgInfoData:A,onNavigateToOrg:M,recoveryStatus:$,onRecoveryResume:W,onRecoveryCancel:B,commsState:U,commsMessage:H,onCommsRefresh:V,onCommsReadMessage:Y,savedOrgsList:Z,activeSavedOrg:q,onSavedOrgsList:G,onSavedOrgLoad:J}){const{sessions:P,activeSessionId:X,activeSession:ee}=u,[te,re]=E.useState("collapsed"),{width:oe,isResizing:de,handleMouseDown:se}=KF({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>re("collapsed")}),[je,we]=E.useState("chat"),[Ce,Be]=E.useState(null),[Ge,Ye]=E.useState({kind:"activity"}),[yt,Vt]=E.useState([]),[bt,vt]=E.useState(!1),[me,Oe]=E.useState({}),rt=E.useRef(D),Qe=E.useRef({active:null,child:null}),Je=r==="company"||r==="org"||r==="custom",fe=`secretary:${d}`,be=`activity:${d}`,Me=E.useMemo(()=>Ce?P.find(ue=>ue.taskId===Ce)??null:null,[P,Ce]),Fe=E.useMemo(()=>Ge.kind!=="task-detail"?null:e.tasks.find(ue=>ue.id===Ge.taskId)??null,[Ge,e.tasks]),$e=E.useMemo(()=>{const ue=jm(Fe);return ue?P.find(Se=>Se.taskId===ue||Se.runtimeTaskId===ue||Se.executionTurnId===ue)??null:null},[P,Fe]),Ut=E.useMemo(()=>$e?a.getChannelMessages($e.channelId):[],[a.messages,a.getChannelMessages,$e]),rn=E.useMemo(()=>gf(ee,P),[P,ee]),ke=E.useMemo(()=>Tf(ee,P),[P,ee]),Te=E.useMemo(()=>Rf(ee,[...ke,...rn]),[ee,rn,ke]);E.useEffect(()=>{rt.current=D},[D]);const Pe=E.useCallback((ue,Se,Ue="summary")=>{const pt=rt.current;!pt||!ue||(Oe(tn=>tn[ue]?tn:{...tn,[ue]:!0}),pt(ue,{limit:ZF,beforeCreatedAt:Se?.timestamp,beforeMessageId:Se?.id,detailLevel:Ue}),window.setTimeout(()=>{Oe(tn=>tn[ue]?{...tn,[ue]:!1}:tn)},800))},[]),Ve=E.useCallback(ue=>!!me[ue],[me]);E.useEffect(()=>{Qe.current={active:null,child:null}},[d]),E.useEffect(()=>{Ce&&!Me&&Be(null)},[Ce,Me]),E.useEffect(()=>{Ge.kind==="task-detail"&&!Fe&&Ye({kind:"activity"})},[Ge,Fe]);const qe=E.useRef(null);E.useEffect(()=>{if(!$e){qe.current=null;return}qe.current!==$e.taskId&&(qe.current=$e.taskId,Pe($e.taskId,void 0,"full"))},[$e,Pe]),E.useEffect(()=>{if(!Ce){Qe.current.child=null;return}Qe.current.child!==Ce&&(Qe.current.child=Ce,Pe(Ce,void 0,"full"))},[Ce,Pe]),E.useEffect(()=>{if(!X){Qe.current.active=null;return}const ue=Te.timelineSessions.length>0?Te.timelineSessions:P.find(Ue=>Ue.taskId===X)?[P.find(Ue=>Ue.taskId===X)]:[];if(ue.length===0){Qe.current.active=null;return}const Se=ue.map(Ue=>`${Ue.taskId}:${nC(Ue,{childDetail:Ue.mode==="child"})}`).join("|");if(Qe.current.active!==Se){Qe.current.active=Se;for(const Ue of ue)Pe(Ue.taskId,void 0,nC(Ue,{childDetail:Ue.mode==="child"}))}},[Te.timelineSessions,X,Pe,P]);const et=E.useMemo(()=>Ce?{kind:"child-detail"}:Ge.kind==="task-detail"||Ge.kind==="secretary"?Ge:X?{kind:"session",taskId:X}:{kind:"activity"},[Ge,X,Ce]),Mn=E.useMemo(()=>et.kind==="secretary"?fe:et.kind==="child-detail"&&Me?Me.channelId:et.kind==="session"&&Te.displaySession?Te.displaySession.channelId:et.kind==="session"&&ee?ee.channelId:be,[et,Te.displaySession,ee,Me,fe,be]),Tn=E.useMemo(()=>{if(et.kind==="activity")return[be];if(et.kind==="secretary")return[fe];if(et.kind==="child-detail"&&Me)return[Me.channelId];if(et.kind==="session"){const ue=Te.timelineSessions.map(Se=>Se.channelId).filter((Se,Ue,pt)=>!!Se&&pt.indexOf(Se)===Ue);if(ue.length>0)return ue}return Mn?[Mn]:[]},[et.kind,Te.timelineSessions,Me,be,fe,Mn]),Dn=E.useMemo(()=>{const ue=new Set;for(const Se of P)Se.status!=="cancelled"&&ue.add(Se. Line truncated
`).replace(/\r/g,`
`).split(`
`).map(i=>i.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim(),n=iV(t),r=n.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);return r.length>1&&/^Verification:\s/i.test(r[r.length-1])?r.slice(0,-1).join(`
`).trim():n}function iV(e){const t=String(e||"").trim(),n=t.match(/^\*\*(.{8,160}?)\*\*:\s+([\s\S]+)$/);if(n){const a=n[2].trim();if(a.length>=80)return a}const r=t.indexOf(": ");if(r<8||r>160)return t;const i=t.slice(0,r).replace(/\*/g,"").trim(),o=t.slice(r+2).trim();return o.length<80||!/[A-Za-z\u4e00-\u9fff]/.test(i)||/^(https?|file)$/i.test(i)?t:o}function qo(e){const t=Go(e),n=new Set,r=typeof t.checkpoint_type=="string"?t.checkpoint_type.trim():"",i=typeof t.checkpoint_id=="string"?t.checkpoint_id.trim():"";for(const o of[e.id,typeof t.ui_message_id=="string"?t.ui_message_id:"",r&&i?`checkpoint:${r}:${i}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function sV(e){return e.startsWith("checkpoint:")}function qi(e){return typeof e.timestamp=="number"?e.timestamp:0}function sC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Go(e),r=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||r==="user"?"user":"assistant"}function oC(e){const t=Go(e),n=String(e.sender??"").trim().toLowerCase();let r=0;const i=kI(e);return i&&(r+=1e3+i),t.source==="engine"&&(r+=100),n&&n!=="system"&&(r+=20),n&&!["assistant","system","user"].includes(n)&&(r+=5),e.replyToId&&(r+=2),r+=Math.min(Object.keys(t).length,10),r}function aC(e){return String(Go(e).source??"").trim().toLowerCase()==="engine"}function kI(e){const t=Go(e),n=String(t.transcript_kind??"").trim();if(n)return iC[n]??0;const r=String(t.kind??"").trim();return iC[r]??0}function Zf(e){return kI(e)>0}function SI(e,t){if(e.channelId!==t.channelId)return!1;const n=qo(e),r=qo(t);for(const i of n)if(r.has(i))return!0;return!1}function Gy(e,t){if(SI(e,t))return!0;if(e.channelId!==t.channelId||sC(e)!==sC(t)||Kf(e.content)!==Kf(t.content))return!1;const n=Zf(e)&&Zf(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(aC(e)||aC(t)))return!1;const r=qi(e),i=qi(t);return!(!n&&r&&i&&Math.abs(r-i)>dv)}function qy(e,t,n=!1){let r=e,i=t;(n||oC(t)>oC(e))&&(r=t,i=e);const o=[];for(const h of[i.mentions,r.mentions])for(const g of h??[])o.includes(g)||o.push(g);const a=qo(e),u=qo(t);let d="";for(const h of a)if(u.has(h)&&!sV(h)){d=h;break}const m=Kf(r.content),p=m&&m===Kf(i.content)?m:r.content;return{...i,...r,...d?{id:d}:{},content:p,metadata:{...Go(i),...Go(r)},mentions:o,timestamp:qi(r)||qi(i)}}function Qg(e){const t=[],n=new Map;for(const r of[...e].sort((i,o)=>qi(i)-qi(o))){const i=qo(r);let o=-1,a=!1;for(const d of i){const m=n.get(d);if(m!==void 0){o=m,a=t[m].id===r.id;break}}if(o===-1){const d=qi(r),m=Zf(r);for(let p=t.length-1;p>=0;p--){const h=qi(t[p]);if(!m&&d>0&&h>0&&d-h>dv)break;if(Gy(t[p],r)){o=p;break}}}const u=o===-1?t.length:o;o===-1?t.push(r):t[o]=qy(t[o],r,a);for(const d of qo(t[u]))n.has(d)||n.set(d,u)}return t}function oV(e,t){switch(t.type){case"SET":return t.channels;case"CLEAR":return[];case"ADD":return e.some(n=>n.id===t.channel.id)?e:[...e,t.channel];case"REMOVE":return e.filter(n=>n.id!==t.channelId);case"REMOVE_PARTICIPANT":return e.map(n=>({...n,participants:n.participants.filter(r=>r!==t.agentId)}));default:return e}}function aV(e,t){switch(t.type){case"SET":{const n=Qg(t.messages);if(e.length===0)return n;const r=e.filter(i=>typeof i.id=="string"&&i.id.startsWith("msg-")&&!n.some(o=>Gy(i,o)));return r.length===0?n:Qg([...n,...r])}case"CLEAR":return[];case"ADD":{const n=qi(t.message);qo(t.message);let r=!1;for(let i=e.length-1;i>=0;i--){const o=qi(e[i]);if(!r&&n>0&&o>0&&n-o>dv&&(r=!0),SI(e[i],t.message)){const a=[...e];return a[i]=qy(e[i],t.message,e[i].id===t.message.id),a}if((Zf(t.message)||!r)&&Gy(e[i],t.message)){const a=[...e];return a[i]=qy(e[i],t.message),a}}return[...e,t.message]}case"MERGE":return t.messages.length===0?e:Qg([...e,...t.messages]);case"MARK_SENDER_DELETED":return e.map(n=>n.sender===t.senderId?{...n,senderDeleted:!0,senderName:"[已删除的 Agent]"}:n);case"REMOVE_BY_CHANNEL":return e.filter(n=>n.channelId!==t.channelId);case"REMOVE_BY_TASK_ID":return e.filter(n=>n.channelId!==`session:${t.taskId}`&&n.metadata?.task_id!==t.taskId);default:return e}}function lV(){const[e,t]=E.useReducer(oV,[]),[n,r]=E.useReducer(aV,[]),[i,o]=E.useState({}),[a,u]=E.useState("default"),d=E.useMemo(()=>{const I={};for(const D of n)I[D.channelId]||(I[D.channelId]=[]),I[D.channelId].push(D);return I},[n]),m=E.useMemo(()=>{const I={};for(const D of n){if(D.sender==="user")continue;const T=i[D.channelId]??0;D.timestamp<=T||(I[D.channelId]=(I[D.channelId]??0)+1)}return I},[n,i]),p=E.useCallback(I=>{const D={id:`msg-${rV()}`,channelId:I.channelId,sender:I.sender,senderName:I.senderName,content:I.content,timestamp:Date.now(),replyToId:I.replyToId,mentions:[],metadata:I.metadata};return r({type:"ADD",message:D}),D},[]),h=E.useCallback(I=>d[I]??[],[d]),g=E.useCallback(I=>m[I]??0,[m]),y=E.useCallback(I=>{o(D=>({...D,[I]:Date.now()}))},[]),v=E.useCallback(I=>{r({type:"MARK_SENDER_DELETED",senderId:I})},[]),w=E.useCallback(I=>{t({type:"REMOVE_PARTICIPANT",agentId:I})},[]),S=E.useCallback(I=>{t({type:"REMOVE",channe Line truncated
${t}`:`${e}${t}`}function cV(e,t){return"Thinking"}function uV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,summary:typeof e.summary=="string"?e.summary:"",detail:typeof e.detail=="string"&&e.detail?e.detail:void 0,turnId:typeof e.turnId=="string"&&e.turnId?e.turnId:void 0,itemId:typeof e.itemId=="string"&&e.itemId?e.itemId:void 0,streamId:typeof e.streamId=="string"&&e.streamId?e.streamId:void 0,toolCallId:typeof e.toolCallId=="string"&&e.toolCallId?e.toolCallId:void 0,permissionGroupKey:typeof e.permissionGroupKey=="string"&&e.permissionGroupKey?e.permissionGroupKey:void 0,seq:typeof e.seq=="number"&&Number.isFinite(e.seq)?e.seq:void 0,executionMode:typeof e.executionMode=="string"&&e.executionMode?e.executionMode:void 0}}function Qf(e){const t=e.itemId||e.streamId;return t?`${e.type}:${e.turnId??""}:${t}`:e.toolCallId&&(e.type==="tool_call"||e.type==="autonomy")?`${e.type}:${e.turnId??""}:${e.toolCallId}`:e.permissionGroupKey&&e.type==="autonomy"?`${e.type}:${e.turnId??""}:${e.permissionGroupKey}`:""}function dV(e,t){const n=Qf(e),r=Qf(t);return n&&r?n===r:t.timestamp-e.timestamp>Mm||e.type!==t.type?!1:e.type==="thinking"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function fV(e,t){return t.timestamp-e.timestamp<=Mm&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function mV(e,t){if(e.type==="thinking"){const n=Wy(e.detail??e.summary,t.detail??t.summary,"thinking");return{timestamp:t.timestamp,type:"thinking",summary:cV(n,t.summary||e.summary),detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}if(e.type==="tool_call"){const n=Wy(e.detail??"",t.detail??"","tool_call");return{timestamp:t.timestamp,type:"tool_call",summary:t.summary||e.summary,detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}return t}function wI(e,t,n=100){const r=uV(t),i=Qf(r),o=i?[...e].reverse().findIndex(d=>Qf(d)===i):-1,a=o>=0?e.length-1-o:e.length-1,u=e[a];return u?i&&typeof u.seq=="number"&&typeof r.seq=="number"&&r.seq<=u.seq?e:fV(u,r)?tl([...e.slice(0,a),{...u,timestamp:r.timestamp},...e.slice(a+1)],n):dV(u,r)?tl([...e.slice(0,a),mV(u,r),...e.slice(a+1)],n):tl([...e,r],n):[r]}function CI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>wI(n,r,t),[])}function hV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,workItemProjectionId:typeof e.workItemProjectionId=="string"&&e.workItemProjectionId?e.workItemProjectionId:void 0,workItemTurnType:typeof e.workItemTurnType=="string"&&e.workItemTurnType?e.workItemTurnType:void 0,workItemProjectionTitle:typeof e.workItemProjectionTitle=="string"&&e.workItemProjectionTitle?e.workItemProjectionTitle:void 0,runtimeTaskId:typeof e.runtimeTaskId=="string"&&e.runtimeTaskId?e.runtimeTaskId:void 0,executionTurnId:typeof e.executionTurnId=="string"&&e.executionTurnId?e.executionTurnId:void 0,roleName:typeof e.roleName=="string"&&e.roleName?e.roleName:void 0,detail:typeof e.detail=="string"&&e.detail?e.detail:void 0}}function jI(e,t){return e.type===t.type&&(e.workItemProjectionId??"")===(t.workItemProjectionId??"")&&(e.workItemTurnType??"")===(t.workItemTurnType??"")&&(e.workItemProjectionTitle??"")===(t.workItemProjectionTitle??"")&&(e.executionTurnId??e.runtimeTaskId??"")===(t.executionTurnId??t.runtimeTaskId??"")&&(e.roleName??"")===(t.roleName??"")}function pV(e,t){return t.timestamp-e.timestamp<=Mm&&jI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function gV(e,t){return jI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Mm}function xV(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:Wy(e.detail??"",t.detail??"",n)||void 0}}function EI(e,t,n=100){const r=hV(t),i=e[e.length-1];return i?gV(i,r)?tl([...e.slice(0,-1),{...i,timestamp:r.timestamp}],n):pV(i,r)?tl([...e.slice(0,-1),xV(i,r)],n):tl([...e,r],n):[r]}function NI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>EI(n,r,t),[])}function Yy(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function yV(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function II(e){const t=String(e.execMode??"").trim().toLowerCase(),n=String(e.companyProfile??"").trim().toLowerCase(),r=String(e.orgId??"").trim(),o=t.length>0?Yy(t):n==="custom"||r?"org":Yy(t);return o==="org"?{...e,execMode:"org",companyProfile:"custom",orgId:r||void 0}:o==="company"?{...e,execMode:"company",companyProfile:"corporate",orgId:void 0}:{...e,execMode:"task",companyProfile:void 0,orgId:void Line truncated
`)),[L,A]=E.useState(!1),M=E.useRef(e.role_id);E.useEffect(()=>{M.current!==e.role_id&&(M.current=e.role_id,d(e.name),p(e.responsibility),g(e.reports_to),v(e.icon??null),S(new Set(e.can_spawn)),k(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),I(e.preferred_external_agent??null),T((e.prompt_refs??[]).join(`
`)),A(!1))},[e]);const $=E.useRef({}),W=E.useRef(null),B=E.useRef(e.role_id);E.useEffect(()=>{B.current=e.role_id},[e.role_id]);const U=E.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;$.current={},Object.keys(se).length!==0&&i(B.current,se)},[i]),H=E.useCallback(se=>{r||($.current={...$.current,...se},W.current&&clearTimeout(W.current),W.current=setTimeout(U,500))},[U,r]);E.useEffect(()=>()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;Object.keys(se).length>0&&($.current={},i(B.current,se))},[i]);const V=se=>{d(se),H({name:se})},Y=se=>{p(se),H({responsibility:se})},Z=se=>{g(se),H({reports_to:se})},q=se=>{v(se),H({icon:se})},G=se=>{N(se),H({execution_strategy:se})},J=se=>{I(se),H({preferred_external_agent:se})},P=se=>{T(se);const je=se.split(`
`).map(we=>we.trim()).filter(Boolean);H({prompt_refs:je})},X=se=>{const je=new Set(w);je.has(se)?je.delete(se):je.add(se),S(je),H({can_spawn:Array.from(je)})},ee=se=>{const je=new Set(_);je.has(se)?je.delete(se):je.add(se),k(je),H({tools:Array.from(je)})},te=E.useMemo(()=>t.filter(se=>se.role_id!==e.role_id),[t,e.role_id]),re=E.useMemo(()=>n.filter(se=>(se.role_ids?.length?se.role_ids:[se.role_id]).includes(e.role_id)).length,[n,e.role_id]),oe=E.useMemo(()=>D.split(`
`).filter(se=>se.trim()).length,[D]),de=()=>{if(!L){A(!0);return}U(),o(e.role_id)};return c.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[c.jsxs("header",{className:"ri-panel-header",children:[c.jsx("img",{src:wu(y),alt:"",className:"ri-panel-icon"}),c.jsxs("div",{className:"ri-panel-title-wrap",children:[c.jsx("h3",{className:"ri-panel-title",children:u||"(unnamed)"}),c.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),c.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),c.jsxs("div",{className:"ri-panel-body",children:[c.jsxs(Ha,{title:"Identity",defaultExpanded:!0,children:[c.jsx(gi,{label:"Name",children:c.jsx("input",{className:"ri-text-input",value:u,onChange:se=>V(se.target.value),disabled:r})}),c.jsx(gi,{label:"Responsibility",children:c.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:se=>Y(se.target.value),disabled:r})}),c.jsx(gi,{label:"Icon",children:c.jsx(UV,{value:y,onChange:q,readOnly:r})})]}),c.jsxs(Ha,{title:"Hierarchy",defaultExpanded:!0,children:[c.jsx(gi,{label:"Reports to",children:c.jsxs("select",{className:"ri-select",value:h,onChange:se=>Z(se.target.value),disabled:r,children:[c.jsx("option",{value:"owner",children:"You (Owner)"}),te.map(se=>c.jsx("option",{value:se.role_id,children:se.name},se.role_id))]})}),c.jsx(gi,{label:"Can delegate to",children:c.jsx(GV,{allIds:te.map(se=>se.role_id),labelFor:se=>te.find(je=>je.role_id===se)?.name??se,selected:w,onToggle:X,readOnly:r})}),c.jsx(gi,{label:"Employees assigned",children:c.jsx("span",{className:"ri-meta-value",children:re})})]}),c.jsx(Ha,{title:`Tools (${_.size})`,children:c.jsx(qV,{tools:_,onToggle:ee,readOnly:r})}),c.jsx(Ha,{title:`Prompts (${oe})`,children:c.jsx(gi,{label:"Prompt refs / inline",children:c.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:se=>P(se.target.value),disabled:r})})}),c.jsxs(Ha,{title:"Runtime policy",children:[c.jsx(gi,{label:"Execution strategy",children:c.jsx("div",{className:"ri-radio-group",children:FV.map(se=>c.jsxs("label",{className:"ri-radio",title:se.hint,children:[c.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:se.value,checked:C===se.value,onChange:()=>G(se.value),disabled:r}),se.label]},se.value))})}),C==="external"&&c.jsx(gi,{label:"Preferred external agent",children:c.jsxs("select",{className:"ri-select",value:O??"",onChange:se=>J(se.target.value||null),disabled:r,children:[c.jsx("option",{value:"",children:"(any)"}),HV.map(se=>c.jsx("option",{value:se,children:se},se))]})})]}),c.jsxs(Ha,{title:"Advanced",children:[c.jsx(gi,{label:"Role type",children:c.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),c.jsx(gi,{label:"Skills",children:c.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),c.jsx(gi,{label:"Artifact contract",children:c.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!r&&c.jsx("footer",{className:"ri-panel-footer",children:c.jsx("button",{className:`btn btn-sm ${L?"btn-danger":"btn-ghost"}`,onClick:de,onBlur:()=>A(!1),children:L?"Confirm delete?":"Delete role"})})]})}function Ha({title:e,defaultExpanded:t=!1,children:n}){const[r,i]=E.useState(t);return c.jsxs("section",{className:`ri-group${r?" is-expanded":""}`,children:[c.jsxs("button",{className:"ri-group-header",onClick:()=>i(o=>!o),children:[c.jsx("span",{className:"ri-group-caret",children:r?"▾":"▸"}),c.jsx("span",{className:"ri-group-title",children:e})]}),r&&c.jsx("div",{className:"ri-group-body",children:n})]})}function gi({label:e,children:t}){return c.jsxs("div",{className:"ri-field",children:[c.jsx("label",{className:"ri-field-label",children:e}),c.jsx("div",{className:"ri-field-control",children:t})]})}function UV({value:e,onChange:t,readOnly:n}){const[r,i]=E.useState(!1);return c.jsxs("div",{className:"ri-icon-picker",children:[c.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&i(o=>!o),disabled:n,children:[c.jsx("img",{src:wu(e),alt:"",className:"ri-icon-picker-current"}),c.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),r&&c.jsxs("div",{className:"ri-icon-picker-popover",children:[c.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),i(!1)},title:"Default icon",children:c.jsx("img",{src:Wc.generic,alt:""})}),BV.filter(o=>o!=="generic").map(o=>c.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),i(!1)},title:o,children:c.jsx("img",{src:Wc[o],alt:o})},o))]})]})}function GV({allIds:e,labelFor:t,selected:n,onToggle:r,readOnly:i}){const[o,a]=E.useState(!1),u=e.filter(d=>!n.has(d));return c.jsxs("div",{className:"ri-multiselect",children:[c.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>c.jsxs("span",{className:"ri-ch Line truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return i}}function xt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function XV(e,t,n,r){const i=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:gt(()=>[e,n,t,o],(a,u,d,m)=>({table:a,column:u,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),xt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function KV(e,t,n,r){var i,o;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let m=(i=(o=u.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?i:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:d&&(d.includes(".")?p=g=>{let y=g;for(const w of d.split(".")){var v;y=(v=y)==null?void 0:v[w]}return y}:p=g=>g[u.accessorKey]),!m)throw new Error;let h={id:`${String(m)}`,accessorFn:p,parent:r,depth:n,columnDef:u,columns:[],getFlatColumns:gt(()=>[!0],()=>{var g;return[h,...(g=h.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},xt(e.options,"debugColumns")),getLeafColumns:gt(()=>[e._getOrderColumnsFn()],g=>{var y;if((y=h.columns)!=null&&y.length){let v=h.columns.flatMap(w=>w.getLeafColumns());return g(v)}return[h]},xt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(h,e);return h}const _r="debugHeaders";function fC(e,t,n){var r;let o={id:(r=n.id)!=null?r: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 a=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),a.push(d)};return u(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const ZV={createTable:e=>{e.getHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,a;const u=(o=r?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?o:[],d=(a=i?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?a:[],m=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(i!=null&&i.includes(h.id)));return Jd(t,[...u,...m,...d],e)},xt(e.options,_r)),e.getCenterHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Jd(t,n,e,"center")),xt(e.options,_r)),e.getLeftHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return Jd(t,o,e,"left")},xt(e.options,_r)),e.getRightHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return Jd(t,o,e,"right")},xt(e.options,_r)),e.getFooterGroups=gt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),xt(e.options,_r)),e.getLeftFooterGroups=gt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),xt(e.options,_r)),e.getCenterFooterGroups=gt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),xt(e.options,_r)),e.getRightFooterGroups=gt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),xt(e.options,_r)),e.getFlatHeaders=gt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,_r)),e.getLeftFlatHeaders=gt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,_r)),e.getCenterFlatHeaders=gt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,_r)),e.getRightFlatHeaders=gt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,_r)),e.getCenterLeafHeaders=gt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,_r)),e.getLeftLeafHeaders=gt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,_r)),e.getRightLeafHeaders=gt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,_r)),e.getLeafHeaders=gt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,a,u,d,m;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(a=(u=n[0])==null?void 0:u.headers)!=null?a:[],...(d=(m=r[0])==null?void 0:m.headers)!=null?d:[]].map(p=>p.getLeafHeaders()).flat()},xt(e.options,_r))}};function Jd(e,t,n,r){var i,o;let a=0;const u=function(g,y){y===void 0&&(y=1),a=Math.max(a,y),g.filter(v=>v.getIsVisible()).forEach(v=>{var w;(w=v.columns)!=null&&w.length&&u(v.columns,y+1)},0)};u(e);let d=[];const m=(g,y)=>{const v={depth:y,id:[r,`${y}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),p=m.reduce((h,g)=>h.concat(...g),[]);return[m,p]}return[[],[]]},[e]);return E.useEffect(()=>{const d=t?.target??i2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const p=y=>{if(i.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!i.current||i.current&&!m)&&ET(y))return!1;const w=o2(y.code,u);if(o.current.add(y[w]),s2(a,o.current,!1)){const S=y.composedPath?.()?.[0]||y.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(i.current||!_)&&y.preventDefault(),r(!0)}},h=y=>{const v=o2(y.code,u);s2(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(y[v]),y.key==="Meta"&&o.current.clear(),i.current=!1},g=()=>{o.current.clear(),r(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function s2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function o2(e,t){return t.includes(e)?"code":"key"}const YX=()=>{const e=In();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:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:o,maxZoom:a,panZoom:u}=e.getState(),d=wv(t,r,i,o,a,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:u,y:d}=a.getBoundingClientRect(),m={x:t.x-u,y:t.y-d},p=n.snapGrid??i,h=n.snapToGrid??o;return Tu(m,r,h,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:o}=r.getBoundingClientRect(),a=lm(t,n);return{x:a.x+i,y:a.y+o}}}),[])};function XT(e,t){const n=[],r=new Map,i=[];for(const o of e)if(o.type==="add"){i.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const a=r.get(o.id);a?a.push(o):r.set(o.id,[o])}for(const o of t){const a=r.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const u={...o};for(const d of a)XX(d,u);n.push(u)}return i.length&&i.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function XX(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 KT(e,t){return XT(e,t)}function KX(e,t){return XT(e,t)}function zo(e,t){return{id:e,type:"select",selected:t}}function Xa(e,t=new Set,n=!1){const r=[];for(const[i,o]of e){const a=t.has(i);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),r.push(zo(o.id,a)))}return r}function a2({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),u=a?.internals?.userNode??a;u!==void 0&&u!==o&&n.push({id:o.id,item:o,type:"replace"}),u===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function l2(e){return{id:e.id,type:"remove"}}const c2=e=>vY(e),ZX=e=>vT(e);function ZT(e){return E.forwardRef(e)}function u2(e){const[t,n]=E.useState(BigInt(0)),[r]=E.useState(()=>QX(()=>n(i=>i+BigInt(1))));return m0(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function QX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const QT=E.createContext(null);function JX({children:e}){const t=In(),n=E.useCallback(u=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let w=d;for(const _ of u)w=typeof _=="function"?_(w):_;let S=a2({items:w,lookup:g});for(const _ of v.values())S=_(S);p&&m(w),S.length>0?h?.(S):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:k,setNodes:C}=t.getState();_&&C(k)})},[]),r=u2(n),i=E.useCallback(u=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}wR.displayName="MiniMap";const $Z=E.memo(wR),HZ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,FZ={[yl.Line]:"right",[yl.Handle]:"bottom-right"};function VZ({nodeId:e,position:t,variant:n=yl.Handle,className:r,style:i=void 0,children:o,color:a,minWidth:u=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:w,onResize:S,onResizeEnd:_}){const k=tR(),C=typeof e=="string"?e:k,N=In(),O=E.useRef(null),I=n===yl.Handle,D=Ft(E.useCallback(HZ(I&&y),[I,y]),Nn),T=E.useRef(null),L=t??FZ[n];E.useEffect(()=>{if(!(!O.current||!C))return T.current||(T.current=xX({domNode:O.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,domNode:H}=N.getState();return{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,paneDomNode:H}},onChange:(M,$)=>{const{triggerNodeChanges:W,nodeLookup:B,parentLookup:U,nodeOrigin:H}=N.getState(),V=[],Y={x:M.x,y:M.y},Z=B.get(C);if(Z&&Z.expandParent&&Z.parentId){const q=Z.origin??H,G=M.width??Z.measured.width??0,J=M.height??Z.measured.height??0,P={id:Z.id,parentId:Z.parentId,rect:{width:G,height:J,...CT({x:M.x??Z.position.x,y:M.y??Z.position.y},{width:G,height:J},Z.parentId,B,q)}},X=Tv([P],B,U,H);V.push(...X),Y.x=M.x?Math.max(q[0]*G,M.x):void 0,Y.y=M.y?Math.max(q[1]*J,M.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const q={id:C,type:"position",position:{...Y}};V.push(q)}if(M.width!==void 0&&M.height!==void 0){const G={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};V.push(G)}for(const q of $){const G={...q,type:"position"};V.push(G)}W(V)},onEnd:({width:M,height:$})=>{const W={id:C,type:"dimensions",resizing:!1,dimensions:{width:M,height:$}};N.getState().triggerNodeChanges([W])}})),T.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:d,maxWidth:m,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:w,onResize:S,onResizeEnd:_,shouldResize:v}),()=>{T.current?.destroy()}},[L,u,d,m,p,h,w,S,_,v]);const A=L.split("-");return c.jsx("div",{className:Zn(["react-flow__resize-control","nodrag",...A,n,r]),ref:O,style:{...i,scale:D,...a&&{[I?"backgroundColor":"borderColor"]:a}},children:o})}E.memo(VZ);const UZ=E.memo(function({data:t}){const n=["oc-canvas-node",t.isOwner&&"is-owner",t.isSelected&&"is-selected",t.isDropTarget&&"is-drop-target"].filter(Boolean).join(" "),r=wu(t.icon);return c.jsxs("div",{className:n,children:[c.jsx(vl,{type:"target",position:at.Top,className:"oc-canvas-handle"}),c.jsxs("div",{className:"oc-canvas-node-row",children:[c.jsx("div",{className:"oc-canvas-node-chip",children:c.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${r}")`,maskImage:`url("${r}")`},"aria-hidden":!0})}),c.jsxs("div",{className:"oc-canvas-node-text",children:[c.jsx("span",{className:"oc-canvas-node-name",children:t.name}),c.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?c.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):c.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&c.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),c.jsx(vl,{type:"source",position:at.Bottom,className:"oc-canvas-handle"})]})});var bx,k2;function Mv(){if(k2)return bx;k2=1;var e="\0",t="\0",n="";class r{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(p){p&&(this._isDirected=Object.hasOwn(p,"directed")?p.directed:!0,this._isMultigraph=Object.hasOwn(p,"multigraph")?p.multigraph:!1,this._isCompound=Object.hasOwn(p,"compound")?p.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(p){return this._label=p,this}graph(){return this._label}setDefaultNodeLabel(p){return this._defaultNodeLabelFn=p,typeof p!="function"&&(this._defaultNodeLabelFn=()=>p),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var p=this;return this.nodes().filter(h=>Object.keys(p._in[h]).length===0)}sinks(){var p=this;return this.nodes().filter(h=>Object.keys(p._out[h]).length===0)}setNodes(p,h){var g=arguments,y=this;return p.forEach(function(v){g.length>1?y.setNode(v,h):y.setNode(v)}),this}setNode(p,h){return Object.hasOwn(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=h),this):(this._nodes[p]=arguments.length>1?h:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=t, Line truncated
${r}`}),c.jsx(TV,{projects:Rr.projects,activeId:Rr.activeProjectId,onSelect:Q=>{const z=Es(Q);t.current?.switchProject(Q,z)},onCreate:Q=>{t.current?.createProject(Q)},onDelete:Q=>t.current?.deleteProject(Q)})]}),c.jsxs("div",{className:"topbar-center",children:[c.jsxs("div",{className:"page-nav",children:[c.jsxs("button",{className:`page-nav-btn${$==="workspace"?" active":""}`,onClick:()=>W("workspace"),children:["Workspace",(()=>{const Q=Cr.channels.reduce((z,ne)=>z+Cr.getUnreadCount(ne.id),0);return Q>0?c.jsx("span",{className:"nav-unread-badge",children:Q>99?"99+":Q}):null})()]}),c.jsx("button",{className:`page-nav-btn${$==="office"?" active":""}`,onClick:()=>W("office"),children:"Office"}),c.jsx("button",{className:`page-nav-btn${$==="org"?" active":""}`,onClick:()=>W("org"),children:"Org"})]}),c.jsxs("div",{className:"stat-chips",children:[c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:ii.totalAgents})," agents"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:ii.totalSkills})," skills"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:Hn.getOpenTaskCount()})," tasks"]})]})]}),c.jsxs("div",{className:"topbar-right",children:[c.jsxs("select",{className:"theme-select",value:Tr,title:"Outdoor lighting override",onChange:Q=>{const z=Q.target.value;wr(z);try{z==="auto"?(localStorage.removeItem("opc_outdoor_override"),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night")):(localStorage.setItem("opc_outdoor_override",z),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night"))}catch{}e.current.syncOutdoorLighting()},children:[c.jsx("option",{value:"auto",children:"Outdoor auto"}),c.jsx("option",{value:"day",children:"Outdoor day"}),c.jsx("option",{value:"night",children:"Outdoor night"})]}),c.jsxs("select",{className:"theme-select",value:C,onChange:Q=>N(Q.target.value),children:[c.jsx("option",{value:"midnight",children:"Midnight"}),c.jsx("option",{value:"neon",children:"Neon"}),c.jsx("option",{value:"paper",children:"Paper"}),c.jsx("option",{value:"retro",children:"Retro"}),c.jsx("option",{value:"terminal",children:"Terminal"}),c.jsx("option",{value:"cozy",children:"Cozy"}),c.jsx("option",{value:"openopc",children:"OpenOPC"})]}),c.jsx("button",{className:`icon-btn ${H?"active":""}`,onClick:()=>V(Q=>!Q),title:"Developer Tools",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[c.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),$==="workspace"&&c.jsx(nV,{boardStore:Hn,chatStore:Cr,sessionStore:hn,agents:B,officeMap:Is,execMode:q,companyProfile:J,taskPreferredAgent:X,projectId:Rr.activeProjectId,orgInfoData:te,onNavigateToOrg:()=>W("org"),savedOrgsList:rn,activeSavedOrg:Te,onSavedOrgsList:El,onSavedOrgLoad:Mu,recoveryStatus:oe,onRecoveryResume:Q=>t.current?.recoveryAction(ct(),"resume",Q),onRecoveryCancel:Q=>t.current?.recoveryAction(ct(),"cancel",Q),commsState:se,commsMessage:we,onCommsRefresh:Q=>{const{project_id:z,...ne}=Q??{};t.current?.commsState(ct(),ne)},onCommsReadMessage:Q=>t.current?.commsReadMessage(ct(),Q),onRunTask:(Q,z,ne,le,ge)=>{t.current?.send({type:"run_task",project_id:ct(),task_id:Q,title:z,description:ne,mode:le,profile:ge})},onCreateTask:(Q,z,ne,le)=>{t.current?.send({type:"kanban_create_task",project_id:ct(),title:Q,board_id:z,column_id:ne,task_id:le})},onMoveTask:(Q,z)=>{t.current?.send({type:"kanban_move_task",project_id:ct(),task_id:Q,column_id:z})},onCreateSession:()=>{if(vn.current||Tt.current)return;const Q=ct();Cn(Q),t.current?.createSession(Q,void 0,q,py(q),X,Do(q,Te))},onSessionSend:(Q,z,ne,le)=>t.current?.sessionSend(ct(),Q,z,ne,le),onSecretarySend:Q=>t.current?.secretarySend(ct(),Q),onDeleteSession:Q=>t.current?.deleteSession(ct(),Q),onTitleChange:(Q,z)=>t.current?.sessionUpdateTitle(ct(),Q,z),onSessionConfigChange:Ou,onSessionTaskAgentChange:xr,onContinueInNewChat:Ji,onSessionStop:go,onSessionResume:Zm,onSessionComplete:Q=>t.current?.sessionComplete(ct(),Q),onLoadSessionDetail:(Q,z)=>t.current?.sessionDetail(ct(),Q,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:["messages","session_state"],viewGeneration:ve.current}),onOpenExecutionPanel:Q=>ht(Q),onCollabSync:()=>t.current?.collabSync(ct(),void 0,ve.current)}),$==="org"&&c.jsx("div",{className:"org-page",children:c.jsx(JQ,{data:te,sessionRecruitmentByRole:Ru,talents:Be,employeeDetail:Vt,reorgProposals:vt,isCustomMode:Oi,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:Q=>t.current?.employeeDetail(Q),onHireTalent:(Q,z)=>{kn(Q),t.current?.talentHire(Q,z,void 0,te?.organization_id||Te||void 0)},hiringTemplateId:Dt,onImportEmployee:Q=>t.curre Line truncated
@@ -1,155 +0,0 @@
import{g as Zo,r as R3}from"./phaser-DFK5Ua9d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Gp={exports:{}},hc={};var sk;function A3(){if(sk)return hc;sk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var u in i)u!=="key"&&(o[u]=i[u])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:o}}return hc.Fragment=t,hc.jsx=n,hc.jsxs=n,hc}var ok;function M3(){return ok||(ok=1,Gp.exports=A3()),Gp.exports}var c=M3(),qp={exports:{}},_t={};var ak;function D3(){if(ak)return _t;ak=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function y(U){return U===null||typeof U!="object"?null:(U=g&&U[g]||U["@@iterator"],typeof U=="function"?U:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function _(U,ee,P){this.props=U,this.context=ee,this.refs=S,this.updater=P||v}_.prototype.isReactComponent={},_.prototype.setState=function(U,ee){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,ee,"setState")},_.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function k(){}k.prototype=_.prototype;function C(U,ee,P){this.props=U,this.context=ee,this.refs=S,this.updater=P||v}var N=C.prototype=new k;N.constructor=C,w(N,_.prototype),N.isPureReactComponent=!0;var L=Array.isArray;function I(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function O(U,ee,P){var K=P.ref;return{$$typeof:e,type:U,key:ee,ref:K!==void 0?K:null,props:P}}function M(U,ee){return O(U.type,ee,U.props)}function A(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function $(U){var ee={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(P){return ee[P]})}var Y=/\/+/g;function B(U,ee){return typeof U=="object"&&U!==null&&U.key!=null?$(""+U.key):ee.toString(36)}function G(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(I,I):(U.status="pending",U.then(function(ee){U.status==="pending"&&(U.status="fulfilled",U.value=ee)},function(ee){U.status==="pending"&&(U.status="rejected",U.reason=ee)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function H(U,ee,P,K,J){var te=typeof U;(te==="undefined"||te==="boolean")&&(U=null);var re=!1;if(U===null)re=!0;else switch(te){case"bigint":case"string":case"number":re=!0;break;case"object":switch(U.$$typeof){case e:case t:re=!0;break;case p:return re=U._init,H(re(U._payload),ee,P,K,J)}}if(re)return J=J(U),re=K===""?"."+B(U,0):K,L(J)?(P="",re!=null&&(P=re.replace(Y,"$&/")+"/"),H(J,ee,P,"",function(se){return se})):J!=null&&(A(J)&&(J=M(J,P+(J.key==null||U&&U.key===J.key?"":(""+J.key).replace(Y,"$&/")+"/")+re)),ee.push(J)),1;re=0;var oe=K===""?".":K+":";if(L(U))for(var fe=0;fe<U.length;fe++)K=U[fe],te=oe+B(K,fe),re+=H(K,ee,P,te,J);else if(fe=y(U),typeof fe=="function")for(U=fe.call(U),fe=0;!(K=U.next()).done;)K=K.value,te=oe+B(K,fe++),re+=H(K,ee,P,te,J);else if(te==="object"){if(typeof U.then=="function")return H(G(U),ee,P,K,J);throw ee=String(U),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return re}function V(U,ee,P){if(U==null)return U;var K=[],J=0;return H(U,K,"","",function(te){return ee.call(P,te,J++)}),K}function W(U){if(U._status===-1){var ee=U._result;ee=ee(),ee.then(function(P){(U._status===0||U._status===-1)&&(U._status=1,U._result=P)},function(P){(U._status===0||U._status===-1)&&(U._status=2,U._result=P)}),U._status===-1&&(U._status=0,U._result=ee)}if(U._status=Line truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Se+s+Ce}var We=!1;function Ye(s,l){if(!s||We)return"";We=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(l){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(ye){var xe=ye}Reflect.construct(s,[],Ie)}else{try{Ie.call()}catch(ye){xe=ye}s.call(Ie.prototype)}}else{try{throw Error()}catch(ye){xe=ye}(Ie=s())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(ye){if(ye&&xe&&typeof ye.stack=="string")return[ye.stack,xe.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=x.DetermineComponentFrameRoot(),F=j[0],X=j[1];if(F&&X){var ie=F.split(`
`),pe=X.split(`
`);for(b=x=0;x<ie.length&&!ie[x].includes("DetermineComponentFrameRoot");)x++;for(;b<pe.length&&!pe[b].includes("DetermineComponentFrameRoot");)b++;if(x===ie.length||b===pe.length)for(x=ie.length-1,b=pe.length-1;1<=x&&0<=b&&ie[x]!==pe[b];)b--;for(;1<=x&&0<=b;x--,b--)if(ie[x]!==pe[b]){if(x!==1||b!==1)do if(x--,b--,0>b||ie[x]!==pe[b]){var _e=`
`+ie[x].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=x&&0<=b);break}}}finally{We=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?He(f):""}function gt(s,l){switch(s.tag){case 26:case 27:case 5:return He(s.type);case 16:return He("Lazy");case 13:return s.child!==l&&l!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return Ye(s.type,!1);case 11:return Ye(s.type.render,!1);case 1:return Ye(s.type,!0);case 31:return He("Activity");default:return""}}function Ut(s){try{var l="",f=null;do l+=gt(s,f),f=s,s=s.return;while(s);return l}catch(x){return`
Error generating stack: `+x.message+`
`+x.stack}}var bt=Object.prototype.hasOwnProperty,xt=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,it=e.unstable_requestPaint,et=e.unstable_now,nt=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,Ue=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,vt=e.log,Rt=e.unstable_setDisableYieldValue,ke=null,Re=null;function Ke(s){if(typeof vt=="function"&&Rt(s),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(ke,s)}catch{}}var Ge=Math.clz32?Math.clz32:xn,tt=Math.log,Qe=Math.LN2;function xn(s){return s>>>=0,s===0?32:31-(tt(s)/Qe|0)|0}var Qt=256,kn=262144,Nn=4194304;function sn(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function tn(s,l,f){var x=s.pendingLanes;if(x===0)return 0;var b=0,j=s.suspendedLanes,F=s.pingedLanes;s=s.warmLanes;var X=x&134217727;return X!==0?(x=X&~j,x!==0?b=sn(x):(F&=X,F!==0?b=sn(F):f||(f=X&~s,f!==0&&(b=sn(f))))):(X=x&~j,X!==0?b=sn(X):F!==0?b=sn(F):f||(f=x&~s,f!==0&&(b=sn(f)))),b===0?0:l!==0&&l!==b&&(l&j)===0&&(j=b&-b,f=l&-l,j>=f||j===32&&(f&4194048)!==0)?l:b}function Nt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function kt(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 qe(){var s=Nn;return Nn<<=1,(Nn&62914560)===0&&(Nn=4194304),s}function ze(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function pn(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function In(s,l,f,x,b,j){var F=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var X=s.entanglements,ie=s.expirationTimes,pe=s.hiddenUpdates;for(f=F&~f;0<f;){var _e=31-Ge(f),Ie=1<<_e;X[_e]=0,ie[_e]=-1;var xe=pe[_e];if(xe!==null)for(pe[_e]=null,_e=0;_e<xe.length;_e++){var ye=xe[_e];ye!==null&&(ye.lane&=-536870913)}f&=~Ie}x!==0&&$t(s,x,0),j!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=j&~(F&~l))}function $t(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var x=31-Ge(l);s.entangledLanes|=l,s.entanglements[x]=s.entanglements[x]|1073741824|f&261930}function Gt(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var x=31-Ge(f),b=1<<x;b&l|s[x]&l&&(s[x]|=l),f&=~b}}function Jt(s,l){var f=l&-l;return f=(f&42)!==0?1:tr(f),(f&(s.suspendedLanes|l))!==0?0:f}function tr(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Mn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ee(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:Q_(s.type))}function Te(s,l){var f=V.p;try{return V.p=s,l()}finally{V.p=f}}var Xe=Math.random().toString(36).slice(2),$e="__reactFiber$"+Xe,It="__reactProps$"+Xe,yt="__reactContainer$"+Xe,Kn="__reactEvents$"+Xe,Me="__reactListeners$"+Xe,Mt="__reactHandles$"+Xe,Tn="__reactResources$"+Xe,or="__reactMarker$"+Xe;function Rn(s){delete s[$e],delete s[It],delete s[Kn],delete s[Me],delete s[Mt]}function Ve(s){var l=s[$e];if(l)return l;for(var f=s.parentNode;f;){if(l=f[yt]||f[$e]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=L_(s);s!==null;){if(f=s[$e])return f;s=L_(s)}return l}s=f,f=s.parentNode}return null}function ar(s){if(s=s[$e]||s[yt]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Zn(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(r(33))}function An(s){var l=s[Tn];return l||(l=s[Tn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Tt(s){s[or]=!0}var lr=new Set,Sn={};function dt(s,l){st(s,l),st(s+"Capture",l)}function st(s,l){for(Sn[s]=l,s=0;s<l.length;s++)lr.add(l[s])}var cr=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(JA,"")}function j_(s,l){return l=C_(l),C_(s)===l}function un(s,l,f,x,b,j){switch(f){case"children":typeof x=="string"?l==="body"||l==="textarea"&&x===""||Ns(s,x):(typeof x=="number"||typeof x=="bigint")&&l!=="body"&&Ns(s,""+x);break;case"className":Dn(s,"class",x);break;case"tabIndex":Dn(s,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":Dn(s,f,x);break;case"style":Ru(s,x,j);break;case"data":if(l!=="object"){Dn(s,"data",x);break}case"src":case"href":if(x===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=Qi(""+x),s.setAttribute(f,x);break;case"action":case"formAction":if(typeof x=="function"){s.setAttribute(f,"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 j=="function"&&(f==="formAction"?(l!=="input"&&un(s,l,"name",b.name,b,null),un(s,l,"formEncType",b.formEncType,b,null),un(s,l,"formMethod",b.formMethod,b,null),un(s,l,"formTarget",b.formTarget,b,null)):(un(s,l,"encType",b.encType,b,null),un(s,l,"method",b.method,b,null),un(s,l,"target",b.target,b,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=Qi(""+x),s.setAttribute(f,x);break;case"onClick":x!=null&&(s.onclick=gi);break;case"onScroll":x!=null&&Ot("scroll",s);break;case"onScrollEnd":x!=null&&Ot("scrollend",s);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"multiple":s.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":s.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){s.removeAttribute("xlink:href");break}f=Qi(""+x),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""+x):s.removeAttribute(f);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":x&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":x===!0?s.setAttribute(f,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,x):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?s.setAttribute(f,x):s.removeAttribute(f);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?s.removeAttribute(f):s.setAttribute(f,x);break;case"popover":Ot("beforetoggle",s),Ot("toggle",s),yn(s,"popover",x);break;case"xlinkActuate":Sr(s,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":Sr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":Sr(s,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":Sr(s,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":Sr(s,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":Sr(s,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":Sr(s,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":Sr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":Sr(s,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":yn(s,"is",x);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=Au.get(f)||f,yn(s,f,x))}}function Ep(s,l,f,x,b,j){switch(f){case"style":Ru(s,x,j);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"children":typeof x=="string"?Ns(s,x):(typeof x=="number"||typeof x=="bigint")&&Ns(s,""+x);break;case"onScroll":x!=null&&Ot("scroll",s);break;case"onScrollEnd":x!=null&&Ot("scrollend",s);break;case"onClick":x!=null&&(s.onclick=gi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),oe=h.map(([fe,se])=>` [${fe}, ${se}],`).join(`
`);return`const MAP_STR: string[] = [
${re}
]
const SEATS: [number, number][] = [
${oe}
]`})(),ee=()=>I(te=>Math.min(te+.25,3)),P=()=>I(te=>Math.max(te-.25,.5)),K=m.flat().filter(te=>te===1).length,J=m.flat().filter(te=>te===0).length;return c.jsxs("div",{className:"collision-editor",children:[c.jsxs("div",{className:"ce-toolbar",children:[c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("span",{className:"ce-title",children:"Map Editor"}),c.jsx("select",{className:"ce-office-select",value:a,onChange:te=>A(te.target.value),children:i.map(te=>c.jsx("option",{value:te.id,children:te.name},te.id))})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsxs("button",{className:`ce-mode-btn ${y==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[c.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[c.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[c.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:"ce-btn",onClick:P,children:"-"}),c.jsxs("span",{className:"ce-zoom-label",children:[Math.round(L*100),"%"]}),c.jsx("button",{className:"ce-btn",onClick:ee,children:"+"}),c.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>T(te=>!te),children:"Grid"})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:`ce-btn apply${C?" success":""}`,onClick:W,children:C?"Applied":"Apply"}),c.jsx("button",{className:`ce-btn${_?" active":""}`,onClick:Z,children:"Export"}),c.jsx("button",{className:"ce-btn danger",onClick:q,children:"Reset"})]}),c.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[c.jsxs("span",{children:["Walls: ",K]}),c.jsxs("span",{children:["Floor: ",J]}),c.jsxs("span",{children:["Seats: ",h.length]})]})]}),c.jsxs("div",{className:"ce-body",children:[c.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:c.jsx("canvas",{ref:t,style:{width:O*R*L,height:M*R*L,imageRendering:"pixelated",cursor:y==="seat"?"crosshair":"cell"},onMouseDown:G,onMouseMove:H,onMouseUp:V,onMouseLeave:V})}),_&&c.jsxs("div",{className:"ce-export-panel",children:[c.jsxs("div",{className:"ce-export-header",children:[c.jsx("span",{children:"Export — copy to source code"}),c.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(U),children:"Copy"})]}),c.jsx("textarea",{className:"ce-export-textarea",value:U,readOnly:!0,rows:20})]})]})]})}let GM=0;function er(e,t,n={}){return{event_id:`test-${++GM}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function Cn(e){return new Promise(t=>setTimeout(t,e))}async function qM(e){const t=[],n=e.getScene();if(!n)return t.push({name:"scene-ready",pass:!1,detail:"OfficeScene not initialized"}),t;console.log("%c[EventTest] Starting full event test suite (multi-office)...","color: #6366f1; font-weight: bold");for(const A of[...n.agents.keys()])n.removeAgent(A);await Cn(100);const r=Pn();t.push({name:"offices-loaded",pass:r.length>=3,detail:`${r.length} offices loaded: ${r.map(A=>A.name).join(", ")}`});const i=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const A of i)e.pushEvent(er("agent_active",A));await Cn(300);const o=new Set;let a=!1;for(const A of i){const $=n.getAgent(A);$&&$.seatId&&(o.has($.seatId)&&(a=!0),o.add($.seatId))}t.push({name:"desk-assignment-unique",pass:!a&&o.size===i.length,detail:`Assigned ${o.size} unique seats to ${i.length} agents. IDs: [${[...o].join(", ")}]`});const u=i.every(A=>n.getAgent(A)?.officeId!=null);t.push({name:"agents-have-officeId",pass:u,detail:i.map(A=>`${A}=${n.getAgent(A)?.officeId}`).join(", ")}),e.pushEvent(er("tool_start","agent-A",{tool_name:"shell"})),await Cn(200);const d=n.getAgent("agent-A");t.push({name:"tool_start-state",pass:d.isActive===!0&&d.currentTool==="shell",detail:`isActive=${d.isActive}, currentTool=${d.currentTool}`}),e.pushEvent(er("tool_done","agent-A",{tool_name:"shell"})),await Cn(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let A=0;A<20&&d.agentState==="celebrate";A++)await Cn(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(er("waiting","agent-B")),await Cn(200);const m=n.getAgent("agent-B");t.push({name:"waiting-state",pass:m.isActive===!1&&(m.agentState==="walk"||m.agentState==="idle"||m.agentState==="coffee"),detail:`isActive=${m.isActive}, state=${m.agentState}`}),e.pushEvent(er("reflect_start","agent-C")),await Cn(200);const p=n.getAgent("agent-C");t.push({name:"reflect_start-state",pass:p.currentTool==="Reflect"&&(p.agentState==="walk"||p.agentState==="reflect"),detail:`currentTool=${p.currentTool}, state=${p.agentState}`}),e.pushEvent(er("reflect_done","agent-C")),await Cn(100),t.push({name:"reflect_done-celebrate",pass:p.agentState==="celebrate",detail:`staLine truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return a.updateDeps=u=>{r=u},a}function Ok(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const r4=(e,t)=>Math.abs(e-t)<1.01,i4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Lk=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},s4=e=>e,o4=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},a4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=a=>{const{width:u,height:d}=a;t({width:Math.round(u),height:Math.round(d)})};if(i(Lk(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(a=>{const u=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Lk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},zk={passive:!0},Pk=typeof window>"u"?!0:"onscrollend"in window,l4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&Pk?()=>{}:i4(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=p=>()=>{const{horizontal:h,isRtl:g}=e.options;i=h?n.scrollLeft*(g&&-1||1):n.scrollTop,o(),t(i,p)},u=a(!0),d=a(!1);n.addEventListener("scroll",u,zk);const m=e.options.useScrollendEvent&&Pk;return m&&n.addEventListener("scrollend",d,zk),()=>{n.removeEventListener("scroll",u),m&&n.removeEventListener("scrollend",d)}},c4=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},u4=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const a=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class d4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const a=()=>{const u=o.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:s4,rangeExtractor:o4,onChange:()=>{},measureElement:c4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Da(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)} Line truncated
The error may be correlated with this previous error:
${te.current.stack}
`),Se}Af(()=>{te.current=void 0,P.current=void 0,U.current=fe});const se=E.useMemo(()=>E.createElement(S,{...fe,ref:O}),[O,S,fe]);return E.useMemo(()=>v?E.createElement(A.Provider,{value:q},se):se,[A,se,q])}const I=E.memo(N);if(I.WrappedComponent=S,I.displayName=N.displayName=k,d){const T=E.forwardRef(function(M,A){return E.createElement(I,{...M,reactReduxForwardedRef:A})});return T.displayName=k,T.WrappedComponent=S,by(T,S)}return by(I,S)}}var Xj=X5;function K5(e){const{children:t,context:n,serverState:r,store:i}=e,o=E.useMemo(()=>{const d=qj(i);return{store:i,subscription:d,getServerState:r?()=>r:void 0}},[i,r]),a=E.useMemo(()=>i.getState(),[i]);Af(()=>{const{subscription:d}=o;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),a!==i.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[o,a]);const u=n||Yj;return E.createElement(u.Provider,{value:o},t)}var Z5=K5,Q5="Invariant failed";function J5(e,t){throw new Error(Q5)}var Ci=function(t){var n=t.top,r=t.right,i=t.bottom,o=t.left,a=r-o,u=i-n,d={top:n,right:r,bottom:i,left:o,width:a,height:u,x:o,y:n,center:{x:(r+o)/2,y:(i+n)/2}};return d},_0=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},cS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},eD=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},lg={top:0,right:0,bottom:0,left:0},k0=function(t){var n=t.borderBox,r=t.margin,i=r===void 0?lg:r,o=t.border,a=o===void 0?lg:o,u=t.padding,d=u===void 0?lg:u,m=Ci(_0(n,i)),p=Ci(cS(n,a)),h=Ci(cS(p,d));return{marginBox:m,borderBox:Ci(n),paddingBox:p,contentBox:h,margin:i,border:a,padding:d}},ci=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var i=Number(n);return isNaN(i)&&J5(),i},tD=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Mf=function(t,n){var r=t.borderBox,i=t.border,o=t.margin,a=t.padding,u=eD(r,n);return k0({borderBox:u,border:i,margin:o,padding:a})},Df=function(t,n){return n===void 0&&(n=tD()),Mf(t,n)},Kj=function(t,n){var r={top:ci(n.marginTop),right:ci(n.marginRight),bottom:ci(n.marginBottom),left:ci(n.marginLeft)},i={top:ci(n.paddingTop),right:ci(n.paddingRight),bottom:ci(n.paddingBottom),left:ci(n.paddingLeft)},o={top:ci(n.borderTopWidth),right:ci(n.borderRightWidth),bottom:ci(n.borderBottomWidth),left:ci(n.borderLeftWidth)};return k0({borderBox:t,margin:r,padding:i,border:o})},Zj=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Kj(n,r)},Qc=function(t){var n=[],r=null,i=function(){for(var a=arguments.length,u=new Array(a),d=0;d<a;d++)u[d]=arguments[d];n=u,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return i.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},i};function Of(){return Of=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Of.apply(null,arguments)}function Qj(e,t){}Qj.bind(null,"warn");Qj.bind(null,"error");function io(){}function nD(e,t){return{...e,...t}}function mi(e,t,n){const r=t.map(i=>{const o=nD(n,i.options);return e.addEventListener(i.eventName,i.fn,o),function(){e.removeEventListener(i.eventName,i.fn,o)}});return function(){r.forEach(o=>{o()})}}const rD="Invariant failed";class Lf extends Error{}Lf.prototype.toString=function(){return this.message};function Le(e,t){throw new Lf(rD)}let iD=class extends Ct.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=io,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Lf&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=mi(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Lf){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const sD=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,zf=e=>e+1,oD=e=>`
You have lifted an item in position ${zf(e.source.index)}
`,Jj=(e,t)=>{const n=e.droppableId===t.droppableId,r=zf(e.index),i=zf(t.index);return n?`
You have moved the item from position ${r}
to position ${i}
`:`
You have moved the item from position ${r}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${i}
`},eE=(e,t,n)=>t.droppableId===n.droppableId?`
The item ${e}
has been combined with ${n.draggableId}`:`
The item ${e}
in list ${t.droppableId}
has been combined with ${n.draggableId}
in list ${n.droppableId}
`,aD=e=>{const t=e.destination;if(t)return Jj(e.source,t);const n=e.combine;return n?eE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},uS=e=>`
The item has returned to its starting position
of ${zf(e.index)}
`,lD=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${uS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${Jj(e.source,t)}
`:n?`
You have dropped the item.
${eE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${uS(e.source)}
`},gf={dragHandleUsageInstructions:sD,onDragStart:oD,onDragUpdate:aD,onDragEnd:lD};function cD(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function tE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!cD(e[n],t[n]))return!1;return!0}function Ht(e,t){const n=E.useState(()=>({inputs:t,result:e()}))[0],r=E.useRef(!0),i=E.useRef(n),a=r.current||!!(t&&i.current.inputs&&tE(t,i.current.inputs))?i.current:{inputs:t,result:e()};return E.useEffect(()=>{r.current=!1,i.current=a},[a]),a.result}function ot(e,t){return Ht(()=>e,t)}const sr={x:0,y:0},hr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Yr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),so=(e,t)=>e.x===t.x&&e.y===t.y,bl=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Fo=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Jc=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),dS=(e,t)=>Math.min(...t.map(n=>Jc(e,n))),nE=e=>t=>({x:e(t.x),y:e(t.y)});var uD=(e,t)=>{const n=Ci({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const yu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),fS=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],dD={top:0,right:0,bottom:0,left:0},fD=(e,t)=>t?yu(e,t.scroll.diff.displacement):e,mD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,hD=(e,t)=>t&&t.shouldClipSubject?uD(t.pageMarginBox,e):Ci(e);var il=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const i=fD(e.marginBox,r),o=mD(i,n,t),a=hD(o,r);return{page:e,withPlaceholder:t,active:a}},S0=(e,t)=>{e.frame||Le();const n=e.frame,r=Yr(t,n.scroll.initial),i=bl(r),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:i},max:n.scroll.max}},a=il({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function ir(e,t=tE){let n=null;function r(...i){if(n&&n.lastThis===this&&t(i,n.lastArgs))return n.lastResult;const o=e.apply(this,i);return n={lastResult:o,lastArgs:i,lastThis:this},o}return r.clear=function(){n=null},r}const rE=ir(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),iE=ir(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),ym=ir(e=>Object.values(e)),pD=ir(e=>Object.values(e));var _l=ir((e,t)=>pD(t).filter(r=>e===r.descriptor.droppableId).sort((r,i)=>r.descriptor.index-i.descriptor.index));function w0(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function vm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var bm=ir((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),gD=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:i})=>{if(!n.isCombineEnabled||!w0(i))return null;function a(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...i,at:v}}const u=i.displaced.all,d=u.length?u[0]:null;if(e)return d?a(d):null;const m=bm(t,r);if(!d){if(!m.length)return null;const y=m[m.length-1];return a(y.descriptor.id)}const p=m.findIndex(y=>y.descriptor.id===d);p===-1&&Le();const h=p-1;if(h<0)return null;const g=m[h];return a(g.descriptor.id)},kl=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const sE={point:sr,value:0},eu={invisible:{},visible:{},all:[]},xD={displaced:eu,displacedBy:sE,at:null};var hi=(e,t)=>n=>e<=n&&n<=t,oE=e=>{const t=hi(e.top,e.bottom),n=hi(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const o=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(o&&a)return!0;const d=r.top<e.top&&r.bottom>e.bottom,m=r.left<e.left&&r.right>e.right;return d&&m?!0:d&&a||m&&o}},yD=e=>{const t=hi(e.top,e.bottom),n=hi(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const C0={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},aE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var vD=e=>t=>{const n=hi(t.top,t.bottom),r=hi(t.left,t.right);return i=>e===C0?n(i.top)&&n(i.bottom):r(i.left)&&r(i.right)};const bD=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:sr;return yu(e,n)},_D=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,kD=(e,t,n)=>n(t)(e),j0=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:i})=>{const o=r?bD(e,t):e;return _D(o,t,i)&&kD(o,n,i)},SD=e=>j0({...e,isVisibleThroughFrameFn:oE}),lE=e=>j0({...e,isVisibleThroughFrameFn:yD}),wD=e=>j0({...e,isVisibleThroughFrameFn:vD(e.destination.axis)}),CD=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:i}=t;if(r[e])return!1;const o=i[e];return o?o.shouldAnimate:!0};function jD(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Ci(_0(n,r))}function tu({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:i,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(ol.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:u,dragging:EL,dropAnimating:u}}})(),r=(()=>{const u=`
transition: ${Hc.outOfTheWay};
`;return{selector:t(Cy.contextId),styles:{dragging:u,dropAnimating:u,userCancel:u}}})(),i={selector:t(CL.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,i,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:vc(a,"always"),resting:vc(a,"resting"),dragging:vc(a,"dragging"),dropAnimating:vc(a,"dropAnimating"),userCancel:vc(a,"userCancel")}};const Kr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?E.useLayoutEffect:E.useEffect,mg=()=>{const e=document.querySelector("head");return e||Le(),e},jS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function IL(e,t){const n=Ht(()=>NL(e),[e]),r=E.useRef(null),i=E.useRef(null),o=ot(ir(h=>{const g=i.current;g||Le(),g.textContent=h}),[]),a=ot(h=>{const g=r.current;g||Le(),g.textContent=h},[]);Kr(()=>{!r.current&&!i.current||Le();const h=jS(t),g=jS(t);return r.current=h,i.current=g,h.setAttribute(`${sl}-always`,e),g.setAttribute(`${sl}-dynamic`,e),mg().appendChild(h),mg().appendChild(g),a(n.always),o(n.resting),()=>{const y=v=>{const w=v.current;w||Le(),mg().removeChild(w),v.current=null};y(r),y(i)}},[t,a,o,n.always,n.resting,e]);const u=ot(()=>o(n.dragging),[o,n.dragging]),d=ot(h=>{if(h==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=ot(()=>{i.current&&o(n.resting)},[o,n.resting]);return Ht(()=>({dragging:u,dropping:d,resting:m}),[u,d,m])}function OE(e,t){return Array.from(e.querySelectorAll(t))}var LE=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function km(e){return e instanceof LE(e).HTMLElement}function TL(e,t){const n=`[${ol.contextId}="${e}"]`,r=OE(document,n);if(!r.length)return null;const i=r.find(o=>o.getAttribute(ol.draggableId)===t);return!i||!km(i)?null:i}function RL(e){const t=E.useRef({}),n=E.useRef(null),r=E.useRef(null),i=E.useRef(!1),o=ot(function(g,y){const v={id:g,focus:y};return t.current[g]=v,function(){const S=t.current;S[g]!==v&&delete S[g]}},[]),a=ot(function(g){const y=TL(e,g);y&&y!==document.activeElement&&y.focus()},[e]),u=ot(function(g,y){n.current===g&&(n.current=y)},[]),d=ot(function(){r.current||i.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const g=n.current;g&&a(g)}))},[a]),m=ot(function(g){n.current=null;const y=document.activeElement;y&&y.getAttribute(ol.draggableId)===g&&(n.current=g)},[]);return Kr(()=>(i.current=!0,function(){i.current=!1;const g=r.current;g&&cancelAnimationFrame(g)}),[]),Ht(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:u}),[o,m,d,u])}function AL(){const e={draggables:{},droppables:{}},t=[];function n(h){return t.push(h),function(){const y=t.indexOf(h);y!==-1&&t.splice(y,1)}}function r(h){t.length&&t.forEach(g=>g(h))}function i(h){return e.draggables[h]||null}function o(h){const g=i(h);return g||Le(),g}const a={register:h=>{e.draggables[h.descriptor.id]=h,r({type:"ADDITION",value:h})},update:(h,g)=>{const y=e.draggables[g.descriptor.id];y&&y.uniqueId===h.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[h.descriptor.id]=h)},unregister:h=>{const g=h.descriptor.id,y=i(g);y&&h.uniqueId===y.uniqueId&&(delete e.draggables[g],e.droppables[h.descriptor.droppableId]&&r({type:"REMOVAL",value:h}))},getById:o,findById:i,exists:h=>!!i(h),getAllByType:h=>Object.values(e.draggables).filter(g=>g.descriptor.type===h)};function u(h){return e.droppables[h]||null}function d(h){const g=u(h);return g||Le(),g}const m={register:h=>{e.droppables[h.descriptor.id]=h},unregister:h=>{const g=u(h.descriptor.id);g&&h.uniqueId===g.uniqueId&&delete e.droppables[h.descriptor.id]},getById:d,findById:u,exists:h=>!!u(h),getAllByType:h=>Object.values(e.droppables).filter(g=>g.descriptor.type===h)};function p(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:m,subscribe:n,clean:p}}function ML(){const e=Ht(AL,[]);return E.useEffect(()=>function(){e.clean()},[e]),e}var z0=Ct.createContext(null),Bf=()=>{const e=document.body;return e||Le(),e};const DL={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},OL=e=>`rfd-announcement-${e}`;function LL(e){const t=Ht(()=>OL(e),[e]),n=E.useRef(null);return E.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),Of(o.style,DL),Bf().appendChild(o),function(){setTimeout(function(){const d=Bf();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),ot(i=>{const o=n.current;if(o){o.textContent=i;return}},[])}const zL={separator:"::"};function P0(e,t=zL){const n=Ct.useId();return Ht(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function PL({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function BL({contextId:e,text:t}){const n=P0("hidden-text",{separator:"-"}),r=Ht(()=>PL({contextId:e,uniqueId:n}),[n,e]);return E.useEffect(function(){const o=document.createElement("div");return o.id=r,o.textContent=t,o.style.display="none",Bf().appendChild(o),function(){const u=Bf();u.contains(o)&&u.removeChild(o)}},[r,t]),r}var Sm=Ct.c Line truncated
`,m="/",p="*",h="",g="comment",y="declaration";function v(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var k=1,C=1;function N(B){var G=B.match(t);G&&(k+=G.length);var H=B.lastIndexOf(d);C=~H?B.length-H:C+B.length}function L(){var B={line:k,column:C};return function(G){return G.position=new I(B),O(),G}}function I(B){this.start=B,this.end={line:k,column:C},this.source=_.source}I.prototype.content=S;function D(B){var G=new Error(_.source+":"+k+":"+C+": "+B);if(G.reason=B,G.filename=_.source,G.line=k,G.column=C,G.source=S,!_.silent)throw G}function T(B){var G=B.exec(S);if(G){var H=G[0];return N(H),S=S.slice(H.length),G}}function O(){T(n)}function M(B){var G;for(B=B||[];G=A();)G!==!1&&B.push(G);return B}function A(){var B=L();if(!(m!=S.charAt(0)||p!=S.charAt(1))){for(var G=2;h!=S.charAt(G)&&(p!=S.charAt(G)||m!=S.charAt(G+1));)++G;if(G+=2,h===S.charAt(G-1))return D("End of comment missing");var H=S.slice(2,G-2);return C+=2,N(H),S=S.slice(G),C+=2,B({type:g,comment:H})}}function $(){var B=L(),G=T(r);if(G){if(A(),!T(i))return D("property missing ':'");var H=T(o),V=B({type:y,property:w(G[0].replace(e,h)),value:H?w(H[0].replace(e,h)):h});return T(a),V}}function Y(){var B=[];M(B);for(var G;G=$();)G!==!1&&(B.push(G),M(B));return B}return O(),Y()}function w(S){return S?S.replace(u,h):h}return kg=v,kg}var US;function sz(){if(US)return za;US=1;var e=za&&za.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(za,"__esModule",{value:!0}),za.default=n;const t=e(iz());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),u=typeof i=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:p}=d;u?i(m,p,d):p&&(o=o||{},o[m]=p)}),o}return za}var Sc={},GS;function oz(){if(GS)return Sc;GS=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},a=function(m,p){return p.toUpperCase()},u=function(m,p){return"".concat(p,"-")},d=function(m,p){return p===void 0&&(p={}),o(m)?m:(m=m.toLowerCase(),p.reactCompat?m=m.replace(i,u):m=m.replace(r,u),m.replace(t,a))};return Sc.camelCase=d,Sc}var wc,qS;function az(){if(qS)return wc;qS=1;var e=wc&&wc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(sz()),n=oz();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(u,d){u&&d&&(a[(0,n.camelCase)(u,o)]=d)}),a}return r.default=r,wc=r,wc}var lz=az();const cz=Zo(lz),lN=cN("end"),U0=cN("start");function cN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function uz(e){const t=U0(e),n=lN(e);if(t&&n)return{start:t,end:n}}function Fc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?WS(e.position):"start"in e||"end"in e?WS(e):"line"in e||"column"in e?Ty(e):""}function Ty(e){return YS(e&&e.line)+":"+YS(e&&e.column)}function WS(e){return Ty(e&&e.start)+"-"+Ty(e&&e.end)}function YS(e){return e&&typeof e=="number"?e:1}class kr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?o.ruleId=r:(o.source=r.slice(0,d),o.ruleId=r.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Fc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}kr.prototype.file="";kr.prototype.name="";kr.prototype.reason="";kr.prototype.message="";kr.prototype.stack="";kr.prototype.column=void 0;kr.prototype.line=void 0;kr.prototype.ancestors=void 0;kr.prototype.cause=void 0;kr.prototype.fatal=void 0;kr.prototype.place=void 0;kr.prototype.ruleId=void 0;kr.prototype.source=void 0;const G0={}.hasOwnProperty,dz=new Map,fz=/[A-Z]/g,mz=new Set(["table","tbody","thead","tfoot","tr"]),hz=new Set(["td","th"]),uN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pz(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.j Line truncated
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function SB(e){const r={constructs:pN([vB,...(e||{}).extensions||[]]),content:i(Pz),defined:[],document:i($z),flow:i(iB),lazy:{},string:i(aB),text:i(lB)};return r;function i(o){return a;function a(u){return bB(r,o,u)}}}function wB(e){for(;!bN(e););return e}const iw=/[\0\t\n\r]/g;function CB(){let e=1,t="",n=!0,r;return i;function i(o,a,u){const d=[];let m,p,h,g,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),h=0,t="",n&&(o.charCodeAt(0)===65279&&h++,n=void 0);h<o.length;){if(iw.lastIndex=h,m=iw.exec(o),g=m&&m.index!==void 0?m.index:o.length,y=o.charCodeAt(g),!m){t=o.slice(h);break}if(y===10&&h===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),h<g&&(d.push(o.slice(h,g)),e+=g-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const jB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EB(e){return e.replace(jB,NB)}function NB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return gN(n.slice(o?2:1),o?16:10)}return X0(n)||e}const jN={}.hasOwnProperty;function IB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),TB(n)(wB(SB(n).document().write(CB()(e,t,!0))))}function TB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(bt),autolinkProtocol:O,autolinkEmail:O,atxHeading:o(We),blockQuote:o(se),characterEscape:O,characterReference:O,codeFenced:o(je),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(je,a),codeText:o(Se,a),codeTextData:O,data:O,codeFlowValue:O,definition:o(Ce),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(He),hardBreakEscape:o(Ye),hardBreakTrailing:o(Ye),htmlFlow:o(gt,a),htmlFlowData:O,htmlText:o(gt,a),htmlTextData:O,image:o(Ut),label:a,link:o(bt),listItem:o(me),listItemValue:g,listOrdered:o(xt,h),listUnordered:o(xt),paragraph:o(Oe),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(We),strong:o(it),thematicBreak:o(nt)},exit:{atxHeading:d(),atxHeadingSequence:L,autolink:d(),autolinkEmail:fe,autolinkProtocol:oe,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:te,characterReference:re,codeFenced:d(S),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(_),codeText:d(G),codeTextData:M,data:M,definition:d(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:C,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(Y),htmlFlowData:M,htmlText:d(B),htmlTextData:M,image:d(V),label:Z,labelText:W,lineEnding:A,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:q,resourceTitleString:U,resource:ee,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:I,strong:d(),thematicBreak:d()}};EN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let ve={type:"root",children:[]};const Ae={stack:[ve],tokenStack:[],config:t,enter:u,exit:m,buffer:a,resume:p,data:n},Ue=[];let Fe=-1;for(;++Fe<de.length;)if(de[Fe][1].type==="listOrdered"||de[Fe][1].type==="listUnordered")if(de[Fe][0]==="enter")Ue.push(Fe);else{const vt=Ue.pop();Fe=i(de,vt,Fe)}for(Fe=-1;++Fe<de.length;){const vt=t[de[Fe][0]];jN.call(vt,de[Fe][1].type)&&vt[de[Fe][1].type].call(Object.assign({sliceSerialize:de[Fe][2].sliceSerialize},Ae),de[Fe][1])}if(Ae.tokenStack.length>0){const vt=Ae.tokenStack[Ae.tokenStack.length-1];(vt[1]||sw).call(Ae,void 0,vt[0])}for(ve.position={start:Qs(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Qs(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ve=t.transforms[Fe](ve)||ve;return ve}function i(de,ve,Ae){let Ue=ve-1,Fe=-1,vt=!1,Rt,ke,Re,Ke;for(;++Ue<=Ae;){const Ge=de[Ue];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?Fe++:Fe--,Ke=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(Rt&&!Ke&&!Fe&&!Re&&(Re=Ue),Ke=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ke=void 0}if(!Fe&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||Fe===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(Rt){let tt=Ue;for(ke=void 0;tt--;){const Qe=de[tt];if(Qe[1].type==="lineEnding"||Qe[1].type==="lineEndingBlank"){if(Qe[0]==="exit")continue;ke&&(de[ke][1].type="lineEndingBlank",vt=!0),Qe[1].type="lineEnding",ke=tt}else if(!(Qe[1].type==="linePrefix"||Qe[1].type==="blockQuotePrefix"||Qe[1].type==="blockQuotePrefixWhitespace"|Line truncated
`}]}function OB(e,t){const n=t.value?t.value+`
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function LB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=wl(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,u+=1,e.footnoteCounts.set(r,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function BB(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $B(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function NN(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function HB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return NN(e,t);const i={src:wl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function FB(e,t){const n={src:wl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function VB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function UB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return NN(e,t);const i={href:wl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function GB(e,t){const n={href:wl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qB(e,t,n){const r=e.all(t),i=n?WB(n):IN(t),o={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(i||u!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!i?a.push(...p.children):a.push(p)}const d=r[r.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`});const m={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,m),e.applyData(t,m)}function WB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=IN(n[r])}return t}function IN(e){const t=e.spread;return t??e.children.length>1}function YB(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function XB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ZB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QB(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=U0(t.children[1]),d=lN(t.children[t.children.length-1]);u&&d&&(a.position={start:u,end:d}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function JB(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,u=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const h=t.children[d],g={},y=a?a[d]:void 0;y&&(g.align=y);let v={type:"element",tagName:o,properties:g,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),m.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,p),e.applyData(t,p)}function e9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ow=9,aw=32;function t9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(lw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(lw(t.slice(i),i>0,!1)),o.join("")}function lw(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===ow||o===aw;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===ow||o===aw;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function n9(e,t){const n={type:"text",value:t9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const i9={blockquote:MB,break:DB,code:OB,delete:LB,emphasis:zB,footnoteReference:PB,heading:BB,html:$B,imageReference:HB,image:FB,inlineCode:VB,linkReference:UB,link:GB,listItem:qB,list:YB,paragraph:XB,root:KB,strong:ZB,table:QB,tableCell:e9,tableRow:JB,text:n9,thematicBreak:r9,toml:Vd,yaml:Vd,definition:Vd,footnoteDefinition:Vd};function Vd(){}const TN=-1,Im=0,Uc=1,Gf=2,Z0=3,Q0=4,J0=5,ev=6,RN=7,AN=8,cw=typeof self=="object"?self:globalThis,s9=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case Im:case TN:return n(a,i);case Uc:{const u=n([],i);for(const d of a)u.push(r(d));return u}case Gf:{const u=n({},i);for(const[d,m]of a)u[r(d)]=r(m);return u}case Z0:return n(new Date(a),i);case Q0:{const{source:u,flags:d}=a;return n(new RegExp(u,d),i)}case J0:{const u=n(new Map,i);for(const[d,m]of a)u.set(r(d),r(m));return u}case ev:{const u=n(new Set,i);for(const d of a)u.add(r(d));return u}case RN:{const{name:u,message:d}=a;return n(new cw[u](d),i)}case AN:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new cw[o](a),i)};return r},uw=e=>s9(new Map,e)(0),Pa="",{toString:o9}={},{keys:a9}=Object,jc=e=>{const t=typeof e;if(t!=="object"||!e)return[Im,t];const n=o9.call(e).slice(8,-1);switch(n){case"Array":return[Uc,Pa];case"Object":return[Gf,Pa];case"Date":return[Z0,Pa];case"RegExp":return[Q0,Pa];case"Map":return[J0,Pa];case"Set":return[ev,Pa];case"DataView":return[Uc,n]}return n.includes("Array")?[Uc,n]:n.includes("Error")?[RN,n]:[Gf,n]},Ud=([e,t])=>e===Im&&(t==="function"||t==="symbol"),l9=(e,t,n,r)=>{const i=(a,u)=>{const d=r.push(a)-1;return n.set(u,d),d},o=a=>{if(n.has(a))return n.get(a);let[u,d]=jc(a);switch(u){case Im:{let p=a;switch(d){case"bigint":u=AN,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return i([TN],a)}return i([u,p],a)}case Uc:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array( Line truncated
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
`}]}}const Tm=(function(e){if(e==null)return p9;if(typeof e=="function")return Rm(e);if(typeof e=="object")return Array.isArray(e)?f9(e):m9(e);if(typeof e=="string")return h9(e);throw new Error("Expected function, string, or object as test")});function f9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Tm(e[n]);return Rm(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function m9(e){const t=e;return Rm(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function h9(e){return Rm(t);function t(n){return n&&n.type===e}}function Rm(e){return t;function t(n,r,i){return!!(g9(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function p9(){return!0}function g9(e){return e!==null&&typeof e=="object"&&"type"in e}const MN=[],x9=!0,My=!1,y9="skip";function DN(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Tm(i),a=r?-1:1;u(e,void 0,[])();function u(d,m,p){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=MN,v,w,S;if((!t||o(d,m,p[p.length-1]||void 0))&&(y=v9(n(d,p)),y[0]===My))return y;if("children"in d&&d.children){const _=d;if(_.children&&y[0]!==y9)for(w=(r?_.children.length:-1)+a,S=p.concat(_);w>-1&&w<_.children.length;){const k=_.children[w];if(v=u(k,w,S)(),v[0]===My)return v;w=typeof v[1]=="number"?v[1]:w+a}}return y}}}function v9(e){return Array.isArray(e)?e:typeof e=="number"?[x9,e]:e==null?MN:[e]}function tv(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),DN(e,o,u,i);function u(d,m){const p=m[m.length-1],h=p?p.children.indexOf(d):void 0;return a(d,h,p)}}const Dy={}.hasOwnProperty,b9={};function _9(e,t){const n=t||b9,r=new Map,i=new Map,o=new Map,a={...i9,...n.handlers},u={all:m,applyData:S9,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:k9,wrap:C9};return tv(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),u;function d(p,h){const g=p.type,y=u.handlers[g];if(Dy.call(u.handlers,g)&&y)return y(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(g)){if("children"in p){const{children:w,...S}=p,_=qf(S);return _.children=u.all(p),_}return qf(p)}return(u.options.unknownHandler||w9)(u,p,h)}function m(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const v=u.one(g[y],p);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=fw(v.value)),!Array.isArray(v)&&v.type==="element")){const w=v.children[0];w&&w.type==="text"&&(w.value=fw(w.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function k9(e,t){e.position&&(t.position=uz(e))}function S9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,qf(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function w9(e,t){const n=t.data||{},r="value"in t&&!(Dy.call(n,"hProperties")||Dy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function C9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function fw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mw(e,t){const n=_9(e,t),r=n.one(e,void 0),i=d9(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
`},i),o}function j9(e,t){return e&&"run"in e?async function(n,r){const i=mw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return mw(n,{file:r,...e||t})}}function hw(e){if(e)throw e}var jg,pw;function E9(){if(pw)return jg;pw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var p=e.call(m,"constructor"),h=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!p&&!h)return!1;var g;for(g in m);return typeof g>"u"||e.call(m,g)},a=function(m,p){n&&p.name==="__proto__"?n(m,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):m[p.name]=p.newValue},u=function(m,p){if(p==="__proto__")if(e.call(m,p)){if(r)return r(m,p).value}else return;return m[p]};return jg=function d(){var m,p,h,g,y,v,w=arguments[0],S=1,_=arguments.length,k=!1;for(typeof w=="boolean"&&(k=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<_;++S)if(m=arguments[S],m!=null)for(p in m)h=u(w,p),g=u(m,p),w!==g&&(k&&g&&(o(g)||(y=i(g)))?(y?(y=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},a(w,{name:p,newValue:d(k,v,g)})):typeof g<"u"&&a(w,{name:p,newValue:g}));return w},jg}var N9=E9();const Eg=Zo(N9);function Oy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function I9(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);u(null,...i);function u(d,...m){const p=e[++o];let h=-1;if(d){a(d);return}for(;++h<i.length;)(m[h]===null||m[h]===void 0)&&(m[h]=i[h]);i=m,p?T9(p,u)(...m):a(null,...m)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function T9(e,t){let n;return r;function r(...a){const u=e.length>a.length;let d;u&&a.push(i);try{d=e.apply(this,a)}catch(m){const p=m;if(u&&n)throw p;return i(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(a,...u){n||(n=!0,t(a,...u))}function o(a){i(null,a)}}const $i={basename:R9,dirname:A9,extname:M9,join:D9,sep:"/"};function R9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ku(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function A9(e){if(ku(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function M9(e){ku(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const u=e.codePointAt(t);if(u===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function D9(...e){let t=-1,n;for(;++t<e.length;)ku(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":O9(n)}function O9(e){ku(e);const t=e.codePointAt(0)===47;let n=L9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function L9(e,t){let n="",r=0,i=-1,o=0,a=-1,u,d;for(;++a<=e.length;){if(a<e.length)u=e.codePointAt(a);else{if(u===47)break;u=47}if(u===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else u===46&&o>-1?o++:o=-1}return n}function ku(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const z9={cwd:P9};function P9(){return"/"}function Ly(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function B9(e){if(typeof e=="string")e=new URL(e);else if(!Ly(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $9(e)}function $9(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?PN:T$))),m(),d}}function T$(e,t,n){return t===0?e:PN(e,t,n)}function PN(e,t,n){return(n?"":" ")+e}const R$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];BN.peek=L$;function A$(){return{canContainEols:["delete"],enter:{strikethrough:D$},exit:{strikethrough:O$}}}function M$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:R$}],handlers:{delete:BN}}}function D$(e){this.enter({type:"delete",children:[]},e)}function O$(e){this.exit(e)}function BN(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function L$(){return"~"}function z$(e){return e.length}function P$(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||z$,o=[],a=[],u=[],d=[];let m=0,p=-1;for(;++p<e.length;){const w=[],S=[];let _=-1;for(e[p].length>m&&(m=e[p].length);++_<e[p].length;){const k=B$(e[p][_]);if(n.alignDelimiters!==!1){const C=i(k);S[_]=C,(d[_]===void 0||C>d[_])&&(d[_]=C)}w.push(k)}a[p]=w,u[p]=S}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<m;)o[h]=kw(r[h]);else{const w=kw(r);for(;++h<m;)o[h]=w}h=-1;const g=[],y=[];for(;++h<m;){const w=o[h];let S="",_="";w===99?(S=":",_=":"):w===108?S=":":w===114&&(_=":");let k=n.alignDelimiters===!1?1:Math.max(1,d[h]-S.length-_.length);const C=S+"-".repeat(k)+_;n.alignDelimiters!==!1&&(k=S.length+k+_.length,k>d[h]&&(d[h]=k),y[h]=k),g[h]=C}a.splice(1,0,g),u.splice(1,0,y),p=-1;const v=[];for(;++p<a.length;){const w=a[p],S=u[p];h=-1;const _=[];for(;++h<m;){const k=w[h]||"";let C="",N="";if(n.alignDelimiters!==!1){const L=d[h]-(S[h]||0),I=o[h];I===114?C=" ".repeat(L):I===99?L%2?(C=" ".repeat(L/2+.5),N=" ".repeat(L/2-.5)):(C=" ".repeat(L/2),N=C):N=" ".repeat(L)}n.delimiterStart!==!1&&!h&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||h)&&_.push(" "),n.alignDelimiters!==!1&&_.push(C),_.push(k),n.alignDelimiters!==!1&&_.push(N),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||h!==m-1)&&_.push("|")}v.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return v.join(`
`)}function B$(e){return e==null?"":String(e)}function kw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function $$(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),H$);return i(),a}function H$(e,t,n){return">"+(n?"":" ")+e}function F$(e,t){return Sw(e,t.inConstruct,!0)&&!Sw(e,t.notInConstruct,!1)}function Sw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ww(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&F$(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function V$(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function U$(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function G$(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function q$(e,t,n,r){const i=G$(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(U$(e,n)){const h=n.enter("codeIndented"),g=n.indentLines(o,W$);return h(),g}const u=n.createTracker(r),d=i.repeat(Math.max(V$(o,i)+1,3)),m=n.enter("codeFenced");let p=u.move(d);if(e.lang){const h=n.enter(`codeFencedLang${a}`);p+=u.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${a}`);p+=u.move(" "),p+=u.move(n.safe(e.meta,{before:p,after:`
`,encode:["`"],...u.current()})),h()}return p+=u.move(`
`),o&&(p+=u.move(o+`
`)),p+=u.move(d),m(),p}function W$(e,t,n){return(n?"":" ")+e}function rv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Y$(e,t,n,r){const i=rv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("[");return m+=d.move(n.safe(n.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),a(),m}function X$(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function au(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Wf(e,t,n){const r=cl(e),i=cl(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$N.peek=K$;function $N(e,t,n,r){const i=X$(n),o=n.enter("emphasis"),a=n.createTracker(r),u=a.move(i);let d=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const m=d.charCodeAt(0),p=Wf(r.before.charCodeAt(r.before.length-1),m,i);p.inside&&(d=au(m)+d.slice(1));const h=d.charCodeAt(d.length-1),g=Wf(r.after.charCodeAt(0),h,i);g.inside&&(d=d.slice(0,-1)+au(h));const y=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},u+d+y}function K$(e,t,n){return n.options.emphasis||"*"}function Z$(e,t){let n=!1;return tv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,My}),!!((!e.depth||e.depth<3)&&Y0(e)&&(t.options.setext||n))}function Q$(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Z$(e,n)){const p=n.enter("headingSetext"),h=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return h(),p(),g+`
`+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(i),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=au(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),u(),m}HN.peek=J$;function HN(e){return e.value||""}function J$(){return"<"}FN.peek=e7;function FN(e,t,n,r){const i=rv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("![");return m+=d.move(n.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),m+=d.move(")"),a(),m}function e7(){return"!"}VN.peek=t7;function VN(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("![");const m=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function t7(){return"!"}UN.peek=n7;function UN(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],u=n.compilePattern(a);let d;if(a.atBreak)for(;d=u.exec(r);){let m=d.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(d.index+1)}}return i+r+i}function n7(){return"`"}function GN(e,t){const n=Y0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}qN.peek=r7;function qN(e,t,n,r){const i=rv(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,d;if(GN(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),d=n.enter("label");let m=a.move("[");return m+=a.move(n.containerPhrasing(e,{before:m,after:"](",...a.current()})),m+=a.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=a.move("<"),m+=a.move(n.safe(e.url,{before:m,after:">",...a.current()})),m+=a.move(">")):(d=n.enter("destinationRaw"),m+=a.move(n.safe(e.url,{before:m,after:e.title?" ":")",...a.current()}))),d(),e.title&&(d=n.enter(`title${o}`),m+=a.move(" "+i),m+=a.move(n.safe(e.title,{before:m,after:i,...a.current()})),m+=a.move(i),d()),m+=a.move(")"),u(),m}function r7(e,t,n){return GN(e,n)?"<":"["}WN.peek=i7;function WN(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function i7(){return"["}function iv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function s7(e){const t=iv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function o7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function YN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function a7(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?o7(n):iv(n);const u=e.ordered?a==="."?")":".":s7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),YN(n)===a&&p){let h=-1;for(;++h<e.chilLine truncated
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:d,tableRow:u}};function a(y,v,w,S){return m(p(y,w,S),y.align)}function u(y,v,w,S){const _=h(y,w,S),k=m([_]);return k.slice(0,k.indexOf(`
`))}function d(y,v,w,S){const _=w.enter("tableCell"),k=w.enter("phrasing"),C=w.containerPhrasing(y,{...S,before:o,after:o});return k(),_(),C}function m(y,v){return P$(y,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function p(y,v,w){const S=y.children;let _=-1;const k=[],C=v.enter("table");for(;++_<S.length;)k[_]=h(S[_],v,w);return C(),k}function h(y,v,w){const S=y.children;let _=-1;const k=[],C=v.enter("tableRow");for(;++_<S.length;)k[_]=d(S[_],y,v,w);return C(),k}function g(y,v,w){let S=KN.inlineCode(y,v,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function C7(){return{exit:{taskListCheckValueChecked:jw,taskListCheckValueUnchecked:jw,paragraph:E7}}}function j7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:N7}}}function jw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function E7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function N7(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let d=KN.listItem(e,t,n,{...r,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(p){return p+a}}function I7(){return[a$(),N$(),A$(),y7(),C7()]}function T7(e){return{extensions:[l$(),I$(e),M$(),w7(e),j7()]}}const R7={tokenize:z7,partial:!0},ZN={tokenize:P7,partial:!0},QN={tokenize:B7,partial:!0},JN={tokenize:$7,partial:!0},A7={tokenize:H7,partial:!0},eI={name:"wwwAutolink",tokenize:O7,previous:nI},tI={name:"protocolAutolink",tokenize:L7,previous:rI},Cs={name:"emailAutolink",tokenize:D7,previous:iI},Ki={};function M7(){return{text:Ki}}let Mo=48;for(;Mo<123;)Ki[Mo]=Cs,Mo++,Mo===58?Mo=65:Mo===91&&(Mo=97);Ki[43]=Cs;Ki[45]=Cs;Ki[46]=Cs;Ki[95]=Cs;Ki[72]=[Cs,tI];Ki[104]=[Cs,tI];Ki[87]=[Cs,eI];Ki[119]=[Cs,eI];function D7(e,t,n){const r=this;let i,o;return a;function a(h){return!zy(h)||!iI.call(r,r.previous)||sv(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return zy(h)?(e.consume(h),u):h===64?(e.consume(h),d):n(h)}function d(h){return h===46?e.check(A7,p,m)(h):h===45||h===95||_r(h)?(o=!0,e.consume(h),d):p(h)}function m(h){return e.consume(h),i=!0,d}function p(h){return o&&i&&Er(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function O7(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!nI.call(r,r.previous)||sv(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(R7,e.attempt(ZN,e.attempt(QN,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function L7(e,t,n){const r=this;let i="",o=!1;return a;function a(h){return(h===72||h===104)&&rI.call(r,r.previous)&&!sv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Er(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(h),d}return n(h)}function d(h){return h===47?(e.consume(h),o?m:(o=!0,d)):n(h)}function m(h){return h===null||Uf(h)||hn(h)||Uo(h)||Em(h)?n(h):e.attempt(ZN,e.attempt(QN,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function z7(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function P7(e,t,n){let r,i,o;return a;function a(m){return m===46||m===95?e.check(JN,d,u)(m):m===null||hn(m)||Uo(m)||m!==45&&Em(m)?d(m):(o=!0,e.consume(m),a)}function u(m){return m===95?r=!0:(i=r,r=void 0),e.consume(m),a}function d(m){return i||r||!o?n(m):t(m)}}function B7(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(JN,t,o)(a):a===null||hn(a)||Uo(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function $7(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||hn(u)||Uo(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||hn(u)||Uo(u)?t(u):r(u)}function o(u){return Er(u)?a(u):n(u)}function a(u){re Line truncated
`),m=d.length>dH,p=m?d.length-Pg*2:0,h=E.useCallback(()=>{navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1500)},[a]);return c.jsxs("div",{className:"code-block-wrap",children:[c.jsxs("div",{className:"code-block-header",children:[c.jsxs("span",{className:"code-block-lang",children:[u||"code",m?` (${d.length} lines)`:""]}),c.jsx("button",{className:"code-block-copy",onClick:h,children:n?c.jsxs(c.Fragment,{children:[c.jsx(vl,{})," ",c.jsx("span",{children:"Copied"})]}):c.jsxs(c.Fragment,{children:[c.jsx(hm,{})," ",c.jsx("span",{children:"Copy"})]})})]}),c.jsx("pre",{children:c.jsx("code",{className:e,children:m&&!i?c.jsxs(c.Fragment,{children:[d.slice(0,Pg).join(`
`)+`
`,c.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",p," lines (click to expand)"]}),`
`+d.slice(-Pg).join(`
`)]}):a})}),m&&i&&c.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const mH={code({className:e,children:t,...n}){return e?.startsWith("language-")?c.jsx(fH,{className:e,children:t}):c.jsx("code",{className:e,...n,children:t})}},hH=3e3,pH=60,Bg=800;function Nw(e){if(e.length>hH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=pH)return!0;return!1}function gH(e){const t=e.lastIndexOf(`
`,Bg);return e.slice(0,t>Bg/2?t:Bg)}const rr=Ct.memo(function({content:t,className:n="msg-content-agent",collapseMode:r="auto"}){const i=r!=="never"&&Nw(t),[o,a]=E.useState(i);E.useEffect(()=>{a(r!=="never"&&Nw(t))},[r,t]);const u=o?gH(t):t,d=t.split(`
`).length,m=t.length;return c.jsxs("div",{className:n,children:[c.jsx(Z9,{remarkPlugins:[uH],components:mH,children:u}),i&&o&&c.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),i&&!o&&c.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),Iw={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},lu="codex",$g="native",xH=["codex","native","claude_code","cursor","opencode"],yH=["native","codex","claude_code","cursor","opencode"];function sI(e){if(!e)return{kind:"fallback"};if(e.kind==="employee"){const t=String(e.id??e.employee_id??"").trim();return t?{kind:"employee",id:t}:{kind:"fallback"}}if(e.kind==="template"){const t=String(e.id??e.template_id??"").trim();return t?{kind:"template",id:t}:{kind:"fallback"}}return{kind:"fallback"}}function oI(e){const t=sI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function vH(e,t,n){const r=String(e.role_id??"").trim(),i=String(e.role_label??"").trim(),o=`${r} ${i} ${e.role_responsibility??""}`.toLowerCase(),a=new Set((e.same_role_employee_ids??[]).map(m=>String(m??"").trim()).filter(Boolean)),u=t.map(m=>{const p=String(m.employee_id??"").trim(),h=String(m.employee_name??p).trim()||p,g=String(m.role_id??"").trim(),y=String(m.category??"").trim(),v=[g,y].filter(Boolean).join(" · ")||p;return{kind:"employee",id:p,name:h,subtitle:v,category:y,searchText:`${p} ${h} ${g} ${y} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),rank:a.has(p)||g===r?0:2}}).filter(m=>m.id).sort((m,p)=>m.rank-p.rank||m.name.localeCompare(p.name)),d=n.map(m=>{const p=String(m.template_id??"").trim(),h=String(m.template_name??p).trim()||p,g=String(m.category??"").trim(),y=[g,p].filter(Boolean).join(" · ")||p,v=`${p} ${h} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),w=o.split(/[^a-z0-9]+/).filter(S=>S.length>=3).reduce((S,_)=>S+(v.includes(_)?1:0),0);return{kind:"template",id:p,name:h,subtitle:y,category:g,searchText:v,rank:w}}).filter(m=>m.id).sort((m,p)=>p.rank-m.rank||m.name.localeCompare(p.name));return[...u,...d,{kind:"fallback",id:"",name:"Fallback role-only",subtitle:"No employee override",category:"fallback",searchText:"fallback role only no employee override"}]}function bH(e,t){const n=oI(t);return e.find(r=>`${r.kind}:${r.id}`===n)??e[0]}function _H(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(r=>e.searchText.includes(r))}function kH(e){return e.map(t=>{const n=String(t.role_id??"").trim(),r=String(t.existing_employee?.employee_id??"").trim(),i=String(t.candidate?.template_id??"").trim(),o=r?{kind:"employee",id:r}:i?{kind:"template",id:i}:{kind:"fallback"};return{role_id:n,role_label:t.role_labels?.[0]??n,role_responsibility:"",default_selection:o,same_role_employee_ids:t.existing_employee_ids??[],fallback_available:!0,default_agent:t.default_agent??lu,selected_agent:t.selected_agent??t.default_agent??lu,default_source:"recruitment"}}).filter(t=>t.role_id)}function SH(e,t){return t.kind==="template"&&e?.candidate?.template_id===t.id?e.candidate.proposed_name||e.candidate.template_name||t.name:t.kind==="employee"&&e?.existing_employee?.employee_id===t.id&&e.existing_employee.employee_name||t.name}function Tw(e,t){const n={},r=e.staffing_selections??{};for(const i of t){const o=String(i.role_id??"").trim();o&&(n[o]=sI(r[o]??i.default_selection))}return n}function Rw(e,t){const n=e.recruitment_role_agents??{},r={};for(const i of t){const o=String(i.role_id??"").trim();o&&(r[o]=n[o]??i.selected_agent??i.default_agent??lu)}return r}function wH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const aI=Ct.memo(function({meta:t,onReply:n,responded:r}){const i=t.proposals??[],o=E.useMemo(()=>{const O={};for(const M of i){const A=String(M.role_id??"").trim();A&&(O[A]=M)}return O},[i]),a=E.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:kH(i),[t.staffing_roles,i]),u=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],p=E.useMemo(()=>{const O={};for(const M of a){const A=String(M.role_id??"").trim();A&&(O[A]=vH(M,u,d))}return O},[u,a,d]),[h,g]=E.useState({}),[y,v]=E.useState(""),[w,S]=E.useState(()=>Tw(t,a)),[_,k]=E.useState(()=>Rw(t,a)),[C,N]=E.useState(t.recruitment_agent??$g),L=r;E.useEffect(()=>{!L||!wH(t)||(S(Tw(t,a)),k(Rw(t,a)),N(t.recruitment_agent??$g))},[L,t,a]),E.useEffect(()=>{N(t.recruitment_agent??$g)},[t.recruitment_agent]);const I=E.useCallback(O=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const A=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:M,response_to_checkpoint_type:A||"company_recruitment_confirmation",checkpoint_reply_kind:O,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function MH(e){switch(e){case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const Yf=Ct.memo(function({meta:t,onReply:n,responded:r}){const i=r,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=MH(o),u=String(t.prompt??t.summary??""),d=E.useMemo(()=>u.split(`
`).map(k=>k.trim()).filter(Boolean),[u]),m=AH(u).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",p=d.slice(1).join(`
`).trim(),h=String(t.summary??"").trim(),g=(t.options??[]).filter(k=>!!k?.id),y=E.useMemo(()=>(t.active_subagents??[]).filter(k=>!!k&&typeof k=="object"),[t.active_subagents]),v=E.useMemo(()=>(t.permission_requests??[]).filter(k=>!!k&&typeof k=="object"),[t.permission_requests]),w=String(t.worktree_path??"").trim(),S=y.length>0||v.length>0||!!w,_=E.useCallback(k=>{i||n(k.label||k.id)},[i,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),c.jsx("path",{d:"M8 5.5V9"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),h&&h!==m&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(rr,{content:h,className:"ckpt-markdown"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(rr,{content:p,className:"ckpt-markdown"})]}),S&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[w&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:w})]}),y.length>0&&c.jsxs("div",{children:["Active subagents: ",y.length]}),v.length>0&&c.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!i&&g.length>0&&c.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(k=>c.jsx("button",{className:`ckpt-btn ${k.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}`,onClick:()=>_(k),children:k.label||k.id},k.id))}),!i&&t.default_action&&c.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",c.jsx("code",{children:t.default_action})]})]})});function DH(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function OH(e){switch(e){case"ignored":return"Ignored";case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"superseded":return"Superseded";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const fI=Ct.memo(function({meta:t,onReply:n,responded:r}){const i=r,[o,a]=E.useState(""),[u,d]=E.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),p=OH(m),h=String(t.prompt??t.summary??"").trim(),y=`${String(t.work_item_projection_title??DH(h)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),w=E.useMemo(()=>(t.active_subagents??[]).filter(T=>!!T&&typeof T=="object"),[t.active_subagents]),S=E.useMemo(()=>(t.permission_requests??[]).filter(T=>!!T&&typeof T=="object"),[t.permission_requests]),_=String(t.worktree_path??"").trim(),k=w.length>0||S.length>0||!!_,C=i||u!==null,N=E.useCallback((T,O="")=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const A={response_to_checkpoint_id:M,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:T};return(T==="approve"||T==="feedback")&&(A.self_evolution_trigger=!0,A.human_feedback_text=O),A},[t.checkpoint_id]),L=E.useCallback(()=>{if(C)return;const T=N("approve");d("approve"),n("I fully agree with this delivery.",T)},[C,N,n]),I=E.useCallback(()=>{const T=o.trim();if(C||!T)return;const O=N("feedback",T);d("feedback"),n(T,O),a("")},[C,N,o,n]),D=E.useCallback(()=>{if(C)return;const T=N("ignore");d("ignore"),n("Ignore this self-evolution review.",T)},[C,N,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14 5v4.5c0 2.25-1.8 4.25-6 5-4.2-.75-6-2.75-6-5V5L8 1.5Z"}),c.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),c.jsx("div",{className:"ckpt-title",children:y}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:p})]}),v&&v!==y&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(rr,{content:v,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),c.jsx(rr,{content:h,className:"ckpt-markdown"})]}),k&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[_&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:_})]}),w.length>0&&c.jsxs("div",{children:["Active subagents: ",w.length]}),S.length>0&&c.jsxs("div",{children:["Pending permission records: ",S.length]})]})]}),!i&&c.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:L,disabled:C,children:"Fully Agree"}),c.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:C,children:"Ignore"}),c.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:T=>a(T.target.value),disabled:C,rows:2}),c.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:I,disabled:C||!o.trim(),children:"Send Feedback"})]})]})}),Wd="__other__",LH=["A","B","C"];function Hi(e){return String(e??"").trim()}function zH(e,t){const n=Hi(e.question),r=Hi(e.header);if(!n&&!r)return null;const i=(e.options??[]).slice(0,3).map((o,a)=>({id:Hi(o.id)||String.fromCharCode(97+a),label:Hi(o.label),description:Hi(o.description)})).filter(o=>o.label);return{id:Hi(e.id)||`question_${t+1}`,header:r,question:n||r,options:i,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const mI=Ct.memo(function({meta:t,onReply:n,responded:r}){const[i,o]=E.useState(""),[a,u]=E.useState({}),d=r,m=String(t.work_item_projection_title??t.work_item_projection_id??"Input Needed").trim()||"Input Needed",p=String(t.summary??"").trim(),h=String(t.prompt??"").trim(),g=String(t.context_note??"").trim(),y=String(t.resume_hint??"").trim(),v=E.useMemo(()=>(t.questions??[]).map(V=>String(V).trim()).filter(Boolean),[t.questions]),w=E.useMemo(()=>(t.input_questions??[]).map((V,W)=>zH(V,W)).filter(V=>V!==null),[t.input_questions]),S=w.some(V=>(V.options??[]).length>0),_=E.useMemo(()=>(t.required_fields??[]).map(V=>String(V).trim()).filter(Boolean),[t.required_fields]),k=E.useMemo(()=>(t.active_subagents??[]).filter(V=>!!V&&typeof V=="object"),[t.active_subagents]),C=E.useMemo(( Line truncated
`),{user_input_answers:V})},[a,B,w,d,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),c.jsx("path",{d:"M5.5 6h5"}),c.jsx("path",{d:"M5.5 8h3.5"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(rr,{content:p,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(rr,{content:h,className:"ckpt-markdown"})]}),S?c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("div",{className:"ckpt-choice-list",children:w.map(V=>{const W=a[V.id]??{freeformText:""},Z=V.options??[],q=V.allow_freeform!==!1,U=q&&(Z.length===0||W.selectedOptionId===Wd);return c.jsxs("div",{className:"ckpt-choice-question",children:[V.header&&c.jsx("div",{className:"ckpt-question-header",children:V.header}),c.jsx(rr,{content:V.question,className:"ckpt-markdown"}),Z.length>0&&c.jsxs("div",{className:"ckpt-choice-grid",children:[Z.map((ee,P)=>{const K=W.selectedOptionId===ee.id;return c.jsxs("button",{className:`ckpt-choice-option${K?" is-selected":""}`,onClick:()=>A(V.id,ee.id),children:[c.jsx("span",{className:"ckpt-choice-letter",children:LH[P]??"?"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:ee.label}),ee.description&&c.jsx("span",{className:"ckpt-choice-desc",children:ee.description})]})]},ee.id)}),q&&c.jsxs("button",{className:`ckpt-choice-option${W.selectedOptionId===Wd?" is-selected":""}`,onClick:()=>A(V.id,Wd),children:[c.jsx("span",{className:"ckpt-choice-letter",children:"D"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:"Other"}),c.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),U&&c.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:W.freeformText,onChange:ee=>$(V.id,ee.target.value),rows:3})]},V.id)})})]}):v.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("ul",{className:"ckpt-task-list",children:v.map(V=>c.jsx("li",{children:V},V))})]}),_.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),c.jsx("div",{className:"ckpt-task-tags",children:_.map(V=>c.jsx("span",{className:"ckpt-field-tag",children:V},V))})]}),g&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Context"}),c.jsx(rr,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),y&&c.jsx("div",{className:"ckpt-escalation-hint",children:y}),M&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[L&&c.jsxs("div",{children:["Requester: ",c.jsx("code",{children:L})]}),D&&c.jsxs("div",{children:["Work item: ",c.jsx("code",{children:D})]}),I&&c.jsxs("div",{children:["Task: ",c.jsx("code",{children:I})]}),T&&c.jsxs("div",{children:["Seat: ",c.jsx("code",{children:T})]}),N&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:N})]}),k.length>0&&c.jsxs("div",{children:["Active subagents: ",k.length]}),C.length>0&&c.jsxs("div",{children:["Pending permission records: ",C.length]})]})]}),!d&&c.jsxs("div",{className:"ckpt-feedback-area",children:[S?null:c.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:i,onChange:V=>o(V.target.value),rows:3}),c.jsx("div",{className:"ckpt-feedback-btns",children:c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:S?H:G,disabled:S?!B:!i.trim(),children:"Send Reply"})})]})]})}),By={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function Fg(e,t){if(t&&t in By)return t;switch(e){case"active":return"in_progress";case"waiting":return"in_review";case"done":return"done";case"failed":return"done";case"pending":return"todo";default:return"todo"}}function Yd(e){return By[e]??By.todo}const Lw={active:0,waiting:1,failed:2,done:3,pending:4};function PH(e){if(e.length===0)return"pending";let t=e[0],n=Lw[t]??99;for(const r of e){const i=Lw[r]??99;i<n&&(t=r,n=i)}return t}const BH={native:"Native",codex:"Codex",claude_code:"Claude Cod Line truncated
`)[0].slice(0,140),tone:"danger"};const o=t.match(/^\[Company:([^\]]+)\]\s*(.+)$/);if(o){const d=o[1].split("::"),m=d[0]||"company",p=o[2].trim(),h=p.toLowerCase(),g=h.includes("completed")||h.includes("done")?"success":h.includes("blocked")||h.includes("failed")?"warning":"info";return{kind:"company_event",label:`${m.toUpperCase()} · ${d[1]??""}`.replace(/ · $/,""),summary:p,tone:g}}const a=t.match(/^(Review needed|Status digest|Blocked|Completion):\s*(.+)$/i);if(a){const d=a[1].replace(/\b\w/g,p=>p.toUpperCase()),m=Gc(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const u=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return u?{kind:"company_event",label:"Delegation check",summary:Gc(u[1]).slice(0,180),tone:"info"}:null}function pF(e,t){const{isCompanyRuntime:n,detailMode:r}=t;if(!n||r==="full"||Zc(e.metadata))return null;const i=pI(e.content);if(!i)return null;const o=e.sender==="system"||e.metadata?.type==="system",a=i.kind==="company_event"||e.content.startsWith("[Company:");return!o&&!a?null:{msg:e,classification:i}}function gF(e,t={}){const{isCompanyRuntime:n=!1,detailMode:r="summary"}=t,i=[];let o=[],a=0;const u=new Set,d=new Set,m=()=>{if(o.length===0)return;const p=o[0].msg,h=o[o.length-1].msg;i.push({kind:"ops-bundle",id:`ops:${p.id}:${o.length}:${h.id}`,timestamp:p.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((p,h)=>{const g=h*2+1,y=pF(p,{isCompanyRuntime:n,detailMode:r});if(y){o.length===0&&(a=g),o.push(y);return}const v=r==="summary"?hI(p.content):null;if(v){const w=[p.sender,Math.round(p.timestamp/1e3),v.kind,Gc(v.summary||v.acceptanceSummary||"").slice(0,500),v.verdict??"",v.deliverables.map(S=>`${S.name}:${S.path}`).join("|").slice(0,800)].join("");if(u.has(w))return;u.add(w)}if(r==="summary"){const w=Gc(iF(p.content)).slice(0,1200);if(w){const S=sF(p)?["result",w].join(""):[p.sender,Math.round(p.timestamp/1e3),w].join("");if(d.has(S))return;d.add(S)}}m(),i.push({kind:"message",id:p.id,timestamp:p.timestamp,msg:p,sortOrder:g})}),m(),i}const xF=Ct.memo(function({msg:t,showDate:n,dateStr:r,classification:i}){const[o,a]=E.useState(!1),u=t.content.trim()!==`[${i.label}] ${i.summary}`.trim()&&t.content.trim().length>i.summary.length+4;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("div",{className:`msg-ops-row msg-ops-tone-${i.tone}${o?" expanded":""}`,onClick:u?()=>a(d=>!d):void 0,role:u?"button":void 0,tabIndex:u?0:-1,children:[c.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),c.jsx("span",{className:"msg-ops-label",children:i.label}),i.summary&&c.jsx("span",{className:"msg-ops-summary",title:i.summary,children:i.summary}),c.jsx("span",{className:"msg-ops-time",title:Wi(t.timestamp),children:Ss(t.timestamp)}),u&&c.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:c.jsx(_s,{down:o})})]}),u&&o&&c.jsx("div",{className:"msg-ops-details",children:c.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),yF=Ct.memo(function({events:t,showDate:n,dateStr:r}){const[i,o]=E.useState(!1);if(t.length===0)return null;const a=t[0].msg,u=t[t.length-1].msg,d=t.reduce((h,g)=>{const y=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return h[y]=(h[y]??0)+1,h},{}),m=Object.entries(d).map(([h,g])=>`${g} ${h}`).join(" · "),p=`${t.length} technical event${t.length===1?"":"s"} hidden`;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("button",{type:"button",className:`msg-ops-bundle${i?" expanded":""}`,onClick:()=>o(h=>!h),title:`${Wi(a.timestamp)} - ${Wi(u.timestamp)}`,children:[c.jsx("span",{className:"msg-ops-bundle-dot"}),c.jsx("span",{className:"msg-ops-bundle-title",children:p}),c.jsx("span",{className:"msg-ops-bundle-summary",children:m}),c.jsx("span",{className:"msg-ops-bundle-time",children:Ss(a.timestamp)}),c.jsx("span",{className:"msg-ops-bundle-chevron",children:c.jsx(_s,{down:i})})]}),i&&c.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:h,classification:g})=>c.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[c.jsx("span",{className:"msg-ops-dot"}),c.jsx("span",{className:"msg-ops-label",children:g.label}),c.jsx("span",{className:"msg-ops-summary",children:g.summary}),c.jsx("span",{className:"msg-ops-time",title:Wi(h.timestamp),children:Ss(h.timestamp)})]},h.id))})]})});function vF(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const bF=Ct.memo(function({msg:t,payload:n,showDate:r,dateStr:i,isCopied:o,onCopy:a}){const u=ov(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=vF(n),p=n.summary||n.acceptanceSummary||m;return c.jsxs("div",{children:[r&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("spa Line truncated
Set up at least one role before running a task.
Go to Org tab now?`)&&n?.(),!1;if(a.length>1&&!u)return confirm(`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(r.map(y=>y.role_id));o.runtimeTeams.filter(y=>y.member_role_ids.some(v=>m.has(v))||y.manager_role_id&&m.has(y.manager_role_id)).length===0&&d.push("No runtime teams defined — the system will auto-generate from your roles");const h=new Set(i.map(y=>y.role_id)),g=r.filter(y=>!h.has(y.role_id));if(g.length>0){const y=g.map(v=>v.name).join(", ");d.push(`${g.length} role(s) have no employees: ${y}`)}return d.length>0?confirm(`Before running this task:
`+d.map(y=>"• "+y).join(`
`)+`
Run anyway?`):!0}function eV(e){if(!e)return!1;const t=jm(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function Jw(e,t){const n=!!t?.childDetail;return e?n?"full":e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function eC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function tV({boardColor:e,title:t,onCommit:n}){const[r,i]=E.useState(!1),[o,a]=E.useState(t),u=E.useRef(null);E.useEffect(()=>{r||a(t)},[t,r]);const d=E.useCallback(()=>{const p=o.trim();p&&p!==t?n(p):a(t),i(!1)},[o,t,n]),m=E.useCallback(()=>{a(t),i(!0),setTimeout(()=>u.current?.select(),0)},[t]);return c.jsx("div",{className:"board-selector",children:c.jsx("div",{className:"board-tabs",children:c.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[c.jsx("span",{className:"board-tab-dot",style:{background:e}}),r?c.jsx("input",{ref:u,className:"board-tab-title-input",value:o,onChange:p=>a(p.target.value),onBlur:d,onKeyDown:p=>{p.key==="Enter"&&d(),p.key==="Escape"&&(a(t),i(!1))}}):c.jsx("span",{className:"board-tab-title",onClick:m,title:"Click to edit session title",children:t})]})})})}function nV({boardStore:e,agents:t,officeMap:n,execMode:r,companyProfile:i,taskPreferredAgent:o,chatStore:a,sessionStore:u,projectId:d,onRunTask:m,onCreateTask:p,onMoveTask:h,onCreateSession:g,onSessionSend:y,onSecretarySend:v,onDeleteSession:w,onTitleChange:S,onSessionConfigChange:_,onSessionTaskAgentChange:k,onContinueInNewChat:C,onSessionStop:N,onSessionResume:L,onSessionComplete:I,onLoadSessionDetail:D,onOpenExecutionPanel:T,onCollabSync:O,orgInfoData:M,onNavigateToOrg:A,recoveryStatus:$,onRecoveryResume:Y,onRecoveryCancel:B,commsState:G,commsMessage:H,onCommsRefresh:V,onCommsReadMessage:W,savedOrgsList:Z,activeSavedOrg:q,onSavedOrgsList:U,onSavedOrgLoad:ee}){const{sessions:P,activeSessionId:K,activeSession:J}=u,[te,re]=E.useState("collapsed"),{width:oe,isResizing:fe,handleMouseDown:se}=KF({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>re("collapsed")}),[je,Se]=E.useState("chat"),[Ce,He]=E.useState(null),[We,Ye]=E.useState({kind:"activity"}),[gt,Ut]=E.useState([]),[bt,xt]=E.useState(!1),[me,Oe]=E.useState({}),it=E.useRef(D),et=E.useRef({active:null,child:null}),nt=r==="company"||r==="org"||r==="custom",de=`secretary:${d}`,ve=`activity:${d}`,Ae=E.useMemo(()=>Ce?P.find(ue=>ue.taskId===Ce)??null:null,[P,Ce]),Ue=E.useMemo(()=>We.kind!=="task-detail"?null:e.tasks.find(ue=>ue.id===We.taskId)??null,[We,e.tasks]),Fe=E.useMemo(()=>{const ue=Cm(Ue);return ue?P.find(be=>be.taskId===ue||be.runtimeTaskId===ue||be.executionTurnId===ue)??null:null},[P,Ue]),vt=E.useMemo(()=>Fe?a.getChannelMessages(Fe.channelId):[],[a.messages,a.getChannelMessages,Fe]),Rt=E.useMemo(()=>pf(J,P),[P,J]),ke=E.useMemo(()=>If(J,P),[P,J]),Re=E.useMemo(()=>Tf(J,[...ke,...Rt]),[J,Rt,ke]);E.useEffect(()=>{it.current=D},[D]);const Ke=E.useCallback((ue,be,Be="summary")=>{const mt=it.current;!mt||!ue||(Oe(vn=>vn[ue]?vn:{...vn,[ue]:!0}),mt(ue,{limit:ZF,beforeCreatedAt:be?.timestamp,beforeMessageId:be?.id,detailLevel:Be}),window.setTimeout(()=>{Oe(vn=>vn[ue]?{...vn,[ue]:!1}:vn)},800))},[]),Ge=E.useCallback(ue=>!!me[ue],[me]);E.useEffect(()=>{et.current={active:null,child:null}},[d]),E.useEffect(()=>{Ce&&!Ae&&He(null)},[Ce,Ae]),E.useEffect(()=>{We.kind==="task-detail"&&!Ue&&Ye({kind:"activity"})},[We,Ue]);const tt=E.useRef(null);E.useEffect(()=>{if(!Fe){tt.current=null;return}tt.current!==Fe.taskId&&(tt.current=Fe.taskId,Ke(Fe.taskId,void 0,"full"))},[Fe,Ke]),E.useEffect(()=>{if(!Ce){et.current.child=null;return}et.current.child!==Ce&&(et.current.child=Ce,Ke(Ce,void 0,"full"))},[Ce,Ke]),E.useEffect(()=>{if(!K){et.current.active=null;return}const ue=Re.timelineSessions.length>0?Re.timelineSessions:P.find(Be=>Be.taskId===K)?[P.find(Be=>Be.taskId===K)]:[];if(ue.length===0){et.current.active=null;return}const be=ue.map(Be=>`${Be.taskId}:${Jw(Be,{childDetail:Be.mode==="child"})}`).join("|");if(et.current.active!==be){et.current.active=be;for(const Be of ue)Ke(Be.taskId,void 0,Jw(Be,{childDetail:Be.mode==="child"}))}},[Re.timelineSessions,K,Ke,P]);const Qe=E.useMemo(()=>Ce?{kind:"child-detail"}:We.kind==="task-detail"||We.kind==="secretary"?We:K?{kind:"session",taskId:K}:{kind:"activity"},[We,K,Ce]),xn=E.useMemo(()=>Qe.kind==="secretary"?de:Qe.kind==="child-detail"&&Ae?Ae.channelId:Qe.kind==="session"&&Re.displaySession?Re.displaySession.channelId:Qe.kind==="session"&&J?J.channelId:ve,[Qe,Re.displaySession,J,Ae,de,ve]),Qt=E.useMemo(()=>{if(Qe.kind==="activity")return[ve];if(Qe.kind==="secretary")return[de];if(Qe.kind==="child-detail"&&Ae)return[Ae.channelId];if(Qe.kind==="session"){const ue=Re.timelineSessions.map(be=>be.channelId).filter((be,Be,mt)=>!!be&&mt.indexOf(be)===Be);if(ue.length>0)return ue}return xn?[xn]:[]},[Qe.kind,Re.timelineSessions,Ae,ve,de,xn]),kn=E.useMemo(()=>{const ue=new Set;for(const be of P)be.status!=="cancelled"&&ue.add(be.channelId Line truncated
`).replace(/\r/g,`
`).split(`
`).map(i=>i.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim(),n=iV(t),r=n.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);return r.length>1&&/^Verification:\s/i.test(r[r.length-1])?r.slice(0,-1).join(`
`).trim():n}function iV(e){const t=String(e||"").trim(),n=t.match(/^\*\*(.{8,160}?)\*\*:\s+([\s\S]+)$/);if(n){const a=n[2].trim();if(a.length>=80)return a}const r=t.indexOf(": ");if(r<8||r>160)return t;const i=t.slice(0,r).replace(/\*/g,"").trim(),o=t.slice(r+2).trim();return o.length<80||!/[A-Za-z\u4e00-\u9fff]/.test(i)||/^(https?|file)$/i.test(i)?t:o}function qo(e){const t=Go(e),n=new Set,r=typeof t.checkpoint_type=="string"?t.checkpoint_type.trim():"",i=typeof t.checkpoint_id=="string"?t.checkpoint_id.trim():"";for(const o of[e.id,typeof t.ui_message_id=="string"?t.ui_message_id:"",r&&i?`checkpoint:${r}:${i}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function sV(e){return e.startsWith("checkpoint:")}function Gi(e){return typeof e.timestamp=="number"?e.timestamp:0}function nC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Go(e),r=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||r==="user"?"user":"assistant"}function rC(e){const t=Go(e),n=String(e.sender??"").trim().toLowerCase();let r=0;const i=vI(e);return i&&(r+=1e3+i),t.source==="engine"&&(r+=100),n&&n!=="system"&&(r+=20),n&&!["assistant","system","user"].includes(n)&&(r+=5),e.replyToId&&(r+=2),r+=Math.min(Object.keys(t).length,10),r}function iC(e){return String(Go(e).source??"").trim().toLowerCase()==="engine"}function vI(e){const t=Go(e),n=String(t.transcript_kind??"").trim();if(n)return tC[n]??0;const r=String(t.kind??"").trim();return tC[r]??0}function Kf(e){return vI(e)>0}function bI(e,t){if(e.channelId!==t.channelId)return!1;const n=qo(e),r=qo(t);for(const i of n)if(r.has(i))return!0;return!1}function Vy(e,t){if(bI(e,t))return!0;if(e.channelId!==t.channelId||nC(e)!==nC(t)||Xf(e.content)!==Xf(t.content))return!1;const n=Kf(e)&&Kf(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(iC(e)||iC(t)))return!1;const r=Gi(e),i=Gi(t);return!(!n&&r&&i&&Math.abs(r-i)>cv)}function Uy(e,t,n=!1){let r=e,i=t;(n||rC(t)>rC(e))&&(r=t,i=e);const o=[];for(const h of[i.mentions,r.mentions])for(const g of h??[])o.includes(g)||o.push(g);const a=qo(e),u=qo(t);let d="";for(const h of a)if(u.has(h)&&!sV(h)){d=h;break}const m=Xf(r.content),p=m&&m===Xf(i.content)?m:r.content;return{...i,...r,...d?{id:d}:{},content:p,metadata:{...Go(i),...Go(r)},mentions:o,timestamp:Gi(r)||Gi(i)}}function Kg(e){const t=[],n=new Map;for(const r of[...e].sort((i,o)=>Gi(i)-Gi(o))){const i=qo(r);let o=-1,a=!1;for(const d of i){const m=n.get(d);if(m!==void 0){o=m,a=t[m].id===r.id;break}}if(o===-1){const d=Gi(r),m=Kf(r);for(let p=t.length-1;p>=0;p--){const h=Gi(t[p]);if(!m&&d>0&&h>0&&d-h>cv)break;if(Vy(t[p],r)){o=p;break}}}const u=o===-1?t.length:o;o===-1?t.push(r):t[o]=Uy(t[o],r,a);for(const d of qo(t[u]))n.has(d)||n.set(d,u)}return t}function oV(e,t){switch(t.type){case"SET":return t.channels;case"CLEAR":return[];case"ADD":return e.some(n=>n.id===t.channel.id)?e:[...e,t.channel];case"REMOVE":return e.filter(n=>n.id!==t.channelId);case"REMOVE_PARTICIPANT":return e.map(n=>({...n,participants:n.participants.filter(r=>r!==t.agentId)}));default:return e}}function aV(e,t){switch(t.type){case"SET":{const n=Kg(t.messages);if(e.length===0)return n;const r=e.filter(i=>typeof i.id=="string"&&i.id.startsWith("msg-")&&!n.some(o=>Vy(i,o)));return r.length===0?n:Kg([...n,...r])}case"CLEAR":return[];case"ADD":{const n=Gi(t.message);qo(t.message);let r=!1;for(let i=e.length-1;i>=0;i--){const o=Gi(e[i]);if(!r&&n>0&&o>0&&n-o>cv&&(r=!0),bI(e[i],t.message)){const a=[...e];return a[i]=Uy(e[i],t.message,e[i].id===t.message.id),a}if((Kf(t.message)||!r)&&Vy(e[i],t.message)){const a=[...e];return a[i]=Uy(e[i],t.message),a}}return[...e,t.message]}case"MERGE":return t.messages.length===0?e:Kg([...e,...t.messages]);case"MARK_SENDER_DELETED":return e.map(n=>n.sender===t.senderId?{...n,senderDeleted:!0,senderName:"[已删除的 Agent]"}:n);case"REMOVE_BY_CHANNEL":return e.filter(n=>n.channelId!==t.channelId);case"REMOVE_BY_TASK_ID":return e.filter(n=>n.channelId!==`session:${t.taskId}`&&n.metadata?.task_id!==t.taskId);default:return e}}function lV(){const[e,t]=E.useReducer(oV,[]),[n,r]=E.useReducer(aV,[]),[i,o]=E.useState({}),[a,u]=E.useState("default"),d=E.useMemo(()=>{const I={};for(const D of n)I[D.channelId]||(I[D.channelId]=[]),I[D.channelId].push(D);return I},[n]),m=E.useMemo(()=>{const I={};for(const D of n){if(D.sender==="user")continue;const T=i[D.channelId]??0;D.timestamp<=T||(I[D.channelId]=(I[D.channelId]??0)+1)}return I},[n,i]),p=E.useCallback(I=>{const D={id:`msg-${rV()}`,channelId:I.channelId,sender:I.sender,senderName:I.senderName,content:I.content,timestamp:Date.now(),replyToId:I.replyToId,mentions:[],metadata:I.metadata};return r({type:"ADD",message:D}),D},[]),h=E.useCallback(I=>d[I]??[],[d]),g=E.useCallback(I=>m[I]??0,[m]),y=E.useCallback(I=>{o(D=>({...D,[I]:Date.now()}))},[]),v=E.useCallback(I=>{r({type:"MARK_SENDER_DELETED",senderId:I})},[]),w=E.useCallback(I=>{t({type:"REMOVE_PARTICIPANT",agentId:I})},[]),S=E.useCallback(I=>{t({type:"REMOVE",channe Line truncated
${t}`:`${e}${t}`}function cV(e,t){return"Thinking"}function uV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,summary:typeof e.summary=="string"?e.summary:"",detail:typeof e.detail=="string"&&e.detail?e.detail:void 0,turnId:typeof e.turnId=="string"&&e.turnId?e.turnId:void 0,itemId:typeof e.itemId=="string"&&e.itemId?e.itemId:void 0,streamId:typeof e.streamId=="string"&&e.streamId?e.streamId:void 0,toolCallId:typeof e.toolCallId=="string"&&e.toolCallId?e.toolCallId:void 0,permissionGroupKey:typeof e.permissionGroupKey=="string"&&e.permissionGroupKey?e.permissionGroupKey:void 0,seq:typeof e.seq=="number"&&Number.isFinite(e.seq)?e.seq:void 0,executionMode:typeof e.executionMode=="string"&&e.executionMode?e.executionMode:void 0}}function Zf(e){const t=e.itemId||e.streamId;return t?`${e.type}:${e.turnId??""}:${t}`:e.toolCallId&&(e.type==="tool_call"||e.type==="autonomy")?`${e.type}:${e.turnId??""}:${e.toolCallId}`:e.permissionGroupKey&&e.type==="autonomy"?`${e.type}:${e.turnId??""}:${e.permissionGroupKey}`:""}function dV(e,t){const n=Zf(e),r=Zf(t);return n&&r?n===r:t.timestamp-e.timestamp>Am||e.type!==t.type?!1:e.type==="thinking"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function fV(e,t){return t.timestamp-e.timestamp<=Am&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function mV(e,t){if(e.type==="thinking"){const n=Gy(e.detail??e.summary,t.detail??t.summary,"thinking");return{timestamp:t.timestamp,type:"thinking",summary:cV(n,t.summary||e.summary),detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}if(e.type==="tool_call"){const n=Gy(e.detail??"",t.detail??"","tool_call");return{timestamp:t.timestamp,type:"tool_call",summary:t.summary||e.summary,detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}return t}function _I(e,t,n=100){const r=uV(t),i=Zf(r),o=i?[...e].reverse().findIndex(d=>Zf(d)===i):-1,a=o>=0?e.length-1-o:e.length-1,u=e[a];return u?i&&typeof u.seq=="number"&&typeof r.seq=="number"&&r.seq<=u.seq?e:fV(u,r)?Ja([...e.slice(0,a),{...u,timestamp:r.timestamp},...e.slice(a+1)],n):dV(u,r)?Ja([...e.slice(0,a),mV(u,r),...e.slice(a+1)],n):Ja([...e,r],n):[r]}function kI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>_I(n,r,t),[])}function hV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,workItemProjectionId:typeof e.workItemProjectionId=="string"&&e.workItemProjectionId?e.workItemProjectionId:void 0,workItemTurnType:typeof e.workItemTurnType=="string"&&e.workItemTurnType?e.workItemTurnType:void 0,workItemProjectionTitle:typeof e.workItemProjectionTitle=="string"&&e.workItemProjectionTitle?e.workItemProjectionTitle:void 0,runtimeTaskId:typeof e.runtimeTaskId=="string"&&e.runtimeTaskId?e.runtimeTaskId:void 0,executionTurnId:typeof e.executionTurnId=="string"&&e.executionTurnId?e.executionTurnId:void 0,roleName:typeof e.roleName=="string"&&e.roleName?e.roleName:void 0,detail:typeof e.detail=="string"&&e.detail?e.detail:void 0}}function SI(e,t){return e.type===t.type&&(e.workItemProjectionId??"")===(t.workItemProjectionId??"")&&(e.workItemTurnType??"")===(t.workItemTurnType??"")&&(e.workItemProjectionTitle??"")===(t.workItemProjectionTitle??"")&&(e.executionTurnId??e.runtimeTaskId??"")===(t.executionTurnId??t.runtimeTaskId??"")&&(e.roleName??"")===(t.roleName??"")}function pV(e,t){return t.timestamp-e.timestamp<=Am&&SI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function gV(e,t){return SI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Am}function xV(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:Gy(e.detail??"",t.detail??"",n)||void 0}}function wI(e,t,n=100){const r=hV(t),i=e[e.length-1];return i?gV(i,r)?Ja([...e.slice(0,-1),{...i,timestamp:r.timestamp}],n):pV(i,r)?Ja([...e.slice(0,-1),xV(i,r)],n):Ja([...e,r],n):[r]}function CI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>wI(n,r,t),[])}function qy(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function yV(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function jI(e){const t=String(e.execMode??"").trim().toLowerCase(),n=String(e.companyProfile??"").trim().toLowerCase(),r=String(e.orgId??"").trim(),o=t.length>0?qy(t):n==="custom"||r?"org":qy(t);return o==="org"?{...e,execMode:"org",companyProfile:"custom",orgId:r||void 0}:o==="company"?{...e,execMode:"company",companyProfile:"corporate",orgId:void 0}:{...e,execMode:"task",companyProfile:void 0,orgId:void Line truncated
`)),[O,M]=E.useState(!1),A=E.useRef(e.role_id);E.useEffect(()=>{A.current!==e.role_id&&(A.current=e.role_id,d(e.name),p(e.responsibility),g(e.reports_to),v(e.icon??null),S(new Set(e.can_spawn)),k(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),I(e.preferred_external_agent??null),T((e.prompt_refs??[]).join(`
`)),M(!1))},[e]);const $=E.useRef({}),Y=E.useRef(null),B=E.useRef(e.role_id);E.useEffect(()=>{B.current=e.role_id},[e.role_id]);const G=E.useCallback(()=>{Y.current&&(clearTimeout(Y.current),Y.current=null);const se=$.current;$.current={},Object.keys(se).length!==0&&i(B.current,se)},[i]),H=E.useCallback(se=>{r||($.current={...$.current,...se},Y.current&&clearTimeout(Y.current),Y.current=setTimeout(G,500))},[G,r]);E.useEffect(()=>()=>{Y.current&&(clearTimeout(Y.current),Y.current=null);const se=$.current;Object.keys(se).length>0&&($.current={},i(B.current,se))},[i]);const V=se=>{d(se),H({name:se})},W=se=>{p(se),H({responsibility:se})},Z=se=>{g(se),H({reports_to:se})},q=se=>{v(se),H({icon:se})},U=se=>{N(se),H({execution_strategy:se})},ee=se=>{I(se),H({preferred_external_agent:se})},P=se=>{T(se);const je=se.split(`
`).map(Se=>Se.trim()).filter(Boolean);H({prompt_refs:je})},K=se=>{const je=new Set(w);je.has(se)?je.delete(se):je.add(se),S(je),H({can_spawn:Array.from(je)})},J=se=>{const je=new Set(_);je.has(se)?je.delete(se):je.add(se),k(je),H({tools:Array.from(je)})},te=E.useMemo(()=>t.filter(se=>se.role_id!==e.role_id),[t,e.role_id]),re=E.useMemo(()=>n.filter(se=>(se.role_ids?.length?se.role_ids:[se.role_id]).includes(e.role_id)).length,[n,e.role_id]),oe=E.useMemo(()=>D.split(`
`).filter(se=>se.trim()).length,[D]),fe=()=>{if(!O){M(!0);return}G(),o(e.role_id)};return c.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[c.jsxs("header",{className:"ri-panel-header",children:[c.jsx("img",{src:Su(y),alt:"",className:"ri-panel-icon"}),c.jsxs("div",{className:"ri-panel-title-wrap",children:[c.jsx("h3",{className:"ri-panel-title",children:u||"(unnamed)"}),c.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),c.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),c.jsxs("div",{className:"ri-panel-body",children:[c.jsxs(Ba,{title:"Identity",defaultExpanded:!0,children:[c.jsx(ui,{label:"Name",children:c.jsx("input",{className:"ri-text-input",value:u,onChange:se=>V(se.target.value),disabled:r})}),c.jsx(ui,{label:"Responsibility",children:c.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:se=>W(se.target.value),disabled:r})}),c.jsx(ui,{label:"Icon",children:c.jsx(UV,{value:y,onChange:q,readOnly:r})})]}),c.jsxs(Ba,{title:"Hierarchy",defaultExpanded:!0,children:[c.jsx(ui,{label:"Reports to",children:c.jsxs("select",{className:"ri-select",value:h,onChange:se=>Z(se.target.value),disabled:r,children:[c.jsx("option",{value:"owner",children:"You (Owner)"}),te.map(se=>c.jsx("option",{value:se.role_id,children:se.name},se.role_id))]})}),c.jsx(ui,{label:"Can delegate to",children:c.jsx(GV,{allIds:te.map(se=>se.role_id),labelFor:se=>te.find(je=>je.role_id===se)?.name??se,selected:w,onToggle:K,readOnly:r})}),c.jsx(ui,{label:"Employees assigned",children:c.jsx("span",{className:"ri-meta-value",children:re})})]}),c.jsx(Ba,{title:`Tools (${_.size})`,children:c.jsx(qV,{tools:_,onToggle:J,readOnly:r})}),c.jsx(Ba,{title:`Prompts (${oe})`,children:c.jsx(ui,{label:"Prompt refs / inline",children:c.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:se=>P(se.target.value),disabled:r})})}),c.jsxs(Ba,{title:"Runtime policy",children:[c.jsx(ui,{label:"Execution strategy",children:c.jsx("div",{className:"ri-radio-group",children:FV.map(se=>c.jsxs("label",{className:"ri-radio",title:se.hint,children:[c.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:se.value,checked:C===se.value,onChange:()=>U(se.value),disabled:r}),se.label]},se.value))})}),C==="external"&&c.jsx(ui,{label:"Preferred external agent",children:c.jsxs("select",{className:"ri-select",value:L??"",onChange:se=>ee(se.target.value||null),disabled:r,children:[c.jsx("option",{value:"",children:"(any)"}),HV.map(se=>c.jsx("option",{value:se,children:se},se))]})})]}),c.jsxs(Ba,{title:"Advanced",children:[c.jsx(ui,{label:"Role type",children:c.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),c.jsx(ui,{label:"Skills",children:c.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),c.jsx(ui,{label:"Artifact contract",children:c.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!r&&c.jsx("footer",{className:"ri-panel-footer",children:c.jsx("button",{className:`btn btn-sm ${O?"btn-danger":"btn-ghost"}`,onClick:fe,onBlur:()=>M(!1),children:O?"Confirm delete?":"Delete role"})})]})}function Ba({title:e,defaultExpanded:t=!1,children:n}){const[r,i]=E.useState(t);return c.jsxs("section",{className:`ri-group${r?" is-expanded":""}`,children:[c.jsxs("button",{className:"ri-group-header",onClick:()=>i(o=>!o),children:[c.jsx("span",{className:"ri-group-caret",children:r?"▾":"▸"}),c.jsx("span",{className:"ri-group-title",children:e})]}),r&&c.jsx("div",{className:"ri-group-body",children:n})]})}function ui({label:e,children:t}){return c.jsxs("div",{className:"ri-field",children:[c.jsx("label",{className:"ri-field-label",children:e}),c.jsx("div",{className:"ri-field-control",children:t})]})}function UV({value:e,onChange:t,readOnly:n}){const[r,i]=E.useState(!1);return c.jsxs("div",{className:"ri-icon-picker",children:[c.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&i(o=>!o),disabled:n,children:[c.jsx("img",{src:Su(e),alt:"",className:"ri-icon-picker-current"}),c.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),r&&c.jsxs("div",{className:"ri-icon-picker-popover",children:[c.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),i(!1)},title:"Default icon",children:c.jsx("img",{src:qc.generic,alt:""})}),BV.filter(o=>o!=="generic").map(o=>c.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),i(!1)},title:o,children:c.jsx("img",{src:qc[o],alt:o})},o))]})]})}function GV({allIds:e,labelFor:t,selected:n,onToggle:r,readOnly:i}){const[o,a]=E.useState(!1),u=e.filter(d=>!n.has(d));return c.jsxs("div",{className:"ri-multiselect",children:[c.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>c.jsxs("span",{className:"ri-ch Line truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return i}}function pt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function XV(e,t,n,r){const i=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:ht(()=>[e,n,t,o],(a,u,d,m)=>({table:a,column:u,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),pt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function KV(e,t,n,r){var i,o;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let m=(i=(o=u.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?i:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:d&&(d.includes(".")?p=g=>{let y=g;for(const w of d.split(".")){var v;y=(v=y)==null?void 0:v[w]}return y}:p=g=>g[u.accessorKey]),!m)throw new Error;let h={id:`${String(m)}`,accessorFn:p,parent:r,depth:n,columnDef:u,columns:[],getFlatColumns:ht(()=>[!0],()=>{var g;return[h,...(g=h.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},pt(e.options,"debugColumns")),getLeafColumns:ht(()=>[e._getOrderColumnsFn()],g=>{var y;if((y=h.columns)!=null&&y.length){let v=h.columns.flatMap(w=>w.getLeafColumns());return g(v)}return[h]},pt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(h,e);return h}const br="debugHeaders";function cC(e,t,n){var r;let o={id:(r=n.id)!=null?r: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 a=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),a.push(d)};return u(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const ZV={createTable:e=>{e.getHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,a;const u=(o=r?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?o:[],d=(a=i?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?a:[],m=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(i!=null&&i.includes(h.id)));return Qd(t,[...u,...m,...d],e)},pt(e.options,br)),e.getCenterHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Qd(t,n,e,"center")),pt(e.options,br)),e.getLeftHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return Qd(t,o,e,"left")},pt(e.options,br)),e.getRightHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return Qd(t,o,e,"right")},pt(e.options,br)),e.getFooterGroups=ht(()=>[e.getHeaderGroups()],t=>[...t].reverse(),pt(e.options,br)),e.getLeftFooterGroups=ht(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),pt(e.options,br)),e.getCenterFooterGroups=ht(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),pt(e.options,br)),e.getRightFooterGroups=ht(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),pt(e.options,br)),e.getFlatHeaders=ht(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,br)),e.getLeftFlatHeaders=ht(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,br)),e.getCenterFlatHeaders=ht(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,br)),e.getRightFlatHeaders=ht(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,br)),e.getCenterLeafHeaders=ht(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,br)),e.getLeftLeafHeaders=ht(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,br)),e.getRightLeafHeaders=ht(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,br)),e.getLeafHeaders=ht(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,a,u,d,m;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(a=(u=n[0])==null?void 0:u.headers)!=null?a:[],...(d=(m=r[0])==null?void 0:m.headers)!=null?d:[]].map(p=>p.getLeafHeaders()).flat()},pt(e.options,br))}};function Qd(e,t,n,r){var i,o;let a=0;const u=function(g,y){y===void 0&&(y=1),a=Math.max(a,y),g.filter(v=>v.getIsVisible()).forEach(v=>{var w;(w=v.columns)!=null&&w.length&&u(v.columns,y+1)},0)};u(e);let d=[];const m=(g,y)=>{const v={depth:y,id:[r,`${y}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),p=m.reduce((h,g)=>h.concat(...g),[]);return[m,p]}return[[],[]]},[e]);return E.useEffect(()=>{const d=t?.target??t2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const p=y=>{if(i.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!i.current||i.current&&!m)&&wT(y))return!1;const w=r2(y.code,u);if(o.current.add(y[w]),n2(a,o.current,!1)){const S=y.composedPath?.()?.[0]||y.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(i.current||!_)&&y.preventDefault(),r(!0)}},h=y=>{const v=r2(y.code,u);n2(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(y[v]),y.key==="Meta"&&o.current.clear(),i.current=!1},g=()=>{o.current.clear(),r(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function n2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function r2(e,t){return t.includes(e)?"code":"key"}const YX=()=>{const e=En();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:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:o,maxZoom:a,panZoom:u}=e.getState(),d=kv(t,r,i,o,a,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:u,y:d}=a.getBoundingClientRect(),m={x:t.x-u,y:t.y-d},p=n.snapGrid??i,h=n.snapToGrid??o;return Iu(m,r,h,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:o}=r.getBoundingClientRect(),a=am(t,n);return{x:a.x+i,y:a.y+o}}}),[])};function qT(e,t){const n=[],r=new Map,i=[];for(const o of e)if(o.type==="add"){i.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const a=r.get(o.id);a?a.push(o):r.set(o.id,[o])}for(const o of t){const a=r.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const u={...o};for(const d of a)XX(d,u);n.push(u)}return i.length&&i.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function XX(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 WT(e,t){return qT(e,t)}function KX(e,t){return qT(e,t)}function zo(e,t){return{id:e,type:"select",selected:t}}function Wa(e,t=new Set,n=!1){const r=[];for(const[i,o]of e){const a=t.has(i);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),r.push(zo(o.id,a)))}return r}function i2({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),u=a?.internals?.userNode??a;u!==void 0&&u!==o&&n.push({id:o.id,item:o,type:"replace"}),u===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function s2(e){return{id:e.id,type:"remove"}}const o2=e=>vY(e),ZX=e=>gT(e);function YT(e){return E.forwardRef(e)}function a2(e){const[t,n]=E.useState(BigInt(0)),[r]=E.useState(()=>QX(()=>n(i=>i+BigInt(1))));return d0(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function QX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const XT=E.createContext(null);function JX({children:e}){const t=En(),n=E.useCallback(u=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let w=d;for(const _ of u)w=typeof _=="function"?_(w):_;let S=i2({items:w,lookup:g});for(const _ of v.values())S=_(S);p&&m(w),S.length>0?h?.(S):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:k,setNodes:C}=t.getState();_&&C(k)})},[]),r=a2(n),i=E.useCallback(u=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}_R.displayName="MiniMap";const $Z=E.memo(_R),HZ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,FZ={[gl.Line]:"right",[gl.Handle]:"bottom-right"};function VZ({nodeId:e,position:t,variant:n=gl.Handle,className:r,style:i=void 0,children:o,color:a,minWidth:u=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:w,onResize:S,onResizeEnd:_}){const k=QT(),C=typeof e=="string"?e:k,N=En(),L=E.useRef(null),I=n===gl.Handle,D=Vt(E.useCallback(HZ(I&&y),[I,y]),jn),T=E.useRef(null),O=t??FZ[n];E.useEffect(()=>{if(!(!L.current||!C))return T.current||(T.current=xX({domNode:L.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:A,transform:$,snapGrid:Y,snapToGrid:B,nodeOrigin:G,domNode:H}=N.getState();return{nodeLookup:A,transform:$,snapGrid:Y,snapToGrid:B,nodeOrigin:G,paneDomNode:H}},onChange:(A,$)=>{const{triggerNodeChanges:Y,nodeLookup:B,parentLookup:G,nodeOrigin:H}=N.getState(),V=[],W={x:A.x,y:A.y},Z=B.get(C);if(Z&&Z.expandParent&&Z.parentId){const q=Z.origin??H,U=A.width??Z.measured.width??0,ee=A.height??Z.measured.height??0,P={id:Z.id,parentId:Z.parentId,rect:{width:U,height:ee,...kT({x:A.x??Z.position.x,y:A.y??Z.position.y},{width:U,height:ee},Z.parentId,B,q)}},K=Nv([P],B,G,H);V.push(...K),W.x=A.x?Math.max(q[0]*U,A.x):void 0,W.y=A.y?Math.max(q[1]*ee,A.y):void 0}if(W.x!==void 0&&W.y!==void 0){const q={id:C,type:"position",position:{...W}};V.push(q)}if(A.width!==void 0&&A.height!==void 0){const U={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};V.push(U)}for(const q of $){const U={...q,type:"position"};V.push(U)}Y(V)},onEnd:({width:A,height:$})=>{const Y={id:C,type:"dimensions",resizing:!1,dimensions:{width:A,height:$}};N.getState().triggerNodeChanges([Y])}})),T.current.update({controlPosition:O,boundaries:{minWidth:u,minHeight:d,maxWidth:m,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:w,onResize:S,onResizeEnd:_,shouldResize:v}),()=>{T.current?.destroy()}},[O,u,d,m,p,h,w,S,_,v]);const M=O.split("-");return c.jsx("div",{className:Xn(["react-flow__resize-control","nodrag",...M,n,r]),ref:L,style:{...i,scale:D,...a&&{[I?"backgroundColor":"borderColor"]:a}},children:o})}E.memo(VZ);const UZ=E.memo(function({data:t}){const n=["oc-canvas-node",t.isOwner&&"is-owner",t.isSelected&&"is-selected",t.isDropTarget&&"is-drop-target"].filter(Boolean).join(" "),r=Su(t.icon);return c.jsxs("div",{className:n,children:[c.jsx(xl,{type:"target",position:lt.Top,className:"oc-canvas-handle"}),c.jsxs("div",{className:"oc-canvas-node-row",children:[c.jsx("div",{className:"oc-canvas-node-chip",children:c.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${r}")`,maskImage:`url("${r}")`},"aria-hidden":!0})}),c.jsxs("div",{className:"oc-canvas-node-text",children:[c.jsx("span",{className:"oc-canvas-node-name",children:t.name}),c.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?c.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):c.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&c.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),c.jsx(xl,{type:"source",position:lt.Bottom,className:"oc-canvas-handle"})]})});var yx,v2;function Rv(){if(v2)return yx;v2=1;var e="\0",t="\0",n="";class r{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(p){p&&(this._isDirected=Object.hasOwn(p,"directed")?p.directed:!0,this._isMultigraph=Object.hasOwn(p,"multigraph")?p.multigraph:!1,this._isCompound=Object.hasOwn(p,"compound")?p.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(p){return this._label=p,this}graph(){return this._label}setDefaultNodeLabel(p){return this._defaultNodeLabelFn=p,typeof p!="function"&&(this._defaultNodeLabelFn=()=>p),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var p=this;return this.nodes().filter(h=>Object.keys(p._in[h]).length===0)}sinks(){var p=this;return this.nodes().filter(h=>Object.keys(p._out[h]).length===0)}setNodes(p,h){var g=arguments,y=this;return p.forEach(function(v){g.length>1?y.setNode(v,h):y.setNode(v)}),this}setNode(p,h){return Object.hasOwn(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=h),this):(this._nodes[p]=arguments.length>1?h:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p Line truncated
${r}`}),c.jsx(TV,{projects:ei.projects,activeId:ei.activeProjectId,onSelect:Q=>{const z=pi(Q);t.current?.switchProject(Q,z)},onCreate:Q=>{t.current?.createProject(Q)},onDelete:Q=>t.current?.deleteProject(Q)})]}),c.jsxs("div",{className:"topbar-center",children:[c.jsxs("div",{className:"page-nav",children:[c.jsxs("button",{className:`page-nav-btn${O==="workspace"?" active":""}`,onClick:()=>M("workspace"),children:["Workspace",(()=>{const Q=Qn.channels.reduce((z,ne)=>z+Qn.getUnreadCount(ne.id),0);return Q>0?c.jsx("span",{className:"nav-unread-badge",children:Q>99?"99+":Q}):null})()]}),c.jsx("button",{className:`page-nav-btn${O==="office"?" active":""}`,onClick:()=>M("office"),children:"Office"}),c.jsx("button",{className:`page-nav-btn${O==="org"?" active":""}`,onClick:()=>M("org"),children:"Org"})]}),c.jsxs("div",{className:"stat-chips",children:[c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:Au.totalAgents})," agents"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:Au.totalSkills})," skills"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:ln.getOpenTaskCount()})," tasks"]})]})]}),c.jsxs("div",{className:"topbar-right",children:[c.jsxs("select",{className:"theme-select",value:lr,title:"Outdoor lighting override",onChange:Q=>{const z=Q.target.value;Sn(z);try{z==="auto"?(localStorage.removeItem("opc_outdoor_override"),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night")):(localStorage.setItem("opc_outdoor_override",z),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night"))}catch{}e.current.syncOutdoorLighting()},children:[c.jsx("option",{value:"auto",children:"Outdoor auto"}),c.jsx("option",{value:"day",children:"Outdoor day"}),c.jsx("option",{value:"night",children:"Outdoor night"})]}),c.jsxs("select",{className:"theme-select",value:C,onChange:Q=>N(Q.target.value),children:[c.jsx("option",{value:"midnight",children:"Midnight"}),c.jsx("option",{value:"neon",children:"Neon"}),c.jsx("option",{value:"paper",children:"Paper"}),c.jsx("option",{value:"retro",children:"Retro"}),c.jsx("option",{value:"terminal",children:"Terminal"}),c.jsx("option",{value:"cozy",children:"Cozy"}),c.jsx("option",{value:"openopc",children:"OpenOPC"})]}),c.jsx("button",{className:`icon-btn ${Y?"active":""}`,onClick:()=>B(Q=>!Q),title:"Developer Tools",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[c.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),O==="workspace"&&c.jsx(nV,{boardStore:ln,chatStore:Qn,sessionStore:St,agents:A,officeMap:gi,execMode:V,companyProfile:Z,taskPreferredAgent:U,projectId:ei.activeProjectId,orgInfoData:P,onNavigateToOrg:()=>M("org"),savedOrgsList:Ue,activeSavedOrg:vt,onSavedOrgsList:Cl,onSavedOrgLoad:jl,recoveryStatus:J,onRecoveryResume:Q=>t.current?.recoveryAction(st(),"resume",Q),onRecoveryCancel:Q=>t.current?.recoveryAction(st(),"cancel",Q),commsState:re,commsMessage:fe,onCommsRefresh:Q=>{const{project_id:z,...ne}=Q??{};t.current?.commsState(st(),ne)},onCommsReadMessage:Q=>t.current?.commsReadMessage(st(),Q),onRunTask:(Q,z,ne,le,ge)=>{t.current?.send({type:"run_task",project_id:st(),task_id:Q,title:z,description:ne,mode:le,profile:ge})},onCreateTask:(Q,z,ne,le)=>{t.current?.send({type:"kanban_create_task",project_id:st(),title:Q,board_id:z,column_id:ne,task_id:le})},onMoveTask:(Q,z)=>{t.current?.send({type:"kanban_move_task",project_id:st(),task_id:Q,column_id:z})},onCreateSession:()=>{if($t.current||Te.current)return;const Q=st();vn(Q),t.current?.createSession(Q,void 0,V,my(V),U,Do(V,vt))},onSessionSend:(Q,z,ne,le)=>t.current?.sessionSend(st(),Q,z,ne,le),onSecretarySend:Q=>t.current?.secretarySend(st(),Q),onDeleteSession:Q=>t.current?.deleteSession(st(),Q),onTitleChange:(Q,z)=>t.current?.sessionUpdateTitle(st(),Q,z),onSessionConfigChange:Du,onSessionTaskAgentChange:ta,onContinueInNewChat:na,onSessionStop:gr,onSessionResume:es,onSessionComplete:Q=>t.current?.sessionComplete(st(),Q),onLoadSessionDetail:(Q,z)=>t.current?.sessionDetail(st(),Q,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:["messages","session_state"],viewGeneration:Jt.current}),onOpenExecutionPanel:Q=>Tt(Q),onCollabSync:()=>t.current?.collabSync(st(),void 0,Jt.current)}),O==="org"&&c.jsx("div",{className:"org-page",children:c.jsx(JQ,{data:P,sessionRecruitmentByRole:fo,talents:je,employeeDetail:We,reorgProposals:gt,isCustomMode:yi,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:Q=>t.current?.employeeDetail(Q),onHireTalent:(Q,z)=>{Kn(Q),t.current?.talentHire(Q,z,void 0,P?.organization_id||vt||void 0)},hiringTemplateId:yt,onImportEmployee:Q=>t.current?. Line truncated
@@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="data:," />
<title>OpenOPC Pixel Office</title>
<script type="module" crossorigin src="./assets/index-iXYjKKT7.js"></script>
<script type="module" crossorigin src="./assets/index-DoyFIcGP.js"></script>
<link rel="modulepreload" crossorigin href="./assets/phaser-DFK5Ua9d.js">
<link rel="stylesheet" crossorigin href="./assets/index-CyXk-Ux0.css">
<link rel="stylesheet" crossorigin href="./assets/index-CMqG6mW8.css">
</head>
<body>
<div id="root"></div>
+17 -1
View File
@@ -459,6 +459,14 @@ export default function App() {
const [selectedAgentId, setSelectedAgentId] = useState<string | null>(null)
const [theme, setTheme] = useState<ThemeName>('openopc')
const [showSubagents, setShowSubagents] = useState(true)
const [sidebarCollapsed, setSidebarCollapsed] = useState(() => {
try { return localStorage.getItem('opc_office_sidebar_collapsed') === '1' } catch { return false }
})
const toggleSidebar = () => setSidebarCollapsed(v => {
const next = !v
try { localStorage.setItem('opc_office_sidebar_collapsed', next ? '1' : '0') } catch { /* private mode */ }
return next
})
const [eventTypeFilter, setEventTypeFilter] = useState('all')
const [activePage, setActivePage] = useState<AppPage>('workspace')
const [swarmAgents, setSwarmAgents] = useState<AgentInfo[]>([])
@@ -2408,13 +2416,21 @@ export default function App() {
)}
{/* Main Grid */}
<main className={`main-grid${activePage !== 'office' ? ' hidden' : ''}`}>
<main className={`main-grid${activePage !== 'office' ? ' hidden' : ''}${sidebarCollapsed ? ' sidebar-collapsed' : ''}`}>
{/* Phaser Game Canvas */}
<section className="canvas-wrap">
<PhaserGame bridge={bridgeRef.current} />
<button className="canvas-float-btn" onClick={() => setShowSubagents((v) => !v)} title={showSubagents ? 'Hide sub-agents' : 'Show sub-agents'}>
{showSubagents ? '👥' : '👤'}
</button>
<button
className="sidebar-collapse-btn"
onClick={toggleSidebar}
title={sidebarCollapsed ? 'Show side panel' : 'Hide side panel'}
aria-label={sidebarCollapsed ? 'Show side panel' : 'Hide side panel'}
>
<span className="collapse-glyph">{sidebarCollapsed ? '❮' : '❯'}</span>
</button>
</section>
{/* Sidebar */}
@@ -36,6 +36,7 @@ export class GameBridge extends Phaser.Events.EventEmitter {
pushEvent(evt: VisualEvent) {
if (!this.scene) {
this.eventQueue.push(evt)
if (this.eventQueue.length > 500) this.eventQueue.shift()
return
}
this.applyEvent(evt)
@@ -45,7 +46,11 @@ export class GameBridge extends Phaser.Events.EventEmitter {
const agentCount = Object.keys(snapshot.agents ?? {}).length
if (!this.scene) {
console.log(`[GameBridge] pushSnapshot queued (scene not ready) — ${agentCount} agents`)
this.snapshotQueue.push(snapshot)
// A snapshot fully resets the scene, so it supersedes anything queued
// before it. The game may not be created until the Office page is first
// opened — keep the queues bounded in the meantime.
this.snapshotQueue = [snapshot]
this.eventQueue = []
return
}
console.log(`[GameBridge] pushSnapshot applying now — ${agentCount} agents`)
@@ -15,47 +15,51 @@ export function PhaserGame({ bridge }: Props) {
const gameRef = useRef<Phaser.Game | null>(null)
useEffect(() => {
if (!wrapperRef.current || !containerRef.current || gameRef.current) return
if (!wrapperRef.current || !containerRef.current) return
// Measure the wrapper (which has definite CSS dimensions from the grid layout).
// The inner container div is initially empty so has 0 dimensions.
const wrapper = wrapperRef.current
const container = containerRef.current
// Force container to fill wrapper so clientWidth/Height are non-zero
container.style.width = `${wrapper.clientWidth}px`
container.style.height = `${wrapper.clientHeight}px`
// Safety: never create a 0×0 game
const w = container.clientWidth || window.innerWidth - 400
const h = container.clientHeight || window.innerHeight - 48
if (w < 50 || h < 50) {
console.warn('[PhaserGame] Container too small:', w, h, '— using fallback size')
container.style.width = `${window.innerWidth - 400}px`
container.style.height = `${window.innerHeight - 48}px`
const createGame = (w: number, h: number) => {
console.log('[PhaserGame] Creating Phaser game', w, '×', h)
const config = createGameConfig(container, w, h)
config.scene = [BootScene, OfficeScene]
const game = new Phaser.Game(config)
game.registry.set('bridge', bridge)
gameRef.current = game
}
console.log('[PhaserGame] Creating Phaser game', container.clientWidth, '×', container.clientHeight)
const config = createGameConfig(container)
config.scene = [BootScene, OfficeScene]
const game = new Phaser.Game(config)
game.registry.set('bridge', bridge)
gameRef.current = game
// Keep canvas sized to wrapper on window resize
const onResize = () => {
if (!wrapper || !game) return
container.style.width = `${wrapper.clientWidth}px`
container.style.height = `${wrapper.clientHeight}px`
game.scale.resize(wrapper.clientWidth, wrapper.clientHeight)
if (typeof ResizeObserver === 'undefined') {
createGame(wrapper.clientWidth || window.innerWidth - 380, wrapper.clientHeight || window.innerHeight - 48)
return () => {
gameRef.current?.destroy(true)
gameRef.current = null
}
}
window.addEventListener('resize', onResize)
// The office page can start hidden (display:none → 0×0). Never create or
// resize the game at zero size; wait for the first real layout instead.
const observer = new ResizeObserver((entries) => {
const rect = entries[entries.length - 1].contentRect
const w = Math.floor(rect.width)
const h = Math.floor(rect.height)
if (w < 1 || h < 1) return // hidden — keep last known size
if (!gameRef.current) {
createGame(w, h)
} else {
// In RESIZE scale mode the game follows parentSize, which Phaser only
// re-measures on its 500ms poll — and scale.resize() gets clobbered by
// that stale value. Re-measure the parent, then refresh.
const scale = gameRef.current.scale
scale.getParentBounds()
scale.refresh()
}
})
observer.observe(wrapper)
return () => {
window.removeEventListener('resize', onResize)
game.destroy(true)
observer.disconnect()
gameRef.current?.destroy(true)
gameRef.current = null
}
}, [bridge]) // bridge is a stable ref, effect runs once
@@ -63,8 +67,9 @@ export function PhaserGame({ bridge }: Props) {
return (
// Wrapper fills the CSS grid cell
<div ref={wrapperRef} style={{ width: '100%', height: '100%' }}>
{/* Phaser mounts its canvas inside this div */}
<div ref={containerRef} />
{/* Phaser mounts its canvas inside this div; it must track the wrapper
so Phaser's own parent-bounds polling reads the true size. */}
<div ref={containerRef} style={{ width: '100%', height: '100%' }} />
</div>
)
}
@@ -99,9 +99,9 @@ export const STATUS_BUBBLE_DURATION = 5.0
export const INACTIVE_SEAT_TIMER_MIN = 3.0
export const INACTIVE_SEAT_TIMER_RANGE = 2.0
export function createGameConfig(parent: HTMLElement): Phaser.Types.Core.GameConfig {
const w = parent.clientWidth || window.innerWidth - 380
const h = parent.clientHeight || window.innerHeight - 48
export function createGameConfig(parent: HTMLElement, width?: number, height?: number): Phaser.Types.Core.GameConfig {
const w = width || parent.clientWidth || window.innerWidth - 380
const h = height || parent.clientHeight || window.innerHeight - 48
const skyHex = isLocalDaytime() ? '#a8d4ec' : '#31453a'
return {
type: Phaser.CANVAS,
@@ -320,9 +320,9 @@ export class OfficeScene extends Phaser.Scene {
targets: cam,
zoom: targetZoom,
duration: 260,
ease: 'Cubic.Out',
ease: 'Cubic.easeOut',
})
cam.pan(targetX, targetY, 260, 'Cubic.Out')
cam.pan(targetX, targetY, 260, 'Cubic.easeOut')
}
panToOffice(officeId: string) {
@@ -343,9 +343,9 @@ export class OfficeScene extends Phaser.Scene {
targets: cam,
zoom: targetZoom,
duration: 380,
ease: 'Cubic.Out',
ease: 'Cubic.easeOut',
})
cam.pan(cx, cy, 380, 'Cubic.Out')
cam.pan(cx, cy, 380, 'Cubic.easeOut')
}
// ── Agent management ──────────────────────────────────
@@ -478,12 +478,22 @@ html, body, #root {
height: 100%;
min-height: 0;
overflow: hidden;
/* Canvas follows via ResizeObserver in PhaserGame, so the column change animates cleanly */
transition: grid-template-columns 220ms ease;
}
.main-grid.hidden {
display: none;
}
.main-grid.sidebar-collapsed {
grid-template-columns: 1fr 0px;
}
.main-grid.sidebar-collapsed .sidebar {
border-left: none;
}
/* ── Canvas ─────────────────────────────────────────── */
.canvas-wrap {
@@ -535,6 +545,35 @@ html, body, #root {
transform: scale(1.05);
}
/* Handle on the canvas/sidebar boundary that collapses or expands the side panel */
.sidebar-collapse-btn {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
width: 18px;
height: 56px;
padding: 0;
border: 1px solid var(--border);
border-right: none;
border-radius: 8px 0 0 8px;
background: rgba(20, 27, 43, 0.94);
color: var(--text-secondary);
font-size: 10px;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 6;
transition: background 150ms, color 150ms;
}
.sidebar-collapse-btn:hover {
background: var(--surface-hover);
color: var(--text);
}
/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
@@ -1314,6 +1353,14 @@ html, body, #root {
.main-grid {
grid-template-columns: 1fr;
grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr);
transition: grid-template-rows 220ms ease;
}
.main-grid.sidebar-collapsed {
grid-template-columns: 1fr;
grid-template-rows: minmax(0, 1fr) 0;
}
.main-grid.sidebar-collapsed .sidebar {
border-top: none;
}
.sidebar {
border-left: none;
@@ -1321,6 +1368,22 @@ html, body, #root {
max-height: 48vh;
min-height: 0;
}
/* Sidebar stacks below the canvas here — move the handle to the bottom edge */
.sidebar-collapse-btn {
top: auto;
bottom: 0;
right: 50%;
transform: translateX(50%);
width: 56px;
height: 18px;
border: 1px solid var(--border);
border-bottom: none;
border-radius: 8px 8px 0 0;
}
.sidebar-collapse-btn .collapse-glyph {
display: inline-block;
transform: rotate(90deg);
}
.stat-chips { display: none; }
}