@coralai/sps-cli 0.58.41 → 0.58.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/projectInit.d.ts.map +1 -1
- package/dist/commands/projectInit.js +12 -0
- package/dist/commands/projectInit.js.map +1 -1
- package/dist/console/routes/cards.d.ts +0 -15
- package/dist/console/routes/cards.d.ts.map +1 -1
- package/dist/console/routes/cards.js +31 -1
- package/dist/console/routes/cards.js.map +1 -1
- package/dist/console-assets/assets/{index-CKyH_olo.js → index-BWtYBuM9.js} +10 -10
- package/dist/console-assets/index.html +1 -1
- package/dist/core/claude/hooksWiring.d.ts +7 -0
- package/dist/core/claude/hooksWiring.d.ts.map +1 -0
- package/dist/core/claude/hooksWiring.js +64 -0
- package/dist/core/claude/hooksWiring.js.map +1 -0
- package/dist/manager/worker-manager-impl.d.ts +6 -0
- package/dist/manager/worker-manager-impl.d.ts.map +1 -1
- package/dist/manager/worker-manager-impl.js +19 -1
- package/dist/manager/worker-manager-impl.js.map +1 -1
- package/dist/services/promptPreview.d.ts +4 -0
- package/dist/services/promptPreview.d.ts.map +1 -1
- package/dist/services/promptPreview.js +1 -0
- package/dist/services/promptPreview.js.map +1 -1
- package/package.json +1 -1
|
@@ -468,13 +468,13 @@ Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}
|
|
|
468
468
|
{cmd}`,"system.diagnostics.title":"Project health check","system.diagnostics.checkAll":"Check all","system.diagnostics.empty":"No projects yet.","system.diagnostics.expandAria":"Expand","system.diagnostics.collapseAria":"Collapse","system.diagnostics.never":'Click "Check" to run sps doctor',"system.diagnostics.checkAria":"Check","system.diagnostics.check":"Check","system.diagnostics.noFixesNeeded":"Nothing to fix","system.diagnostics.fix.tip":"Run sps doctor <proj> --fix: auto-create .claude/hooks/stop.sh, state.json, etc.","system.diagnostics.fixAria":"Auto fix","system.diagnostics.fix":"Fix","system.diagnostics.fixed":"Fixed","system.diagnostics.error.fix":"doctor fix failed","system.diagnostics.error.check":"doctor check failed","chat.title":"Chat 💬","chat.empty.title":"Chat 💬","chat.empty.hint":'Click "New chat" on the left to start a session, or just type below — a session will be auto-created.',"chat.empty.shortcuts":"Enter to send · Shift+Enter for newline · streamed reply","chat.list.heading":"History {count}","chat.list.new":"New chat","chat.list.empty":"No chats yet. Click above to start.","chat.list.delete.aria":"Delete chat","chat.list.deleteCli.aria":"Remove this CLI session from the Console (does not affect Claude jsonl history)","chat.list.openAria":"Open chat {title}{cwd}","chat.list.cwdSuffix":" (cwd: {cwd})","chat.list.msgs":"{count} msg · {time}","chat.list.olderToggle":"Earlier · {count}","chat.detail.model.tooltip":"Current model in use","chat.detail.claudeSession.tooltip":"Underlying claude session id — the anchor for resuming session & memory","chat.delete.confirm.title":"Delete chat","chat.delete.confirm.body.cli":"Will be removed from the Console list (the daemon session is stopped). The Claude CLI history under ~/.claude/projects is preserved — to continue, run `sps agent --chat --name <name>` in a terminal.","chat.delete.confirm.body.console":"Chat history will be permanently deleted.","chat.delete.confirm.button":"Delete","chat.cli.banner.bold":"CLI session","chat.cli.banner":"This session was created by sps agent. The Console only shows history. To continue, run in a terminal:","chat.input.placeholder":"Say something… (Enter to send, Shift+Enter for newline, drag files / paste images)","chat.input.dragOver":"Drop to attach…","chat.input.aria":"Message input","chat.input.attach.aria":"Attach a local file","chat.input.attach.title":"Attach a local file (also drag / paste images)","chat.input.send":"Send","chat.input.send.aria":"Send","chat.input.interrupt":"Stop","chat.input.interrupt.aria":"Stop generation","chat.input.uploading":"Uploading…","chat.input.removeAttachment":"Remove {name}","chat.error.interrupt.title":"Interrupt failed","chat.cliBadge":"CLI","chat.cliBadge.tooltip":"Created by sps agent CLI; history is read live from Claude jsonl (read-only).","chat.session.title":"{title}","chat.session.id":"{id}","chat.session.empty":"Type a question below to start · Enter to send · Shift+Enter for newline","notFound.title":"404","notFound.body":"This page does not exist.","notFound.home":"Back to home","workers.active.empty":"No workers running.","workers.alerts.allHealthy":"All workers healthy","workers.alerts.pidDead":"PID dead.","workers.alerts.markerStale":"marker stale {ago}.","workers.capacity.col.project":"Project","workers.capacity.col.usage":"Usage","workers.capacity.col.other":"Other","workers.capacity.detailHint":"details →","workers.panel.boardLink":"Board →","workers.panel.loading":"Loading workers…","workers.panel.empty.slots":"This project has no worker slots.","workers.panel.empty.noWorker":"No workers","workers.panel.empty.pickOne":"Pick a worker","workers.panel.idle.short":"idle","workers.panel.section.currentCard":"Current card","workers.panel.idle.full":"Slot idle, no current card.","workers.panel.section.claudeOutput":"Claude output · last {n} lines","workers.panel.output.loading":"Loading…","workers.panel.output.empty":"No session output yet. The worker needs a few seconds to start.","workers.panel.section.heartbeat":"Supervisor heartbeat · last {n} lines","workers.panel.heartbeat.fullLog":"View full log →","workers.panel.action.restart":"Restart","workers.panel.action.restart.confirm.title":"Restart worker-{slot}","workers.panel.action.restart.confirm.body":"Kill the process, then re-launch onto #{seq}","workers.panel.action.restart.confirm.button":"Restart","workers.panel.action.restart.error":"Restart failed","workers.panel.action.kill":"Kill","workers.panel.action.kill.confirm.title":"Kill worker-{slot}","workers.panel.action.kill.confirm.body":"The current task will be force-aborted.","workers.panel.action.kill.confirm.button":"Kill","workers.panel.action.kill.error":"Kill failed","dialog.confirm.default":"OK","dialog.alert.default":"Got it","dialog.cancel.default":"Cancel","dirPicker.title.default":"Pick a directory","dirPicker.close.aria":"Close","dirPicker.up.aria":"Parent directory","dirPicker.up.title":"Parent directory","dirPicker.home.aria":"Back to home","dirPicker.home.title":"Back to home","dirPicker.loading":"Loading…","dirPicker.error.title":"Read failed","dirPicker.empty":"— empty —","dirPicker.enter.aria":"Enter {name}/","dirPicker.pickFile.aria":"Pick {name} (double-click to confirm)","dirPicker.fileLocked":"File not selectable","dirPicker.cancel":"Cancel","dirPicker.useFile":"Use this file","dirPicker.useFile.tooltip.empty":"Click a file first","dirPicker.useDir":"Use this directory","dirPicker.newDir":"New folder","dirPicker.newDir.aria":"Create a subdirectory in the current directory","dirPicker.newDir.prompt":"New folder name (letters, digits, _ . - only)","dirPicker.newDir.placeholder":"Folder name","dirPicker.newDir.create":"Create","dirPicker.newDir.error.title":"Failed to create folder","errorBoundary.title":"💥 UI crashed","errorBoundary.refresh":"Refresh page","chat.error.create.title":"Failed to create chat","chat.error.send.title":"Send failed","chat.error.fileTooBig.title":"File too large","chat.error.fileTooBig.body":"Per-file limit is 50 MB; this is {size} MB ({name})","chat.error.uploadAttachment.title":"Attachment upload failed","chat.placeholder.attachment":"(attachment)","chat.placeholder.viewAttachment":"(see attachment)","chat.placeholder.attachmentTitle":"Attachment","chat.attachment.previewTooltip":`{name}
|
|
469
469
|
{path}
|
|
470
470
|
Click to preview`,"chat.attachment.previewSimpleTooltip":`{name}
|
|
471
|
-
Click to zoom`,"chat.attachment.preview.aria":"Preview {name}","chat.attachment.close.aria":"Close","chat.attachment.readErr":"Read failed: {detail}","chat.attachment.loading":"Loading…","chat.attachment.unsupported":"This file type cannot be previewed inline.","chat.attachment.download":"Download","chat.message.role.you":"You","chat.message.role.error":"Error","chat.message.role.assistant":"assistant","chat.message.truncated":"⚠ Output exceeded 10MB and was truncated","chat.filePicker.title":"Pick attachment file","chat.newSession.title":"New chat","chat.newSession.title.aria":"New chat","chat.newSession.close.aria":"Close","chat.newSession.field.agent":"Agent","chat.newSession.field.model":"Model (optional)","chat.newSession.field.model.default":"Use global default model","chat.newSession.field.title":"Title (optional)","chat.newSession.field.title.placeholder":"Empty = auto-generate from first message","chat.newSession.field.cwd":"Working directory (optional)","chat.newSession.field.cwd.browse":"Browse","chat.newSession.field.cwd.browseAria":"Pick directory","chat.newSession.field.cwd.title":"Pick directory","chat.newSession.field.cwd.help1":"The agent reads/writes files here. Absolute path; must exist.","chat.newSession.field.cwd.help2":"Empty = use the daemon’s startup cwd.","chat.newSession.cancel":"Cancel","chat.newSession.create":"Create","cardModal.editing":"⚠ Editing","cardModal.title.aria":"Card title","cardModal.editAria":"Edit card","cardModal.edit":"Edit","cardModal.close.aria":"Close","cardModal.error.save.title":"Save failed","cardModal.error.load":"Load failed: {detail}","cardModal.skills.loading":"Loading skill list…","cardModal.label.removeAria":"Remove {label}","cardModal.label.addPlaceholder":"+ Add label","cardModal.label.addAria":"Add label","cardModal.label.note":"Note: AI-PIPELINE / STARTED-* / COMPLETED-* / NEEDS-FIX are managed by the pipeline; manual changes may be overwritten","cardModal.section.description":"Description","cardModal.section.empty":"(empty)","cardModal.section.checklist":"Checklist","cardModal.checklist.empty":"No checklist items. Add `- [ ] item` syntax in the description.","cardModal.section.log":"Log","cardModal.body.aria":"Card description","cardModal.body.replaceNote":'Only replaces the "## Description" section; checklist and log sections are untouched.',"cardModal.action.launch":"Launch worker","cardModal.action.launch.disabledDone":"Card is done; drag back to Todo to launch","cardModal.action.launch.disabledRunning":"Pipeline is running — supervisor dispatches automatically, no manual launch needed","cardModal.action.launch.error":"Launch worker failed","cardModal.action.reset":"Reset card","cardModal.action.viewPrompt":"View prompt","cardModal.prompt.title":"Worker prompt (preview)","cardModal.prompt.loading":"Rebuilding prompt…","cardModal.prompt.error":"Failed: {detail}","cardModal.prompt.copy":"Copy","cardModal.prompt.copied":"Copied","cardModal.prompt.metaSkills":"skills: {skills}","cardModal.prompt.metaMemory":"memory block","cardModal.prompt.metaGit":"git mode","cardModal.prompt.metaNonGit":"non-git","cardModal.prompt.nativeTitle":"Also read natively by claude (not in this string):","cardModal.action.reset.confirm.title":"Reset card #{seq}","cardModal.action.reset.confirm.body":"Card state goes back to initial; checklist progress is cleared.","cardModal.action.reset.confirm.button":"Reset","cardModal.action.reset.error":"Reset failed","cardModal.action.delete":"Delete card","cardModal.action.delete.confirm1.title":"Delete card #{seq}","cardModal.action.delete.confirm1.body":'About to delete "{title}". This cannot be undone (the md file is physically removed). Continue?',"cardModal.action.delete.confirm1.button":"Continue","cardModal.action.delete.confirm2.title":"Final confirmation","cardModal.action.delete.confirm2.body":"Please re-confirm deleting card #{seq}.","projectDetail.tab.skills":"Skills","projectDetail.tab.rules":"Rules","projectDetail.skills.title":"Skill whitelist","projectDetail.skills.desc":"Pick which skills this project loads. Narrows what workers, subagents and chat see — cuts token cost.","projectDetail.skills.noPolicy":"No whitelist — all skills are available (subagents load the full set from disk).","projectDetail.skills.hasPolicy":"Whitelist active — {count} skill(s) eligible.","projectDetail.skills.save":"Save whitelist","projectDetail.skills.clear":"Clear (load all)","projectDetail.skills.saveError":"Failed to save whitelist","projectDetail.skills.applied":"Saved. Projected {linked} linked, {pruned} pruned.","projectDetail.skills.unknown":"Unknown skill name(s), ignored: {names}","projectDetail.skills.empty":"No skills installed. Run `sps skill sync` first.","projectDetail.skills.selectAll":"Select all","projectDetail.skills.selectNone":"Select none","projectDetail.rules.title":"Project rules (read-only)","projectDetail.rules.readonly":"sps-cli only reads these. Editing is done at project creation or by an agent later.","projectDetail.rules.missing":"Not present","nav.prompts":"Prompts","prompts.title":"Prompt library","prompts.desc":"Reusable prompts with {{variable}} templates. Insert them into chat.","prompts.new":"New prompt","prompts.search":"Search prompts…","prompts.empty":"No prompts yet. Create one.","prompts.name":"Name","prompts.namePlaceholder":"kebab-case, e.g. code-review","prompts.nameError":"Name must be kebab-case (a-z, 0-9, dashes).","prompts.description":"Description","prompts.tags":"Tags","prompts.tagsPlaceholder":"comma,separated","prompts.body":"Body","prompts.bodyPlaceholder":"Write your prompt. Use {{variable}} for fill-ins.","prompts.favorite":"Favorite","prompts.save":"Save","prompts.delete":"Delete","prompts.deleteConfirm":'Delete prompt "{name}"? This removes the file.',"prompts.saveError":"Failed to save prompt","prompts.vars":"Variables: {names}","prompts.noVars":"No variables","prompts.insert":"Insert a prompt","prompts.selectHint":"Select a prompt on the left, or create a new one.","prompts.tagAdd":"Type a tag, press Enter","prompts.ai":"AI generate","prompts.ai.title":"AI generate a prompt","prompts.ai.intent":"Describe what you want","prompts.ai.placeholder":"e.g. a prompt for reviewing TypeScript code for security issues","prompts.ai.submit":"Generate","prompts.ai.wait":"The agent is writing… this can take a while.","prompts.ai.error":"Generation failed","skills.import":"Import","skills.import.title":"Import a skill","skills.import.name":"Name (kebab-case)","skills.import.body":"SKILL.md content","skills.import.submit":"Import","skills.import.error":"Import failed","skills.export":"Export SKILL.md","skills.updates.badge":"{count} update(s) available","skills.updates.none":"Up to date","skills.ai":"AI create","skills.ai.title":"AI create a skill","skills.ai.name":"Name (kebab-case)","skills.ai.intent":"What is this skill for?","skills.ai.placeholder":"e.g. how to write idiomatic Rust error handling","skills.ai.submit":"Create","skills.ai.wait":"The agent is writing the skill… this can take a while.","skills.ai.error":"Create failed","projectDetail.tab.graph":"Code Graph","projectDetail.tab.logs":"Logs","graph.title":"Code Graph","graph.desc":"A symbol-level dependency graph of this project (tree-sitter, zero-token). Gives agents surgical context so they explore fewer files.","graph.build":"Build graph","graph.rebuild":"Rebuild","graph.building":"Building…","graph.sync":"Sync","graph.syncing":"Syncing…","graph.sync.desc":"Incremental — only re-index changed files (fast)","graph.empty":"No graph yet — build one to enable agent navigation and the dependency view.","graph.buildFailed":"Build failed","graph.stat.files":"Files","graph.stat.nodes":"Nodes","graph.stat.edges":"Edges","graph.stat.db":"DB size","graph.stat.lastBuilt":"Last built","graph.viz.title":"File dependency graph","graph.viz.loading":"Loading graph…","graph.viz.empty":"Build the graph to see the dependency view.","graph.viz.hint":"Node = file · edge = import · drag to explore · search to highlight","graph.viz.search":"Highlight files…"},F3={"app.title":"SPS 控制台","nav.chat":"对话","nav.projects":"项目","nav.board":"看板","nav.workers":"Workers","nav.logs":"日志","nav.skills":"技能","nav.system":"系统","nav.processes":"进程","nav.audit":"审计日志","nav.memory":"记忆","nav.plugins":"插件","plugins.h1":"插件","plugins.desc":"全局插件开关。改动对之后新派发的卡生效。","plugins.tab.memory":"记忆","plugins.tab.channel":"频道","plugins.tab.model":"模型","plugins.tab.tool":"工具","plugins.comingSoon":"即将上线","plugins.model.title":"智能体模型","plugins.model.desc":"配置两个智能体的模型(全局)。worker=claude 执行、review·designer=openai 监工+编排。","plugins.model.worker":"Worker(执行 / claude)","plugins.model.reviewer":"Review·Designer(监工 / openai)","plugins.model.provider":"Provider","plugins.model.model":"模型","plugins.model.official":"官方 claude(默认)","plugins.model.save":"保存","plugins.model.saved":"已保存","plugins.model.error":"保存失败","nav.arrange":"编排","arrange.h1":"智能编排","arrange.project":"项目","arrange.none":"尚未开始 — 点上方「启动」拉起编排(几秒后出任务清单,确认即跑)。若下拉无项目,先在「新建项目」选智能编排模式。","arrange.start":"启动","arrange.stop":"停止","arrange.startErr":"启动/停止失败","arrange.view":"切换画板视图","arrange.viewFree":"自由","arrange.viewLane":"泳道","arrange.starting":"启动中,正在拆解任务清单…","arrange.planning":"正在拆解任务清单…","arrange.orchestrating":"正在编排中…","arrange.status":"状态","arrange.goal":"目标","arrange.plan":"任务清单 + 卡链路","arrange.approve":"确认任务清单","arrange.approveErr":"确认失败","arrange.tasks":"任务清单","arrange.collapse":"收起","arrange.expand":"展开任务清单","arrange.noCards":"暂无卡片 — 等待 orchestrator 派卡(确认清单后开始)。","arrange.cardPrompt":"卡片提示词","arrange.cardSkills":"技能","arrange.cardTask":"所属任务","arrange.cardLog":"日志","arrange.close":"关闭","arrange.cardsCount":"张卡","nav.aria":"主导航","memory.sub":"跨项目记忆 · 经 console 鉴权代理 agentmemory","memory.searchPlaceholder":"搜索记忆…(如:三消美术竞态怎么修)","memory.search":"搜索","memory.results":"召回结果","memory.rawHint":"(原始观察 · 接入实时捕获+压缩后这里会显示提炼的教训)","memory.sessions":"最近会话","memory.empty":"暂无记忆 · 接入实时捕获(P1)后自动累积","processes.title":"进程监控","processes.subtitle":"SPS ACP 启动的 claude 进程(其它途径启动的,如你自己的会话,不显示)","processes.refresh":"刷新","processes.aliveCount":"运行中 {n}","processes.col.kind":"类型","processes.col.slot":"会话槽","processes.col.project":"项目","processes.col.state":"状态","processes.col.memory":"内存","processes.col.action":"操作","processes.empty":"没有 SPS 进程","processes.filter.all":"全部","processes.filter.alive":"运行中","processes.filter.offline":"离线","processes.kind.all":"全部类型","processes.kind.worker":"构建 Worker","processes.kind.chat":"对话","processes.kill":"关闭","processes.killConfirm":"确定关闭进程 {slot}?","audit.title":"审计日志","audit.subtitle":"项目生命周期:创建 / 修改 / 删除","audit.refresh":"刷新","audit.filter.all":"全部","audit.action.create":"创建","audit.action.modify":"修改","audit.action.delete":"删除","audit.action.daemon":"Daemon","audit.col.time":"时间","audit.col.action":"动作","audit.col.project":"项目","audit.col.detail":"详情","audit.empty":"暂无审计记录","lang.toggle.aria":"切换界面语言","lang.en":"EN","lang.zh":"中","theme.toggle.aria":"切换主题","theme.dark":"暗色主题","theme.light":"亮色主题","status.server":"服务","status.offline":"离线","status.sse.open":"SSE","status.sse.connecting":"SSE·连接中","status.sse.down":"SSE·断开","status.pipelines.tooltip":"活跃流水线数","status.workers.tooltip":"活跃 Worker 数","status.pipeline.unit":"流水线","status.worker.unit":"Worker","common.save":"保存","common.cancel":"取消","common.delete":"删除","common.confirm":"确认","common.create":"创建","common.edit":"编辑","common.close":"关闭","common.loading":"加载中…","common.error":"出错","common.retry":"重试","common.empty":"暂无内容","common.search":"搜索","common.refresh":"刷新","common.copy":"复制","common.copied":"已复制","common.yes":"是","common.no":"否","common.required":"必填","common.optional":"可选","common.ok":"好","projects.title":"项目","projects.count":"本机有 {count} 个项目","projects.refresh.hint":"点击刷新重试","projects.new":"新建项目","projects.selectHint":"在左侧选择一个项目查看详情。","projects.sort.label":"排序方式","projects.sort.activity":"活跃度","projects.sort.date":"修改日期","projects.sort.name":"名字","projects.load.failed":"加载失败","projects.empty.title":"还没有项目","projects.empty.hint":"运行 {cmd} 创建第一个项目。","newProject.title":"新建项目","newProject.subtitle":"配置一个项目,worker 自动开跑","newProject.field.mode":"执行模式","newProject.field.mode.pipeline":"自动工作流","newProject.field.mode.pipelineDesc":"固定阶段流水线,claude worker 按卡执行","newProject.field.mode.smart":"智能编排","newProject.field.mode.smartDesc":"OpenAI 监工动态派卡 + claude worker 执行","newProject.field.mode.pipelineHint":"传统模式:你建卡片,worker 按阶段跑。","newProject.field.mode.smartHint":"给一个总目标,OpenAI 监工每轮探查产物、动态生成任务卡、驱动 claude 完成。","newProject.field.goal":"总目标 (GOAL.md)","newProject.field.goal.hint":"写入 docs/GOAL.md;智能编排据此拆任务清单。缺失则 tick 跳过该项目。","newProject.field.goal.placeholder":"例:做一个纯前端、单文件可运行的贪吃蛇网页小游戏…","newProject.field.name":"项目名","newProject.field.name.help":"只允许小写字母、数字、_ 和 -","newProject.field.dir":"项目目录","newProject.field.dir.preview":"项目将创建在 →","newProject.field.dir.help":"绝对路径;不存在会自动创建","newProject.field.branch":"合并目标分支","newProject.field.branch.help":"默认 main","newProject.field.maxWorkers":"最大并发 Worker 数","newProject.field.maxWorkers.help":"单项目并发数(推荐 1)","newProject.field.ackTimeout":"ACK 超时(秒)","newProject.field.ackTimeout.help":"Worker 响应等待秒数(默认 300)","newProject.field.gitlabProject":"GitLab/GitHub 远程","newProject.field.gitlabProject.help":"格式:用户名/仓库(可选)","newProject.field.matrixRoom":"Matrix 房间 ID","newProject.field.matrixRoom.help":"可选;不填则用全局默认","newProject.field.git":"启用 git","newProject.field.git.help":"关闭 → 非代码项目,跳过 commit/push/MR","newProject.submit":"创建项目","newProject.creating":"创建中…","newProject.created":"项目已创建","newProject.error.dirRequired":"项目目录必填","newProject.dir.browse":"浏览","newProject.dir.browseAria":"选择目录","newProject.back":"返回","newProject.back.aria":"返回项目列表","newProject.field.name.placeholder":"例如:acme-web","newProject.field.name.example":"只能用字母、数字、下划线、连字符。例如 acme-web","newProject.field.name.invalid":"名称只能包含 a-z A-Z 0-9 _ -","newProject.field.dir.long":"本机绝对路径的【项目目录】。选中的目录本身就是项目根;项目名默认取目录名。已有代码 → 收编(只加 .claude/ 配置,不动源码);空目录 → 新建。","newProject.field.dir.placeholder":"/home/you/projects/my-app","newProject.field.dir.createIfMissing":"目录不存在时自动创建(推荐 —— 否则 .claude/ 安装会被跳过)","newProject.field.dir.pickerTitle":"选择项目目录","newProject.field.dir.adopt":"检测到已有内容 → 将收编(只加配置,不动源码)","newProject.field.dir.fresh":"空目录 → 新建项目","newProject.field.name.derived":"项目名(默认取目录名,可微调)","newProject.field.maxWorkers.short":"最大 Worker 数","newProject.field.ackTimeout.minutes":"ACK 超时(分钟)","newProject.field.ackTimeout.minutes.help":"Worker 启动后多久没 ACK 视为失败","newProject.field.git.label":"启用 Git(Worker 自动 commit + push)","newProject.field.git.detail":"关闭后 Worker 只做任务、不做版本控制;适合文档/数据处理等非代码项目。","newProject.field.review.label":"启用清单验收(每卡完成后独立 agent 审核)","newProject.field.review.detail":"开启后:卡带「检查清单」的,Worker 完成后由独立 reviewer 逐条对着真实产物验收;全过留 Done,有不过自动插一张修正卡(优先跑)。无清单的卡不审。建卡时用 --checklist 写验收点。","newProject.field.git.branch":"合并分支","newProject.field.gitlabProject.label":"Git 远程项目路径","newProject.field.gitlabProject.help2":"如 user/repo,空则跳过远程 API(只本地 commit/push)","newProject.field.gitlabProject.placeholder":"user/repo","newProject.field.gitlabProjectId":"GitLab 项目 ID","newProject.field.gitlabProjectId.help":"数字;GitHub 用户留空","newProject.field.gitlabProjectId.placeholder":"42","newProject.section.notifications":"通知","newProject.field.matrixRoom.label":"Matrix 房间 ID","newProject.field.matrixRoom.help2":"空则使用全局配置;不填 = 不通知","newProject.field.matrixRoom.placeholder":"!abc:matrix.example.com","newProject.error.create.title":"创建失败","projectDetail.tab.pipeline":"流水线","projectDetail.tab.conf":"配置","projectDetail.tab.delete":"删除项目","projectDetail.delete.title":"删除该项目","projectDetail.delete.warn":"会删除项目配置、运行时和 worktree。{repoDir} 下的代码仓库不动。","projectDetail.delete.confirmLabel":"输入项目名以确认","projectDetail.delete.button":"删除项目","projectDetail.delete.deleting":"删除中…","projectDetail.lastActivity":"最后活跃","projectDetail.notFound":"项目不存在","projectDetail.notFoundHint":"可能已被删除或重命名。","projectDetail.backToList":"返回项目列表","pipeline.editor.title":"流水线 YAML","pipeline.editor.savedAt":"{time} 已保存","pipeline.editor.unsaved":"有未保存的修改","pipeline.editor.save":"保存","pipeline.editor.saving":"保存中…","pipeline.editor.reload":"从磁盘重新加载","pipeline.editor.discard.title":"放弃未保存的修改?","pipeline.editor.discard.body":"你的编辑会丢失。","pipeline.editor.errors":"YAML 解析错误","pipeline.editor.list":"流水线","pipeline.editor.list.add":"新建流水线","pipeline.editor.list.delete":"删除流水线","pipeline.editor.list.use":"设为当前","pipeline.editor.list.activeBadge":"当前","pipeline.editor.list.sample":"示例","pipeline.editor.delete.confirm.title":"删除流水线 {name}?","pipeline.editor.delete.confirm.body":"此操作不可撤销。","pipeline.newDialog.title":"新建流水线","pipeline.newDialog.field.filename":"文件名","pipeline.newDialog.field.filename.help":"只允许字母、数字、_ 和 -;自动追加 .yaml","pipeline.newDialog.field.copyFrom":"复制自","pipeline.newDialog.copyFrom.sample":"示例模板","pipeline.newDialog.copyFrom.active":"当前活动","pipeline.newDialog.create":"创建","projectDetail.tab.overview":"概览","projectDetail.tab.config":"配置","projectDetail.tab.pipelines":"流水线","projectDetail.tab.danger":"危险操作","projectDetail.openBoard":"看板","projectDetail.overview.repoDir":"仓库路径","projectDetail.overview.pmBackend":"PM 后端","projectDetail.overview.agent":"Agent","projectDetail.overview.cards":"卡片","projectDetail.overview.cards.value":"共 {total} 张 · {inprogress} 进行中 · {done} 完成","projectDetail.overview.workers":"Worker","projectDetail.overview.workers.value":"共 {total} 个({active} 活跃)","projectDetail.overview.pipeline":"Pipeline","projectDetail.overview.lastActivity":"最近活动","projectDetail.overview.notFound":"项目 {name} 不存在或无法读取。","projectDetail.config.confDirty":"● 未保存的修改","projectDetail.config.reload":"重新加载","projectDetail.config.save":"保存","projectDetail.config.saveAria":"保存配置","projectDetail.config.editorAria":"conf 文件编辑器","projectDetail.config.error.conflict.title":"配置已被其他地方修改","projectDetail.config.error.conflict.body":'conf 文件在你编辑期间被改过。点"重新加载"后再编辑。',"projectDetail.config.error.save.title":"保存失败","projectDetail.config.error.load":"加载失败:{detail}","projectDetail.pipelines.title":"流水线","projectDetail.pipelines.add":"新建流水线","projectDetail.pipelines.empty":'还没有流水线文件。点"新建流水线"开始。',"projectDetail.pipelines.activeBadge":"当前","projectDetail.pipelines.edit":"编辑","projectDetail.pipelines.editAria":"编辑 {name}","projectDetail.pipelines.switch":"切换","projectDetail.pipelines.switchAria":"切换到 {name}","projectDetail.pipelines.switch.confirm.title":"切换到 {name}","projectDetail.pipelines.switch.confirm.body":"当前 project.yaml 会被 {name} 的内容覆盖。继续?","projectDetail.pipelines.switch.confirm.button":"切换","projectDetail.pipelines.switch.error":"切换失败","projectDetail.pipelines.delete.confirm.title":"删除 {name}","projectDetail.pipelines.delete.confirm.body":"这个流水线文件会被永久删除。","projectDetail.pipelines.delete.error":"删除失败","projectDetail.pipelines.deleteAria":"删除 {name}","projectDetail.pipelines.create.error":"创建失败","projectDetail.danger.title":"删除项目","projectDetail.danger.body":"这会清理 {path}(包括所有卡片、runtime、logs)。","projectDetail.danger.includeClaude.label":"同时清理 repo 的 .claude/","projectDetail.danger.includeClaude.note":"repo 本身不动,只清这个目录。","projectDetail.danger.confirmPrompt":"输入项目名 {name} 确认:","projectDetail.danger.deleteAria":"永久删除项目","projectDetail.danger.deleteButton":"永久删除","projectDetail.danger.deleted.title":"已删除","projectDetail.danger.deleted.bodyWithList":`项目已删除。同时清理了:
|
|
471
|
+
Click to zoom`,"chat.attachment.preview.aria":"Preview {name}","chat.attachment.close.aria":"Close","chat.attachment.readErr":"Read failed: {detail}","chat.attachment.loading":"Loading…","chat.attachment.unsupported":"This file type cannot be previewed inline.","chat.attachment.download":"Download","chat.message.role.you":"You","chat.message.role.error":"Error","chat.message.role.assistant":"assistant","chat.message.truncated":"⚠ Output exceeded 10MB and was truncated","chat.filePicker.title":"Pick attachment file","chat.newSession.title":"New chat","chat.newSession.title.aria":"New chat","chat.newSession.close.aria":"Close","chat.newSession.field.agent":"Agent","chat.newSession.field.model":"Model (optional)","chat.newSession.field.model.default":"Use global default model","chat.newSession.field.title":"Title (optional)","chat.newSession.field.title.placeholder":"Empty = auto-generate from first message","chat.newSession.field.cwd":"Working directory (optional)","chat.newSession.field.cwd.browse":"Browse","chat.newSession.field.cwd.browseAria":"Pick directory","chat.newSession.field.cwd.title":"Pick directory","chat.newSession.field.cwd.help1":"The agent reads/writes files here. Absolute path; must exist.","chat.newSession.field.cwd.help2":"Empty = use the daemon’s startup cwd.","chat.newSession.cancel":"Cancel","chat.newSession.create":"Create","cardModal.editing":"⚠ Editing","cardModal.title.aria":"Card title","cardModal.editAria":"Edit card","cardModal.edit":"Edit","cardModal.close.aria":"Close","cardModal.error.save.title":"Save failed","cardModal.error.load":"Load failed: {detail}","cardModal.skills.loading":"Loading skill list…","cardModal.label.removeAria":"Remove {label}","cardModal.label.addPlaceholder":"+ Add label","cardModal.label.addAria":"Add label","cardModal.label.note":"Note: AI-PIPELINE / STARTED-* / COMPLETED-* / NEEDS-FIX are managed by the pipeline; manual changes may be overwritten","cardModal.section.description":"Description","cardModal.section.empty":"(empty)","cardModal.section.checklist":"Checklist","cardModal.checklist.empty":"No checklist items. Add `- [ ] item` syntax in the description.","cardModal.section.log":"Log","cardModal.body.aria":"Card description","cardModal.body.replaceNote":'Only replaces the "## Description" section; checklist and log sections are untouched.',"cardModal.action.launch":"Launch worker","cardModal.action.launch.disabledDone":"Card is done; drag back to Todo to launch","cardModal.action.launch.disabledRunning":"Pipeline is running — supervisor dispatches automatically, no manual launch needed","cardModal.action.launch.error":"Launch worker failed","cardModal.action.reset":"Reset card","cardModal.action.viewPrompt":"View prompt","cardModal.prompt.title":"Worker prompt (preview)","cardModal.prompt.loading":"Rebuilding prompt…","cardModal.prompt.error":"Failed: {detail}","cardModal.prompt.copy":"Copy","cardModal.prompt.copied":"Copied","cardModal.prompt.metaSkills":"skills: {skills}","cardModal.prompt.metaMemory":"memory block","cardModal.prompt.metaGit":"git mode","cardModal.prompt.metaNonGit":"non-git","cardModal.prompt.nativeTitle":"Also read natively by claude (not in this string):","cardModal.prompt.sourceActual":"✅ Actual prompt as dispatched ({time})","cardModal.prompt.sourcePreview":"⚠️ Reconstructed preview (card not yet dispatched; memory reflects current state, may differ from the real dispatch)","cardModal.action.reset.confirm.title":"Reset card #{seq}","cardModal.action.reset.confirm.body":"Card state goes back to initial; checklist progress is cleared.","cardModal.action.reset.confirm.button":"Reset","cardModal.action.reset.error":"Reset failed","cardModal.action.delete":"Delete card","cardModal.action.delete.confirm1.title":"Delete card #{seq}","cardModal.action.delete.confirm1.body":'About to delete "{title}". This cannot be undone (the md file is physically removed). Continue?',"cardModal.action.delete.confirm1.button":"Continue","cardModal.action.delete.confirm2.title":"Final confirmation","cardModal.action.delete.confirm2.body":"Please re-confirm deleting card #{seq}.","projectDetail.tab.skills":"Skills","projectDetail.tab.rules":"Rules","projectDetail.skills.title":"Skill whitelist","projectDetail.skills.desc":"Pick which skills this project loads. Narrows what workers, subagents and chat see — cuts token cost.","projectDetail.skills.noPolicy":"No whitelist — all skills are available (subagents load the full set from disk).","projectDetail.skills.hasPolicy":"Whitelist active — {count} skill(s) eligible.","projectDetail.skills.save":"Save whitelist","projectDetail.skills.clear":"Clear (load all)","projectDetail.skills.saveError":"Failed to save whitelist","projectDetail.skills.applied":"Saved. Projected {linked} linked, {pruned} pruned.","projectDetail.skills.unknown":"Unknown skill name(s), ignored: {names}","projectDetail.skills.empty":"No skills installed. Run `sps skill sync` first.","projectDetail.skills.selectAll":"Select all","projectDetail.skills.selectNone":"Select none","projectDetail.rules.title":"Project rules (read-only)","projectDetail.rules.readonly":"sps-cli only reads these. Editing is done at project creation or by an agent later.","projectDetail.rules.missing":"Not present","nav.prompts":"Prompts","prompts.title":"Prompt library","prompts.desc":"Reusable prompts with {{variable}} templates. Insert them into chat.","prompts.new":"New prompt","prompts.search":"Search prompts…","prompts.empty":"No prompts yet. Create one.","prompts.name":"Name","prompts.namePlaceholder":"kebab-case, e.g. code-review","prompts.nameError":"Name must be kebab-case (a-z, 0-9, dashes).","prompts.description":"Description","prompts.tags":"Tags","prompts.tagsPlaceholder":"comma,separated","prompts.body":"Body","prompts.bodyPlaceholder":"Write your prompt. Use {{variable}} for fill-ins.","prompts.favorite":"Favorite","prompts.save":"Save","prompts.delete":"Delete","prompts.deleteConfirm":'Delete prompt "{name}"? This removes the file.',"prompts.saveError":"Failed to save prompt","prompts.vars":"Variables: {names}","prompts.noVars":"No variables","prompts.insert":"Insert a prompt","prompts.selectHint":"Select a prompt on the left, or create a new one.","prompts.tagAdd":"Type a tag, press Enter","prompts.ai":"AI generate","prompts.ai.title":"AI generate a prompt","prompts.ai.intent":"Describe what you want","prompts.ai.placeholder":"e.g. a prompt for reviewing TypeScript code for security issues","prompts.ai.submit":"Generate","prompts.ai.wait":"The agent is writing… this can take a while.","prompts.ai.error":"Generation failed","skills.import":"Import","skills.import.title":"Import a skill","skills.import.name":"Name (kebab-case)","skills.import.body":"SKILL.md content","skills.import.submit":"Import","skills.import.error":"Import failed","skills.export":"Export SKILL.md","skills.updates.badge":"{count} update(s) available","skills.updates.none":"Up to date","skills.ai":"AI create","skills.ai.title":"AI create a skill","skills.ai.name":"Name (kebab-case)","skills.ai.intent":"What is this skill for?","skills.ai.placeholder":"e.g. how to write idiomatic Rust error handling","skills.ai.submit":"Create","skills.ai.wait":"The agent is writing the skill… this can take a while.","skills.ai.error":"Create failed","projectDetail.tab.graph":"Code Graph","projectDetail.tab.logs":"Logs","graph.title":"Code Graph","graph.desc":"A symbol-level dependency graph of this project (tree-sitter, zero-token). Gives agents surgical context so they explore fewer files.","graph.build":"Build graph","graph.rebuild":"Rebuild","graph.building":"Building…","graph.sync":"Sync","graph.syncing":"Syncing…","graph.sync.desc":"Incremental — only re-index changed files (fast)","graph.empty":"No graph yet — build one to enable agent navigation and the dependency view.","graph.buildFailed":"Build failed","graph.stat.files":"Files","graph.stat.nodes":"Nodes","graph.stat.edges":"Edges","graph.stat.db":"DB size","graph.stat.lastBuilt":"Last built","graph.viz.title":"File dependency graph","graph.viz.loading":"Loading graph…","graph.viz.empty":"Build the graph to see the dependency view.","graph.viz.hint":"Node = file · edge = import · drag to explore · search to highlight","graph.viz.search":"Highlight files…"},F3={"app.title":"SPS 控制台","nav.chat":"对话","nav.projects":"项目","nav.board":"看板","nav.workers":"Workers","nav.logs":"日志","nav.skills":"技能","nav.system":"系统","nav.processes":"进程","nav.audit":"审计日志","nav.memory":"记忆","nav.plugins":"插件","plugins.h1":"插件","plugins.desc":"全局插件开关。改动对之后新派发的卡生效。","plugins.tab.memory":"记忆","plugins.tab.channel":"频道","plugins.tab.model":"模型","plugins.tab.tool":"工具","plugins.comingSoon":"即将上线","plugins.model.title":"智能体模型","plugins.model.desc":"配置两个智能体的模型(全局)。worker=claude 执行、review·designer=openai 监工+编排。","plugins.model.worker":"Worker(执行 / claude)","plugins.model.reviewer":"Review·Designer(监工 / openai)","plugins.model.provider":"Provider","plugins.model.model":"模型","plugins.model.official":"官方 claude(默认)","plugins.model.save":"保存","plugins.model.saved":"已保存","plugins.model.error":"保存失败","nav.arrange":"编排","arrange.h1":"智能编排","arrange.project":"项目","arrange.none":"尚未开始 — 点上方「启动」拉起编排(几秒后出任务清单,确认即跑)。若下拉无项目,先在「新建项目」选智能编排模式。","arrange.start":"启动","arrange.stop":"停止","arrange.startErr":"启动/停止失败","arrange.view":"切换画板视图","arrange.viewFree":"自由","arrange.viewLane":"泳道","arrange.starting":"启动中,正在拆解任务清单…","arrange.planning":"正在拆解任务清单…","arrange.orchestrating":"正在编排中…","arrange.status":"状态","arrange.goal":"目标","arrange.plan":"任务清单 + 卡链路","arrange.approve":"确认任务清单","arrange.approveErr":"确认失败","arrange.tasks":"任务清单","arrange.collapse":"收起","arrange.expand":"展开任务清单","arrange.noCards":"暂无卡片 — 等待 orchestrator 派卡(确认清单后开始)。","arrange.cardPrompt":"卡片提示词","arrange.cardSkills":"技能","arrange.cardTask":"所属任务","arrange.cardLog":"日志","arrange.close":"关闭","arrange.cardsCount":"张卡","nav.aria":"主导航","memory.sub":"跨项目记忆 · 经 console 鉴权代理 agentmemory","memory.searchPlaceholder":"搜索记忆…(如:三消美术竞态怎么修)","memory.search":"搜索","memory.results":"召回结果","memory.rawHint":"(原始观察 · 接入实时捕获+压缩后这里会显示提炼的教训)","memory.sessions":"最近会话","memory.empty":"暂无记忆 · 接入实时捕获(P1)后自动累积","processes.title":"进程监控","processes.subtitle":"SPS ACP 启动的 claude 进程(其它途径启动的,如你自己的会话,不显示)","processes.refresh":"刷新","processes.aliveCount":"运行中 {n}","processes.col.kind":"类型","processes.col.slot":"会话槽","processes.col.project":"项目","processes.col.state":"状态","processes.col.memory":"内存","processes.col.action":"操作","processes.empty":"没有 SPS 进程","processes.filter.all":"全部","processes.filter.alive":"运行中","processes.filter.offline":"离线","processes.kind.all":"全部类型","processes.kind.worker":"构建 Worker","processes.kind.chat":"对话","processes.kill":"关闭","processes.killConfirm":"确定关闭进程 {slot}?","audit.title":"审计日志","audit.subtitle":"项目生命周期:创建 / 修改 / 删除","audit.refresh":"刷新","audit.filter.all":"全部","audit.action.create":"创建","audit.action.modify":"修改","audit.action.delete":"删除","audit.action.daemon":"Daemon","audit.col.time":"时间","audit.col.action":"动作","audit.col.project":"项目","audit.col.detail":"详情","audit.empty":"暂无审计记录","lang.toggle.aria":"切换界面语言","lang.en":"EN","lang.zh":"中","theme.toggle.aria":"切换主题","theme.dark":"暗色主题","theme.light":"亮色主题","status.server":"服务","status.offline":"离线","status.sse.open":"SSE","status.sse.connecting":"SSE·连接中","status.sse.down":"SSE·断开","status.pipelines.tooltip":"活跃流水线数","status.workers.tooltip":"活跃 Worker 数","status.pipeline.unit":"流水线","status.worker.unit":"Worker","common.save":"保存","common.cancel":"取消","common.delete":"删除","common.confirm":"确认","common.create":"创建","common.edit":"编辑","common.close":"关闭","common.loading":"加载中…","common.error":"出错","common.retry":"重试","common.empty":"暂无内容","common.search":"搜索","common.refresh":"刷新","common.copy":"复制","common.copied":"已复制","common.yes":"是","common.no":"否","common.required":"必填","common.optional":"可选","common.ok":"好","projects.title":"项目","projects.count":"本机有 {count} 个项目","projects.refresh.hint":"点击刷新重试","projects.new":"新建项目","projects.selectHint":"在左侧选择一个项目查看详情。","projects.sort.label":"排序方式","projects.sort.activity":"活跃度","projects.sort.date":"修改日期","projects.sort.name":"名字","projects.load.failed":"加载失败","projects.empty.title":"还没有项目","projects.empty.hint":"运行 {cmd} 创建第一个项目。","newProject.title":"新建项目","newProject.subtitle":"配置一个项目,worker 自动开跑","newProject.field.mode":"执行模式","newProject.field.mode.pipeline":"自动工作流","newProject.field.mode.pipelineDesc":"固定阶段流水线,claude worker 按卡执行","newProject.field.mode.smart":"智能编排","newProject.field.mode.smartDesc":"OpenAI 监工动态派卡 + claude worker 执行","newProject.field.mode.pipelineHint":"传统模式:你建卡片,worker 按阶段跑。","newProject.field.mode.smartHint":"给一个总目标,OpenAI 监工每轮探查产物、动态生成任务卡、驱动 claude 完成。","newProject.field.goal":"总目标 (GOAL.md)","newProject.field.goal.hint":"写入 docs/GOAL.md;智能编排据此拆任务清单。缺失则 tick 跳过该项目。","newProject.field.goal.placeholder":"例:做一个纯前端、单文件可运行的贪吃蛇网页小游戏…","newProject.field.name":"项目名","newProject.field.name.help":"只允许小写字母、数字、_ 和 -","newProject.field.dir":"项目目录","newProject.field.dir.preview":"项目将创建在 →","newProject.field.dir.help":"绝对路径;不存在会自动创建","newProject.field.branch":"合并目标分支","newProject.field.branch.help":"默认 main","newProject.field.maxWorkers":"最大并发 Worker 数","newProject.field.maxWorkers.help":"单项目并发数(推荐 1)","newProject.field.ackTimeout":"ACK 超时(秒)","newProject.field.ackTimeout.help":"Worker 响应等待秒数(默认 300)","newProject.field.gitlabProject":"GitLab/GitHub 远程","newProject.field.gitlabProject.help":"格式:用户名/仓库(可选)","newProject.field.matrixRoom":"Matrix 房间 ID","newProject.field.matrixRoom.help":"可选;不填则用全局默认","newProject.field.git":"启用 git","newProject.field.git.help":"关闭 → 非代码项目,跳过 commit/push/MR","newProject.submit":"创建项目","newProject.creating":"创建中…","newProject.created":"项目已创建","newProject.error.dirRequired":"项目目录必填","newProject.dir.browse":"浏览","newProject.dir.browseAria":"选择目录","newProject.back":"返回","newProject.back.aria":"返回项目列表","newProject.field.name.placeholder":"例如:acme-web","newProject.field.name.example":"只能用字母、数字、下划线、连字符。例如 acme-web","newProject.field.name.invalid":"名称只能包含 a-z A-Z 0-9 _ -","newProject.field.dir.long":"本机绝对路径的【项目目录】。选中的目录本身就是项目根;项目名默认取目录名。已有代码 → 收编(只加 .claude/ 配置,不动源码);空目录 → 新建。","newProject.field.dir.placeholder":"/home/you/projects/my-app","newProject.field.dir.createIfMissing":"目录不存在时自动创建(推荐 —— 否则 .claude/ 安装会被跳过)","newProject.field.dir.pickerTitle":"选择项目目录","newProject.field.dir.adopt":"检测到已有内容 → 将收编(只加配置,不动源码)","newProject.field.dir.fresh":"空目录 → 新建项目","newProject.field.name.derived":"项目名(默认取目录名,可微调)","newProject.field.maxWorkers.short":"最大 Worker 数","newProject.field.ackTimeout.minutes":"ACK 超时(分钟)","newProject.field.ackTimeout.minutes.help":"Worker 启动后多久没 ACK 视为失败","newProject.field.git.label":"启用 Git(Worker 自动 commit + push)","newProject.field.git.detail":"关闭后 Worker 只做任务、不做版本控制;适合文档/数据处理等非代码项目。","newProject.field.review.label":"启用清单验收(每卡完成后独立 agent 审核)","newProject.field.review.detail":"开启后:卡带「检查清单」的,Worker 完成后由独立 reviewer 逐条对着真实产物验收;全过留 Done,有不过自动插一张修正卡(优先跑)。无清单的卡不审。建卡时用 --checklist 写验收点。","newProject.field.git.branch":"合并分支","newProject.field.gitlabProject.label":"Git 远程项目路径","newProject.field.gitlabProject.help2":"如 user/repo,空则跳过远程 API(只本地 commit/push)","newProject.field.gitlabProject.placeholder":"user/repo","newProject.field.gitlabProjectId":"GitLab 项目 ID","newProject.field.gitlabProjectId.help":"数字;GitHub 用户留空","newProject.field.gitlabProjectId.placeholder":"42","newProject.section.notifications":"通知","newProject.field.matrixRoom.label":"Matrix 房间 ID","newProject.field.matrixRoom.help2":"空则使用全局配置;不填 = 不通知","newProject.field.matrixRoom.placeholder":"!abc:matrix.example.com","newProject.error.create.title":"创建失败","projectDetail.tab.pipeline":"流水线","projectDetail.tab.conf":"配置","projectDetail.tab.delete":"删除项目","projectDetail.delete.title":"删除该项目","projectDetail.delete.warn":"会删除项目配置、运行时和 worktree。{repoDir} 下的代码仓库不动。","projectDetail.delete.confirmLabel":"输入项目名以确认","projectDetail.delete.button":"删除项目","projectDetail.delete.deleting":"删除中…","projectDetail.lastActivity":"最后活跃","projectDetail.notFound":"项目不存在","projectDetail.notFoundHint":"可能已被删除或重命名。","projectDetail.backToList":"返回项目列表","pipeline.editor.title":"流水线 YAML","pipeline.editor.savedAt":"{time} 已保存","pipeline.editor.unsaved":"有未保存的修改","pipeline.editor.save":"保存","pipeline.editor.saving":"保存中…","pipeline.editor.reload":"从磁盘重新加载","pipeline.editor.discard.title":"放弃未保存的修改?","pipeline.editor.discard.body":"你的编辑会丢失。","pipeline.editor.errors":"YAML 解析错误","pipeline.editor.list":"流水线","pipeline.editor.list.add":"新建流水线","pipeline.editor.list.delete":"删除流水线","pipeline.editor.list.use":"设为当前","pipeline.editor.list.activeBadge":"当前","pipeline.editor.list.sample":"示例","pipeline.editor.delete.confirm.title":"删除流水线 {name}?","pipeline.editor.delete.confirm.body":"此操作不可撤销。","pipeline.newDialog.title":"新建流水线","pipeline.newDialog.field.filename":"文件名","pipeline.newDialog.field.filename.help":"只允许字母、数字、_ 和 -;自动追加 .yaml","pipeline.newDialog.field.copyFrom":"复制自","pipeline.newDialog.copyFrom.sample":"示例模板","pipeline.newDialog.copyFrom.active":"当前活动","pipeline.newDialog.create":"创建","projectDetail.tab.overview":"概览","projectDetail.tab.config":"配置","projectDetail.tab.pipelines":"流水线","projectDetail.tab.danger":"危险操作","projectDetail.openBoard":"看板","projectDetail.overview.repoDir":"仓库路径","projectDetail.overview.pmBackend":"PM 后端","projectDetail.overview.agent":"Agent","projectDetail.overview.cards":"卡片","projectDetail.overview.cards.value":"共 {total} 张 · {inprogress} 进行中 · {done} 完成","projectDetail.overview.workers":"Worker","projectDetail.overview.workers.value":"共 {total} 个({active} 活跃)","projectDetail.overview.pipeline":"Pipeline","projectDetail.overview.lastActivity":"最近活动","projectDetail.overview.notFound":"项目 {name} 不存在或无法读取。","projectDetail.config.confDirty":"● 未保存的修改","projectDetail.config.reload":"重新加载","projectDetail.config.save":"保存","projectDetail.config.saveAria":"保存配置","projectDetail.config.editorAria":"conf 文件编辑器","projectDetail.config.error.conflict.title":"配置已被其他地方修改","projectDetail.config.error.conflict.body":'conf 文件在你编辑期间被改过。点"重新加载"后再编辑。',"projectDetail.config.error.save.title":"保存失败","projectDetail.config.error.load":"加载失败:{detail}","projectDetail.pipelines.title":"流水线","projectDetail.pipelines.add":"新建流水线","projectDetail.pipelines.empty":'还没有流水线文件。点"新建流水线"开始。',"projectDetail.pipelines.activeBadge":"当前","projectDetail.pipelines.edit":"编辑","projectDetail.pipelines.editAria":"编辑 {name}","projectDetail.pipelines.switch":"切换","projectDetail.pipelines.switchAria":"切换到 {name}","projectDetail.pipelines.switch.confirm.title":"切换到 {name}","projectDetail.pipelines.switch.confirm.body":"当前 project.yaml 会被 {name} 的内容覆盖。继续?","projectDetail.pipelines.switch.confirm.button":"切换","projectDetail.pipelines.switch.error":"切换失败","projectDetail.pipelines.delete.confirm.title":"删除 {name}","projectDetail.pipelines.delete.confirm.body":"这个流水线文件会被永久删除。","projectDetail.pipelines.delete.error":"删除失败","projectDetail.pipelines.deleteAria":"删除 {name}","projectDetail.pipelines.create.error":"创建失败","projectDetail.danger.title":"删除项目","projectDetail.danger.body":"这会清理 {path}(包括所有卡片、runtime、logs)。","projectDetail.danger.includeClaude.label":"同时清理 repo 的 .claude/","projectDetail.danger.includeClaude.note":"repo 本身不动,只清这个目录。","projectDetail.danger.confirmPrompt":"输入项目名 {name} 确认:","projectDetail.danger.deleteAria":"永久删除项目","projectDetail.danger.deleteButton":"永久删除","projectDetail.danger.deleted.title":"已删除","projectDetail.danger.deleted.bodyWithList":`项目已删除。同时清理了:
|
|
472
472
|
{paths}`,"projectDetail.danger.deleted.body":"项目已删除。","projectDetail.danger.error":"删除失败","pipelineEditor.close":"关闭","pipelineEditor.error.conflict.title":"文件已被其他地方修改","pipelineEditor.error.yaml.title":"YAML 语法错误","pipelineEditor.error.save.title":"保存失败","pipelineEditor.error.serialize.title":"YAML 序列化失败","pipelineEditor.error.load":"加载失败:{detail}","pipelineEditor.mode.structured":"结构化","pipelineEditor.mode.yaml":"原始 YAML","pipelineEditor.parseError.prefix":"YAML 解析:{detail}","pipelineEditor.activeWarning":"⚠ 这是当前激活的流水线,保存后下一轮 tick 生效","pipelineEditor.yamlAria":"pipeline YAML 编辑器","pipelineEditor.status.unsaved":"● 未保存","pipelineEditor.status.saved":"已保存","pipelineEditor.status.noChanges":"无变化","pipelineEditor.reload":"重新加载","pipelineEditor.save":"保存","pipelineEditor.saveAria":"保存 pipeline","pipelineEditor.activeBadge":"当前","pipelineEditor.modeHint":"project = 事件驱动流水线(默认) · steps = 顺序脚本","pipelineEditor.stages.heading":"Stages({count})","pipelineEditor.stages.add":"添加 stage","pipelineEditor.stages.empty":'还没 stage。点"添加 stage"开始。',"pipelineEditor.stage.name.hint":"stage 唯一名","pipelineEditor.stage.profile.hint":"skill 画像,可空","pipelineEditor.stage.cardState.hint":"本 stage 期间卡片状态","pipelineEditor.stage.timeout.hint":"可选,如 30m 2h","pipelineEditor.stage.trigger.hint":"触发条件,可空走默认","pipelineEditor.stage.onComplete.hint":"成功后动作","pipelineEditor.stage.onFail.action.hint":"失败时动作,如 label NEEDS-FIX","pipelineEditor.stage.onFail.comment.hint":"写进卡片的注释","pipelineEditor.stage.halt.note":"(失败后停流水线;去掉则继续下一张卡)","pipelineEditor.stage.moveUp":"上移","pipelineEditor.stage.moveDown":"下移","pipelineEditor.stage.remove":"删除 stage","newPipelineDialog.title":"新建流水线","newPipelineDialog.field.filename.label":"文件名","newPipelineDialog.field.filename.placeholder":"例如 ci","newPipelineDialog.field.filename.help":"实际会保存为 {filename}。只允许 a-z A-Z 0-9 _ -;已有同名文件会 409 报错。","newPipelineDialog.section.template":"初始内容","newPipelineDialog.template.blank.label":"空白模板","newPipelineDialog.template.blank.desc":"最简 1 stage(develop → Done)","newPipelineDialog.template.sample.label":"教学模板","newPipelineDialog.template.sample.desc":"从 sample.yaml.example 复制(带注释,讲解所有字段)","newPipelineDialog.template.sample.unavailable":"sample.yaml.example 不存在","newPipelineDialog.template.active.label":"复制当前活动的","newPipelineDialog.template.active.desc":"从 project.yaml 复制(基于目前的配置改)","newPipelineDialog.template.active.unavailable":"project.yaml 不存在","newPipelineDialog.create.aria":"创建 pipeline","newPipelineDialog.cancel":"取消","board.title":"看板","board.title.bare":"看板","board.subtitle":"{name} · {cards} 张卡片 · {workers} workers 活跃","board.pickPrompt.title":"选择一个项目 🎯","board.pickPrompt.body":"看板按项目分。挑一个开始:","board.action.start":"启动","board.action.stop":"停止","board.action.startAria":"启动 pipeline","board.action.stopAria":"停止 pipeline","board.action.startError":"启动 pipeline 失败","board.action.stopError":"停止 pipeline 失败","board.action.reset":"重置","board.action.resetError":"重置失败","board.action.reset.confirm.title":"重置整个流水线","board.action.reset.confirm.body":"这会清空所有卡片的运行状态、worker marker、分支。不可撤销。","board.action.reset.confirm.button":"重置全部","board.action.newCard":"新卡片","board.action.newCard.error":"新建卡片失败","board.action.moveCard.error":"移动卡片失败","board.search.placeholder":"搜索标题 / skill / label…","board.search.aria":"搜索卡片","board.filter.clear":"清空","board.filter.clearAria":"清空筛选","board.filter.aria":"按 {label} 筛选","board.filter.clearSelection":"清空选择","board.error.loadCards":"加载卡片失败","board.col.planning":"Planning","board.col.backlog":"Backlog","board.col.todo":"Todo","board.col.inprogress":"Inprogress","board.col.qa":"QA / Review","board.col.done":"Done","kanban.checklist.label":"检查清单 {done}/{total}","kanban.checklist.more":"… 还有 {count} 条","kanban.column.empty":"— 空 —","kanban.time.justNow":"刚才","kanban.time.minutes":"{n} 分钟前","kanban.time.hours":"{n} 小时前","kanban.time.days":"{n} 天前","newCard.title":"新建卡片","newCard.field.title":"标题 *","newCard.field.title.placeholder":"例如:接入 GitHub OAuth 登录","newCard.field.title.help":"写简短明了的目标(<200 字符)","newCard.field.description":"描述","newCard.field.description.placeholder":"用户故事、需求、验收标准、参考资料… Claude 启动时会读这里的内容","newCard.field.description.help":"支持 markdown。空的话就只有 title,Claude 只能靠 title 推断要做啥。","newCard.field.skills":"技能","newCard.field.skills.help":"勾选哪些 skill 会被加载(走 frontmatter `skills:`)。不选也行,Worker 默认加载项目级 skills。","newCard.field.skills.loading":"加载 skill 列表…","newCard.field.skills.error":"skill 列表加载失败,不影响创建:{detail}","newCard.field.skills.selected":"已选 {count} 个:{names}","newCard.field.dispatch":"派发","newCard.field.dispatch.label":"立即派发执行(直接进 Backlog)","newCard.field.dispatch.help":"默认不勾:卡进 Planning 暂存,等你看板上拖到 Backlog 再开工。勾上:跳过暂存,下次 tick 直接派 worker 跑。","newCard.create.aria":"创建卡片","cardDetail.loading":"加载中…","cardDetail.error.load":"卡片加载失败","cardDetail.tabs.overview":"概览","cardDetail.tabs.body":"描述","cardDetail.tabs.checklist":"检查清单","cardDetail.tabs.history":"历史","cardDetail.tabs.actions":"操作","cardDetail.field.state":"状态","cardDetail.field.skills":"技能","cardDetail.field.labels":"标签","cardDetail.field.branch":"分支","cardDetail.field.assignee":"处理人","cardDetail.field.created":"创建时间","cardDetail.field.updated":"更新时间","cardDetail.field.empty":"—","cardDetail.actions.delete":"删除卡片","cardDetail.actions.delete.confirm.title":"删除卡片 #{seq}","cardDetail.actions.delete.confirm.body":"该卡片会被永久删除。","cardDetail.actions.delete.error":"删除失败","cardDetail.actions.update.error":"更新失败","cardDetail.body.empty":"没有描述","cardDetail.checklist.empty":"没有检查清单","cardDetail.checklist.progress":"进度 {done}/{total}","cardDetail.history.empty":"没有历史记录","cardDetail.notFound":"卡片 #{seq} 不存在","cardDetail.copy.aria":"复制 seq","cardDetail.close.aria":"关闭","cardDetail.save":"保存","cardDetail.saving":"保存中…","workers.title":"Workers","workers.summary":"跨 {projects} 项目 · {running} 跑 · {starting} 启动 · {stuck} 卡 · {crashed} 崩 · {idle} 闲","workers.summary.stuck":"{n} 卡","workers.summary.crashed":"{n} 崩","workers.refresh.aria":"刷新","workers.refresh":"刷新","workers.error.load":"加载失败:{detail}","workers.empty.hint":"点击项目 / worker 查看详情","logs.title":"日志","logs.subtitle.allProjects":"全部项目","logs.subtitle.project":"{name} 实时日志","logs.filter.errors":"只看错误","logs.filter.errors.aria":"只显示错误","logs.filter.search.placeholder":"过滤消息…","logs.empty":"还没有日志 —— 等待事件中","logs.error.load":"日志加载失败","logs.refresh":"刷新","logs.refresh.aria":"刷新日志","logs.scroll.bottom.aria":"滚动到底部","logs.scroll.pause":"已暂停(自动滚动关闭)","logs.scroll.resume":"恢复自动滚动","logs.subtitle.allProjectsCount":"全部项目({count})","logs.poll.5s":"5s 轮询","logs.paused":"⏸ 已暂停","logs.mode.live":"实时","logs.mode.history":"历史","logs.history.startAria":"查询起始时间","logs.history.queryAria":"查询","logs.history.query":"查询","logs.filter.project.aria":"筛选项目","logs.filter.project.all":"全部项目","logs.filter.keyword.placeholder":"过滤关键字…","logs.filter.keyword.aria":"过滤日志","logs.empty.match":"没有匹配的日志","skills.title":"技能 🧠","skills.subtitle":"跨项目共用的 skill(用 `sps skill ...` 管理)","skills.empty.title":"还没有 skill","skills.empty.hint":"运行 {cmd} 同步 bundled skills。","skills.linked.tooltip":"已链接到该项目","skills.frozen.tooltip":"已冻结(项目独立副本)","skills.category.all":"全部","skills.category.language":"语言","skills.category.domain":"领域","skills.category.persona":"角色","skills.category.workflow":"流程","skills.category.engine":"引擎","skills.category.genre":"品类","skills.category.platform":"平台","skills.category.review":"审核","skills.category.meta":"工具","skills.category.other":"其它","skills.tags.title":"标签","skills.tags.clear":"清除","skills.subtitleCount":"{count} 个 user-level skill","skills.search.placeholder":"搜索 skill…","skills.search.aria":"搜索 skill","skillDetail.actionFailed":"{label}失败","skillDetail.unfreezeAction":"解冻","skillDetail.freezeAction":"冻结","skillDetail.removeAction":"移除","skillDetail.removeConfirm.title":"从 {project} 移除 {name}","skillDetail.removeConfirm.body":"skill 链接会被解除,项目后续运行时将无法使用该 skill。","skillDetail.removeConfirm.button":"移除","skillDetail.unfreezeConfirm.title":"解冻 {name} @ {project}","skillDetail.unfreezeConfirm.body":"本地对这个 skill 的改动会被覆盖,回到最新共享版本。","skillDetail.unfreezeConfirm.button":"解冻","skillDetail.close.aria":"关闭","skillDetail.loading":"加载中…","skillDetail.error.load":"加载失败:{detail}","skillDetail.section.projects":"项目链接状态","skillDetail.section.empty":"还没有任何项目。先去创建一个项目。","skillDetail.section.preview":"SKILL.md 预览","skillDetail.toggleSection.aria":"{action} {file}","skillDetail.expand":"展开","skillDetail.collapse":"收起","skillDetail.edit":"编辑","skillDetail.translate":"中英转换","skillDetail.delete":"删除","skillDetail.save":"保存","skillDetail.cancel":"取消","skillDetail.translating":"翻译中…","skillDetail.saving":"保存中…","skillDetail.editHint":"直接编辑整份 SKILL.md(含 frontmatter)。保存后建议跑 `sps skill lint` 校验三轴与格式。","skillDetail.deleteConfirm":"确定从库中删除「{name}」?整目录会被移除,此操作不可撤销。","skillDetail.translateFailed":"翻译失败:{detail}","skillDetail.saveFailed":"保存失败:{detail}","skillDetail.deleteFailed":"删除失败:{detail}","system.title":"系统","system.subtitle":"全局配置 + 诊断 + 升级","system.section.env":"全局 env","system.section.env.help":"存储在 ~/.coral/env(mode 600)。所有项目共用。","system.section.env.save":"保存 env","system.section.env.error.conflict":"env 已被其它地方修改","system.section.env.error.save":"保存 env 失败","system.section.env.error.load":"加载 env 失败","system.section.env.dirtyDot":"● 未保存","system.section.env.aria":"env 编辑器","system.section.env.reload":"重新加载","system.section.upgrade":"升级","system.section.upgrade.current":"当前:v{version}","system.section.upgrade.latest":"npm 最新:v{version}","system.section.upgrade.uptodate":"已是最新","system.section.upgrade.update":"立即升级","system.section.upgrade.upgrading":"升级中…","system.section.upgrade.checking":"正在查询 npm…","system.section.upgrade.checkError":"查询失败:{detail}","system.section.upgrade.upgradeError":"升级失败:{detail}","system.section.upgrade.upgradeError.title":"升级失败","system.section.upgrade.command":"或在终端执行:{cmd}","system.section.upgrade.runningPipelines":"有 pipeline 在跑,先停止:{projects}","system.section.diagnostics":"诊断","system.section.diagnostics.help":"一次性跑所有项目的 sps doctor,看哪些项目出问题","system.section.diagnostics.run":"运行诊断","system.section.diagnostics.running":"运行中…","system.section.diagnostics.empty":"没有项目","system.section.diagnostics.checkAria":"检查 {project}","system.section.diagnostics.statusOk":"正常","system.section.diagnostics.statusFail":"有问题","system.section.diagnostics.error":"诊断失败:{detail}","system.h1":"系统","system.runtime":"运行时","system.memory.title":"记忆后端","system.memory.desc":"全局设置:worker 的记忆读写走哪个后端。改动对新派发的卡生效。","system.memory.provider":"后端","system.memory.url":"自定义 URL","system.memory.url.placeholder":"http://127.0.0.1:3111","system.memory.save":"保存","system.memory.save.aria":"保存记忆后端设置","system.memory.saved":"已保存","system.memory.error":"保存失败","system.memory.opt.none":"关闭(none)","system.memory.opt.builtin":"本地文件记忆(builtin)","system.memory.opt.agentmemory":"agentmemory(语义库)","system.memory.opt.custom":"自定义 REST(custom)","system.env.title.code":"~/.coral/env","system.env.title.prefix":"全局配置 ","system.env.edit.aria":"编辑 env 文件","system.env.edit.button":"编辑","system.env.editing.label":"⚠ 编辑模式","system.env.empty.before":'env 文件不存在。点"编辑"或者终端运行 ',"system.env.empty.after":"。","system.env.warning":"⚠ 文件包含凭证明文。保存时保持 0600 权限。","system.env.aria":"env 文件编辑器","system.env.dirtyMark":" · ● 未保存","system.env.cancel":"取消","system.env.save":"保存","system.env.save.aria":"保存 env","system.env.error.conflict.title":"env 被其他地方修改了","system.env.error.save.title":"保存失败","system.env.error.conflict.body":"请点取消后重开编辑。","system.upgrade.title":"版本","system.upgrade.checkLatest.aria":"检查最新版本","system.upgrade.checkUpdate":"检查更新","system.upgrade.label.current":"sps-cli(当前)","system.upgrade.label.latest":"npm(最新)","system.upgrade.latestPill":"最新","system.upgrade.button.upgradeAria":"升级到最新版本","system.upgrade.button.upgrade":"升级","system.upgrade.button.copyAria":"复制升级命令","system.upgrade.button.copyTitle":"自动升级失败时手动跑","system.upgrade.button.copy":"复制命令","system.upgrade.label.installed":"已安装","system.upgrade.installed.ok":"已生效(重启 console 后可见)","system.upgrade.installed.fail":"未升级成功","system.upgrade.label.check":"检查","system.upgrade.confirm.title":"升级 sps-cli","system.upgrade.confirm.body":"当前 {current},升级到 {latest}。要求所有 pipeline 已停止。升级后请重启 sps console 生效。","system.upgrade.confirm.button":"升级","system.upgrade.success.title":"升级完成","system.upgrade.success.body":'装上了 v{version}。请 `pkill -f "sps console"` 再重启以生效。',"system.upgrade.notEffective.title":"升级未生效","system.upgrade.notEffective.same":"npm 执行完毕但版本没变(仍 {version})——多半是权限或 registry 问题。可复制下面的命令在终端手动跑。","system.upgrade.notEffective.notInstalled":"npm 没装上新版本。可复制命令手动跑,或看下面日志定位。","system.upgrade.error.title":"升级失败","system.upgrade.copy.success.title":"命令已复制","system.upgrade.copy.success.body":`粘贴到终端运行即可:
|
|
473
473
|
{cmd}`,"system.upgrade.copy.fail.title":"复制失败","system.upgrade.copy.fail.body":`请手动复制:
|
|
474
474
|
{cmd}`,"system.diagnostics.title":"项目健康检查","system.diagnostics.checkAll":"检查全部","system.diagnostics.empty":"还没有项目。","system.diagnostics.expandAria":"展开","system.diagnostics.collapseAria":"折叠","system.diagnostics.never":'点 "检查" 运行 sps doctor',"system.diagnostics.checkAria":"检查","system.diagnostics.check":"检查","system.diagnostics.noFixesNeeded":"已无可修问题","system.diagnostics.fix.tip":"调 sps doctor <proj> --fix:自动创建 .claude/hooks/stop.sh、state.json 等","system.diagnostics.fixAria":"自动修复","system.diagnostics.fix":"修复","system.diagnostics.fixed":"已修复","system.diagnostics.error.fix":"doctor 修复失败","system.diagnostics.error.check":"doctor 检查失败","chat.title":"对话 💬","chat.empty.title":"对话 💬","chat.empty.hint":'点左上角"新建对话"开始一个 session。或直接在下方输入,会自动建 session。',"chat.empty.shortcuts":"Enter 发送 · Shift+Enter 换行 · 内容流式返回","chat.list.heading":"历史 {count}","chat.list.new":"新建对话","chat.list.empty":"还没对话。点上面新建。","chat.list.delete.aria":"删除对话","chat.list.deleteCli.aria":"从 Console 移除该 CLI 会话(不影响 Claude jsonl 存档)","chat.list.openAria":"打开对话 {title}{cwd}","chat.list.cwdSuffix":"(工作目录 {cwd})","chat.list.msgs":"{count} 条 · {time}","chat.list.olderToggle":"更早 · {count} 条","chat.detail.model.tooltip":"当前使用的模型","chat.detail.claudeSession.tooltip":"底层 claude 会话 id —— 恢复会话与记忆的锚","chat.delete.confirm.title":"删除对话","chat.delete.confirm.body.cli":"会从 Console 列表移除(停 daemon 会话)。Claude CLI 在 ~/.claude/projects 下的对话存档会保留 —— 想恢复到终端继续聊就重新跑 sps agent --chat --name <名>。","chat.delete.confirm.body.console":"对话记录会永久删除,不可恢复。","chat.delete.confirm.button":"删除","chat.cli.banner.bold":"CLI 会话","chat.cli.banner":"这是 CLI 会话(由 sps agent 创建),Console 仅展示历史。续聊请在终端运行:","chat.input.placeholder":"说点什么… (Enter 发送,Shift+Enter 换行,可拖入文件 / 粘贴图片)","chat.input.dragOver":"松开鼠标以附加文件…","chat.input.aria":"消息输入","chat.input.attach.aria":"附加本地文件","chat.input.attach.title":"附加本地文件(也可拖拽 / 粘贴图片)","chat.input.send":"发送","chat.input.send.aria":"发送","chat.input.interrupt":"中断","chat.input.interrupt.aria":"中断生成","chat.input.uploading":"上传中…","chat.input.removeAttachment":"移除 {name}","chat.error.interrupt.title":"中断失败","chat.cliBadge":"CLI","chat.cliBadge.tooltip":"该会话由 sps agent CLI 创建,从 Claude jsonl 实时读取(只读)","chat.session.title":"{title}","chat.session.id":"{id}","chat.session.empty":"下方输入问题开始对话 · Enter 发送 · Shift+Enter 换行","notFound.title":"404","notFound.body":"这个页面不存在。","notFound.home":"回到首页","workers.active.empty":"没有 worker 在运行。","workers.alerts.allHealthy":"全部 worker 健康","workers.alerts.pidDead":"PID 已死。","workers.alerts.markerStale":"marker 停 {ago}。","workers.capacity.col.project":"项目","workers.capacity.col.usage":"占用","workers.capacity.col.other":"其它","workers.capacity.detailHint":"详情 →","workers.panel.boardLink":"看板 →","workers.panel.loading":"加载 workers…","workers.panel.empty.slots":"该项目没有 worker slot。","workers.panel.empty.noWorker":"无 worker","workers.panel.empty.pickOne":"请选择一个 worker","workers.panel.idle.short":"空闲","workers.panel.section.currentCard":"当前卡片","workers.panel.idle.full":"slot 空闲,没有当前卡片。","workers.panel.section.claudeOutput":"Claude 输出 · 最近 {n} 行","workers.panel.output.loading":"加载中…","workers.panel.output.empty":"还没收到 session 输出。Worker 刚启动时需要几秒。","workers.panel.section.heartbeat":"Supervisor 心跳 · 最近 {n} 行","workers.panel.heartbeat.fullLog":"查看完整 log →","workers.panel.action.restart":"重启","workers.panel.action.restart.confirm.title":"重启 worker-{slot}","workers.panel.action.restart.confirm.body":"先杀进程,再重新 launch 到 #{seq}","workers.panel.action.restart.confirm.button":"重启","workers.panel.action.restart.error":"重启失败","workers.panel.action.kill":"终止","workers.panel.action.kill.confirm.title":"终止 worker-{slot}","workers.panel.action.kill.confirm.body":"当前任务强制中断。","workers.panel.action.kill.confirm.button":"终止","workers.panel.action.kill.error":"终止失败","dialog.confirm.default":"确定","dialog.alert.default":"知道了","dialog.cancel.default":"取消","dirPicker.title.default":"选择目录","dirPicker.close.aria":"关闭","dirPicker.up.aria":"上级目录","dirPicker.up.title":"上级目录","dirPicker.home.aria":"回到 Home","dirPicker.home.title":"回到 Home","dirPicker.loading":"加载中...","dirPicker.error.title":"读取失败","dirPicker.empty":"— 空目录 —","dirPicker.enter.aria":"进入 {name}/","dirPicker.pickFile.aria":"选择 {name}(双击直接确认)","dirPicker.fileLocked":"文件不可选","dirPicker.cancel":"取消","dirPicker.useFile":"使用此文件","dirPicker.useFile.tooltip.empty":"请先点选一个文件","dirPicker.useDir":"选此目录","dirPicker.newDir":"新建目录","dirPicker.newDir.aria":"在当前目录下新建子目录","dirPicker.newDir.prompt":"新目录名(仅字母数字 _ . -)","dirPicker.newDir.placeholder":"目录名","dirPicker.newDir.create":"创建","dirPicker.newDir.error.title":"新建目录失败","errorBoundary.title":"💥 UI 崩了","errorBoundary.refresh":"刷新页面","chat.error.create.title":"新建对话失败","chat.error.send.title":"发送失败","chat.error.fileTooBig.title":"文件超过上限","chat.error.fileTooBig.body":"单文件上限 50 MB;当前 {size} MB({name})","chat.error.uploadAttachment.title":"附件上传失败","chat.placeholder.attachment":"(附件)","chat.placeholder.viewAttachment":"(请查看附件)","chat.placeholder.attachmentTitle":"附件","chat.attachment.previewTooltip":`{name}
|
|
475
475
|
{path}
|
|
476
476
|
点击预览`,"chat.attachment.previewSimpleTooltip":`{name}
|
|
477
|
-
点击放大`,"chat.attachment.preview.aria":"预览 {name}","chat.attachment.close.aria":"关闭","chat.attachment.readErr":"读取失败:{detail}","chat.attachment.loading":"加载中...","chat.attachment.unsupported":"此文件类型不支持内联预览。","chat.attachment.download":"下载","chat.message.role.you":"你","chat.message.role.error":"错误","chat.message.role.assistant":"assistant","chat.message.truncated":"⚠ 输出超过 10MB,已截断","chat.filePicker.title":"选择附件文件","chat.newSession.title":"新建对话","chat.newSession.title.aria":"新建对话","chat.newSession.close.aria":"关闭","chat.newSession.field.agent":"Agent","chat.newSession.field.model":"模型(可选)","chat.newSession.field.model.default":"用全局默认模型","chat.newSession.field.title":"标题(可选)","chat.newSession.field.title.placeholder":"留空 = 自动用首条消息生成","chat.newSession.field.cwd":"工作目录(可选)","chat.newSession.field.cwd.browse":"浏览","chat.newSession.field.cwd.browseAria":"浏览选择目录","chat.newSession.field.cwd.title":"选择目录","chat.newSession.field.cwd.help1":"Agent 在该目录下读写文件。绝对路径,必须存在。","chat.newSession.field.cwd.help2":"留空则用 daemon 启动时的目录。","chat.newSession.cancel":"取消","chat.newSession.create":"创建","cardModal.editing":"⚠ 编辑中","cardModal.title.aria":"卡片标题","cardModal.editAria":"编辑卡片","cardModal.edit":"编辑","cardModal.close.aria":"关闭","cardModal.error.save.title":"保存失败","cardModal.error.load":"加载失败:{detail}","cardModal.skills.loading":"加载 skill 列表…","cardModal.label.removeAria":"删除 {label}","cardModal.label.addPlaceholder":"+ 添加 label","cardModal.label.addAria":"添加 label","cardModal.label.note":"注意:AI-PIPELINE / STARTED-* / COMPLETED-* / NEEDS-FIX 由流水线自动管理,手动改可能被覆盖","cardModal.section.description":"描述","cardModal.section.empty":"(空)","cardModal.section.checklist":"检查清单","cardModal.checklist.empty":"暂无清单项。在描述里用 `- [ ] 项` 语法添加。","cardModal.section.log":"日志","cardModal.body.aria":"卡片描述","cardModal.body.replaceNote":'只替换 "## 描述" 段的内容;检查清单和日志段不动。',"cardModal.action.launch":"启动 worker","cardModal.action.launch.disabledDone":"卡片已完成;先拖回 Todo 再启动","cardModal.action.launch.disabledRunning":"Pipeline 正在跑——supervisor 会自动 dispatch,无需手动启动","cardModal.action.launch.error":"启动 worker 失败","cardModal.action.reset":"重置卡片","cardModal.action.viewPrompt":"查看 prompt","cardModal.prompt.title":"注入 worker 的提示词(预览)","cardModal.prompt.loading":"重建提示词中…","cardModal.prompt.error":"获取失败:{detail}","cardModal.prompt.copy":"复制","cardModal.prompt.copied":"已复制","cardModal.prompt.metaSkills":"skills:{skills}","cardModal.prompt.metaMemory":"记忆块","cardModal.prompt.metaGit":"git 模式","cardModal.prompt.metaNonGit":"非 git","cardModal.prompt.nativeTitle":"claude 另原生读入(不在本串里):","cardModal.action.reset.confirm.title":"重置卡片 #{seq}","cardModal.action.reset.confirm.body":"卡片状态会回到初始,已做的 checklist 会清空。","cardModal.action.reset.confirm.button":"重置","cardModal.action.reset.error":"重置失败","cardModal.action.delete":"删除卡片","cardModal.action.delete.confirm1.title":"删除卡片 #{seq}","cardModal.action.delete.confirm1.body":'即将删除 "{title}"。此操作不可恢复(md 文件将被物理删除)。是否继续?',"cardModal.action.delete.confirm1.button":"继续","cardModal.action.delete.confirm2.title":"最终确认","cardModal.action.delete.confirm2.body":"请再次确认删除卡片 #{seq}。","projectDetail.tab.skills":"技能","projectDetail.tab.rules":"规则","projectDetail.skills.title":"Skill 白名单","projectDetail.skills.desc":"选择本项目加载哪些 skill。收窄 worker、subagent 与 chat 能看到的范围,降低 token 消耗。","projectDetail.skills.noPolicy":"未设白名单 —— 全部 skill 都可用(subagent 会从磁盘吃全量)。","projectDetail.skills.hasPolicy":"白名单已生效 —— {count} 个 skill 合格。","projectDetail.skills.save":"保存白名单","projectDetail.skills.clear":"清除(加载全部)","projectDetail.skills.saveError":"保存白名单失败","projectDetail.skills.applied":"已保存。投影 {linked} 个链接,清理 {pruned} 个。","projectDetail.skills.unknown":"未识别的 skill 名(已忽略):{names}","projectDetail.skills.empty":"尚无已安装的 skill,先跑 `sps skill sync`。","projectDetail.skills.selectAll":"全选","projectDetail.skills.selectNone":"全不选","projectDetail.rules.title":"项目规则(只读)","projectDetail.rules.readonly":"sps-cli 只读这些文件。编辑在项目创建时或日后由 agent 协助完成。","projectDetail.rules.missing":"不存在","nav.prompts":"提示词","prompts.title":"提示词库","prompts.desc":"带 {{变量}} 模板的可复用提示词,可插入到会话中。","prompts.new":"新建提示词","prompts.search":"搜索提示词…","prompts.empty":"还没有提示词,新建一个。","prompts.name":"名称","prompts.namePlaceholder":"kebab-case,如 code-review","prompts.nameError":"名称须为 kebab-case(小写字母、数字、连字符)。","prompts.description":"描述","prompts.tags":"标签","prompts.tagsPlaceholder":"逗号,分隔","prompts.body":"正文","prompts.bodyPlaceholder":"写你的提示词。用 {{变量}} 做填充位。","prompts.favorite":"收藏","prompts.save":"保存","prompts.delete":"删除","prompts.deleteConfirm":"删除提示词「{name}」?会移除文件。","prompts.saveError":"保存提示词失败","prompts.vars":"变量:{names}","prompts.noVars":"无变量","prompts.insert":"插入提示词","prompts.selectHint":"在左侧选择一个提示词,或新建一个。","prompts.tagAdd":"输入标签后按 Enter","prompts.ai":"AI 生成","prompts.ai.title":"AI 生成提示词","prompts.ai.intent":"描述你想要什么","prompts.ai.placeholder":"例如:一个用于审查 TypeScript 代码安全问题的提示词","prompts.ai.submit":"生成","prompts.ai.wait":"agent 正在生成…可能需要一会儿。","prompts.ai.error":"生成失败","skills.import":"导入","skills.import.title":"导入 Skill","skills.import.name":"名称(kebab-case)","skills.import.body":"SKILL.md 内容","skills.import.submit":"导入","skills.import.error":"导入失败","skills.export":"导出 SKILL.md","skills.updates.badge":"有 {count} 个可更新","skills.updates.none":"已是最新","skills.ai":"AI 创建","skills.ai.title":"AI 创建 Skill","skills.ai.name":"名称(kebab-case)","skills.ai.intent":"这个 skill 用来做什么?","skills.ai.placeholder":"例如:如何写地道的 Rust 错误处理","skills.ai.submit":"创建","skills.ai.wait":"agent 正在生成 skill…可能需要一会儿。","skills.ai.error":"创建失败","projectDetail.tab.graph":"代码图谱","projectDetail.tab.logs":"日志","graph.title":"代码图谱","graph.desc":"本项目的符号级依赖图(tree-sitter,零 token)。给 agent 精准上下文,少读文件、省 token。","graph.build":"建图","graph.rebuild":"重建","graph.building":"建图中…","graph.sync":"增量同步","graph.syncing":"同步中…","graph.sync.desc":"增量 —— 只重新索引变化的文件(快)","graph.empty":"尚未建图 —— 建一次即可启用 agent 导航与依赖图。","graph.buildFailed":"建图失败","graph.stat.files":"文件","graph.stat.nodes":"节点","graph.stat.edges":"边","graph.stat.db":"DB 体积","graph.stat.lastBuilt":"上次建图","graph.viz.title":"文件依赖图","graph.viz.loading":"加载图谱…","graph.viz.empty":"建图后可查看依赖图。","graph.viz.hint":"节点=文件 · 边=import · 拖拽探索 · 搜索高亮","graph.viz.search":"高亮文件…"},y_=j.createContext(null),b_="sps-console-lang";function q3(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(b_);if(e==="en"||e==="zh")return e}catch{}return"en"}function H3(e){try{window.localStorage.setItem(b_,e)}catch{}}function K3({children:e}){const[t,n]=j.useState(()=>q3());j.useEffect(()=>{typeof document<"u"&&(document.documentElement.lang=t==="zh"?"zh-CN":"en")},[t]);const i=j.useCallback(o=>{n(o),H3(o)},[]),a=j.useMemo(()=>{const o=t==="zh"?F3:U3;return(d,f)=>{let p=o[d]??d;if(f)for(const[g,m]of Object.entries(f))m!==void 0&&(p=p.replace(`{${g}}`,String(m)));return p}},[t]),l=j.useMemo(()=>({lang:t,setLang:i,t:a}),[t,i,a]);return c.jsx(y_.Provider,{value:l,children:e})}function x_(){const e=j.useContext(y_);if(!e)throw new Error("useLang must be used inside I18nProvider");return e}function Pe(){return x_().t}function G3(){const{lang:e,setLang:t,t:n}=x_();return c.jsxs("div",{role:"group","aria-label":n("lang.toggle.aria"),className:"dimension-segmented flex-1 min-w-0",children:[c.jsx(yk,{active:e==="en",onClick:()=>t("en"),label:n("lang.en"),ariaLabel:"English"}),c.jsx(yk,{active:e==="zh",onClick:()=>t("zh"),label:n("lang.zh"),ariaLabel:"中文"})]})}function yk({active:e,onClick:t,label:n,ariaLabel:i}){return c.jsx("button",{type:"button",onClick:t,"aria-label":i,"aria-pressed":e,className:["dimension-segment flex-1 py-1.5 text-xs font-bold font-[family-name:var(--font-mono)]",e?"dimension-segment-active":""].join(" "),children:n})}const v_="sps-console-theme";function w_(){if(typeof window>"u")return"dark";try{const e=window.localStorage.getItem(v_);if(e==="dark"||e==="light")return e}catch{}return"dark"}function Hy(e){typeof document>"u"||(document.documentElement.dataset.theme=e)}function V3(e){try{window.localStorage.setItem(v_,e)}catch{}}function Y3(){const e=w_();return Hy(e),e}const W3=["dark","light"];function Q3(){const e=Pe(),[t,n]=j.useState(()=>w_());j.useEffect(()=>{Hy(t)},[t]);const i=j.useCallback(a=>{n(a),V3(a),Hy(a)},[]);return c.jsx("div",{role:"group","aria-label":e("theme.toggle.aria"),className:"dimension-segmented shrink-0",children:W3.map(a=>{const l=t===a,o=a==="dark"?YL:N3;return c.jsx("button",{type:"button","aria-label":e(a==="dark"?"theme.dark":"theme.light"),"aria-pressed":l,title:e(a==="dark"?"theme.dark":"theme.light"),onClick:()=>i(a),className:["dimension-segment h-8 w-9",l?"dimension-segment-active":""].join(" "),children:c.jsx(o,{size:15,strokeWidth:2.4})},a)})})}const X3=[{to:"/chat",labelKey:"nav.chat",icon:a_},{to:"/projects",labelKey:"nav.projects",icon:r_},{to:"/board",labelKey:"nav.board",icon:PL},{to:"/workers",labelKey:"nav.workers",icon:m_},{to:"/skills",labelKey:"nav.skills",icon:CL},{to:"/prompts",labelKey:"nav.prompts",icon:l_},{to:"/arrange",labelKey:"nav.arrange",icon:Kb},{to:"/plugins",labelKey:"nav.plugins",icon:o3},{to:"/system",labelKey:"nav.system",icon:u_},{to:"/processes",labelKey:"nav.processes",icon:gp},{to:"/audit",labelKey:"nav.audit",icon:qb},{to:"/memory",labelKey:"nav.memory",icon:YR}];function Z3(){const e=Pe();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"shrink-0 font-[family-name:var(--font-heading)] font-bold text-lg px-3 pt-2 pb-4 flex items-center gap-3 text-[var(--color-text)]",children:[c.jsx(pl,{size:20,strokeWidth:2.5}),e("app.title")]}),c.jsx("nav",{className:"flex flex-1 min-h-0 flex-col gap-0.5 mt-2 overflow-y-auto pr-1","aria-label":e("nav.aria"),children:X3.map(t=>{const n=t.icon;return c.jsxs(YN,{to:t.to,className:({isActive:i})=>["dimension-menu-item gap-3 px-3 py-2.5 pl-4 font-semibold text-sm cursor-pointer",i?"dimension-menu-item-active":""].join(" "),children:[c.jsx(n,{size:18,strokeWidth:2.5}),e(t.labelKey)]},t.to)})}),c.jsxs("div",{className:"shrink-0 pt-3 flex items-center gap-2",children:[c.jsx(G3,{}),c.jsx(Q3,{})]})]})}class J3 extends Error{constructor(t,n,i){super(n),this.status=t,this.detail=i,this.name="ApiError"}}async function Gb(e){const t=await e.text().catch(()=>"");let n=t,i=`${e.status} ${e.statusText}`;try{const a=JSON.parse(t);if(n=a,a&&typeof a=="object"){const l=a,o=l.detail??l.title??l.message;typeof o=="string"&&o&&(i=o)}}catch{t&&(i=t.slice(0,300))}return new J3(e.status,i,n)}async function ct(e){const t=await fetch(e,{headers:{Accept:"application/json"}});if(!t.ok)throw await Gb(t);return await t.json()}async function gr(e,t){return E_("POST",e,t)}async function Vb(e,t){return E_("PUT",e,t)}async function k_(e){const t=await fetch(e,{method:"DELETE",headers:{Accept:"application/json"}});if(!t.ok)throw await Gb(t)}async function E_(e,t,n){const i=await fetch(t,{method:e,headers:{Accept:"application/json","Content-Type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)});if(!i.ok)throw await Gb(i);return await i.json()}function S_(){return ct("/api/system/info")}function eI(){return ct("/api/system/env")}function tI(){return ct("/api/system/env/raw")}async function nI(e,t){const n=await fetch("/api/system/env",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,etag:t})});if(!n.ok){const i=await n.text(),a=new Error(`${n.status}: ${i}`);throw a.status=n.status,a}return n.json()}function iI(){return ct("/api/system/memory")}async function rI(e,t){const n=await fetch("/api/system/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,url:t})});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}function Yb(){return ct("/api/system/agents")}async function aI(e){const t=await fetch("/api/system/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`${t.status}: ${await t.text()}`);return t.json()}function sI(){return ct("/api/system/latest-version")}async function lI(){const e=await fetch("/api/system/upgrade",{method:"POST"});if(!e.ok&&e.status!==409)throw new Error(`${e.status}: ${await e.text()}`);return e.json()}async function oI(e,t=!1){const n=t?"?fix=1":"",i=await fetch(`/api/system/doctor/${encodeURIComponent(e)}${n}`,{method:"POST"});if(!i.ok)throw new Error(`${i.status}: ${await i.text()}`);return i.json()}function Es(){return ct("/api/projects")}function cI(e){return ct(`/api/projects/${encodeURIComponent(e)}`)}async function uI(e){const t=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.text();throw new Error(`${t.status}: ${n}`)}return t.json()}function dI(e){return ct(`/api/projects/${encodeURIComponent(e)}/conf`)}async function fI(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/conf`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,etag:n})});if(!i.ok){const a=await i.text(),l=new Error(`${i.status}: ${a}`);throw l.status=i.status,l}return i.json()}async function pI(e,t={}){const n=await fetch(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return n.json()}function hI(e){return ct(`/api/projects/${encodeURIComponent(e)}/pipelines`)}async function mI(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/pipeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipeline:t})});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return n.json()}function gI(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`)}async function yI(e,t,n,i){const a=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,etag:i})});if(!a.ok){const l=await a.text(),o=new Error(`${a.status}: ${l}`);throw o.status=a.status,o}return a.json()}async function bI(e,t,n="blank"){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,template:n})});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return i.json()}async function xI(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}}function vI(){var f;const e=Pe(),t=Ve({queryKey:["system-info"],queryFn:S_,refetchInterval:3e4}),n=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:1e4}),i=kI(),a=!t.isError,l=((f=n.data)==null?void 0:f.data)??[],o=l.filter(p=>p.pipelineStatus==="running").length,d=l.reduce((p,g)=>p+g.workers.active,0);return c.jsxs("div",{className:"h-full flex items-center gap-3 px-6 font-[family-name:var(--font-mono)] text-[11px] text-[var(--color-text-muted)]",children:[c.jsx("span",{className:"nb-status",style:{background:a?"var(--color-running-bg)":"var(--color-crashed-bg)",color:a?"var(--color-running)":"var(--color-crashed)",padding:"2px 8px 2px 7px"},children:e(a?"status.server":"status.offline")}),c.jsx(wI,{state:i}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{className:"flex items-center gap-1",title:e("status.pipelines.tooltip"),children:[c.jsx(qp,{size:10,strokeWidth:2.5}),c.jsx("span",{className:"font-bold text-[var(--color-text)]",children:o})," ",e("status.pipeline.unit")]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{className:"flex items-center gap-1",title:e("status.workers.tooltip"),children:[c.jsx(c_,{size:10,strokeWidth:2.5}),c.jsx("span",{className:"font-bold text-[var(--color-text)]",children:d})," ",e("status.worker.unit")]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["localhost:",window.location.port]}),t.data&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["v",t.data.version]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["node ",t.data.nodeVersion]})]})]})}function wI({state:e}){const t=Pe();return e==="open"?c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)",padding:"2px 8px 2px 7px"},children:t("status.sse.open")}):e==="connecting"?c.jsx("span",{className:"nb-status",style:{background:"var(--color-stuck-bg)",color:"var(--color-stuck)",padding:"2px 8px 2px 7px"},children:t("status.sse.connecting")}):c.jsxs("span",{className:"nb-status",style:{background:"var(--color-crashed-bg)",color:"var(--color-crashed)",padding:"2px 8px 2px 7px"},children:[c.jsx(Eu,{size:9,strokeWidth:2.5}),t("status.sse.down")]})}function kI(){const[e,t]=j.useState("connecting");return j.useEffect(()=>{let n=null,i=null,a=!1;const l=()=>{a||(n=new EventSource("/stream/heartbeat"),n.addEventListener("server.heartbeat",()=>t("open")),n.addEventListener("open",()=>t("open")),n.addEventListener("error",()=>{(n==null?void 0:n.readyState)===EventSource.CLOSED?(t("closed"),i==null&&(i=setTimeout(()=>{i=null,n==null||n.close(),l()},1e4))):t("connecting")}))};return l(),()=>{a=!0,i!=null&&clearTimeout(i),n==null||n.close()}},[]),e}function bk({contentMode:e="workspace"}){const t=e==="workspace"?"overflow-hidden":"overflow-auto";return c.jsxs("div",{className:"grid grid-cols-[240px_1fr] grid-rows-[minmax(0,1fr)_40px] h-dvh overflow-hidden",children:[c.jsx("aside",{className:"row-start-1 min-h-0 overflow-hidden border-r-[3px] border-[var(--color-text)] bg-[var(--color-bg)] p-4 flex flex-col",children:c.jsx(Z3,{})}),c.jsx("main",{className:["row-start-1 min-h-0 p-6 flex flex-col gap-4",t].join(" "),children:c.jsx(JO,{})}),c.jsx("footer",{className:"col-span-2 row-start-2 border-t-[3px] border-[var(--color-text)] bg-[var(--color-bg)]",children:c.jsx(vI,{})})]})}function Ky(e,t){try{const n=JSON.stringify({message:(e instanceof Error?e.message:String(e)).slice(0,1e3),stack:(e instanceof Error?e.stack??"":"").slice(0,4e3),url:typeof window<"u"?window.location.href:"",ua:typeof navigator<"u"?navigator.userAgent:"",ts:new Date().toISOString(),context:t==null?void 0:t.slice(0,200)});fetch("/api/system/client-errors",{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(()=>{})}catch{}}function EI(){typeof window>"u"||(window.addEventListener("error",e=>{Ky(e.error??e.message??"unknown error","window.error")}),window.addEventListener("unhandledrejection",e=>{const t=e.reason;Ky(t instanceof Error?t:String(t),"unhandledrejection")}))}class SI extends j.Component{constructor(){super(...arguments);B1(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,i){var a;Ky(n,`ErrorBoundary: ${((a=i.componentStack)==null?void 0:a.slice(0,200))??""}`),console.error("[ErrorBoundary]",n,i)}render(){if(this.state.error){const n=(()=>{try{return window.localStorage.getItem("sps-console-lang")==="zh"?"zh":"en"}catch{return"en"}})(),i=n==="zh"?"💥 UI 崩了":"💥 UI crashed",a=n==="zh"?"刷新页面":"Refresh page";return c.jsx("div",{className:"p-6",children:c.jsxs("div",{className:"nb-card max-w-2xl bg-[var(--color-crashed-bg)]",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold mb-2",children:i}),c.jsx("p",{className:"text-sm mb-3 text-[var(--color-text-muted)]",children:this.state.error.message}),c.jsxs("details",{className:"text-xs mb-4",children:[c.jsx("summary",{className:"cursor-pointer font-semibold",children:"stack"}),c.jsx("pre",{className:"mt-2 font-[family-name:var(--font-mono)] overflow-auto max-h-60 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-md p-3",children:this.state.error.stack??"(no stack)"})]}),c.jsx("button",{className:"nb-btn nb-btn-mint",type:"button",onClick:()=>{this.setState({error:null}),window.location.reload()},children:a})]})})}return this.props.children}}function Wb(e,t){const[n,i]=j.useState(()=>{try{const a=localStorage.getItem(e);return a!==null?JSON.parse(a):t}catch{return t}});return j.useEffect(()=>{try{localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]),[n,i]}const Sf=e=>e.lastActivityAt?Date.parse(e.lastActivityAt):0;function N_(e,t){const n=[...e];return t==="name"?n.sort((i,a)=>i.name.localeCompare(a.name)):t==="date"?n.sort((i,a)=>Sf(a)-Sf(i)):n.sort((i,a)=>{const l=i.pipelineStatus==="running"?1:0,o=a.pipelineStatus==="running"?1:0;return l!==o?o-l:Sf(a)-Sf(i)})}function NI(e,t,n=7){const i=Date.now()-n*864e5,a=[],l=[];for(const o of e){const d=t(o);((d?Date.parse(d):0)>=i?a:l).push(o)}return{recent:a,older:l}}function _I(e){const t=new URLSearchParams;return e.project&&t.set("project",e.project),e.worker&&t.set("worker",e.worker),t.set("limit",String(e.limit)),e.since&&t.set("since",e.since),e.file&&t.set("file",e.file),ct(`/api/logs?${t}`)}function jI(e){return ct(`/api/logs/sources?project=${encodeURIComponent(e)}`)}const CI=["error","warn","info","debug"],AI=["error","warn","info"];function TI({project:e,initialWorker:t}){const n=Pe(),i=t??"",[a,l]=j.useState([]),[o,d]=j.useState(!1),[f,p]=j.useState(!0),[g,m]=j.useState(()=>new Set(AI)),[y,b]=j.useState(""),[k,v]=j.useState("live"),[S,E]=j.useState(()=>{const q=new Date(Date.now()-36e5),Y=D=>String(D).padStart(2,"0");return`${q.getFullYear()}-${Y(q.getMonth()+1)}-${Y(q.getDate())}T${Y(q.getHours())}:${Y(q.getMinutes())}`}),C=j.useRef(null),[N,_]=j.useState(""),{data:T}=Ve({queryKey:["log-sources",e],queryFn:()=>jI(e),enabled:!!e,refetchInterval:5e3}),M=j.useMemo(()=>(T==null?void 0:T.sources)??[],[T]),O=M.find(q=>q.key===N)??(i?M.find(q=>q.worker===Number(i)):void 0)??M.find(q=>q.kind==="pipeline")??M[0],R=O==null?void 0:O.file;j.useEffect(()=>{l([])},[e,R]);const{data:B,refetch:U}=Ve({queryKey:["logs",e,R,k,k==="history"?S:"live"],queryFn:()=>_I({project:e,file:R,limit:k==="history"?2e3:500,since:k==="history"?new Date(S).toISOString():void 0}),enabled:!!e,refetchInterval:k==="live"&&!o?2500:!1});j.useEffect(()=>{B!=null&&B.data&&l(B.data)},[B]),j.useEffect(()=>{if(!f)return;const q=C.current;q&&(q.scrollTop=q.scrollHeight)},[a,f]);const K=j.useMemo(()=>{const q=y.toLowerCase();return a.filter(Y=>!(!g.has(Y.level)||q&&!Y.msg.toLowerCase().includes(q)))},[a,g,y]);return c.jsxs("div",{className:"flex h-full min-h-0 max-w-full flex-col gap-3",children:[M.length>0&&c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 flex-wrap",children:[M.filter(q=>q.worker==null).map(q=>c.jsx(xk,{s:q,active:(O==null?void 0:O.key)===q.key,onClick:()=>_(q.key)},q.key)),c.jsx("div",{className:"ml-auto flex items-center gap-1.5 flex-wrap",children:M.filter(q=>q.worker!=null).map(q=>c.jsx(xk,{s:q,active:(O==null?void 0:O.key)===q.key,onClick:()=>_(q.key)},q.key))})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2 flex-wrap",children:[c.jsxs("div",{className:"flex gap-1 p-1 bg-[var(--color-bg)] border-[2px] border-[var(--color-text)] rounded-full shadow-[2px_2px_0_var(--color-text)]",children:[c.jsxs("button",{type:"button",onClick:()=>v("live"),"aria-pressed":k==="live",className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",k==="live"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]"].join(" "),children:[c.jsx(c_,{size:11,strokeWidth:2.5}),n("logs.mode.live")]}),c.jsxs("button",{type:"button",onClick:()=>v("history"),"aria-pressed":k==="history",className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",k==="history"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]"].join(" "),children:[c.jsx(DL,{size:11,strokeWidth:2.5}),n("logs.mode.history")]})]}),k==="history"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"datetime-local",className:"nb-input",style:{padding:"4px 8px",fontSize:12},value:S,onChange:q=>E(q.target.value),"aria-label":n("logs.history.startAria")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>U(),type:"button","aria-label":n("logs.history.queryAria"),children:[c.jsx(fl,{size:11,strokeWidth:3}),n("logs.history.query")]})]}),c.jsxs("div",{className:"relative flex-1 max-w-md",children:[c.jsx(fl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-subtle)]"}),c.jsx("input",{className:"nb-input pl-9 w-full",placeholder:n("logs.filter.keyword.placeholder"),value:y,onChange:q=>b(q.target.value),"aria-label":n("logs.filter.keyword.aria")})]}),c.jsx("div",{className:"flex items-center gap-1 p-1 bg-[var(--color-bg)] border-[2px] border-[var(--color-text)] rounded-full shadow-[2px_2px_0_var(--color-text)]",children:CI.map(q=>c.jsx(MI,{level:q,enabled:g.has(q),onToggle:()=>{m(Y=>{const D=new Set(Y);return D.has(q)?D.delete(q):D.add(q),D})}},q))}),c.jsxs("div",{className:"ml-auto flex gap-2",children:[k==="live"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>p(q=>!q),type:"button",children:f?"✓ Auto-scroll":"Auto-scroll"}),c.jsx("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>d(q=>!q),type:"button",children:o?c.jsxs(c.Fragment,{children:[c.jsx(Qu,{size:12,strokeWidth:3})," Resume"]}):c.jsxs(c.Fragment,{children:[c.jsx(n3,{size:12,strokeWidth:3})," Pause"]})})]}),c.jsxs("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>{const q=new Blob([K.map(F=>F.raw).join(`
|
|
477
|
+
点击放大`,"chat.attachment.preview.aria":"预览 {name}","chat.attachment.close.aria":"关闭","chat.attachment.readErr":"读取失败:{detail}","chat.attachment.loading":"加载中...","chat.attachment.unsupported":"此文件类型不支持内联预览。","chat.attachment.download":"下载","chat.message.role.you":"你","chat.message.role.error":"错误","chat.message.role.assistant":"assistant","chat.message.truncated":"⚠ 输出超过 10MB,已截断","chat.filePicker.title":"选择附件文件","chat.newSession.title":"新建对话","chat.newSession.title.aria":"新建对话","chat.newSession.close.aria":"关闭","chat.newSession.field.agent":"Agent","chat.newSession.field.model":"模型(可选)","chat.newSession.field.model.default":"用全局默认模型","chat.newSession.field.title":"标题(可选)","chat.newSession.field.title.placeholder":"留空 = 自动用首条消息生成","chat.newSession.field.cwd":"工作目录(可选)","chat.newSession.field.cwd.browse":"浏览","chat.newSession.field.cwd.browseAria":"浏览选择目录","chat.newSession.field.cwd.title":"选择目录","chat.newSession.field.cwd.help1":"Agent 在该目录下读写文件。绝对路径,必须存在。","chat.newSession.field.cwd.help2":"留空则用 daemon 启动时的目录。","chat.newSession.cancel":"取消","chat.newSession.create":"创建","cardModal.editing":"⚠ 编辑中","cardModal.title.aria":"卡片标题","cardModal.editAria":"编辑卡片","cardModal.edit":"编辑","cardModal.close.aria":"关闭","cardModal.error.save.title":"保存失败","cardModal.error.load":"加载失败:{detail}","cardModal.skills.loading":"加载 skill 列表…","cardModal.label.removeAria":"删除 {label}","cardModal.label.addPlaceholder":"+ 添加 label","cardModal.label.addAria":"添加 label","cardModal.label.note":"注意:AI-PIPELINE / STARTED-* / COMPLETED-* / NEEDS-FIX 由流水线自动管理,手动改可能被覆盖","cardModal.section.description":"描述","cardModal.section.empty":"(空)","cardModal.section.checklist":"检查清单","cardModal.checklist.empty":"暂无清单项。在描述里用 `- [ ] 项` 语法添加。","cardModal.section.log":"日志","cardModal.body.aria":"卡片描述","cardModal.body.replaceNote":'只替换 "## 描述" 段的内容;检查清单和日志段不动。',"cardModal.action.launch":"启动 worker","cardModal.action.launch.disabledDone":"卡片已完成;先拖回 Todo 再启动","cardModal.action.launch.disabledRunning":"Pipeline 正在跑——supervisor 会自动 dispatch,无需手动启动","cardModal.action.launch.error":"启动 worker 失败","cardModal.action.reset":"重置卡片","cardModal.action.viewPrompt":"查看 prompt","cardModal.prompt.title":"注入 worker 的提示词(预览)","cardModal.prompt.loading":"重建提示词中…","cardModal.prompt.error":"获取失败:{detail}","cardModal.prompt.copy":"复制","cardModal.prompt.copied":"已复制","cardModal.prompt.metaSkills":"skills:{skills}","cardModal.prompt.metaMemory":"记忆块","cardModal.prompt.metaGit":"git 模式","cardModal.prompt.metaNonGit":"非 git","cardModal.prompt.nativeTitle":"claude 另原生读入(不在本串里):","cardModal.prompt.sourceActual":"✅ 派发时真实注入({time})","cardModal.prompt.sourcePreview":"⚠️ 预览重建(本卡未派发过;记忆按当前库状态,可能与真实派发不同)","cardModal.action.reset.confirm.title":"重置卡片 #{seq}","cardModal.action.reset.confirm.body":"卡片状态会回到初始,已做的 checklist 会清空。","cardModal.action.reset.confirm.button":"重置","cardModal.action.reset.error":"重置失败","cardModal.action.delete":"删除卡片","cardModal.action.delete.confirm1.title":"删除卡片 #{seq}","cardModal.action.delete.confirm1.body":'即将删除 "{title}"。此操作不可恢复(md 文件将被物理删除)。是否继续?',"cardModal.action.delete.confirm1.button":"继续","cardModal.action.delete.confirm2.title":"最终确认","cardModal.action.delete.confirm2.body":"请再次确认删除卡片 #{seq}。","projectDetail.tab.skills":"技能","projectDetail.tab.rules":"规则","projectDetail.skills.title":"Skill 白名单","projectDetail.skills.desc":"选择本项目加载哪些 skill。收窄 worker、subagent 与 chat 能看到的范围,降低 token 消耗。","projectDetail.skills.noPolicy":"未设白名单 —— 全部 skill 都可用(subagent 会从磁盘吃全量)。","projectDetail.skills.hasPolicy":"白名单已生效 —— {count} 个 skill 合格。","projectDetail.skills.save":"保存白名单","projectDetail.skills.clear":"清除(加载全部)","projectDetail.skills.saveError":"保存白名单失败","projectDetail.skills.applied":"已保存。投影 {linked} 个链接,清理 {pruned} 个。","projectDetail.skills.unknown":"未识别的 skill 名(已忽略):{names}","projectDetail.skills.empty":"尚无已安装的 skill,先跑 `sps skill sync`。","projectDetail.skills.selectAll":"全选","projectDetail.skills.selectNone":"全不选","projectDetail.rules.title":"项目规则(只读)","projectDetail.rules.readonly":"sps-cli 只读这些文件。编辑在项目创建时或日后由 agent 协助完成。","projectDetail.rules.missing":"不存在","nav.prompts":"提示词","prompts.title":"提示词库","prompts.desc":"带 {{变量}} 模板的可复用提示词,可插入到会话中。","prompts.new":"新建提示词","prompts.search":"搜索提示词…","prompts.empty":"还没有提示词,新建一个。","prompts.name":"名称","prompts.namePlaceholder":"kebab-case,如 code-review","prompts.nameError":"名称须为 kebab-case(小写字母、数字、连字符)。","prompts.description":"描述","prompts.tags":"标签","prompts.tagsPlaceholder":"逗号,分隔","prompts.body":"正文","prompts.bodyPlaceholder":"写你的提示词。用 {{变量}} 做填充位。","prompts.favorite":"收藏","prompts.save":"保存","prompts.delete":"删除","prompts.deleteConfirm":"删除提示词「{name}」?会移除文件。","prompts.saveError":"保存提示词失败","prompts.vars":"变量:{names}","prompts.noVars":"无变量","prompts.insert":"插入提示词","prompts.selectHint":"在左侧选择一个提示词,或新建一个。","prompts.tagAdd":"输入标签后按 Enter","prompts.ai":"AI 生成","prompts.ai.title":"AI 生成提示词","prompts.ai.intent":"描述你想要什么","prompts.ai.placeholder":"例如:一个用于审查 TypeScript 代码安全问题的提示词","prompts.ai.submit":"生成","prompts.ai.wait":"agent 正在生成…可能需要一会儿。","prompts.ai.error":"生成失败","skills.import":"导入","skills.import.title":"导入 Skill","skills.import.name":"名称(kebab-case)","skills.import.body":"SKILL.md 内容","skills.import.submit":"导入","skills.import.error":"导入失败","skills.export":"导出 SKILL.md","skills.updates.badge":"有 {count} 个可更新","skills.updates.none":"已是最新","skills.ai":"AI 创建","skills.ai.title":"AI 创建 Skill","skills.ai.name":"名称(kebab-case)","skills.ai.intent":"这个 skill 用来做什么?","skills.ai.placeholder":"例如:如何写地道的 Rust 错误处理","skills.ai.submit":"创建","skills.ai.wait":"agent 正在生成 skill…可能需要一会儿。","skills.ai.error":"创建失败","projectDetail.tab.graph":"代码图谱","projectDetail.tab.logs":"日志","graph.title":"代码图谱","graph.desc":"本项目的符号级依赖图(tree-sitter,零 token)。给 agent 精准上下文,少读文件、省 token。","graph.build":"建图","graph.rebuild":"重建","graph.building":"建图中…","graph.sync":"增量同步","graph.syncing":"同步中…","graph.sync.desc":"增量 —— 只重新索引变化的文件(快)","graph.empty":"尚未建图 —— 建一次即可启用 agent 导航与依赖图。","graph.buildFailed":"建图失败","graph.stat.files":"文件","graph.stat.nodes":"节点","graph.stat.edges":"边","graph.stat.db":"DB 体积","graph.stat.lastBuilt":"上次建图","graph.viz.title":"文件依赖图","graph.viz.loading":"加载图谱…","graph.viz.empty":"建图后可查看依赖图。","graph.viz.hint":"节点=文件 · 边=import · 拖拽探索 · 搜索高亮","graph.viz.search":"高亮文件…"},y_=j.createContext(null),b_="sps-console-lang";function q3(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(b_);if(e==="en"||e==="zh")return e}catch{}return"en"}function H3(e){try{window.localStorage.setItem(b_,e)}catch{}}function K3({children:e}){const[t,n]=j.useState(()=>q3());j.useEffect(()=>{typeof document<"u"&&(document.documentElement.lang=t==="zh"?"zh-CN":"en")},[t]);const i=j.useCallback(o=>{n(o),H3(o)},[]),a=j.useMemo(()=>{const o=t==="zh"?F3:U3;return(d,f)=>{let p=o[d]??d;if(f)for(const[g,m]of Object.entries(f))m!==void 0&&(p=p.replace(`{${g}}`,String(m)));return p}},[t]),l=j.useMemo(()=>({lang:t,setLang:i,t:a}),[t,i,a]);return c.jsx(y_.Provider,{value:l,children:e})}function x_(){const e=j.useContext(y_);if(!e)throw new Error("useLang must be used inside I18nProvider");return e}function Pe(){return x_().t}function G3(){const{lang:e,setLang:t,t:n}=x_();return c.jsxs("div",{role:"group","aria-label":n("lang.toggle.aria"),className:"dimension-segmented flex-1 min-w-0",children:[c.jsx(yk,{active:e==="en",onClick:()=>t("en"),label:n("lang.en"),ariaLabel:"English"}),c.jsx(yk,{active:e==="zh",onClick:()=>t("zh"),label:n("lang.zh"),ariaLabel:"中文"})]})}function yk({active:e,onClick:t,label:n,ariaLabel:i}){return c.jsx("button",{type:"button",onClick:t,"aria-label":i,"aria-pressed":e,className:["dimension-segment flex-1 py-1.5 text-xs font-bold font-[family-name:var(--font-mono)]",e?"dimension-segment-active":""].join(" "),children:n})}const v_="sps-console-theme";function w_(){if(typeof window>"u")return"dark";try{const e=window.localStorage.getItem(v_);if(e==="dark"||e==="light")return e}catch{}return"dark"}function Hy(e){typeof document>"u"||(document.documentElement.dataset.theme=e)}function V3(e){try{window.localStorage.setItem(v_,e)}catch{}}function Y3(){const e=w_();return Hy(e),e}const W3=["dark","light"];function Q3(){const e=Pe(),[t,n]=j.useState(()=>w_());j.useEffect(()=>{Hy(t)},[t]);const i=j.useCallback(a=>{n(a),V3(a),Hy(a)},[]);return c.jsx("div",{role:"group","aria-label":e("theme.toggle.aria"),className:"dimension-segmented shrink-0",children:W3.map(a=>{const l=t===a,o=a==="dark"?YL:N3;return c.jsx("button",{type:"button","aria-label":e(a==="dark"?"theme.dark":"theme.light"),"aria-pressed":l,title:e(a==="dark"?"theme.dark":"theme.light"),onClick:()=>i(a),className:["dimension-segment h-8 w-9",l?"dimension-segment-active":""].join(" "),children:c.jsx(o,{size:15,strokeWidth:2.4})},a)})})}const X3=[{to:"/chat",labelKey:"nav.chat",icon:a_},{to:"/projects",labelKey:"nav.projects",icon:r_},{to:"/board",labelKey:"nav.board",icon:PL},{to:"/workers",labelKey:"nav.workers",icon:m_},{to:"/skills",labelKey:"nav.skills",icon:CL},{to:"/prompts",labelKey:"nav.prompts",icon:l_},{to:"/arrange",labelKey:"nav.arrange",icon:Kb},{to:"/plugins",labelKey:"nav.plugins",icon:o3},{to:"/system",labelKey:"nav.system",icon:u_},{to:"/processes",labelKey:"nav.processes",icon:gp},{to:"/audit",labelKey:"nav.audit",icon:qb},{to:"/memory",labelKey:"nav.memory",icon:YR}];function Z3(){const e=Pe();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"shrink-0 font-[family-name:var(--font-heading)] font-bold text-lg px-3 pt-2 pb-4 flex items-center gap-3 text-[var(--color-text)]",children:[c.jsx(pl,{size:20,strokeWidth:2.5}),e("app.title")]}),c.jsx("nav",{className:"flex flex-1 min-h-0 flex-col gap-0.5 mt-2 overflow-y-auto pr-1","aria-label":e("nav.aria"),children:X3.map(t=>{const n=t.icon;return c.jsxs(YN,{to:t.to,className:({isActive:i})=>["dimension-menu-item gap-3 px-3 py-2.5 pl-4 font-semibold text-sm cursor-pointer",i?"dimension-menu-item-active":""].join(" "),children:[c.jsx(n,{size:18,strokeWidth:2.5}),e(t.labelKey)]},t.to)})}),c.jsxs("div",{className:"shrink-0 pt-3 flex items-center gap-2",children:[c.jsx(G3,{}),c.jsx(Q3,{})]})]})}class J3 extends Error{constructor(t,n,i){super(n),this.status=t,this.detail=i,this.name="ApiError"}}async function Gb(e){const t=await e.text().catch(()=>"");let n=t,i=`${e.status} ${e.statusText}`;try{const a=JSON.parse(t);if(n=a,a&&typeof a=="object"){const l=a,o=l.detail??l.title??l.message;typeof o=="string"&&o&&(i=o)}}catch{t&&(i=t.slice(0,300))}return new J3(e.status,i,n)}async function ct(e){const t=await fetch(e,{headers:{Accept:"application/json"}});if(!t.ok)throw await Gb(t);return await t.json()}async function gr(e,t){return E_("POST",e,t)}async function Vb(e,t){return E_("PUT",e,t)}async function k_(e){const t=await fetch(e,{method:"DELETE",headers:{Accept:"application/json"}});if(!t.ok)throw await Gb(t)}async function E_(e,t,n){const i=await fetch(t,{method:e,headers:{Accept:"application/json","Content-Type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)});if(!i.ok)throw await Gb(i);return await i.json()}function S_(){return ct("/api/system/info")}function eI(){return ct("/api/system/env")}function tI(){return ct("/api/system/env/raw")}async function nI(e,t){const n=await fetch("/api/system/env",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,etag:t})});if(!n.ok){const i=await n.text(),a=new Error(`${n.status}: ${i}`);throw a.status=n.status,a}return n.json()}function iI(){return ct("/api/system/memory")}async function rI(e,t){const n=await fetch("/api/system/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,url:t})});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}function Yb(){return ct("/api/system/agents")}async function aI(e){const t=await fetch("/api/system/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`${t.status}: ${await t.text()}`);return t.json()}function sI(){return ct("/api/system/latest-version")}async function lI(){const e=await fetch("/api/system/upgrade",{method:"POST"});if(!e.ok&&e.status!==409)throw new Error(`${e.status}: ${await e.text()}`);return e.json()}async function oI(e,t=!1){const n=t?"?fix=1":"",i=await fetch(`/api/system/doctor/${encodeURIComponent(e)}${n}`,{method:"POST"});if(!i.ok)throw new Error(`${i.status}: ${await i.text()}`);return i.json()}function Es(){return ct("/api/projects")}function cI(e){return ct(`/api/projects/${encodeURIComponent(e)}`)}async function uI(e){const t=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.text();throw new Error(`${t.status}: ${n}`)}return t.json()}function dI(e){return ct(`/api/projects/${encodeURIComponent(e)}/conf`)}async function fI(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/conf`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,etag:n})});if(!i.ok){const a=await i.text(),l=new Error(`${i.status}: ${a}`);throw l.status=i.status,l}return i.json()}async function pI(e,t={}){const n=await fetch(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return n.json()}function hI(e){return ct(`/api/projects/${encodeURIComponent(e)}/pipelines`)}async function mI(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/pipeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipeline:t})});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return n.json()}function gI(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`)}async function yI(e,t,n,i){const a=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,etag:i})});if(!a.ok){const l=await a.text(),o=new Error(`${a.status}: ${l}`);throw o.status=a.status,o}return a.json()}async function bI(e,t,n="blank"){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,template:n})});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return i.json()}async function xI(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/pipelines/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}}function vI(){var f;const e=Pe(),t=Ve({queryKey:["system-info"],queryFn:S_,refetchInterval:3e4}),n=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:1e4}),i=kI(),a=!t.isError,l=((f=n.data)==null?void 0:f.data)??[],o=l.filter(p=>p.pipelineStatus==="running").length,d=l.reduce((p,g)=>p+g.workers.active,0);return c.jsxs("div",{className:"h-full flex items-center gap-3 px-6 font-[family-name:var(--font-mono)] text-[11px] text-[var(--color-text-muted)]",children:[c.jsx("span",{className:"nb-status",style:{background:a?"var(--color-running-bg)":"var(--color-crashed-bg)",color:a?"var(--color-running)":"var(--color-crashed)",padding:"2px 8px 2px 7px"},children:e(a?"status.server":"status.offline")}),c.jsx(wI,{state:i}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{className:"flex items-center gap-1",title:e("status.pipelines.tooltip"),children:[c.jsx(qp,{size:10,strokeWidth:2.5}),c.jsx("span",{className:"font-bold text-[var(--color-text)]",children:o})," ",e("status.pipeline.unit")]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{className:"flex items-center gap-1",title:e("status.workers.tooltip"),children:[c.jsx(c_,{size:10,strokeWidth:2.5}),c.jsx("span",{className:"font-bold text-[var(--color-text)]",children:d})," ",e("status.worker.unit")]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["localhost:",window.location.port]}),t.data&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["v",t.data.version]}),c.jsx("span",{className:"text-[var(--color-text-subtle)]",children:"·"}),c.jsxs("span",{children:["node ",t.data.nodeVersion]})]})]})}function wI({state:e}){const t=Pe();return e==="open"?c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)",padding:"2px 8px 2px 7px"},children:t("status.sse.open")}):e==="connecting"?c.jsx("span",{className:"nb-status",style:{background:"var(--color-stuck-bg)",color:"var(--color-stuck)",padding:"2px 8px 2px 7px"},children:t("status.sse.connecting")}):c.jsxs("span",{className:"nb-status",style:{background:"var(--color-crashed-bg)",color:"var(--color-crashed)",padding:"2px 8px 2px 7px"},children:[c.jsx(Eu,{size:9,strokeWidth:2.5}),t("status.sse.down")]})}function kI(){const[e,t]=j.useState("connecting");return j.useEffect(()=>{let n=null,i=null,a=!1;const l=()=>{a||(n=new EventSource("/stream/heartbeat"),n.addEventListener("server.heartbeat",()=>t("open")),n.addEventListener("open",()=>t("open")),n.addEventListener("error",()=>{(n==null?void 0:n.readyState)===EventSource.CLOSED?(t("closed"),i==null&&(i=setTimeout(()=>{i=null,n==null||n.close(),l()},1e4))):t("connecting")}))};return l(),()=>{a=!0,i!=null&&clearTimeout(i),n==null||n.close()}},[]),e}function bk({contentMode:e="workspace"}){const t=e==="workspace"?"overflow-hidden":"overflow-auto";return c.jsxs("div",{className:"grid grid-cols-[240px_1fr] grid-rows-[minmax(0,1fr)_40px] h-dvh overflow-hidden",children:[c.jsx("aside",{className:"row-start-1 min-h-0 overflow-hidden border-r-[3px] border-[var(--color-text)] bg-[var(--color-bg)] p-4 flex flex-col",children:c.jsx(Z3,{})}),c.jsx("main",{className:["row-start-1 min-h-0 p-6 flex flex-col gap-4",t].join(" "),children:c.jsx(JO,{})}),c.jsx("footer",{className:"col-span-2 row-start-2 border-t-[3px] border-[var(--color-text)] bg-[var(--color-bg)]",children:c.jsx(vI,{})})]})}function Ky(e,t){try{const n=JSON.stringify({message:(e instanceof Error?e.message:String(e)).slice(0,1e3),stack:(e instanceof Error?e.stack??"":"").slice(0,4e3),url:typeof window<"u"?window.location.href:"",ua:typeof navigator<"u"?navigator.userAgent:"",ts:new Date().toISOString(),context:t==null?void 0:t.slice(0,200)});fetch("/api/system/client-errors",{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(()=>{})}catch{}}function EI(){typeof window>"u"||(window.addEventListener("error",e=>{Ky(e.error??e.message??"unknown error","window.error")}),window.addEventListener("unhandledrejection",e=>{const t=e.reason;Ky(t instanceof Error?t:String(t),"unhandledrejection")}))}class SI extends j.Component{constructor(){super(...arguments);B1(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,i){var a;Ky(n,`ErrorBoundary: ${((a=i.componentStack)==null?void 0:a.slice(0,200))??""}`),console.error("[ErrorBoundary]",n,i)}render(){if(this.state.error){const n=(()=>{try{return window.localStorage.getItem("sps-console-lang")==="zh"?"zh":"en"}catch{return"en"}})(),i=n==="zh"?"💥 UI 崩了":"💥 UI crashed",a=n==="zh"?"刷新页面":"Refresh page";return c.jsx("div",{className:"p-6",children:c.jsxs("div",{className:"nb-card max-w-2xl bg-[var(--color-crashed-bg)]",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold mb-2",children:i}),c.jsx("p",{className:"text-sm mb-3 text-[var(--color-text-muted)]",children:this.state.error.message}),c.jsxs("details",{className:"text-xs mb-4",children:[c.jsx("summary",{className:"cursor-pointer font-semibold",children:"stack"}),c.jsx("pre",{className:"mt-2 font-[family-name:var(--font-mono)] overflow-auto max-h-60 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-md p-3",children:this.state.error.stack??"(no stack)"})]}),c.jsx("button",{className:"nb-btn nb-btn-mint",type:"button",onClick:()=>{this.setState({error:null}),window.location.reload()},children:a})]})})}return this.props.children}}function Wb(e,t){const[n,i]=j.useState(()=>{try{const a=localStorage.getItem(e);return a!==null?JSON.parse(a):t}catch{return t}});return j.useEffect(()=>{try{localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]),[n,i]}const Sf=e=>e.lastActivityAt?Date.parse(e.lastActivityAt):0;function N_(e,t){const n=[...e];return t==="name"?n.sort((i,a)=>i.name.localeCompare(a.name)):t==="date"?n.sort((i,a)=>Sf(a)-Sf(i)):n.sort((i,a)=>{const l=i.pipelineStatus==="running"?1:0,o=a.pipelineStatus==="running"?1:0;return l!==o?o-l:Sf(a)-Sf(i)})}function NI(e,t,n=7){const i=Date.now()-n*864e5,a=[],l=[];for(const o of e){const d=t(o);((d?Date.parse(d):0)>=i?a:l).push(o)}return{recent:a,older:l}}function _I(e){const t=new URLSearchParams;return e.project&&t.set("project",e.project),e.worker&&t.set("worker",e.worker),t.set("limit",String(e.limit)),e.since&&t.set("since",e.since),e.file&&t.set("file",e.file),ct(`/api/logs?${t}`)}function jI(e){return ct(`/api/logs/sources?project=${encodeURIComponent(e)}`)}const CI=["error","warn","info","debug"],AI=["error","warn","info"];function TI({project:e,initialWorker:t}){const n=Pe(),i=t??"",[a,l]=j.useState([]),[o,d]=j.useState(!1),[f,p]=j.useState(!0),[g,m]=j.useState(()=>new Set(AI)),[y,b]=j.useState(""),[k,v]=j.useState("live"),[S,E]=j.useState(()=>{const q=new Date(Date.now()-36e5),Y=D=>String(D).padStart(2,"0");return`${q.getFullYear()}-${Y(q.getMonth()+1)}-${Y(q.getDate())}T${Y(q.getHours())}:${Y(q.getMinutes())}`}),C=j.useRef(null),[N,_]=j.useState(""),{data:T}=Ve({queryKey:["log-sources",e],queryFn:()=>jI(e),enabled:!!e,refetchInterval:5e3}),M=j.useMemo(()=>(T==null?void 0:T.sources)??[],[T]),O=M.find(q=>q.key===N)??(i?M.find(q=>q.worker===Number(i)):void 0)??M.find(q=>q.kind==="pipeline")??M[0],R=O==null?void 0:O.file;j.useEffect(()=>{l([])},[e,R]);const{data:B,refetch:U}=Ve({queryKey:["logs",e,R,k,k==="history"?S:"live"],queryFn:()=>_I({project:e,file:R,limit:k==="history"?2e3:500,since:k==="history"?new Date(S).toISOString():void 0}),enabled:!!e,refetchInterval:k==="live"&&!o?2500:!1});j.useEffect(()=>{B!=null&&B.data&&l(B.data)},[B]),j.useEffect(()=>{if(!f)return;const q=C.current;q&&(q.scrollTop=q.scrollHeight)},[a,f]);const K=j.useMemo(()=>{const q=y.toLowerCase();return a.filter(Y=>!(!g.has(Y.level)||q&&!Y.msg.toLowerCase().includes(q)))},[a,g,y]);return c.jsxs("div",{className:"flex h-full min-h-0 max-w-full flex-col gap-3",children:[M.length>0&&c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 flex-wrap",children:[M.filter(q=>q.worker==null).map(q=>c.jsx(xk,{s:q,active:(O==null?void 0:O.key)===q.key,onClick:()=>_(q.key)},q.key)),c.jsx("div",{className:"ml-auto flex items-center gap-1.5 flex-wrap",children:M.filter(q=>q.worker!=null).map(q=>c.jsx(xk,{s:q,active:(O==null?void 0:O.key)===q.key,onClick:()=>_(q.key)},q.key))})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2 flex-wrap",children:[c.jsxs("div",{className:"flex gap-1 p-1 bg-[var(--color-bg)] border-[2px] border-[var(--color-text)] rounded-full shadow-[2px_2px_0_var(--color-text)]",children:[c.jsxs("button",{type:"button",onClick:()=>v("live"),"aria-pressed":k==="live",className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",k==="live"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]"].join(" "),children:[c.jsx(c_,{size:11,strokeWidth:2.5}),n("logs.mode.live")]}),c.jsxs("button",{type:"button",onClick:()=>v("history"),"aria-pressed":k==="history",className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",k==="history"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]"].join(" "),children:[c.jsx(DL,{size:11,strokeWidth:2.5}),n("logs.mode.history")]})]}),k==="history"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"datetime-local",className:"nb-input",style:{padding:"4px 8px",fontSize:12},value:S,onChange:q=>E(q.target.value),"aria-label":n("logs.history.startAria")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>U(),type:"button","aria-label":n("logs.history.queryAria"),children:[c.jsx(fl,{size:11,strokeWidth:3}),n("logs.history.query")]})]}),c.jsxs("div",{className:"relative flex-1 max-w-md",children:[c.jsx(fl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-subtle)]"}),c.jsx("input",{className:"nb-input pl-9 w-full",placeholder:n("logs.filter.keyword.placeholder"),value:y,onChange:q=>b(q.target.value),"aria-label":n("logs.filter.keyword.aria")})]}),c.jsx("div",{className:"flex items-center gap-1 p-1 bg-[var(--color-bg)] border-[2px] border-[var(--color-text)] rounded-full shadow-[2px_2px_0_var(--color-text)]",children:CI.map(q=>c.jsx(MI,{level:q,enabled:g.has(q),onToggle:()=>{m(Y=>{const D=new Set(Y);return D.has(q)?D.delete(q):D.add(q),D})}},q))}),c.jsxs("div",{className:"ml-auto flex gap-2",children:[k==="live"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>p(q=>!q),type:"button",children:f?"✓ Auto-scroll":"Auto-scroll"}),c.jsx("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>d(q=>!q),type:"button",children:o?c.jsxs(c.Fragment,{children:[c.jsx(Qu,{size:12,strokeWidth:3})," Resume"]}):c.jsxs(c.Fragment,{children:[c.jsx(n3,{size:12,strokeWidth:3})," Pause"]})})]}),c.jsxs("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>{const q=new Blob([K.map(F=>F.raw).join(`
|
|
478
478
|
`)],{type:"text/plain"}),Y=URL.createObjectURL(q),D=document.createElement("a");D.href=Y,D.download=`${e}-log-${Date.now()}.log`,D.click(),URL.revokeObjectURL(Y)},type:"button",children:[c.jsx(Hp,{size:12,strokeWidth:2.5})," Export"]})]})]}),c.jsxs("div",{className:"scroll-frame flex min-h-0 flex-1 flex-col rounded-lg border-2 border-[var(--color-border-light)] bg-[var(--color-bg-cream)]",children:[c.jsxs("div",{className:"px-4 bg-surface-soft bg-color-bg-soft py-2 bg-[var(--color-bg-cream)] border-b-2 border-[var(--color-border-light)] flex shrink-0 items-center justify-between font-[family-name:var(--font-mono)] text-xs",children:[c.jsxs("span",{className:"text-[var(--color-text-muted)]",children:[(B==null?void 0:B.file)??`~/.coral/projects/${e}/logs/*.log`," · ",a.length," lines",o&&c.jsx("span",{className:"text-[var(--color-stuck)] ml-2 font-bold",children:n("logs.paused")})]}),k==="live"?c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)"},children:"live"}):c.jsx("span",{className:"nb-status",style:{background:"var(--color-accent-purple)",color:"var(--color-text)"},children:"history"})]}),c.jsxs("div",{ref:C,className:"scroll-frame-body flex-1 bg-surface-input font-[family-name:var(--font-mono)] text-[12px] leading-[22px] p-2",onScroll:q=>{const Y=q.currentTarget;!(Y.scrollHeight-Y.scrollTop-Y.clientHeight<40)&&f&&p(!1)},children:[K.map((q,Y)=>c.jsx(DI,{line:q},Y)),K.length===0&&c.jsx("div",{className:"text-center py-12 text-[var(--color-text-subtle)]",children:n("logs.empty.match")})]})]})]})}function MI({level:e,enabled:t,onToggle:n}){const i={error:"var(--color-crashed-bg)",warn:"var(--color-stuck-bg)",info:"var(--color-secondary)",debug:"var(--color-accent-purple)"},a={error:"var(--color-crashed)",warn:"var(--color-stuck)",info:"var(--color-text)",debug:"var(--color-text)"};return c.jsx("button",{type:"button",onClick:n,"aria-pressed":t,className:["px-3 py-0.5 rounded-full font-[family-name:var(--font-mono)] text-[10px] font-bold tracking-widest cursor-pointer",t?"border-[1.5px] border-[var(--color-text)]":"text-[var(--color-text-subtle)]"].join(" "),style:t?{background:i[e],color:a[e]}:{},children:e.toUpperCase()})}function DI({line:e}){var n;const t={error:"bg-[var(--color-crashed)] text-[var(--color-text)]",warn:"bg-[var(--color-stuck)] text-[var(--color-text)]",info:"bg-[var(--color-secondary)] text-[var(--color-text)]",debug:"",trace:""};return c.jsxs("div",{className:"grid gap-2 px-2 py-0.5 rounded hover:bg-[var(--color-bg-cream)] grid-cols-[100px_60px_1fr]",children:[c.jsx("span",{className:"text-[var(--color-text-subtle)] whitespace-nowrap",children:e.ts?((n=e.ts.split("T")[1])==null?void 0:n.replace("Z",""))??e.ts:"--"}),c.jsx("span",{className:`text-center font-bold ${t[e.level]??""}`,style:{borderRadius:4,padding:"0 6px"},children:e.level.toUpperCase()}),c.jsx("span",{className:"truncate text-[var(--color-text)]",children:e.msg})]})}function xk({s:e,active:t,onClick:n}){const i=e.status==="running"?"#22c55e":e.status==="error"?"#ef4444":"#9ca3af";return c.jsxs("button",{type:"button",onClick:n,"aria-pressed":t,"aria-label":`查看${e.label}日志`,className:["px-2.5 py-1 rounded-full text-xs font-bold border-[2px] border-[var(--color-text)] flex items-center gap-1.5",t?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"bg-white text-[var(--color-text-muted)] hover:-translate-y-px"].join(" "),children:[e.worker!=null&&c.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:i,display:"inline-block"},"aria-hidden":!0}),e.label]})}function OI({title:e,body:t,confirm:n,cancel:i,onConfirm:a,onCancel:l,danger:o}){const d=Pe();return j.useEffect(()=>{const f=p=>{p.key==="Escape"&&l()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[l]),c.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-title",className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/30",children:c.jsxs("div",{className:"nb-card max-w-md w-full",children:[c.jsx("h2",{id:"confirm-title",className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-2",children:e}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-5",children:t}),c.jsxs("div",{className:"flex gap-3 justify-end",children:[c.jsx("button",{className:"nb-btn",onClick:l,type:"button",children:i??d("dialog.cancel.default")}),c.jsx("button",{className:o?"nb-btn nb-btn-danger":"nb-btn nb-btn-yellow",onClick:async()=>{await a()},type:"button",children:n})]})]})})}const __=j.createContext(null);function RI({children:e}){const t=Pe(),[n,i]=j.useState(null),a=j.useCallback(d=>new Promise(f=>{i({kind:"confirm",opts:d,resolve:p=>{i(null),f(p)}})}),[]),l=j.useCallback(d=>new Promise(f=>{i({kind:"alert",opts:d,resolve:()=>{i(null),f()}})}),[]),o=j.useCallback(d=>new Promise(f=>{i({kind:"prompt",opts:d,resolve:p=>{i(null),f(p)}})}),[]);return c.jsxs(__.Provider,{value:{confirm:a,alert:l,prompt:o},children:[e,(n==null?void 0:n.kind)==="confirm"&&c.jsx(OI,{title:n.opts.title,body:n.opts.body,confirm:n.opts.confirm??t("dialog.confirm.default"),cancel:n.opts.cancel,danger:n.opts.danger,onConfirm:()=>n.resolve(!0),onCancel:()=>n.resolve(!1)}),(n==null?void 0:n.kind)==="alert"&&c.jsx(LI,{title:n.opts.title,body:n.opts.body,confirm:n.opts.confirm??t("dialog.alert.default"),onClose:()=>n.resolve()}),(n==null?void 0:n.kind)==="prompt"&&c.jsx(II,{title:n.opts.title,body:n.opts.body,placeholder:n.opts.placeholder,defaultValue:n.opts.defaultValue,confirm:n.opts.confirm??t("dialog.confirm.default"),cancel:n.opts.cancel??t("dialog.cancel.default"),onConfirm:d=>n.resolve(d),onCancel:()=>n.resolve(null)})]})}function un(){const e=j.useContext(__);if(!e)throw new Error("useDialog must be used inside <DialogProvider>");return e}function LI({title:e,body:t,confirm:n,onClose:i}){return j.useEffect(()=>{const a=l=>{(l.key==="Escape"||l.key==="Enter")&&i()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[i]),c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/30",children:c.jsxs("div",{className:"nb-card max-w-md w-full",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-2",children:e}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-5 whitespace-pre-wrap break-words",children:t}),c.jsx("div",{className:"flex gap-3 justify-end",children:c.jsx("button",{className:"nb-btn nb-btn-primary",onClick:i,type:"button",autoFocus:!0,children:n})})]})})}function II({title:e,body:t,placeholder:n,defaultValue:i,confirm:a,cancel:l,onConfirm:o,onCancel:d}){const[f,p]=j.useState(i??""),g=j.useRef(null);j.useEffect(()=>{var b,k;(b=g.current)==null||b.focus(),(k=g.current)==null||k.select();const y=v=>{v.key==="Escape"&&d()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[d]);const m=()=>{const y=f.trim();y&&o(y)};return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/30",children:c.jsxs("div",{className:"nb-card max-w-md w-full",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-2",children:e}),t&&c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-3 whitespace-pre-wrap break-words",children:t}),c.jsx("input",{ref:g,type:"text",className:"nb-input w-full mb-5",placeholder:n,value:f,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&!y.nativeEvent.isComposing&&(y.preventDefault(),m())}}),c.jsxs("div",{className:"flex gap-3 justify-end",children:[c.jsx("button",{className:"nb-btn",onClick:d,type:"button",children:l}),c.jsx("button",{className:"nb-btn nb-btn-primary",onClick:m,type:"button",disabled:!f.trim(),children:a})]})]})})}const Qb=Symbol.for("yaml.alias"),Gy=Symbol.for("yaml.document"),xs=Symbol.for("yaml.map"),j_=Symbol.for("yaml.pair"),Lr=Symbol.for("yaml.scalar"),ec=Symbol.for("yaml.seq"),Yi=Symbol.for("yaml.node.type"),Ss=e=>!!e&&typeof e=="object"&&e[Yi]===Qb,wl=e=>!!e&&typeof e=="object"&&e[Yi]===Gy,tc=e=>!!e&&typeof e=="object"&&e[Yi]===xs,en=e=>!!e&&typeof e=="object"&&e[Yi]===j_,Gt=e=>!!e&&typeof e=="object"&&e[Yi]===Lr,nc=e=>!!e&&typeof e=="object"&&e[Yi]===ec;function on(e){if(e&&typeof e=="object")switch(e[Yi]){case xs:case ec:return!0}return!1}function cn(e){if(e&&typeof e=="object")switch(e[Yi]){case Qb:case xs:case Lr:case ec:return!0}return!1}const C_=e=>(Gt(e)||on(e))&&!!e.anchor,fi=Symbol("break visit"),A_=Symbol("skip children"),Or=Symbol("remove node");function kl(e,t){const n=T_(t);wl(e)?go(null,e.contents,n,Object.freeze([e]))===Or&&(e.contents=null):go(null,e,n,Object.freeze([]))}kl.BREAK=fi;kl.SKIP=A_;kl.REMOVE=Or;function go(e,t,n,i){const a=M_(e,t,n,i);if(cn(a)||en(a))return D_(e,i,a),go(e,a,n,i);if(typeof a!="symbol"){if(on(t)){i=Object.freeze(i.concat(t));for(let l=0;l<t.items.length;++l){const o=go(l,t.items[l],n,i);if(typeof o=="number")l=o-1;else{if(o===fi)return fi;o===Or&&(t.items.splice(l,1),l-=1)}}}else if(en(t)){i=Object.freeze(i.concat(t));const l=go("key",t.key,n,i);if(l===fi)return fi;l===Or&&(t.key=null);const o=go("value",t.value,n,i);if(o===fi)return fi;o===Or&&(t.value=null)}}return a}async function Gp(e,t){const n=T_(t);wl(e)?await yo(null,e.contents,n,Object.freeze([e]))===Or&&(e.contents=null):await yo(null,e,n,Object.freeze([]))}Gp.BREAK=fi;Gp.SKIP=A_;Gp.REMOVE=Or;async function yo(e,t,n,i){const a=await M_(e,t,n,i);if(cn(a)||en(a))return D_(e,i,a),yo(e,a,n,i);if(typeof a!="symbol"){if(on(t)){i=Object.freeze(i.concat(t));for(let l=0;l<t.items.length;++l){const o=await yo(l,t.items[l],n,i);if(typeof o=="number")l=o-1;else{if(o===fi)return fi;o===Or&&(t.items.splice(l,1),l-=1)}}}else if(en(t)){i=Object.freeze(i.concat(t));const l=await yo("key",t.key,n,i);if(l===fi)return fi;l===Or&&(t.key=null);const o=await yo("value",t.value,n,i);if(o===fi)return fi;o===Or&&(t.value=null)}}return a}function T_(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function M_(e,t,n,i){var a,l,o,d,f;if(typeof n=="function")return n(e,t,i);if(tc(t))return(a=n.Map)==null?void 0:a.call(n,e,t,i);if(nc(t))return(l=n.Seq)==null?void 0:l.call(n,e,t,i);if(en(t))return(o=n.Pair)==null?void 0:o.call(n,e,t,i);if(Gt(t))return(d=n.Scalar)==null?void 0:d.call(n,e,t,i);if(Ss(t))return(f=n.Alias)==null?void 0:f.call(n,e,t,i)}function D_(e,t,n){const i=t[t.length-1];if(on(i))i.items[e]=n;else if(en(i))e==="key"?i.key=n:i.value=n;else if(wl(i))i.contents=n;else{const a=Ss(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${a} parent`)}}const zI={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},PI=e=>e.replace(/[!,[\]{}]/g,t=>zI[t]);class ti{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ti.defaultYaml,t),this.tags=Object.assign({},ti.defaultTags,n)}clone(){const t=new ti(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new ti(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ti.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ti.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:ti.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ti.defaultTags),this.atNextDocument=!1);const i=t.trim().split(/[ \t]+/),a=i.shift();switch(a){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;const[l,o]=i;return this.tags[l]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[l]=i;if(l==="1.1"||l==="1.2")return this.yaml.version=l,!0;{const o=/^\d+\.\d+$/.test(l);return n(6,`Unsupported YAML version ${l}`,o),!1}}default:return n(0,`Unknown directive ${a}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,i,a]=t.match(/^(.*!)([^!]*)$/s);a||n(`The ${t} tag has no suffix`);const l=this.tags[i];if(l)try{return l+decodeURIComponent(a)}catch(o){return n(String(o)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+PI(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags);let a;if(t&&i.length>0&&cn(t.contents)){const l={};kl(t.contents,(o,d)=>{cn(d)&&d.tag&&(l[d.tag]=!0)}),a=Object.keys(l)}else a=[];for(const[l,o]of i)l==="!!"&&o==="tag:yaml.org,2002:"||(!t||a.some(d=>d.startsWith(o)))&&n.push(`%TAG ${l} ${o}`);return n.join(`
|
|
479
479
|
`)}}ti.defaultYaml={explicit:!1,version:"1.2"};ti.defaultTags={"!!":"tag:yaml.org,2002:"};function O_(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function R_(e){const t=new Set;return kl(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function L_(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function BI(e,t){const n=[],i=new Map;let a=null;return{onAnchor:l=>{n.push(l),a??(a=R_(e));const o=L_(t,a);return a.add(o),o},setAnchors:()=>{for(const l of n){const o=i.get(l);if(typeof o=="object"&&o.anchor&&(Gt(o.node)||on(o.node)))o.node.anchor=o.anchor;else{const d=new Error("Failed to resolve repeated object (this should not happen)");throw d.source=l,d}}},sourceObjects:i}}function bo(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a){const o=i[a],d=bo(e,i,String(a),o);d===void 0?delete i[a]:d!==o&&(i[a]=d)}else if(i instanceof Map)for(const a of Array.from(i.keys())){const l=i.get(a),o=bo(e,i,a,l);o===void 0?i.delete(a):o!==l&&i.set(a,o)}else if(i instanceof Set)for(const a of Array.from(i)){const l=bo(e,i,a,a);l===void 0?i.delete(a):l!==a&&(i.delete(a),i.add(l))}else for(const[a,l]of Object.entries(i)){const o=bo(e,i,a,l);o===void 0?delete i[a]:o!==l&&(i[a]=o)}return e.call(t,n,i)}function Ki(e,t,n){if(Array.isArray(e))return e.map((i,a)=>Ki(i,String(a),n));if(e&&typeof e.toJSON=="function"){if(!n||!C_(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=l=>{i.res=l,delete n.onCreate};const a=e.toJSON(t,n);return n.onCreate&&n.onCreate(a),a}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class Xb{constructor(t){Object.defineProperty(this,Yi,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:a,reviver:l}={}){if(!wl(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},d=Ki(this,"",o);if(typeof a=="function")for(const{count:f,res:p}of o.anchors.values())a(p,f);return typeof l=="function"?bo(l,{"":d},"",d):d}}class Vp extends Xb{constructor(t){super(Qb),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let i;n!=null&&n.aliasResolveCache?i=n.aliasResolveCache:(i=[],kl(t,{Node:(l,o)=>{(Ss(o)||C_(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let a;for(const l of i){if(l===this)break;l.anchor===this.source&&(a=l)}return a}toJSON(t,n){if(!n)return{source:this.source};const{anchors:i,doc:a,maxAliasCount:l}=n,o=this.resolve(a,n);if(!o){const f=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(f)}let d=i.get(o);if(d||(Ki(o,null,n),d=i.get(o)),(d==null?void 0:d.res)===void 0){const f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(l>=0&&(d.count+=1,d.aliasCount===0&&(d.aliasCount=ep(a,o,i)),d.count*d.aliasCount>l)){const f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}return d.res}toString(t,n,i){const a=`*${this.source}`;if(t){if(O_(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(l)}if(t.implicitKey)return`${a} `}return a}}function ep(e,t,n){if(Ss(t)){const i=t.resolve(e),a=n&&i&&n.get(i);return a?a.count*a.aliasCount:0}else if(on(t)){let i=0;for(const a of t.items){const l=ep(e,a,n);l>i&&(i=l)}return i}else if(en(t)){const i=ep(e,t.key,n),a=ep(e,t.value,n);return Math.max(i,a)}return 1}const I_=e=>!e||typeof e!="function"&&typeof e!="object";class st extends Xb{constructor(t){super(Lr),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ki(this.value,t,n)}toString(){return String(this.value)}}st.BLOCK_FOLDED="BLOCK_FOLDED";st.BLOCK_LITERAL="BLOCK_LITERAL";st.PLAIN="PLAIN";st.QUOTE_DOUBLE="QUOTE_DOUBLE";st.QUOTE_SINGLE="QUOTE_SINGLE";const $I="tag:yaml.org,2002:";function UI(e,t,n){if(t){const i=n.filter(l=>l.tag===t),a=i.find(l=>!l.format)??i[0];if(!a)throw new Error(`Tag ${t} not found`);return a}return n.find(i=>{var a;return((a=i.identify)==null?void 0:a.call(i,e))&&!i.format})}function Nu(e,t,n){var m,y,b;if(wl(e)&&(e=e.contents),cn(e))return e;if(en(e)){const k=(y=(m=n.schema[xs]).createNode)==null?void 0:y.call(m,n.schema,null,n);return k.items.push(e),k}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:a,onTagObj:l,schema:o,sourceObjects:d}=n;let f;if(i&&e&&typeof e=="object"){if(f=d.get(e),f)return f.anchor??(f.anchor=a(e)),new Vp(f.anchor);f={anchor:null,node:null},d.set(e,f)}t!=null&&t.startsWith("!!")&&(t=$I+t.slice(2));let p=UI(e,t,o.tags);if(!p){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const k=new st(e);return f&&(f.node=k),k}p=e instanceof Map?o[xs]:Symbol.iterator in Object(e)?o[ec]:o[xs]}l&&(l(p),delete n.onTagObj);const g=p!=null&&p.createNode?p.createNode(n.schema,e,n):typeof((b=p==null?void 0:p.nodeClass)==null?void 0:b.from)=="function"?p.nodeClass.from(n.schema,e,n):new st(e);return t?g.tag=t:p.default||(g.tag=p.tag),f&&(f.node=g),g}function bp(e,t,n){let i=n;for(let a=t.length-1;a>=0;--a){const l=t[a];if(typeof l=="number"&&Number.isInteger(l)&&l>=0){const o=[];o[l]=i,i=o}else i=new Map([[l,i]])}return Nu(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const uu=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class z_ extends Xb{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>cn(i)||en(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(uu(t))this.add(n);else{const[i,...a]=t,l=this.get(i,!0);if(on(l))l.addIn(a,n);else if(l===void 0&&this.schema)this.set(i,bp(this.schema,a,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${a}`)}}deleteIn(t){const[n,...i]=t;if(i.length===0)return this.delete(n);const a=this.get(n,!0);if(on(a))return a.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){const[i,...a]=t,l=this.get(i,!0);return a.length===0?!n&&Gt(l)?l.value:l:on(l)?l.getIn(a,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!en(n))return!1;const i=n.value;return i==null||t&&Gt(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){const[n,...i]=t;if(i.length===0)return this.has(n);const a=this.get(n,!0);return on(a)?a.hasIn(i):!1}setIn(t,n){const[i,...a]=t;if(a.length===0)this.set(i,n);else{const l=this.get(i,!0);if(on(l))l.setIn(a,n);else if(l===void 0&&this.schema)this.set(i,bp(this.schema,a,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${a}`)}}}const FI=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function da(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Qs=(e,t,n)=>e.endsWith(`
|
|
480
480
|
`)?da(n,t):n.includes(`
|
|
@@ -614,24 +614,24 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
614
614
|
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const a="end"in n.value?n.value.end:void 0,l=Array.isArray(a)?a[a.length-1]:void 0;(l==null?void 0:l.type)==="comment"?a==null||a.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const a=t.items[t.items.length-2],l=(i=a==null?void 0:a.value)==null?void 0:i.end;if(Array.isArray(l)){Array.prototype.push.apply(l,n.start),l.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const a=!this.onKeyLine&&this.indent===t.indent,l=a&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(l&&n.sep&&!n.value){const d=[];for(let f=0;f<n.sep.length;++f){const p=n.sep[f];switch(p.type){case"newline":d.push(f);break;case"space":break;case"comment":p.indent>t.indent&&(d.length=0);break;default:d.length=0}}d.length>=2&&(o=n.sep.splice(d[1]))}switch(this.type){case"anchor":case"tag":l||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):l||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ls(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(v2(n.key)&&!ls(n.sep,"newline")){const d=lo(n.start),f=n.key,p=n.sep;p.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:d,key:f,sep:p}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(ls(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const d=lo(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:d,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||l?t.items.push({start:o,key:null,sep:[this.sourceToken]}):ls(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const d=this.flowScalar(this.type);l||n.value?(t.items.push({start:o,key:d,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(d):(Object.assign(n,{key:d,sep:[]}),this.onKeyLine=!0);return}default:{const d=this.startBlockValue(t);if(d){if(d.type==="block-seq"){if(!n.explicitKey&&n.sep&&!ls(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else a&&t.items.push({start:o});this.stack.push(d);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const a="end"in n.value?n.value.end:void 0,l=Array.isArray(a)?a[a.length-1]:void 0;(l==null?void 0:l.type)==="comment"?a==null||a.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const a=t.items[t.items.length-2],l=(i=a==null?void 0:a.value)==null?void 0:i.end;if(Array.isArray(l)){Array.prototype.push.apply(l,n.start),l.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||ls(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const a=this.startBlockValue(t);if(a){this.stack.push(a);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while((i==null?void 0:i.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const a=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:a,sep:[]}):n.sep?this.stack.push(a):Object.assign(n,{key:a,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{const i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){const a=Af(i),l=lo(a);Ak(t);const o=t.end.splice(1,t.end.length);o.push(this.sourceToken);const d={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:l,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=d}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
615
615
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
616
616
|
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Af(t),i=lo(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Af(t),i=lo(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function w2(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new x2||null,prettyErrors:t}}function Fz(e,t={}){const{lineCounter:n,prettyErrors:i}=w2(t),a=new ux(n==null?void 0:n.addNewLine),l=new cx(t),o=Array.from(l.compose(a.parse(e)));if(i&&n)for(const d of o)d.errors.forEach(vp(e,n)),d.warnings.forEach(vp(e,n));return o.length>0?o:Object.assign([],{empty:!0},l.streamInfo())}function k2(e,t={}){const{lineCounter:n,prettyErrors:i}=w2(t),a=new ux(n==null?void 0:n.addNewLine),l=new cx(t);let o=null;for(const d of l.compose(a.parse(e),!0,e.length))if(!o)o=d;else if(o.options.logLevel!=="silent"){o.errors.push(new Zs(d.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(vp(e,n)),o.warnings.forEach(vp(e,n))),o}function qz(e,t,n){let i;typeof t=="function"?i=t:n===void 0&&t&&typeof t=="object"&&(n=t);const a=k2(e,n);if(!a)return null;if(a.warnings.forEach(l=>$_(a.options.logLevel,l)),a.errors.length>0){if(a.options.logLevel!=="silent")throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:i},n))}function Hz(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const a=Math.round(n);n=a<1?void 0:a>8?{indent:8}:{indent:a}}if(e===void 0){const{keepUndefined:a}=n??t??{};if(!a)return}return wl(e)&&!i?e.toString(n):new ac(e,i,n).toString(n)}const Tk=Object.freeze(Object.defineProperty({__proto__:null,Alias:Vp,CST:Bz,Composer:cx,Document:ac,Lexer:b2,LineCounter:x2,Pair:Vn,Parser:ux,Scalar:st,Schema:a2,YAMLError:lx,YAMLMap:Ni,YAMLParseError:Zs,YAMLSeq:ws,YAMLWarning:l2,isAlias:Ss,isCollection:on,isDocument:wl,isMap:tc,isNode:cn,isPair:en,isScalar:Gt,isSeq:nc,parse:qz,parseAllDocuments:Fz,parseDocument:k2,stringify:Hz,visit:kl,visitAsync:Gp},Symbol.toStringTag,{value:"Module"}));function Kz({projectName:e,file:t,onClose:n,onSaved:i}){const a=Pe(),l=Ft(),{alert:o}=un(),{data:d,isLoading:f,isError:p,error:g,refetch:m}=Ve({queryKey:["pipeline-file",e,t],queryFn:()=>gI(e,t)}),[y,b]=j.useState("structured"),[k,v]=j.useState(null),[S,E]=j.useState(null);j.useEffect(()=>{d&&k===null&&(v(d.content),E(d.etag),d.parseError&&b("yaml"))},[d,k]),j.useEffect(()=>{const O=R=>{R.key==="Escape"&&n()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[n]);const C=Et({mutationFn:()=>{if(k===null||S===null)throw new Error("no draft");return yI(e,t,k,S)},onSuccess:O=>{E(O.etag),l.invalidateQueries({queryKey:["pipeline-file",e,t]}),l.invalidateQueries({queryKey:["project-pipelines",e]}),i()},onError:O=>{const R=O.status;o({title:a(R===409?"pipelineEditor.error.conflict.title":R===422?"pipelineEditor.error.yaml.title":"pipelineEditor.error.save.title"),body:O instanceof Error?O.message:String(O)})}}),N=k!==null&&d&&k!==d.content,{parsed:_,parseError:T}=j.useMemo(()=>{if(k===null)return{parsed:null,parseError:null};try{return{parsed:Tk.parse(k)??{},parseError:null}}catch(O){return{parsed:null,parseError:O instanceof Error?O.message:String(O)}}},[k]),M=O=>{try{const R=Tk.stringify(O,{lineWidth:0});v(R)}catch(R){o({title:a("pipelineEditor.error.serialize.title"),body:R instanceof Error?R.message:String(R)})}};return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-40 flex items-start justify-center p-6 bg-black/30 overflow-auto",children:c.jsxs("div",{className:"nb-card mt-8 w-full max-w-4xl flex flex-col",style:{maxHeight:"calc(100vh - 64px)"},children:[c.jsxs("header",{className:"flex items-start justify-between gap-3 mb-3 flex-shrink-0",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold flex items-center gap-2",children:[c.jsx(mk,{size:20,strokeWidth:2.5}),c.jsx("code",{className:"font-[family-name:var(--font-mono)] text-lg",children:t}),(d==null?void 0:d.isActive)&&c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)",padding:"2px 8px"},children:a("pipelineEditor.activeBadge")})]}),c.jsxs("p",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] mt-1",children:[e,"/pipelines/",t,S&&` · etag ${S}`]})]}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",onClick:n,type:"button","aria-label":a("pipelineEditor.close"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),f&&c.jsx("p",{className:"text-[var(--color-text-muted)]",children:a("common.loading")}),p&&c.jsx("p",{className:"text-[var(--color-crashed)]",children:a("pipelineEditor.error.load",{detail:g instanceof Error?g.message:String(g)})}),d&&k!==null&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-3 flex-shrink-0 flex-wrap",children:[c.jsxs("div",{className:"flex gap-1 p-1 bg-[var(--color-bg)] border-[2px] border-[var(--color-text)] rounded-full shadow-[2px_2px_0_var(--color-text)]",children:[c.jsxs("button",{type:"button",onClick:()=>b("structured"),"aria-pressed":y==="structured",disabled:!!T,className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",y==="structured"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]",T?"opacity-50 cursor-not-allowed":""].join(" "),title:T??void 0,children:[c.jsx(Wu,{size:11,strokeWidth:2.5}),a("pipelineEditor.mode.structured")]}),c.jsxs("button",{type:"button",onClick:()=>b("yaml"),"aria-pressed":y==="yaml",className:["px-3 py-1 rounded-full text-xs font-bold flex items-center gap-1.5",y==="yaml"?"bg-[var(--color-primary)] text-[var(--color-text)] shadow-[1px_1px_0_var(--color-text)]":"text-[var(--color-text-muted)]"].join(" "),children:[c.jsx(mk,{size:11,strokeWidth:2.5}),a("pipelineEditor.mode.yaml")]})]}),T&&c.jsxs("div",{className:"flex items-center gap-1 text-xs text-[var(--color-crashed)] font-bold",children:[c.jsx(Eu,{size:12,strokeWidth:2.5}),a("pipelineEditor.parseError.prefix",{detail:T})]}),(d==null?void 0:d.isActive)&&c.jsx("span",{className:"text-xs text-[var(--color-stuck)] font-bold ml-auto",children:a("pipelineEditor.activeWarning")})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[y==="structured"&&_&&c.jsx(Gz,{parsed:_,onChange:M}),y==="yaml"&&c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",style:{minHeight:400,resize:"vertical"},value:k,onChange:O=>v(O.target.value),spellCheck:!1,"aria-label":a("pipelineEditor.yamlAria")})]}),c.jsxs("div",{className:"flex items-center justify-between mt-3 pt-3 border-t-2 border-dashed border-[var(--color-text)] flex-shrink-0",children:[c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:N?c.jsx("span",{className:"text-[var(--color-stuck)] font-bold",children:a("pipelineEditor.status.unsaved")}):C.isSuccess?c.jsxs("span",{className:"text-[var(--color-running)] font-bold flex items-center gap-1",children:[c.jsx(Su,{size:12,strokeWidth:2.5})," ",a("pipelineEditor.status.saved")]}):a("pipelineEditor.status.noChanges")}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{className:"nb-btn",style:{padding:"6px 14px"},onClick:()=>{v(null),m()},disabled:C.isPending,type:"button",children:a("pipelineEditor.reload")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 14px"},onClick:()=>C.mutate(),disabled:!N||C.isPending,type:"button","aria-label":a("pipelineEditor.saveAria"),children:[C.isPending?c.jsx(Xe,{size:13,strokeWidth:3,className:"animate-spin"}):c.jsx(mr,{size:13,strokeWidth:3}),a("pipelineEditor.save")]})]})]})]})]})})}function Gz({parsed:e,onChange:t}){const n=Pe(),i=e.stages??[],a=p=>{t({...e,stages:p})},l=()=>{a([...i,{name:`stage-${i.length+1}`,on_complete:"move_card Done"}])},o=p=>{a(i.filter((g,m)=>m!==p))},d=(p,g)=>{const m=[...i],y=p+g;y<0||y>=m.length||([m[p],m[y]]=[m[y],m[p]],a(m))},f=(p,g)=>{a(i.map((m,y)=>y===p?{...m,...g}:m))};return c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex bg-surface-input items-center gap-3 p-3 border-2 border-[var(--color-text)] rounded-lg",children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:"font-bold",children:"mode:"}),c.jsxs("select",{className:"nb-input",style:{padding:"4px 10px",fontSize:12},value:e.mode??"project",onChange:p=>t({...e,mode:p.target.value}),children:[c.jsx("option",{value:"project",children:"project"}),c.jsx("option",{value:"steps",children:"steps"})]})]}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:n("pipelineEditor.modeHint")})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider",children:n("pipelineEditor.stages.heading",{count:i.length})}),c.jsxs("button",{type:"button",className:"nb-btn nb-btn-mint",style:{padding:"4px 12px",fontSize:12},onClick:l,"aria-label":n("pipelineEditor.stages.add"),children:[c.jsx(hi,{size:11,strokeWidth:3})," ",n("pipelineEditor.stages.add")]})]}),i.length===0?c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] italic p-4 border-2 border-dashed border-[var(--color-text)] rounded-lg text-center",children:n("pipelineEditor.stages.empty")}):c.jsx("div",{className:"flex flex-col gap-3",children:i.map((p,g)=>c.jsx(Vz,{stage:p,index:g,total:i.length,onChange:m=>f(g,m),onRemove:()=>o(g),onMoveUp:()=>d(g,-1),onMoveDown:()=>d(g,1)},g))})]})]})}function Vz({stage:e,index:t,total:n,onChange:i,onRemove:a,onMoveUp:l,onMoveDown:o}){const d=Pe(),f=e.on_fail??{};return c.jsxs("div",{className:"nb-card bg-[var(--color-bg-cream)] p-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("h4",{className:"font-[family-name:var(--font-heading)] font-bold text-sm",children:["Stage #",t+1,e.name&&c.jsx("code",{className:"ml-2 text-xs font-[family-name:var(--font-mono)] bg-[var(--color-bg)] border-2 border-[var(--color-text)] px-2 py-0.5 rounded",children:e.name})]}),c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"3px 8px"},onClick:l,disabled:t===0,"aria-label":d("pipelineEditor.stage.moveUp"),children:c.jsx(eL,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"3px 8px"},onClick:o,disabled:t===n-1,"aria-label":d("pipelineEditor.stage.moveDown"),children:c.jsx(Yu,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn nb-btn-danger",style:{padding:"3px 8px"},onClick:a,"aria-label":d("pipelineEditor.stage.remove"),children:c.jsx(Vi,{size:12,strokeWidth:3})})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[c.jsx(es,{label:"name",hint:d("pipelineEditor.stage.name.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.name??"",onChange:p=>i({name:p.target.value}),placeholder:"develop"})}),c.jsx(es,{label:"profile",hint:d("pipelineEditor.stage.profile.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.profile??"",onChange:p=>i({profile:p.target.value||void 0}),placeholder:"fullstack"})}),c.jsx(es,{label:"card_state",hint:d("pipelineEditor.stage.cardState.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.card_state??"",onChange:p=>i({card_state:p.target.value||void 0}),placeholder:"Inprogress"})}),c.jsx(es,{label:"timeout",hint:d("pipelineEditor.stage.timeout.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.timeout??"",onChange:p=>i({timeout:p.target.value||void 0}),placeholder:"2h"})}),c.jsx(es,{label:"trigger",hint:d("pipelineEditor.stage.trigger.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.trigger??"",onChange:p=>i({trigger:p.target.value||void 0}),placeholder:"card_enters 'Todo'"})}),c.jsx(es,{label:"on_complete",hint:d("pipelineEditor.stage.onComplete.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:e.on_complete??"",onChange:p=>i({on_complete:p.target.value}),placeholder:"move_card Done"})})]}),c.jsxs("div",{className:"mt-4 pt-3 border-t-2 border-dashed border-[var(--color-text)]",children:[c.jsx("h5",{className:"text-xs font-bold uppercase tracking-wider mb-2 text-[var(--color-text-muted)]",children:"on_fail"}),c.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[c.jsx(es,{label:"action",hint:d("pipelineEditor.stage.onFail.action.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:f.action??"",onChange:p=>i({on_fail:{...f,action:p.target.value||void 0}}),placeholder:"label NEEDS-FIX"})}),c.jsx(es,{label:"comment",hint:d("pipelineEditor.stage.onFail.comment.hint"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:f.comment??"",onChange:p=>i({on_fail:{...f,comment:p.target.value||void 0}}),placeholder:"Worker failed. Check logs."})})]}),c.jsxs("label",{className:"flex items-center gap-2 mt-3 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:f.halt??!0,onChange:p=>i({on_fail:{...f,halt:p.target.checked}})}),c.jsx("span",{className:"font-bold",children:"halt"}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:d("pipelineEditor.stage.halt.note")})]})]})]})}function es({label:e,hint:t,children:n}){return c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-xs font-bold font-[family-name:var(--font-mono)]",children:e}),n,t&&c.jsx("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:t})]})}function Yz({onCancel:e,onCreate:t,hasActive:n,hasSample:i,isPending:a}){const l=Pe(),[o,d]=j.useState(""),[f,p]=j.useState("blank");j.useEffect(()=>{const S=E=>{E.key==="Escape"&&e()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e]);const g=o.trim(),m=g.endsWith(".yaml")?g:g?`${g}.yaml`:"",y=m&&/^[a-zA-Z0-9_.-]+\.yaml$/.test(m),b=()=>{!y||a||t(m,f)},v=l("newPipelineDialog.field.filename.help",{filename:"__FN__"}).split("__FN__");return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/30",children:c.jsxs("div",{className:"nb-card max-w-md w-full",children:[c.jsxs("header",{className:"flex items-start justify-between mb-4",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold",children:l("newPipelineDialog.title")}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",onClick:e,type:"button","aria-label":l("common.close"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("form",{onSubmit:S=>{S.preventDefault(),b()},className:"flex flex-col gap-4",children:[c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsx("span",{className:"text-sm font-bold",children:l("newPipelineDialog.field.filename.label")}),c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:l("newPipelineDialog.field.filename.placeholder"),value:o,onChange:S=>d(S.target.value),autoFocus:!0}),c.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[v[0],c.jsx("code",{className:"font-[family-name:var(--font-mono)]",children:m||"xxx.yaml"}),v[1]]})]}),c.jsxs("fieldset",{className:"flex flex-col gap-2",children:[c.jsx("legend",{className:"text-sm font-bold mb-1",children:l("newPipelineDialog.section.template")}),c.jsx(Ug,{value:"blank",current:f,label:l("newPipelineDialog.template.blank.label"),desc:l("newPipelineDialog.template.blank.desc"),onSelect:p}),c.jsx(Ug,{value:"sample",current:f,label:l("newPipelineDialog.template.sample.label"),desc:l("newPipelineDialog.template.sample.desc"),onSelect:p,disabled:!i,disabledReason:l("newPipelineDialog.template.sample.unavailable")}),c.jsx(Ug,{value:"active",current:f,label:l("newPipelineDialog.template.active.label"),desc:l("newPipelineDialog.template.active.desc"),onSelect:p,disabled:!n,disabledReason:l("newPipelineDialog.template.active.unavailable")})]}),c.jsxs("div",{className:"flex gap-3 justify-end pt-2",children:[c.jsx("button",{className:"nb-btn",onClick:e,type:"button",disabled:a,children:l("common.cancel")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"submit",disabled:!y||a,"aria-label":l("newPipelineDialog.create.aria"),children:[a?c.jsx(Xe,{size:13,strokeWidth:3,className:"animate-spin"}):c.jsx(hi,{size:13,strokeWidth:3}),l("common.create")]})]})]})]})})}function Ug({value:e,current:t,label:n,desc:i,onSelect:a,disabled:l,disabledReason:o}){const d=t===e;return c.jsxs("label",{className:["flex items-start gap-2 p-2 rounded-lg border-2 cursor-pointer",l?"border-[var(--color-border-light)] opacity-50 cursor-not-allowed":d?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[2px_2px_0_var(--color-text)]":"border-[var(--color-border-light)] hover:bg-[var(--color-bg-cream)] hover:border-[var(--color-text)]"].join(" "),children:[c.jsx("input",{type:"radio",name:"pipeline-template",value:e,checked:d,disabled:l,onChange:()=>a(e),className:"mt-1 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"text-sm font-bold",children:n}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)]",children:l?o:i})]})]})}function Wz(e){return ct(`/api/rules/${encodeURIComponent(e)}`)}function Mk(e){return Array.isArray(e)?e.map(t=>String(t).trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function Qz(e){return typeof e=="string"&&["language","domain","persona","workflow","engine","genre","platform","review","meta","other"].includes(e)?e:"other"}function rp(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function dx(e){const t=rp(e);return{name:typeof t.name=="string"?t.name:"",category:Qz(t.category),tags:Mk(t.tags),description:typeof t.description=="string"?t.description:"",origin:typeof t.origin=="string"?t.origin:"",linkedProjects:Mk(t.linkedProjects),stateInProject:t.stateInProject==="absent"||t.stateInProject==="linked"||t.stateInProject==="frozen"?t.stateInProject:void 0}}function Xz(e){const t=rp(e);return{...dx(t),body:typeof t.body=="string"?t.body:"",references:Array.isArray(t.references)?t.references.map(i=>{const a=rp(i);return{name:typeof a.name=="string"?a.name:"",lines:typeof a.lines=="number"?a.lines:0}}).filter(i=>i.name):[],linkedProjects:Array.isArray(t.linkedProjects)?t.linkedProjects.map(i=>{const a=rp(i),l=a.state==="frozen"?"frozen":"linked";return{project:typeof a.project=="string"?a.project:"",state:l}}).filter(i=>i.project):[]}}function Zz(e){return{data:Array.isArray(e.data)?e.data.map(dx).filter(t=>t.name):[]}}async function fx(e){const t=e?`?project=${encodeURIComponent(e)}`:"",n=await ct(`/api/skills${t}`);return Zz(n)}async function Jz(e){const t=await ct(`/api/skills/${encodeURIComponent(e)}`);return Xz(t)}function e4(e,t){return ct(`/api/skills/${encodeURIComponent(e)}/references/${encodeURIComponent(t)}`)}async function t4(e,t){const n=await fetch(`/api/skills/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`)}function n4(e){return k_(`/api/skills/${encodeURIComponent(e)}`)}function i4(e){return gr(`/api/skills/${encodeURIComponent(e)}/translate`)}async function r4(e,t){const n=await fetch(e,{method:"POST",headers:void 0,body:void 0});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json().catch(()=>({}))}function a4(){return r4("/api/skills/sync")}async function s4(e){const t=await ct(`/api/skills/policy/${encodeURIComponent(e)}`);return{data:{...t.data,skills:Array.isArray(t.data.skills)?t.data.skills.map(dx).filter(n=>n.name):[]}}}function l4(e,t){return Vb(`/api/skills/policy/${encodeURIComponent(e)}`,t)}function o4(){return ct("/api/skills/updates")}function c4(e,t,n){return gr("/api/skills/import",{name:e,files:t,overwrite:n})}function u4(e){return ct(`/api/skills/${encodeURIComponent(e)}/export`)}function d4(e,t){return gr("/api/skills/create",{name:e,intent:t})}function E2(){return c.jsx("div",{className:"nb-card",children:c.jsxs("p",{className:"text-[var(--color-text-muted)] flex items-center gap-2",children:[c.jsx(Xe,{size:14,className:"animate-spin"})," …"]})})}function S2({msg:e}){return c.jsx("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:c.jsx("p",{children:e})})}function f4({name:e}){var b,k;const t=Pe(),n=Ft(),{alert:i}=un(),a=Ve({queryKey:["skill-policy",e],queryFn:()=>s4(e),enabled:!!e}),l=(b=a.data)==null?void 0:b.data,[o,d]=j.useState(null),[f,p]=j.useState(null);j.useEffect(()=>{var v;l&&o===null&&d((v=l.policy.allow)!=null&&v.length?new Set(l.policy.allow):new Set(l.skills.map(S=>S.name)))},[l,o]);const g=Et({mutationFn:v=>l4(e,v),onSuccess:v=>{p(v),d(null),n.invalidateQueries({queryKey:["skill-policy",e]})},onError:v=>void i({title:t("projectDetail.skills.saveError"),body:v instanceof Error?v.message:String(v)})});if(a.isLoading||l&&o===null)return c.jsx(E2,{});if(a.isError)return c.jsx(S2,{msg:a.error instanceof Error?a.error.message:String(a.error)});if(!l||!o)return null;if(l.skills.length===0)return c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:t("projectDetail.skills.empty")})});const m=l.eligible!==null,y=v=>d(S=>{const E=new Set(S);return E.has(v)?E.delete(v):E.add(v),E});return c.jsxs("div",{className:"nb-card flex flex-col gap-4 h-full min-h-0",children:[c.jsxs("div",{className:"shrink-0",children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-lg font-bold flex items-center gap-2",children:[c.jsx(d_,{size:18,strokeWidth:2.5}),t("projectDetail.skills.title")]}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:t("projectDetail.skills.desc")}),c.jsx("p",{className:"text-sm mt-1 font-medium",children:m?t("projectDetail.skills.hasPolicy",{count:String(((k=l.eligible)==null?void 0:k.length)??0)}):t("projectDetail.skills.noPolicy")})]}),c.jsxs("div",{className:"flex gap-2 shrink-0",children:[c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"4px 10px",fontSize:12},onClick:()=>d(new Set(l.skills.map(v=>v.name))),children:t("projectDetail.skills.selectAll")}),c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"4px 10px",fontSize:12},onClick:()=>d(new Set),children:t("projectDetail.skills.selectNone")})]}),c.jsx("div",{className:"flex bg-surface-input flex-col gap-1 flex-1 min-h-0 overflow-auto border-2 border-[var(--color-text)] rounded p-2",children:l.skills.map(v=>c.jsxs("label",{className:"flex items-start gap-2 px-2 py-1 rounded hover:bg-[var(--color-bg-cream)] cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:o.has(v.name),onChange:()=>y(v.name),className:"mt-1"}),c.jsxs("span",{className:"flex-1",children:[c.jsx("code",{className:"font-[family-name:var(--font-mono)] text-sm font-bold",children:v.name}),c.jsx("span",{className:"ml-2 text-[10px] uppercase text-[var(--color-text-muted)]",children:v.category}),v.description&&c.jsx("span",{className:"block text-xs text-[var(--color-text-muted)]",children:v.description})]})]},v.name))}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap shrink-0",children:[c.jsxs("button",{type:"button",className:"nb-btn nb-btn-mint",disabled:g.isPending,onClick:()=>g.mutate({allow:[...o]}),children:[g.isPending?c.jsx(Xe,{size:14,className:"animate-spin"}):c.jsx(mr,{size:14,strokeWidth:3}),t("projectDetail.skills.save")]}),c.jsxs("button",{type:"button",className:"nb-btn",disabled:g.isPending,onClick:()=>g.mutate({}),children:[c.jsx(Fb,{size:14,strokeWidth:3}),t("projectDetail.skills.clear")]}),c.jsxs("span",{className:"text-sm text-[var(--color-text-muted)]",children:[o.size,"/",l.skills.length]})]}),f&&c.jsxs("div",{className:"text-sm border-2 border-[var(--color-text)] rounded p-2 bg-[var(--color-bg-cream)]",children:[c.jsx("p",{children:t("projectDetail.skills.applied",{linked:String(f.applied.linked),pruned:String(f.applied.pruned)})}),f.unknown.length>0&&c.jsx("p",{className:"text-[var(--color-text-muted)]",children:t("projectDetail.skills.unknown",{names:f.unknown.join(", ")})})]})]})}function p4({name:e}){var a;const t=Pe(),n=Ve({queryKey:["rules",e],queryFn:()=>Wz(e),enabled:!!e});if(n.isLoading)return c.jsx(E2,{});if(n.isError)return c.jsx(S2,{msg:n.error instanceof Error?n.error.message:String(n.error)});const i=((a=n.data)==null?void 0:a.data)??[];return c.jsxs("div",{className:"flex flex-col gap-4 min-h-full",children:[c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:t("projectDetail.rules.readonly")}),i.map(l=>c.jsxs("div",{className:"nb-card",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("code",{className:"font-[family-name:var(--font-mono)] text-sm font-bold border-2 border-[var(--color-text)] px-2 py-0.5 rounded",children:l.name}),!l.exists&&c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:t("projectDetail.rules.missing")})]}),l.exists&&c.jsx("pre",{className:"overflow-auto max-h-[28rem] text-xs font-[family-name:var(--font-mono)] whitespace-pre-wrap break-words bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded p-3",children:l.content})]},l.name))]})}const ah=e=>`/api/projects/${encodeURIComponent(e)}/graph`;function h4(e){return ct(`${ah(e)}/status`)}function m4(e){return ct(`${ah(e)}/data`)}function g4(e){return gr(`${ah(e)}/build`)}function y4(e){return gr(`${ah(e)}/sync`)}const b4={typescript:"#1D4E89",tsx:"#2563EB",javascript:"#B8860B",json:"#6B7280",yaml:"#C2410C"},Tf=e=>b4[e]??"#2D6A4F";function Dk(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}const x4=e=>Math.max(8,Math.min(22,8+e*2.5));function v4(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function w4(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return"—";const n=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function k4({name:e,status:t}){var y,b,k,v;const n=Pe(),i=Ve({queryKey:["graph-data",e],queryFn:()=>m4(e)}),[a,l]=j.useState(""),o=j.useRef(null),d=j.useRef(null),f=j.useRef(null),p=j.useRef(null),g=[...new Set((((b=(y=i.data)==null?void 0:y.data)==null?void 0:b.nodes)??[]).map(S=>S.language))];if(j.useEffect(()=>{p.current&&(p.current.search=a.trim().toLowerCase())},[a]),j.useEffect(()=>{var we;const S=(we=i.data)==null?void 0:we.data,E=d.current,C=o.current;if(!S||!S.nodes.length||!E||!C)return;const N=E.getContext("2d");if(!N)return;const _={};for(const re of S.links)_[re.source]=(_[re.source]??0)+1,_[re.target]=(_[re.target]??0)+1;const T=S.nodes.length,M=window.devicePixelRatio||1,O=C.getBoundingClientRect(),R=O.width||800,B=O.height||500,U=Math.min(R,B)*.35+T*1.5,K=S.nodes.map((re,Ce)=>{const Me=2*Math.PI*Ce/Math.max(T,1),_e=_[re.id]??0;return{id:re.id,language:re.language,symbols:re.symbols,deg:_e,name:re.id.split("/").pop()||re.id,x:Math.cos(Me)*U+Math.sin(Ce*12.9898)*43758.5453%1*40,y:Math.sin(Me)*U+Math.sin(Ce*78.233)*12345.678%1*40,vx:0,vy:0,r:x4(_e)}}),q={};for(const re of K)q[re.id]=re;const Y=S.links.map(re=>({source:re.source,target:re.target,weight:re.weight})),D={nodes:K,edges:Y,map:q,panX:R/2,panY:B/2,zoom:1,drag:null,mouseX:0,mouseY:0,raf:null,tick:0,quiet:0,sel:null,search:a.trim().toLowerCase(),fitted:!1};p.current=D;const F=()=>{const re=C.getBoundingClientRect();E.width=re.width*M,E.height=re.height*M,E.style.width=re.width+"px",E.style.height=re.height+"px",N.setTransform(M,0,0,M,0,0)};F();const I=new ResizeObserver(F);I.observe(C);const H=()=>{let re=1/0,Ce=1/0,Me=-1/0,_e=-1/0;for(const be of K)re=Math.min(re,be.x-be.r),Ce=Math.min(Ce,be.y-be.r),Me=Math.max(Me,be.x+be.r),_e=Math.max(_e,be.y+be.r);const Qe=E.width/M,Ue=E.height/M,ce=Math.min(Qe/Math.max(Me-re,1),Ue/Math.max(_e-Ce,1),1.4)*.88;D.zoom=ce,D.panX=Qe/2-(re+Me)/2*ce,D.panY=Ue/2-(Ce+_e)/2*ce},W=()=>{const re=K.length;D.tick++;const Ce=.9-Math.min(.4,D.tick/1500),Me=re>1e3?3e3:re>100?2e3:re>50?1200:800,_e=re>100?.002:.005,Qe=re>1e3?.012:re>100?.005:.01,Ue=re>1e3?6:re>200?12:24;for(let ge=0;ge<re;ge++){const pe=K[ge];let Se=-pe.x*Qe,je=-pe.y*Qe;for(let He=0;He<re;He++){if(ge===He)continue;const te=K[He],de=pe.x-te.x,Le=pe.y-te.y,Ze=de*de+Le*Le||1,rt=Math.sqrt(Ze),At=Me/Ze;Se+=de/rt*At,je+=Le/rt*At}if(pe!==D.drag){let He=(pe.vx+Se)*Ce,te=(pe.vy+je)*Ce;He=Math.max(-Ue,Math.min(Ue,He)),te=Math.max(-Ue,Math.min(Ue,te)),pe.vx=He,pe.vy=te}}for(const ge of Y){const pe=q[ge.source],Se=q[ge.target];if(!pe||!Se)continue;const je=Se.x-pe.x,He=Se.y-pe.y,te=Math.sqrt(je*je+He*He)||1,de=(te-100)*_e,Le=je/te*de,Ze=He/te*de;pe!==D.drag&&(pe.vx+=Le,pe.vy+=Ze),Se!==D.drag&&(Se.vx-=Le,Se.vy-=Ze)}let ce=0;for(const ge of K)ge!==D.drag&&(ge.x+=ge.vx,ge.y+=ge.vy,ce+=ge.vx*ge.vx+ge.vy*ge.vy);(re?Math.sqrt(ce/re):0)<.05&&D.tick>60&&!D.drag?D.quiet++:D.quiet=0,!D.fitted&&(D.quiet>8||D.tick>400)&&(D.fitted=!0,H())},G=()=>{const re=E.width/M,Ce=E.height/M;N.clearRect(0,0,re,Ce),N.strokeStyle="rgba(45,55,72,0.05)",N.lineWidth=.5;for(let be=0;be<re;be+=24)N.beginPath(),N.moveTo(be,0),N.lineTo(be,Ce),N.stroke();for(let be=0;be<Ce;be+=24)N.beginPath(),N.moveTo(0,be),N.lineTo(re,be),N.stroke();N.save(),N.translate(D.panX,D.panY),N.scale(D.zoom,D.zoom);const Me=D.search,_e=K.length>40;let Qe=null;if(!D.drag){const be=E.getBoundingClientRect(),ge=(D.mouseX-be.left-D.panX)/D.zoom,pe=(D.mouseY-be.top-D.panY)/D.zoom;for(let Se=K.length-1;Se>=0;Se--){const je=K[Se],He=je.x-ge,te=je.y-pe;if(He*He+te*te<je.r*je.r+25){Qe=je.id;break}}}const Ue=D.sel||Qe;for(const be of Y){const ge=q[be.source],pe=q[be.target];if(!ge||!pe)continue;const Se=Me&&!(ge.name.toLowerCase().includes(Me)||pe.name.toLowerCase().includes(Me)),je=Ue&&(be.source===Ue||be.target===Ue),He=pe.x-ge.x,te=pe.y-ge.y,de=Math.sqrt(He*He+te*te)||1,Le=_e?12:18,Ze=(ge.x+pe.x)/2+-te/de*Le,rt=(ge.y+pe.y)/2+He/de*Le,[At,$n,dn]=Dk(Tf(ge.language));let Mt;if(Se?Mt=.05:Ue&&je?Mt=.6:Ue&&!je?Mt=.05:Mt=_e?.14:.24,N.beginPath(),N.moveTo(ge.x,ge.y),N.quadraticCurveTo(Ze,rt,pe.x,pe.y),N.strokeStyle=`rgba(${At},${$n},${dn},${Mt})`,N.lineWidth=je?2+be.weight*.4:1+be.weight*.25,N.stroke(),!_e||je){const Wt=Math.atan2(pe.y-rt,pe.x-Ze),yt=5+N.lineWidth;N.beginPath(),N.moveTo(pe.x-pe.r*Math.cos(Wt),pe.y-pe.r*Math.sin(Wt)),N.lineTo(pe.x-(pe.r+yt)*Math.cos(Wt-.3),pe.y-(pe.r+yt)*Math.sin(Wt-.3)),N.lineTo(pe.x-(pe.r+yt)*Math.cos(Wt+.3),pe.y-(pe.r+yt)*Math.sin(Wt+.3)),N.closePath(),N.fillStyle=`rgba(${At},${$n},${dn},${Se?.05:je?.55:.18})`,N.fill()}}const ce=_e?1.5:.5;for(const be of K){const ge=Tf(be.language),pe=D.sel===be.id,Se=Qe===be.id,je=!Me||be.name.toLowerCase().includes(Me),He=Ue&&be.id!==Ue&&!Y.some(At=>At.source===Ue&&At.target===be.id||At.target===Ue&&At.source===be.id),te=je?He?.2:1:.12;N.save(),N.globalAlpha=te,je&&!He&&(pe||Se||!Me)&&(N.shadowColor=ge,N.shadowBlur=pe?20:Se?16:_e?4:8);const[de,Le,Ze]=Dk(ge),rt=N.createRadialGradient(be.x-be.r*.3,be.y-be.r*.3,0,be.x,be.y,be.r*1.2);if(rt.addColorStop(0,`rgba(${Math.min(255,de+60)},${Math.min(255,Le+60)},${Math.min(255,Ze+60)},0.95)`),rt.addColorStop(1,ge),N.beginPath(),N.arc(be.x,be.y,be.r,0,Math.PI*2),N.fillStyle=rt,N.fill(),N.shadowBlur=0,N.lineWidth=pe?2.5:1,N.strokeStyle=pe?"#111827":"rgba(255,255,255,0.7)",N.stroke(),N.restore(),je&&!He&&(pe||Se||D.zoom>ce)){const At=1/D.zoom;N.save(),N.globalAlpha=te,N.fillStyle="rgba(45,55,72,0.92)",N.font=`${(10*At).toFixed(1)}px 'DM Sans', sans-serif`,N.textAlign="center",N.fillText(be.name,be.x,be.y+be.r+11*At),N.restore()}}N.restore()},L=()=>{if(W(),G(),D.quiet>40&&!D.drag){D.raf=null;return}D.raf=requestAnimationFrame(L)},z=()=>{D.raf==null&&(D.quiet=0,D.raf=requestAnimationFrame(L))};D.raf=requestAnimationFrame(L);let V=!1,P=0,le=0;const xe=re=>{const Ce=E.getBoundingClientRect();return{x:(re.clientX-Ce.left-D.panX)/D.zoom,y:(re.clientY-Ce.top-D.panY)/D.zoom}},ke=(re,Ce)=>{for(let Me=K.length-1;Me>=0;Me--){const _e=K[Me];if(!_e)continue;const Qe=_e.x-re,Ue=_e.y-Ce;if(Qe*Qe+Ue*Ue<_e.r*_e.r+25)return _e}return null},Ne=re=>{const Ce=xe(re),Me=ke(Ce.x,Ce.y);Me?D.drag=Me:V=!0,P=re.clientX,le=re.clientY,z()},se=re=>{const Ce=re.clientX-P,Me=re.clientY-le;D.drag?(D.drag.x+=Ce/D.zoom,D.drag.y+=Me/D.zoom,D.drag.vx=0,D.drag.vy=0,z()):V&&(D.panX+=Ce,D.panY+=Me,z()),P=re.clientX,le=re.clientY,D.mouseX=re.clientX,D.mouseY=re.clientY;const _e=f.current,Qe=xe(re),Ue=!D.drag&&!V?ke(Qe.x,Qe.y):null;if(_e)if(Ue){const ce=Y.filter(ge=>ge.source===Ue.id||ge.target===Ue.id).length;_e.innerHTML=`<div style="font-weight:700;word-break:break-all">${Ue.id}</div><div style="margin-top:4px;color:#64748b;font-family:var(--font-mono,monospace)"><span style="color:${Tf(Ue.language)}">●</span> ${Ue.language} · ${Ue.symbols} symbols · ${ce} links</div>`;const be=E.getBoundingClientRect();_e.style.left=re.clientX-be.left+14+"px",_e.style.top=re.clientY-be.top+14+"px",_e.style.display="block",E.style.cursor="pointer"}else _e.style.display="none",E.style.cursor=D.drag||V?"grabbing":"grab";z()},ve=re=>{D.drag&&!V?Math.abs(re.clientX-P)>3||(D.sel=D.sel===D.drag.id?null:D.drag.id):V&&Math.abs(re.clientX-P)<3&&Math.abs(re.clientY-le)<3&&(D.sel=null),D.drag=null,V=!1,z()},ue=re=>{re.preventDefault();const Ce=E.getBoundingClientRect(),Me=re.clientX-Ce.left,_e=re.clientY-Ce.top,Qe=re.deltaY>0?.9:1.1,Ue=Math.max(.1,Math.min(5,D.zoom*Qe));D.panX=Me-(Me-D.panX)/D.zoom*Ue,D.panY=_e-(_e-D.panY)/D.zoom*Ue,D.zoom=Ue,z()},J=()=>{f.current&&(f.current.style.display="none")};return E.addEventListener("mousedown",Ne),window.addEventListener("mousemove",se),window.addEventListener("mouseup",ve),E.addEventListener("wheel",ue,{passive:!1}),E.addEventListener("mouseleave",J),()=>{D.raf!=null&&cancelAnimationFrame(D.raf),I.disconnect(),E.removeEventListener("mousedown",Ne),window.removeEventListener("mousemove",se),window.removeEventListener("mouseup",ve),E.removeEventListener("wheel",ue),E.removeEventListener("mouseleave",J),p.current=null}},[i.data]),i.isLoading)return c.jsxs("div",{className:"nb-card flex items-center gap-2 text-sm text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:14,className:"animate-spin"})," ",n("graph.viz.loading")]});if(!((v=(k=i.data)==null?void 0:k.data)!=null&&v.nodes.length))return c.jsx("div",{className:"nb-card text-sm text-[var(--color-text-muted)]",children:n("graph.viz.empty")});const m=[{label:n("graph.stat.files"),value:t.files.toLocaleString()},{label:n("graph.stat.nodes"),value:t.nodes.toLocaleString()},{label:n("graph.stat.edges"),value:t.edges.toLocaleString()},{label:n("graph.stat.db"),value:v4(t.dbSizeBytes)},{label:n("graph.stat.lastBuilt"),value:w4(t.lastIndexedAt)}];return c.jsxs("div",{ref:o,className:"relative w-full flex-1 min-h-[420px] nb-card p-0 overflow-hidden",style:{background:"var(--color-bg-cream)"},children:[c.jsx("canvas",{ref:d,className:"block bg-color-bg-soft absolute inset-0",style:{cursor:"grab"}}),c.jsx("div",{ref:f,className:"absolute z-40 pointer-events-none nb-card bg-[var(--color-bg)] px-3 py-2 text-xs max-w-xs",style:{display:"none"}}),c.jsxs("div",{className:"absolute top-3 right-3 w-52 flex flex-col gap-2 pointer-events-none",children:[c.jsxs("div",{className:"relative pointer-events-auto",children:[c.jsx(fl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-subtle)]"}),c.jsx("input",{className:"nb-input pl-9 w-full text-sm",placeholder:n("graph.viz.search"),value:a,onChange:S=>l(S.target.value),"aria-label":n("graph.viz.search")})]}),c.jsxs("div",{className:"nb-card p-3 flex flex-col gap-1.5 pointer-events-auto bg-[var(--color-bg)]",children:[m.map(S=>c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx("span",{className:"text-[var(--color-text-subtle)] shrink-0",children:S.label}),c.jsx("span",{className:"font-bold font-[family-name:var(--font-mono)] text-right",children:S.value})]},S.label)),c.jsx("div",{className:"mt-1 pt-1.5 border-t-[1.5px] border-dashed border-[var(--color-border-light)] flex flex-wrap gap-x-2 gap-y-1",children:g.map(S=>c.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-[family-name:var(--font-mono)]",children:[c.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full border-[1.5px] border-[var(--color-text)]",style:{background:Tf(S)}}),S]},S))})]}),c.jsx("p",{className:"text-[10px] text-[var(--color-text-subtle)] text-right leading-tight pointer-events-none",children:n("graph.viz.hint")})]})]})}function E4({name:e}){var m,y;const t=Pe(),n=Ft(),i=Ve({queryKey:["graph-status",e],queryFn:()=>h4(e)}),a=()=>{n.invalidateQueries({queryKey:["graph-status",e]}),n.invalidateQueries({queryKey:["graph-data",e]})},l=Et({mutationFn:()=>g4(e),onSuccess:a}),o=Et({mutationFn:()=>y4(e),onSuccess:a}),d=((m=i.data)==null?void 0:m.data)??null,f=l.isPending,p=o.isPending,g=f||p;return c.jsxs("div",{className:"flex flex-col gap-3 max-w-full flex-1 min-h-0",children:[c.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(s_,{size:20,strokeWidth:2.5,className:"shrink-0"}),c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold shrink-0",children:t("graph.title")}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)] truncate hidden sm:inline",children:t("graph.desc")})]}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&c.jsxs("button",{className:"nb-btn shrink-0",onClick:()=>o.mutate(),disabled:g,type:"button",title:t("graph.sync.desc"),children:[p?c.jsx(Xe,{size:14,strokeWidth:2.5,className:"animate-spin"}):c.jsx(_L,{size:14,strokeWidth:2.5}),t(p?"graph.syncing":"graph.sync")]}),c.jsxs("button",{className:"nb-btn nb-btn-mint shrink-0",onClick:()=>l.mutate(),disabled:g,type:"button",children:[f?c.jsx(Xe,{size:14,strokeWidth:2.5,className:"animate-spin"}):d?c.jsx(ya,{size:14,strokeWidth:2.5}):c.jsx(TL,{size:14,strokeWidth:2.5}),t(f?"graph.building":d?"graph.rebuild":"graph.build")]})]})]}),(l.isError||o.isError)&&c.jsxs("div",{className:"nb-card bg-[var(--color-crashed-bg)] text-sm shrink-0",children:[t("graph.buildFailed"),": ",((y=l.error||o.error)==null?void 0:y.message)??""]}),i.isLoading?c.jsxs("div",{className:"nb-card flex items-center gap-2 text-sm text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:14,className:"animate-spin"})," ",t("graph.viz.loading")]}):d?c.jsx(k4,{name:e,status:d}):c.jsx("div",{className:"nb-card text-sm text-[var(--color-text-muted)]",children:t("graph.empty")})]})}const Ok=["overview","config","pipelines","skills","rules","graph","logs"];function S4({name:e,embedded:t}={}){var v;const n=Pe(),{name:i=""}=Lb(),a=e??i,l=ks(),[o]=QN(),[d,f]=Wb("projectDetail.tab","overview"),p=Ok.includes(d)?d:"overview",[g,m]=j.useState(!1),y=o.get("tab"),b=o.get("worker")??void 0;j.useEffect(()=>{if(y==="danger"){m(!0);return}y&&Ok.includes(y)&&f(y)},[y]);const k=Ve({queryKey:["project",a],queryFn:()=>cI(a),enabled:!!a});return c.jsxs("div",{className:"flex flex-col gap-4 w-full flex-1 min-h-0",children:[c.jsxs("header",{className:"flex items-center gap-3 shrink-0",children:[!t&&c.jsxs("button",{type:"button",onClick:()=>l("/projects"),className:"nb-btn",style:{padding:"6px 12px"},"aria-label":n("newProject.back.aria"),children:[c.jsx(ZN,{size:14,strokeWidth:3}),n("newProject.back")]}),c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-3xl font-bold flex-1 truncate",children:a})]}),c.jsxs("nav",{className:"flex items-center gap-2 flex-wrap shrink-0",children:[c.jsx(ts,{current:p,value:"overview",onSelect:f,icon:gL,children:n("projectDetail.tab.overview")}),c.jsx(ts,{current:p,value:"config",onSelect:f,icon:u_,children:n("projectDetail.tab.config")}),c.jsx(ts,{current:p,value:"pipelines",onSelect:f,icon:Kb,children:n("projectDetail.tab.pipelines")}),c.jsx(ts,{current:p,value:"skills",onSelect:f,icon:d_,children:n("projectDetail.tab.skills")}),c.jsx(ts,{current:p,value:"rules",onSelect:f,icon:GR,children:n("projectDetail.tab.rules")}),c.jsx(ts,{current:p,value:"graph",onSelect:f,icon:s_,children:n("projectDetail.tab.graph")}),c.jsx(ts,{current:p,value:"logs",onSelect:f,icon:qb,children:n("projectDetail.tab.logs")}),c.jsx(ts,{current:p,value:"danger",onSelect:()=>m(!0),icon:Vi,children:n("projectDetail.tab.danger")}),c.jsx(vs,{to:`/board?project=${encodeURIComponent(a)}`,className:"nb-btn nb-btn-mint ml-auto",children:n("projectDetail.openBoard")})]}),c.jsxs("div",{className:["flex-1 min-h-0 pr-1 flex flex-col",p==="logs"?"overflow-hidden":"overflow-y-auto"].join(" "),children:[p==="overview"&&c.jsx(N4,{name:a,data:k.data,loading:k.isLoading}),p==="config"&&c.jsx(_4,{name:a}),p==="pipelines"&&c.jsx(j4,{name:a}),p==="skills"&&c.jsx(f4,{name:a}),p==="rules"&&c.jsx(p4,{name:a}),p==="graph"&&c.jsx(E4,{name:a}),p==="logs"&&c.jsx(TI,{project:a,initialWorker:p==="logs"?b:void 0})]}),g&&c.jsx(C4,{name:a,repoDir:((v=k.data)==null?void 0:v.repoDir)??null,onClose:()=>m(!1)})]})}function ts({current:e,value:t,onSelect:n,icon:i,children:a}){const l=e===t;return c.jsxs("button",{type:"button",onClick:()=>n(t),"aria-current":l?"page":void 0,className:["nb-btn",l?"nb-btn-primary":""].join(" "),style:{padding:"6px 14px",fontSize:13},children:[c.jsx(i,{size:13,strokeWidth:2.5}),a]})}function N4({name:e,data:t,loading:n}){const i=Pe();return n?c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:i("common.loading")})}):t?c.jsx("div",{className:"nb-card",children:c.jsxs("dl",{className:"grid grid-cols-[160px_1fr] gap-y-3 text-sm",children:[c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.repoDir")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.repoDir??"—"}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.pmBackend")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.pmBackend}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.agent")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.agentProvider}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.cards")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:i("projectDetail.overview.cards.value",{total:t.cards.total,inprogress:t.cards.inprogress,done:t.cards.done})}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.workers")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:i("projectDetail.overview.workers.value",{total:t.workers.total,active:t.workers.active})}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.pipeline")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.pipelineStatus}),c.jsx("dt",{className:"font-bold",children:i("projectDetail.overview.lastActivity")}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.lastActivityAt?new Date(t.lastActivityAt).toLocaleString():"—"})]})}):c.jsx("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:c.jsx("p",{children:i("projectDetail.overview.notFound",{name:e})})})}function _4({name:e}){const t=Pe(),n=Ft(),{alert:i}=un(),{data:a,isLoading:l,isError:o,error:d,refetch:f}=Ve({queryKey:["project-conf",e],queryFn:()=>dI(e)}),[p,g]=j.useState(null),[m,y]=j.useState(null);j.useEffect(()=>{a&&p===null&&(g(a.content),y(a.etag))},[a,p]);const b=p!==null&&a!==void 0&&p!==a.content,k=Et({mutationFn:()=>{if(p===null||m===null)throw new Error("no draft");return fI(e,p,m)},onSuccess:v=>{y(v.etag),n.invalidateQueries({queryKey:["project-conf",e]}),n.invalidateQueries({queryKey:["project",e]})},onError:v=>{const S=v.status;i({title:t(S===409?"projectDetail.config.error.conflict.title":"projectDetail.config.error.save.title"),body:S===409?t("projectDetail.config.error.conflict.body"):v instanceof Error?v.message:String(v)})}});return l?c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:t("common.loading")})}):o?c.jsx("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:c.jsx("p",{children:t("projectDetail.config.error.load",{detail:d instanceof Error?d.message:String(d)})})}):c.jsxs("div",{className:"nb-card",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-lg font-bold",children:c.jsxs("code",{className:"font-[family-name:var(--font-mono)] text-sm border-2 border-[var(--color-text)] px-2 py-0.5 rounded",children:["~/.coral/projects/",e,"/conf"]})}),m&&c.jsxs("p",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] mt-1",children:["etag: ",m]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",className:"nb-btn",style:{padding:"6px 12px"},onClick:()=>{g(null),f()},disabled:k.isPending,"aria-label":t("projectDetail.config.reload"),children:[c.jsx(ya,{size:13,strokeWidth:2.5}),t("projectDetail.config.reload")]}),c.jsxs("button",{type:"button",className:"nb-btn nb-btn-primary",style:{padding:"6px 12px"},onClick:()=>k.mutate(),disabled:!b||k.isPending,"aria-label":t("projectDetail.config.saveAria"),children:[k.isPending?c.jsx(Xe,{size:13,strokeWidth:3,className:"animate-spin"}):k.isSuccess&&!b?c.jsx(QR,{size:13,strokeWidth:3}):c.jsx(mr,{size:13,strokeWidth:3}),t("projectDetail.config.save")]})]})]}),c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",style:{minHeight:480,resize:"vertical"},value:p??"",onChange:v=>g(v.target.value),spellCheck:!1,"aria-label":t("projectDetail.config.editorAria")}),b&&c.jsx("p",{className:"text-xs text-[var(--color-stuck)] mt-2 font-bold",children:t("projectDetail.config.confDirty")})]})}function j4({name:e}){const t=Pe(),n=Ft(),{confirm:i,alert:a}=un(),{data:l,isLoading:o}=Ve({queryKey:["project-pipelines",e],queryFn:()=>hI(e)}),[d,f]=j.useState(null),[p,g]=j.useState(!1),m=Et({mutationFn:v=>mI(e,v),onSuccess:()=>n.invalidateQueries({queryKey:["project-pipelines",e]}),onError:v=>{a({title:t("projectDetail.pipelines.switch.error"),body:v instanceof Error?v.message:String(v)})}}),y=Et({mutationFn:v=>xI(e,v),onSuccess:()=>n.invalidateQueries({queryKey:["project-pipelines",e]}),onError:v=>{a({title:t("projectDetail.pipelines.delete.error"),body:v instanceof Error?v.message:String(v)})}}),b=Et({mutationFn:v=>bI(e,v.name,v.template),onSuccess:v=>{n.invalidateQueries({queryKey:["project-pipelines",e]}),g(!1),f(v.name)},onError:v=>{a({title:t("projectDetail.pipelines.create.error"),body:v instanceof Error?v.message:String(v)})}});if(o)return c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:t("common.loading")})});const k=[];l!=null&&l.active&&k.push({name:l.active,isActive:!0});for(const v of(l==null?void 0:l.available)??[])k.push({name:v.name,isActive:!1});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nb-card",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-lg font-bold",children:t("projectDetail.pipelines.title")}),c.jsxs("button",{type:"button",className:"nb-btn nb-btn-mint",style:{padding:"6px 12px",fontSize:12},onClick:()=>g(!0),disabled:b.isPending,"aria-label":t("projectDetail.pipelines.add"),children:[c.jsx(hi,{size:12,strokeWidth:3}),t("projectDetail.pipelines.add")]})]}),k.length===0?c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] italic p-4 border-2 border-dashed border-[var(--color-text)] rounded-lg text-center",children:t("projectDetail.pipelines.empty")}):c.jsx("ul",{className:"flex flex-col gap-2",children:k.map(v=>c.jsxs("li",{className:"flex bg-surface-input items-center gap-3 p-3 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg",children:[c.jsx(Kb,{size:16,strokeWidth:2.5}),c.jsx("span",{className:"font-[family-name:var(--font-mono)] font-bold flex-1",children:v.name}),v.isActive&&c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)"},children:t("projectDetail.pipelines.activeBadge")}),c.jsxs("div",{className:"flex gap-1",children:[c.jsxs("button",{type:"button",className:"nb-btn",style:{padding:"4px 10px",fontSize:11},onClick:()=>f(v.name),"aria-label":t("projectDetail.pipelines.editAria",{name:v.name}),children:[c.jsx(Kp,{size:11,strokeWidth:2.5}),t("projectDetail.pipelines.edit")]}),!v.isActive&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"nb-btn nb-btn-primary",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{await i({title:t("projectDetail.pipelines.switch.confirm.title",{name:v.name}),body:t("projectDetail.pipelines.switch.confirm.body",{name:v.name}),confirm:t("projectDetail.pipelines.switch.confirm.button")})&&m.mutate(v.name)},disabled:m.isPending,"aria-label":t("projectDetail.pipelines.switchAria",{name:v.name}),children:t("projectDetail.pipelines.switch")}),c.jsx("button",{type:"button",className:"nb-btn nb-btn-danger",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{await i({title:t("projectDetail.pipelines.delete.confirm.title",{name:v.name}),body:t("projectDetail.pipelines.delete.confirm.body"),confirm:t("common.delete"),danger:!0})&&y.mutate(v.name)},disabled:y.isPending,"aria-label":t("projectDetail.pipelines.deleteAria",{name:v.name}),children:c.jsx(Vi,{size:11,strokeWidth:2.5})})]})]})]},v.name))})]}),d&&c.jsx(Kz,{projectName:e,file:d,onClose:()=>f(null),onSaved:()=>{n.invalidateQueries({queryKey:["project-pipelines",e]})}}),p&&c.jsx(Yz,{hasActive:!!(l!=null&&l.active),hasSample:!0,isPending:b.isPending,onCancel:()=>g(!1),onCreate:(v,S)=>b.mutate({name:v,template:S})})]})}function C4({name:e,repoDir:t,onClose:n}){const i=Pe(),a=ks(),l=Ft(),{alert:o}=un(),[d,f]=j.useState(""),[p,g]=j.useState(!0),m=Et({mutationFn:()=>pI(e,{includeClaudeDir:p}),onSuccess:S=>{l.invalidateQueries({queryKey:["projects"]});const E=S.claudeRemoved.filter(C=>C.ok).map(C=>C.path);n(),o({title:i("projectDetail.danger.deleted.title"),body:E.length>0?i("projectDetail.danger.deleted.bodyWithList",{paths:E.join(`
|
|
617
|
-
`)}):i("projectDetail.danger.deleted.body")}).then(()=>a("/projects"))},onError:S=>{o({title:i("projectDetail.danger.error"),body:S instanceof Error?S.message:String(S)})}});j.useEffect(()=>{const S=E=>{E.key==="Escape"&&n()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[n]);const b=i("projectDetail.danger.body",{path:"__PATH__"}).split("__PATH__"),v=i("projectDetail.danger.confirmPrompt",{name:"__NAME__"}).split("__NAME__");return c.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"danger-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4 overflow-hidden",children:c.jsxs("div",{className:"nb-card w-full max-w-xl max-h-[calc(100vh-2rem)] overflow-y-auto bg-[var(--color-crashed-bg)]",children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 mb-3",children:[c.jsx("h2",{id:"danger-dialog-title",className:"font-[family-name:var(--font-heading)] text-lg font-bold text-[var(--color-crashed)]",children:i("projectDetail.danger.title")}),c.jsx("button",{type:"button",className:"nb-btn nb-btn-mint p-2",onClick:n,"aria-label":i("common.close"),disabled:m.isPending,children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("p",{className:"text-sm mb-4",children:[b[0],c.jsxs("code",{className:"font-[family-name:var(--font-mono)] bg-[var(--color-bg)] border-2 border-[var(--color-text)] px-1.5 py-0.5 rounded",children:["~/.coral/projects/",e,"/"]}),b[1]]}),t&&c.jsxs("label",{className:"flex items-start gap-2 mb-4 p-3 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-lg cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:S=>g(S.target.checked),className:"mt-0.5",disabled:m.isPending}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-bold",children:i("projectDetail.danger.includeClaude.label")}),c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] break-all",children:[t,"/.claude/"]}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-1",children:i("projectDetail.danger.includeClaude.note")})]})]}),c.jsx("div",{className:"mb-4",children:c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsxs("span",{className:"text-sm font-bold",children:[v[0],c.jsx("code",{className:"font-[family-name:var(--font-mono)] text-xs",children:e}),v[1]]}),c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:d,onChange:S=>f(S.target.value),placeholder:e,disabled:m.isPending})]})}),c.jsxs("div",{className:"flex gap-2 justify-end pt-3 border-t-2 border-dashed border-[var(--color-text)]",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:n,disabled:m.isPending,children:i("common.cancel")}),c.jsxs("button",{type:"button",className:"nb-btn nb-btn-danger",disabled:d!==e||m.isPending,onClick:()=>m.mutate(),"aria-label":i("projectDetail.danger.deleteAria"),children:[m.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(Vi,{size:14,strokeWidth:3}),i("projectDetail.danger.deleteButton")]})]})]})})}function px(){return ct("/api/providers")}function N2(e){const t=[];for(const n of e)for(const i of n.models)t.push({providerId:n.id,model:i,label:`${i} · ${n.name}`});return t}async function A4(e,t){const n=await fetch("/api/providers",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:e,entry:t})});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}async function T4(e,t){const n=await fetch(`/api/providers/${e}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}function _2(e){const t=e?`?path=${encodeURIComponent(e)}`:"";return ct(`/api/fs/browse${t}`)}async function M4(e,t){const n=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,name:t})});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return await n.json()}const j2=50*1024*1024;async function D4(e,t){if(t.size>j2)throw new Error(`文件超过 50 MB 上限(当前 ${(t.size/1024/1024).toFixed(2)} MB)`);const n=new FormData;n.append("sessionId",e),n.append("file",t,t.name);const i=await fetch("/api/fs/upload",{method:"POST",body:n});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return await i.json()}function Zy(e,t){return`/api/fs/file?${new URLSearchParams({path:t,sessionId:e}).toString()}`}function hx({initialPath:e,onCancel:t,onSelect:n,title:i,mode:a="directory"}){var C,N,_;const l=Pe(),{prompt:o,alert:d}=un(),f=i??l("dirPicker.title.default"),[p,g]=j.useState(e??null),[m,y]=j.useState(null),b=Ve({queryKey:["fs-browse",p],queryFn:()=>_2(p??void 0),staleTime:0,gcTime:0}),k=((C=b.data)==null?void 0:C.path)??p??"",v=((N=b.data)==null?void 0:N.parent)??null,S=((_=b.data)==null?void 0:_.home)??null,E=async()=>{var M;if(!k)return;const T=(M=await o({title:l("dirPicker.newDir"),body:l("dirPicker.newDir.prompt"),placeholder:l("dirPicker.newDir.placeholder"),confirm:l("dirPicker.newDir.create")}))==null?void 0:M.trim();if(T)try{const O=await M4(k,T);g(O.path)}catch(O){d({title:l("dirPicker.newDir.error.title"),body:O instanceof Error?O.message:String(O)})}};return j.useEffect(()=>{const T=M=>{M.key==="Escape"&&(M.preventDefault(),t())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[t]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[rgba(45,55,72,0.5)] p-4",role:"presentation",children:c.jsxs("div",{className:"nb-card bg-[var(--color-bg)] max-w-lg w-full h-[70vh] min-h-0 overflow-hidden p-5 flex flex-col",role:"dialog","aria-modal":"true","aria-label":f,children:[c.jsxs("header",{className:"flex items-center justify-between mb-3 shrink-0",children:[c.jsx("div",{className:"flex items-center gap-2 min-w-0",children:c.jsx("h3",{className:"font-[family-name:var(--font-heading)] font-bold text-base truncate",children:f})}),c.jsx("button",{type:"button",className:"p-1 hover:bg-[var(--color-bg-cream)] rounded",onClick:t,"aria-label":l("dirPicker.close.aria"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>v&&g(v),disabled:!v||b.isLoading,"aria-label":l("dirPicker.up.aria"),title:l("dirPicker.up.title"),children:c.jsx(JN,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>S&&g(S),disabled:!S||b.isLoading,"aria-label":l("dirPicker.home.aria"),title:l("dirPicker.home.title"),children:c.jsx(RL,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>void E(),disabled:!k||b.isLoading||b.isError,"aria-label":l("dirPicker.newDir.aria"),title:l("dirPicker.newDir.aria"),children:c.jsx(xL,{size:12,strokeWidth:3})}),c.jsx("div",{className:"flex-1 min-w-0 nb-input font-[family-name:var(--font-mono)] text-xs px-2 py-1.5 truncate",title:k,dir:"rtl",children:k||"..."})]}),c.jsx("div",{className:"scroll-frame flex-1 border-2 border-[var(--color-text)] rounded-lg bg-[var(--color-bg-cream)] min-h-0",children:c.jsxs("div",{className:"scroll-frame-body h-full",children:[b.isLoading&&c.jsxs("div",{className:"flex items-center justify-center py-12 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:16,strokeWidth:3,className:"animate-spin mr-2"}),l("dirPicker.loading")]}),b.isError&&c.jsxs("div",{className:"p-4 text-sm text-[var(--color-crashed)]",children:[c.jsx("p",{className:"font-bold mb-1",children:l("dirPicker.error.title")}),c.jsx("p",{className:"text-xs font-[family-name:var(--font-mono)] break-all",children:b.error instanceof Error?b.error.message:String(b.error)})]}),b.data&&c.jsxs("ul",{className:"divide-y-2 divide-[var(--color-text)]/20",children:[b.data.entries.length===0&&c.jsx("li",{className:"p-4 text-xs text-[var(--color-text-subtle)] italic text-center",children:l("dirPicker.empty")}),b.data.entries.map(T=>{const M=(()=>{const B=k.endsWith("/")||k.endsWith("\\")?"":"/";return`${k}${B}${T.name}`})(),O=a==="file"&&m===M,R=T.isDirectory||a==="file";return c.jsx("li",{children:c.jsxs("button",{type:"button",className:["w-full flex items-center gap-2 px-3 py-2 text-left text-sm font-[family-name:var(--font-mono)]","disabled:opacity-50 disabled:cursor-not-allowed",O?"bg-[var(--color-accent-mint)] font-bold":"hover:bg-[var(--color-accent-mint)]"].join(" "),disabled:!R,onClick:()=>{T.isDirectory?(y(null),g(M)):a==="file"&&y(M)},onDoubleClick:()=>{a==="file"&&!T.isDirectory&&n(M)},title:T.isDirectory?l("dirPicker.enter.aria",{name:T.name}):a==="file"?l("dirPicker.pickFile.aria",{name:T.name}):l("dirPicker.fileLocked"),children:[T.isDirectory?c.jsx(yp,{size:14,strokeWidth:2.5,className:"flex-shrink-0 text-[var(--color-text)]"}):c.jsx("span",{className:"w-3.5 h-3.5 flex-shrink-0"}),c.jsx("span",{className:"truncate",children:T.name}),T.isDirectory&&c.jsx(Jo,{size:12,strokeWidth:2.5,className:"ml-auto flex-shrink-0 text-[var(--color-text-muted)]"})]})},T.name)})]})]})}),c.jsxs("div",{className:"flex gap-2 justify-end pt-3 shrink-0",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:t,children:l("dirPicker.cancel")}),a==="file"?c.jsxs("button",{type:"button",className:"nb-btn nb-btn-primary",onClick:()=>m&&n(m),disabled:!m||b.isLoading||b.isError,title:m??l("dirPicker.useFile.tooltip.empty"),children:[c.jsx(Su,{size:14,strokeWidth:3}),l("dirPicker.useFile")]}):c.jsxs("button",{type:"button",className:"nb-btn nb-btn-primary",onClick:()=>n(k),disabled:!k||b.isLoading||b.isError,children:[c.jsx(Su,{size:14,strokeWidth:3}),l("dirPicker.useDir")]})]})]})})}function Mf(e){return(e.replace(/\/+$/,"").split("/").pop()??"").replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function C2({onCancel:e,onCreated:t,dialogMode:n=!1}={}){var K,q,Y,D,F,I;const i=Pe(),a=ks(),l=Ft(),{alert:o}=un(),d=e??(()=>a("/projects")),[f,p]=j.useState({name:"",projectDir:"",enableGit:!0,createIfMissing:!0,mergeBranch:"main",maxWorkers:"1",ackTimeoutMin:"5",pipelineMode:"pipeline"}),g=f.pipelineMode==="smartArrange",m=Ve({queryKey:["system-agents"],queryFn:Yb}),y=((K=m.data)==null?void 0:K.agents.worker.model)??"",b=((q=m.data)==null?void 0:q.agents.reviewer.model)??"",k=[...new Set((((Y=m.data)==null?void 0:Y.providers.openai)??[]).flatMap(H=>H.models))],v=Ve({queryKey:["providers"],queryFn:px}),S=N2(((D=v.data)==null?void 0:D.anthropic)??[]),E=f.workerModel?`${f.workerProviderId??""}::${f.workerModel}`:"",[C,N]=j.useState(!1),_=Et({mutationFn:H=>uI(H),onSuccess:H=>{l.invalidateQueries({queryKey:["projects"]}),t?t(H.name):a(`/projects/${encodeURIComponent(H.name)}`)},onError:H=>{o({title:i("newProject.error.create.title"),body:H instanceof Error?H.message:String(H)})}}),T=/^[a-zA-Z0-9_-]+$/.test(f.name),M=T&&f.projectDir.trim()!==""&&!_.isPending,O=f.projectDir.trim(),R=Ve({queryKey:["fs-browse-probe",O],queryFn:()=>_2(O),enabled:O.startsWith("/"),staleTime:0,gcTime:0,retry:!1}),B=R.isSuccess&&(((F=R.data)==null?void 0:F.entries.length)??0)>0,U=R.isError||R.isSuccess&&(((I=R.data)==null?void 0:I.entries.length)??0)===0;return c.jsxs("div",{className:n?"w-full h-full min-h-0":"w-full",children:[c.jsxs("div",{className:n?"nb-card flex h-full min-h-0 flex-col overflow-hidden":"nb-card flex flex-col gap-4",children:[c.jsxs("header",{className:n?"flex shrink-0 items-center gap-3 border-b-2 border-dashed border-[var(--color-text)] pb-4":"flex items-center gap-3",children:[c.jsxs("button",{type:"button",onClick:d,className:"nb-btn",style:{padding:"6px 12px"},"aria-label":i("newProject.back.aria"),children:[c.jsx(ZN,{size:14,strokeWidth:3}),i("newProject.back")]}),c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:i("newProject.title")})]}),c.jsxs("form",{onSubmit:H=>{H.preventDefault(),M&&_.mutate(f)},className:n?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-4",children:[c.jsxs("div",{className:["grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",n?"min-h-0 flex-1 overflow-y-auto overscroll-contain pr-3 pt-4":""].join(" "),children:[c.jsx(Ui,{className:"md:col-span-2",label:i("newProject.field.mode"),hint:i(g?"newProject.field.mode.smartHint":"newProject.field.mode.pipelineHint"),children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:["pipeline","smartArrange"].map(H=>{const W=f.pipelineMode===H;return c.jsxs("button",{type:"button",onClick:()=>p({...f,pipelineMode:H}),"aria-pressed":W,className:["text-left rounded-xl border-2 p-3 transition-all",W?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[3px_3px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),children:[c.jsx("div",{className:"text-sm font-bold",children:i(H==="pipeline"?"newProject.field.mode.pipeline":"newProject.field.mode.smart")}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:i(H==="pipeline"?"newProject.field.mode.pipelineDesc":"newProject.field.mode.smartDesc")})]},H)})})}),g&&c.jsx(Ui,{className:"md:col-span-2",label:i("newProject.field.goal"),hint:i("newProject.field.goal.hint"),children:c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-sm",style:{minHeight:110,resize:"vertical"},placeholder:i("newProject.field.goal.placeholder"),value:f.goal??"",onChange:H=>p({...f,goal:H.target.value})})}),c.jsx(Ui,{label:"Worker 模型",hint:`默认:${y||"全局默认"}(留空用默认)`,children:c.jsxs("select",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:E,onChange:H=>{const W=H.target.value;if(!W)return p({...f,workerModel:void 0,workerProviderId:void 0});const[G,L]=W.split("::");p({...f,workerModel:L,workerProviderId:G||void 0})},children:[c.jsx("option",{value:"",children:"用全局默认模型"}),S.map(H=>c.jsx("option",{value:`${H.providerId}::${H.model}`,children:H.label},`${H.providerId}::${H.model}`))]})}),g&&c.jsxs(Ui,{label:"OpenAI Agent(监工)模型",hint:`默认:${b||"全局默认"}(留空用默认)`,children:[c.jsx("input",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:f.reviewerModel??"",onChange:H=>p({...f,reviewerModel:H.target.value}),placeholder:b,list:"np-reviewer-models",spellCheck:!1}),c.jsx("datalist",{id:"np-reviewer-models",children:k.map(H=>c.jsx("option",{value:H},H))})]}),c.jsxs(Ui,{label:i("newProject.field.name"),hint:i("newProject.field.name.derived"),children:[c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.name.placeholder"),value:f.name,onChange:H=>p({...f,name:H.target.value}),required:!0}),f.name&&!T&&c.jsx("p",{className:"text-xs text-[var(--color-crashed)] mt-1",children:i("newProject.field.name.invalid")})]}),c.jsxs(Ui,{className:"md:col-span-2",label:i("newProject.field.dir"),hint:i("newProject.field.dir.long"),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",className:"nb-input flex-1 font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.dir.placeholder"),value:f.projectDir,onChange:H=>{const W=H.target.value,G=Mf(W),L=Mf(f.projectDir),z=f.name&&f.name!==L;p({...f,projectDir:W,name:z?f.name:G})},required:!0}),c.jsxs("button",{type:"button",className:"nb-btn flex-shrink-0",onClick:()=>N(!0),"aria-label":i("newProject.dir.browseAria"),title:i("newProject.dir.browseAria"),children:[c.jsx(i_,{size:14,strokeWidth:2.5}),i("newProject.dir.browse")]})]}),B&&c.jsx("p",{className:"text-xs mt-1.5 font-bold text-[var(--color-text)]",children:i("newProject.field.dir.adopt")}),U&&O.startsWith("/")&&c.jsx("p",{className:"text-xs mt-1.5 text-[var(--color-text-muted)]",children:i("newProject.field.dir.fresh")}),c.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.createIfMissing!==!1,onChange:H=>p({...f,createIfMissing:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:i("newProject.field.dir.createIfMissing")})]})]}),c.jsx(Ui,{label:i("newProject.field.maxWorkers.short"),children:c.jsx("input",{type:"number",min:"1",max:"8",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.maxWorkers,onChange:H=>p({...f,maxWorkers:H.target.value})})}),c.jsx(Ui,{label:i("newProject.field.ackTimeout.minutes"),hint:i("newProject.field.ackTimeout.minutes.help"),children:c.jsx("input",{type:"number",min:"1",max:"30",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.ackTimeoutMin??"5",onChange:H=>p({...f,ackTimeoutMin:H.target.value})})}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsxs("label",{className:"flex items-center gap-3 mb-2 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.enableReview??!1,onChange:H=>p({...f,enableReview:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-sm font-bold",children:i("newProject.field.review.label")})]}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:i("newProject.field.review.detail")})]}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsxs("label",{className:"flex items-center gap-3 mb-3 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.enableGit??!0,onChange:H=>p({...f,enableGit:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-sm font-bold",children:i("newProject.field.git.label")})]}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] mb-3",children:i("newProject.field.git.detail")}),f.enableGit!==!1&&c.jsxs("div",{className:"flex flex-col gap-4 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4",children:[c.jsx(Ui,{label:i("newProject.field.git.branch"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.mergeBranch??"main",onChange:H=>p({...f,mergeBranch:H.target.value})})}),c.jsx(Ui,{label:i("newProject.field.gitlabProject.label"),hint:i("newProject.field.gitlabProject.help2"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.gitlabProject.placeholder"),value:f.gitlabProject??"",onChange:H=>p({...f,gitlabProject:H.target.value})})}),f.gitlabProject&&c.jsx(Ui,{label:i("newProject.field.gitlabProjectId"),hint:i("newProject.field.gitlabProjectId.help"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.gitlabProjectId.placeholder"),value:f.gitlabProjectId??"",onChange:H=>p({...f,gitlabProjectId:H.target.value})})})]})]}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-3 text-[var(--color-text-muted)]",children:i("newProject.section.notifications")}),c.jsx(Ui,{label:i("newProject.field.matrixRoom.label"),hint:i("newProject.field.matrixRoom.help2"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.matrixRoom.placeholder"),value:f.matrixRoomId??"",onChange:H=>p({...f,matrixRoomId:H.target.value})})})]})]}),c.jsxs("div",{className:n?"flex shrink-0 gap-3 justify-end border-t-2 border-dashed border-[var(--color-text)] pt-4 mt-4":"flex gap-3 justify-end pt-3",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:d,disabled:_.isPending,children:i("common.cancel")}),c.jsx("button",{type:"submit",className:"nb-btn nb-btn-primary",disabled:!M,"aria-label":i("newProject.submit"),children:_.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}),i("newProject.creating")]}):c.jsxs(c.Fragment,{children:[c.jsx(hi,{size:14,strokeWidth:3}),i("common.create")]})})]})]})]}),C&&c.jsx(hx,{title:i("newProject.field.dir.pickerTitle"),initialPath:f.projectDir.trim()||void 0,onCancel:()=>N(!1),onSelect:H=>{const W=Mf(H),G=Mf(f.projectDir),L=f.name&&f.name!==G;p({...f,projectDir:H,name:L?f.name:W}),N(!1)}})]})}function Ui({label:e,hint:t,children:n,className:i}){return c.jsxs("label",{className:`flex flex-col gap-1.5 ${i??""}`,children:[c.jsx("span",{className:"text-sm font-bold",children:e}),n,t&&c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:t})]})}function O4({onClose:e,onCreated:t}){return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4 overflow-hidden",children:c.jsx("div",{className:"w-full max-w-6xl h-[calc(100vh-2rem)] min-h-0",children:c.jsx(C2,{dialogMode:!0,onCancel:e,onCreated:n=>{e(),t(n)}})})})}const Rk="projects.last",R4=["activity","date","name"];function Lk(){const e=Pe(),t=ks(),{name:n}=Lb(),[i,a]=Wb("projects.sort","activity"),[l,o]=j.useState(!1),[d,f]=j.useState(!1),{data:p,isLoading:g,isError:m,error:y,refetch:b}=Ve({queryKey:["projects"],queryFn:Es}),k=T=>t(`/projects/${encodeURIComponent(T)}`),v=p?N_(p.data,i):[],S=i!=="name",{recent:E,older:C}=S?NI(v,T=>T.lastActivityAt):{recent:v,older:[]},N=l?C:C.filter(T=>T.name===n),_=C.length-N.length;return j.useEffect(()=>{if(n)try{localStorage.setItem(Rk,n)}catch{}},[n]),j.useEffect(()=>{if(n||!p)return;let T=null;try{T=localStorage.getItem(Rk)}catch{}T&&p.data.some(M=>M.name===T)&&t(`/projects/${encodeURIComponent(T)}`,{replace:!0})},[n,p,t]),c.jsxs("div",{className:"flex flex-col flex-1 min-h-0 w-full",children:[m?c.jsxs("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-2",children:e("projects.load.failed")}),c.jsx("p",{className:"text-sm text-[var(--color-text)]",children:y instanceof Error?y.message:String(y)}),c.jsx("button",{className:"nb-btn mt-4",onClick:()=>b(),type:"button",children:e("common.retry")})]}):p&&p.data.length===0?c.jsx(P4,{onNew:()=>f(!0)}):c.jsxs("div",{className:"flex gap-5 flex-1 min-h-0",children:[c.jsxs("aside",{className:"w-80 shrink-0 flex flex-col min-h-0",children:[c.jsxs("div",{className:"shrink-0 flex flex-col gap-2 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold truncate",children:e("projects.title")}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:p?e("projects.count",{count:p.data.length}):e("common.loading")})]}),c.jsxs("button",{className:"nb-btn nb-btn-primary shrink-0",type:"button",onClick:()=>f(!0),"aria-label":e("projects.new"),children:[c.jsx(hi,{size:16,strokeWidth:3}),e("projects.new")]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"inline-flex flex-1 rounded-full overflow-hidden bg-color-bg-soft",role:"group","aria-label":e("projects.sort.label"),children:R4.map(T=>c.jsx("button",{type:"button","aria-pressed":i===T,onClick:()=>a(T),className:["flex-1 px-2 py-1.5 text-xs font-bold font-[family-name:var(--font-mono)] focus-visible:outline focus-visible:outline-2",i===T?"bg-surface-input text-[var(--color-text)]":"bg-transparent text-[var(--color-text-muted)] hover:bg-[rgba(255,255,255,0.08)]"].join(" "),children:e(`projects.sort.${T}`)},T))}),c.jsx("button",{className:"nb-btn nb-btn-yellow shrink-0",style:{padding:"6px 10px"},onClick:()=>b(),type:"button","aria-label":e("common.refresh"),children:c.jsx(qp,{size:16,strokeWidth:2.5})})]})]}),c.jsx("ul",{className:"flex-1 min-h-0 overflow-y-auto flex flex-col gap-0.5 pr-1",children:g?c.jsx(z4,{}):c.jsxs(c.Fragment,{children:[[...E,...N].map(T=>c.jsx(L4,{project:T,selected:T.name===n,onClick:()=>k(T.name)},T.name)),(_>0||l&&C.length>0)&&c.jsx("button",{type:"button",className:"nb-btn text-xs self-start mt-1",onClick:()=>o(T=>!T),"aria-label":l?"收起更早项目":"显示更早项目",children:l?"收起更早":`含更早 (${_})`})]})})]}),c.jsx("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col",children:n?c.jsx(S4,{name:n,embedded:!0}):c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:e("projects.selectHint")})})})]}),d&&c.jsx(O4,{onClose:()=>f(!1),onCreated:k})]})}function L4({project:e,selected:t,onClick:n}){return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:n,className:["dimension-menu-item w-full text-left flex-col items-stretch gap-1 px-3 py-2 pl-4",t?"dimension-menu-item-active":""].join(" "),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] font-bold truncate",children:e.name}),c.jsx(I4,{status:e.pipelineStatus})]}),e.repoDir&&c.jsx("p",{className:"text-[10px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] truncate mt-0.5",children:e.repoDir}),c.jsxs("div",{className:"flex gap-3 text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] mt-1.5",children:[c.jsxs("span",{children:[e.cards.total," cards"]}),c.jsxs("span",{children:[e.cards.inprogress," run"]}),c.jsxs("span",{children:[e.workers.active,"/",e.workers.total," w"]})]})]})})}function I4({status:e}){const t={running:{bg:"var(--color-running-bg)",label:"running"},idle:{bg:"var(--color-idle-bg)",label:"idle"},stopping:{bg:"var(--color-stuck-bg)",label:"stopping"},error:{bg:"var(--color-crashed-bg)",label:"error"}},{bg:n,label:i}=t[e],a=e==="running"?"var(--color-running)":e==="error"?"var(--color-crashed)":e==="stopping"?"var(--color-stuck)":"var(--color-idle)";return c.jsx("span",{className:"nb-status",style:{background:n,color:a},children:i})}function z4(){return c.jsx(c.Fragment,{children:[0,1,2].map(e=>c.jsxs("div",{className:"nb-card opacity-60 animate-pulse",style:{padding:"10px 12px"},children:[c.jsx("div",{className:"h-5 w-28 bg-[var(--color-border-light)] rounded-md mb-2"}),c.jsx("div",{className:"h-3 w-2/3 bg-[var(--color-border-light)] rounded-md"})]},e))})}function P4({onNew:e}){const t=Pe(),n=t("projects.empty.hint",{cmd:"__CMD__"}),[i,a]=n.split("__CMD__");return c.jsxs("div",{className:"nb-card bg-[var(--color-accent-yellow)] flex items-center gap-6 p-8",children:[c.jsx("div",{className:"w-20 h-20 rounded-3xl bg-[rgba(255,255,255,0.12)] text-[var(--color-text)] flex items-center justify-center shadow-[rgba(255,255,255,0.10)_0_0_0_1px_inset]",children:c.jsx(m_,{size:32,strokeWidth:2.5})}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold mb-2",children:t("projects.empty.title")}),c.jsxs("p",{className:"text-sm text-[var(--color-text)] mb-4",children:[i,c.jsx("code",{className:"bg-[rgba(0,0,0,0.35)] px-2 py-0.5 rounded-md font-[family-name:var(--font-mono)]",children:"sps project init <name>"}),a]}),c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",onClick:e,children:[c.jsx(hi,{size:16,strokeWidth:3}),t("projects.new")]})]})]})}function B4({project:e,isPending:t,onCancel:n,onCreate:i}){var N;const a=Pe(),[l,o]=j.useState(""),[d,f]=j.useState(""),[p,g]=j.useState(new Set),[m,y]=j.useState(!1),b=Ve({queryKey:["skills-all",e],queryFn:()=>fx(e)});j.useEffect(()=>{const _=T=>{T.key==="Escape"&&n()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[n]);const v=l.trim().length>0&&l.trim().length<=200&&!t,S=_=>{const T=new Set(p);T.has(_)?T.delete(_):T.add(_),g(T)},E=()=>{v&&i({title:l.trim(),description:d.trim(),skills:[...p],labels:["AI-PIPELINE"],initialState:m?"Backlog":"Planning"})},C=((N=b.data)==null?void 0:N.data)??[];return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-40 flex items-center justify-center p-4 md:p-6 bg-black/30 overflow-hidden",children:c.jsxs("div",{className:"nb-card w-full max-w-5xl flex flex-col",style:{maxHeight:"calc(100vh - 48px)"},children:[c.jsxs("header",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:a("newCard.title")}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",onClick:n,type:"button","aria-label":a("common.close"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsx("form",{onSubmit:_=>{_.preventDefault(),E()},className:"flex min-h-0 flex-1 flex-col",children:c.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-4 overflow-y-auto pr-1 md:grid-cols-[minmax(0,1fr)_minmax(280px,380px)] md:overflow-hidden md:pr-0",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4 md:overflow-y-auto md:pr-1",children:[c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.title")}),c.jsx("input",{type:"text",className:"nb-input w-full",placeholder:a("newCard.field.title.placeholder"),value:l,onChange:_=>o(_.target.value),maxLength:200,autoFocus:!0,required:!0}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.title.help")})]}),c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.description")}),c.jsx("textarea",{className:"nb-input w-full",style:{minHeight:160,resize:"vertical"},placeholder:a("newCard.field.description.placeholder"),value:d,onChange:_=>f(_.target.value)}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.description.help")})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.dispatch")}),c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none p-3 border-[2px] border-[var(--color-text)] rounded-lg bg-[var(--color-bg-cream)]",children:[c.jsx("input",{type:"checkbox",className:"w-4 h-4 accent-[var(--color-cta)] cursor-pointer",checked:m,onChange:_=>y(_.target.checked)}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"text-sm font-bold",children:a("newCard.field.dispatch.label")}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:a("newCard.field.dispatch.help")})]})]})]})]}),c.jsxs("section",{className:"flex min-h-[240px] flex-col gap-2 md:min-h-0 md:overflow-hidden",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.skills")}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.skills.help")}),c.jsx("div",{className:"scroll-frame min-h-0 flex-1 rounded-lg border-2 border-[var(--color-border-light)] bg-[var(--color-bg-cream)]",children:c.jsxs("div",{className:"scroll-frame-body h-full p-2",children:[b.isLoading&&c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("newCard.field.skills.loading")}),b.isError&&c.jsx("p",{className:"text-xs text-[var(--color-crashed)]",children:a("newCard.field.skills.error",{detail:b.error instanceof Error?b.error.message:String(b.error)})}),C.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(_=>{const T=p.has(_.name);return c.jsx("button",{type:"button",onClick:()=>S(_.name),className:["max-w-full break-all px-2.5 py-1 text-left text-xs font-[family-name:var(--font-mono)] rounded-full border-2 transition-all",T?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[2px_2px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),"aria-pressed":T,children:_.name},_.name)})})]})}),p.size>0&&c.jsx("p",{className:"max-h-14 overflow-y-auto break-words text-xs text-[var(--color-text-muted)]",children:a("newCard.field.skills.selected",{count:p.size,names:[...p].join(", ")})})]})]})}),c.jsxs("div",{className:"flex gap-2 justify-end mt-4 pt-3 border-t-2 border-dashed border-[var(--color-text)] flex-shrink-0",children:[c.jsx("button",{className:"nb-btn",style:{padding:"6px 14px"},onClick:n,disabled:t,type:"button",children:a("common.cancel")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 14px"},onClick:E,disabled:!v,type:"button","aria-label":a("newCard.create.aria"),children:[t?c.jsx(Xe,{size:13,strokeWidth:3,className:"animate-spin"}):c.jsx(hi,{size:13,strokeWidth:3}),a("common.create")]})]})]})})}function $4(e){return ct(`/api/projects/${encodeURIComponent(e)}/cards`)}function U4(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/cards/${t}`)}function F4(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/cards/${t}/prompt`)}async function sc(e,t){const n=await fetch(e,{method:"POST",headers:t?{"Content-Type":"application/json"}:void 0,body:t?JSON.stringify(t):void 0});if(!n.ok){const i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json().catch(()=>({}))}function q4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/cards/${t}/reset`)}async function H4(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"DELETE"});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}}function K4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/cards/${t}/launch`)}function G4(e,t){const n=typeof t=="string"?{title:t}:t;return sc(`/api/projects/${encodeURIComponent(e)}/cards`,n)}async function V4(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n})});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}}async function Y4(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return i.json()}function A2(e){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/start`)}function T2(e){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/stop`)}function W4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/reset`,t??{})}function Q4(e){const t=Ft();j.useEffect(()=>{if(!e)return;const n=`/stream/projects/${encodeURIComponent(e)}`,i=new EventSource(n),a=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["cards",f.project]}),t.invalidateQueries({queryKey:["card",f.project,f.seq]}),t.invalidateQueries({queryKey:["projects"]})}catch{}},l=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["workers",f.project]}),t.invalidateQueries({queryKey:["projects"]})}catch{}},o=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["pipeline-status",f.project]}),t.invalidateQueries({queryKey:["projects"]})}catch{}};return i.addEventListener("card.created",a),i.addEventListener("card.updated",a),i.addEventListener("card.moved",a),i.addEventListener("card.deleted",a),i.addEventListener("worker.updated",l),i.addEventListener("worker.added",l),i.addEventListener("worker.deleted",l),i.addEventListener("pipeline.status",o),i.addEventListener("pipeline.started",o),i.addEventListener("pipeline.stopped",o),()=>i.close()},[e,t])}const X4=new Set(["python","typescript","golang","rust","kotlin","swift","java"]),Z4=new Set(["frontend","backend","mobile","database","devops"]),J4=new Set(["backend-architect","frontend-developer","code-reviewer","database-optimizer","devops-automator","security-engineer","qa-tester","security","qa","architect","db-opt"]),e5=new Set(["coding-standards","tdd-workflow","git-workflow","architecture-decision-records","debugging-workflow"]);function t5(e){return X4.has(e)?"lang":Z4.has(e)?"end":J4.has(e)?"persona":e5.has(e)?"workflow":"other"}const n5={lang:"var(--skill-badge-lang-bg, var(--color-accent-purple))",end:"var(--skill-badge-end-bg, var(--color-secondary))",persona:"var(--skill-badge-persona-bg, var(--color-primary))",workflow:"var(--skill-badge-workflow-bg, var(--color-accent-mint))",other:"var(--skill-badge-other-bg, var(--color-bg))"};function mx({name:e}){const t=n5[t5(e)];return c.jsx("span",{className:"nb-badge",style:{background:t},children:e})}function M2({label:e,kind:t="default"}){const n=t==="warn"?"var(--color-accent-pink)":t==="accent"?"var(--color-accent-yellow)":"var(--color-bg-cream)";return c.jsx("span",{className:"nb-badge",style:{background:n},children:e})}function i5({card:e,onClick:t,done:n,draggable:i}){const a=Pe(),l=e.labels.some(o=>o.startsWith("STARTED-"))&&!n;return c.jsxs("article",{onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())},draggable:i,onDragStart:o=>{o.dataTransfer.setData("application/x-sps-card-seq",String(e.seq)),o.dataTransfer.effectAllowed="move"},tabIndex:0,role:"button","aria-label":`Card #${e.seq}: ${e.title}`,className:["nb-card nb-card-interactive p-3 cursor-pointer","transition-[transform,background-color,border-color] duration-[180ms] ease-out","focus:outline-none focus-visible:ring-[3px] focus-visible:ring-offset-2 focus-visible:ring-[var(--color-text)]",n?"opacity-60":"",i?"active:cursor-grabbing":""].join(" "),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[c.jsxs("span",{className:"nb-badge font-[family-name:var(--font-mono)] text-[11px] px-2 py-0.5",children:["#",e.seq]}),l&&c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)"},children:"running"})]}),c.jsx("p",{className:`font-bold text-sm leading-5 mb-2 line-clamp-2 ${n?"line-through decoration-2":""}`,children:e.title}),(e.skills.length>0||e.labels.length>0)&&c.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[e.skills.slice(0,3).map(o=>c.jsx(mx,{name:o},o)),e.labels.filter(o=>o==="NEEDS-FIX").map(o=>c.jsx(M2,{label:o,kind:"warn"},o))]}),e.checklist&&e.checklist.total>0&&c.jsx(r5,{stats:e.checklist}),c.jsxs("div",{className:"pt-2 border-t-[1.5px] border-dashed border-[var(--color-border-light)] flex items-center gap-2 text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-subtle)]",children:[c.jsx("span",{children:a5(e.updatedAt??e.createdAt,a)}),e.branch&&c.jsxs("span",{className:"truncate",children:["· ",e.branch]})]})]})}function r5({stats:e}){const t=Pe();return c.jsxs("div",{className:"mb-2",children:[c.jsxs("div",{className:"flex items-center justify-between text-[11px] font-[family-name:var(--font-mono)] mb-1",children:[c.jsx("span",{className:"font-bold",children:t("kanban.checklist.label",{done:e.done,total:e.total})}),c.jsxs("span",{className:"text-[var(--color-text-subtle)]",children:[e.percent,"%"]})]}),c.jsx("div",{className:"w-full h-1.5 bg-[rgba(255,255,255,0.08)] rounded-full overflow-hidden mb-1.5",children:c.jsx("div",{className:"h-full bg-[var(--color-snow-white)] transition-[width] duration-200",style:{width:`${e.percent}%`}})}),c.jsxs("ul",{className:"text-[11px] space-y-0.5",children:[e.items.slice(0,3).map((n,i)=>c.jsxs("li",{className:`flex items-start gap-1 ${n.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{className:"flex-shrink-0 mt-0.5",children:n.done?"✓":"○"}),c.jsx("span",{className:"line-clamp-1",children:n.text})]},i)),e.items.length>3&&c.jsx("li",{className:"text-[var(--color-text-subtle)] italic pl-3",children:t("kanban.checklist.more",{count:e.items.length-3})})]})]})}function a5(e,t){if(!e)return"—";const n=new Date(e),i=Date.now()-n.getTime();return i<6e4?t("kanban.time.justNow"):i<36e5?t("kanban.time.minutes",{n:Math.floor(i/6e4)}):i<864e5?t("kanban.time.hours",{n:Math.floor(i/36e5)}):n.toLocaleDateString()}function s5({label:e,bg:t,badgeVars:n,cards:i,onCardClick:a,onDropCard:l}){const o=Pe(),[d,f]=j.useState(!1);return c.jsxs("div",{className:["nb-card flex flex-col p-3 min-h-[280px] h-full min-h-0 overflow-hidden","transition-all",d?"bg-[rgba(255,255,255,0.16)]":""].join(" "),style:{background:t,...n},onDragOver:p=>{!l||!p.dataTransfer.types.includes("application/x-sps-card-seq")||(p.preventDefault(),p.dataTransfer.dropEffect="move",d||f(!0))},onDragLeave:()=>f(!1),onDrop:p=>{if(f(!1),!l)return;const g=p.dataTransfer.getData("application/x-sps-card-seq"),m=Number.parseInt(g,10);Number.isFinite(m)&&(p.preventDefault(),l(m))},children:[c.jsxs("div",{className:"flex items-center justify-between px-1 pb-2 mb-2 border-b border-[var(--color-border-light)] shrink-0",children:[c.jsx("span",{className:"font-[family-name:var(--font-heading)] font-bold text-sm uppercase tracking-wider",children:e}),c.jsx("span",{className:"nb-badge font-[family-name:var(--font-mono)] text-xs px-2 py-0.5",children:i.length})]}),c.jsxs("div",{className:"flex flex-col gap-2 flex-1 min-h-0 overflow-y-auto pr-1 -mr-1",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(229,229,229,0.36) transparent"},children:[i.length===0&&c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] text-center py-6 italic",children:o("kanban.column.empty")}),i.map(p=>c.jsx(i5,{card:p,onClick:()=>a(p),done:e==="Done",draggable:!!l},p.seq))]})]})}function Jy(e,t){if(!e)return"";const n=e.split(`
|
|
617
|
+
`)}):i("projectDetail.danger.deleted.body")}).then(()=>a("/projects"))},onError:S=>{o({title:i("projectDetail.danger.error"),body:S instanceof Error?S.message:String(S)})}});j.useEffect(()=>{const S=E=>{E.key==="Escape"&&n()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[n]);const b=i("projectDetail.danger.body",{path:"__PATH__"}).split("__PATH__"),v=i("projectDetail.danger.confirmPrompt",{name:"__NAME__"}).split("__NAME__");return c.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"danger-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4 overflow-hidden",children:c.jsxs("div",{className:"nb-card w-full max-w-xl max-h-[calc(100vh-2rem)] overflow-y-auto bg-[var(--color-crashed-bg)]",children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 mb-3",children:[c.jsx("h2",{id:"danger-dialog-title",className:"font-[family-name:var(--font-heading)] text-lg font-bold text-[var(--color-crashed)]",children:i("projectDetail.danger.title")}),c.jsx("button",{type:"button",className:"nb-btn nb-btn-mint p-2",onClick:n,"aria-label":i("common.close"),disabled:m.isPending,children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("p",{className:"text-sm mb-4",children:[b[0],c.jsxs("code",{className:"font-[family-name:var(--font-mono)] bg-[var(--color-bg)] border-2 border-[var(--color-text)] px-1.5 py-0.5 rounded",children:["~/.coral/projects/",e,"/"]}),b[1]]}),t&&c.jsxs("label",{className:"flex items-start gap-2 mb-4 p-3 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-lg cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:S=>g(S.target.checked),className:"mt-0.5",disabled:m.isPending}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-bold",children:i("projectDetail.danger.includeClaude.label")}),c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] break-all",children:[t,"/.claude/"]}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-1",children:i("projectDetail.danger.includeClaude.note")})]})]}),c.jsx("div",{className:"mb-4",children:c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsxs("span",{className:"text-sm font-bold",children:[v[0],c.jsx("code",{className:"font-[family-name:var(--font-mono)] text-xs",children:e}),v[1]]}),c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:d,onChange:S=>f(S.target.value),placeholder:e,disabled:m.isPending})]})}),c.jsxs("div",{className:"flex gap-2 justify-end pt-3 border-t-2 border-dashed border-[var(--color-text)]",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:n,disabled:m.isPending,children:i("common.cancel")}),c.jsxs("button",{type:"button",className:"nb-btn nb-btn-danger",disabled:d!==e||m.isPending,onClick:()=>m.mutate(),"aria-label":i("projectDetail.danger.deleteAria"),children:[m.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(Vi,{size:14,strokeWidth:3}),i("projectDetail.danger.deleteButton")]})]})]})})}function px(){return ct("/api/providers")}function N2(e){const t=[];for(const n of e)for(const i of n.models)t.push({providerId:n.id,model:i,label:`${i} · ${n.name}`});return t}async function A4(e,t){const n=await fetch("/api/providers",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:e,entry:t})});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}async function T4(e,t){const n=await fetch(`/api/providers/${e}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json()}function _2(e){const t=e?`?path=${encodeURIComponent(e)}`:"";return ct(`/api/fs/browse${t}`)}async function M4(e,t){const n=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,name:t})});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}return await n.json()}const j2=50*1024*1024;async function D4(e,t){if(t.size>j2)throw new Error(`文件超过 50 MB 上限(当前 ${(t.size/1024/1024).toFixed(2)} MB)`);const n=new FormData;n.append("sessionId",e),n.append("file",t,t.name);const i=await fetch("/api/fs/upload",{method:"POST",body:n});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return await i.json()}function Zy(e,t){return`/api/fs/file?${new URLSearchParams({path:t,sessionId:e}).toString()}`}function hx({initialPath:e,onCancel:t,onSelect:n,title:i,mode:a="directory"}){var C,N,_;const l=Pe(),{prompt:o,alert:d}=un(),f=i??l("dirPicker.title.default"),[p,g]=j.useState(e??null),[m,y]=j.useState(null),b=Ve({queryKey:["fs-browse",p],queryFn:()=>_2(p??void 0),staleTime:0,gcTime:0}),k=((C=b.data)==null?void 0:C.path)??p??"",v=((N=b.data)==null?void 0:N.parent)??null,S=((_=b.data)==null?void 0:_.home)??null,E=async()=>{var M;if(!k)return;const T=(M=await o({title:l("dirPicker.newDir"),body:l("dirPicker.newDir.prompt"),placeholder:l("dirPicker.newDir.placeholder"),confirm:l("dirPicker.newDir.create")}))==null?void 0:M.trim();if(T)try{const O=await M4(k,T);g(O.path)}catch(O){d({title:l("dirPicker.newDir.error.title"),body:O instanceof Error?O.message:String(O)})}};return j.useEffect(()=>{const T=M=>{M.key==="Escape"&&(M.preventDefault(),t())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[t]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[rgba(45,55,72,0.5)] p-4",role:"presentation",children:c.jsxs("div",{className:"nb-card bg-[var(--color-bg)] max-w-lg w-full h-[70vh] min-h-0 overflow-hidden p-5 flex flex-col",role:"dialog","aria-modal":"true","aria-label":f,children:[c.jsxs("header",{className:"flex items-center justify-between mb-3 shrink-0",children:[c.jsx("div",{className:"flex items-center gap-2 min-w-0",children:c.jsx("h3",{className:"font-[family-name:var(--font-heading)] font-bold text-base truncate",children:f})}),c.jsx("button",{type:"button",className:"p-1 hover:bg-[var(--color-bg-cream)] rounded",onClick:t,"aria-label":l("dirPicker.close.aria"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>v&&g(v),disabled:!v||b.isLoading,"aria-label":l("dirPicker.up.aria"),title:l("dirPicker.up.title"),children:c.jsx(JN,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>S&&g(S),disabled:!S||b.isLoading,"aria-label":l("dirPicker.home.aria"),title:l("dirPicker.home.title"),children:c.jsx(RL,{size:12,strokeWidth:3})}),c.jsx("button",{type:"button",className:"nb-btn flex-shrink-0",style:{padding:"4px 10px",fontSize:12},onClick:()=>void E(),disabled:!k||b.isLoading||b.isError,"aria-label":l("dirPicker.newDir.aria"),title:l("dirPicker.newDir.aria"),children:c.jsx(xL,{size:12,strokeWidth:3})}),c.jsx("div",{className:"flex-1 min-w-0 nb-input font-[family-name:var(--font-mono)] text-xs px-2 py-1.5 truncate",title:k,dir:"rtl",children:k||"..."})]}),c.jsx("div",{className:"scroll-frame flex-1 border-2 border-[var(--color-text)] rounded-lg bg-[var(--color-bg-cream)] min-h-0",children:c.jsxs("div",{className:"scroll-frame-body h-full",children:[b.isLoading&&c.jsxs("div",{className:"flex items-center justify-center py-12 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:16,strokeWidth:3,className:"animate-spin mr-2"}),l("dirPicker.loading")]}),b.isError&&c.jsxs("div",{className:"p-4 text-sm text-[var(--color-crashed)]",children:[c.jsx("p",{className:"font-bold mb-1",children:l("dirPicker.error.title")}),c.jsx("p",{className:"text-xs font-[family-name:var(--font-mono)] break-all",children:b.error instanceof Error?b.error.message:String(b.error)})]}),b.data&&c.jsxs("ul",{className:"divide-y-2 divide-[var(--color-text)]/20",children:[b.data.entries.length===0&&c.jsx("li",{className:"p-4 text-xs text-[var(--color-text-subtle)] italic text-center",children:l("dirPicker.empty")}),b.data.entries.map(T=>{const M=(()=>{const B=k.endsWith("/")||k.endsWith("\\")?"":"/";return`${k}${B}${T.name}`})(),O=a==="file"&&m===M,R=T.isDirectory||a==="file";return c.jsx("li",{children:c.jsxs("button",{type:"button",className:["w-full flex items-center gap-2 px-3 py-2 text-left text-sm font-[family-name:var(--font-mono)]","disabled:opacity-50 disabled:cursor-not-allowed",O?"bg-[var(--color-accent-mint)] font-bold":"hover:bg-[var(--color-accent-mint)]"].join(" "),disabled:!R,onClick:()=>{T.isDirectory?(y(null),g(M)):a==="file"&&y(M)},onDoubleClick:()=>{a==="file"&&!T.isDirectory&&n(M)},title:T.isDirectory?l("dirPicker.enter.aria",{name:T.name}):a==="file"?l("dirPicker.pickFile.aria",{name:T.name}):l("dirPicker.fileLocked"),children:[T.isDirectory?c.jsx(yp,{size:14,strokeWidth:2.5,className:"flex-shrink-0 text-[var(--color-text)]"}):c.jsx("span",{className:"w-3.5 h-3.5 flex-shrink-0"}),c.jsx("span",{className:"truncate",children:T.name}),T.isDirectory&&c.jsx(Jo,{size:12,strokeWidth:2.5,className:"ml-auto flex-shrink-0 text-[var(--color-text-muted)]"})]})},T.name)})]})]})}),c.jsxs("div",{className:"flex gap-2 justify-end pt-3 shrink-0",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:t,children:l("dirPicker.cancel")}),a==="file"?c.jsxs("button",{type:"button",className:"nb-btn nb-btn-primary",onClick:()=>m&&n(m),disabled:!m||b.isLoading||b.isError,title:m??l("dirPicker.useFile.tooltip.empty"),children:[c.jsx(Su,{size:14,strokeWidth:3}),l("dirPicker.useFile")]}):c.jsxs("button",{type:"button",className:"nb-btn nb-btn-primary",onClick:()=>n(k),disabled:!k||b.isLoading||b.isError,children:[c.jsx(Su,{size:14,strokeWidth:3}),l("dirPicker.useDir")]})]})]})})}function Mf(e){return(e.replace(/\/+$/,"").split("/").pop()??"").replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function C2({onCancel:e,onCreated:t,dialogMode:n=!1}={}){var K,q,Y,D,F,I;const i=Pe(),a=ks(),l=Ft(),{alert:o}=un(),d=e??(()=>a("/projects")),[f,p]=j.useState({name:"",projectDir:"",enableGit:!0,createIfMissing:!0,mergeBranch:"main",maxWorkers:"1",ackTimeoutMin:"5",pipelineMode:"pipeline"}),g=f.pipelineMode==="smartArrange",m=Ve({queryKey:["system-agents"],queryFn:Yb}),y=((K=m.data)==null?void 0:K.agents.worker.model)??"",b=((q=m.data)==null?void 0:q.agents.reviewer.model)??"",k=[...new Set((((Y=m.data)==null?void 0:Y.providers.openai)??[]).flatMap(H=>H.models))],v=Ve({queryKey:["providers"],queryFn:px}),S=N2(((D=v.data)==null?void 0:D.anthropic)??[]),E=f.workerModel?`${f.workerProviderId??""}::${f.workerModel}`:"",[C,N]=j.useState(!1),_=Et({mutationFn:H=>uI(H),onSuccess:H=>{l.invalidateQueries({queryKey:["projects"]}),t?t(H.name):a(`/projects/${encodeURIComponent(H.name)}`)},onError:H=>{o({title:i("newProject.error.create.title"),body:H instanceof Error?H.message:String(H)})}}),T=/^[a-zA-Z0-9_-]+$/.test(f.name),M=T&&f.projectDir.trim()!==""&&!_.isPending,O=f.projectDir.trim(),R=Ve({queryKey:["fs-browse-probe",O],queryFn:()=>_2(O),enabled:O.startsWith("/"),staleTime:0,gcTime:0,retry:!1}),B=R.isSuccess&&(((F=R.data)==null?void 0:F.entries.length)??0)>0,U=R.isError||R.isSuccess&&(((I=R.data)==null?void 0:I.entries.length)??0)===0;return c.jsxs("div",{className:n?"w-full h-full min-h-0":"w-full",children:[c.jsxs("div",{className:n?"nb-card flex h-full min-h-0 flex-col overflow-hidden":"nb-card flex flex-col gap-4",children:[c.jsxs("header",{className:n?"flex shrink-0 items-center gap-3 border-b-2 border-dashed border-[var(--color-text)] pb-4":"flex items-center gap-3",children:[c.jsxs("button",{type:"button",onClick:d,className:"nb-btn",style:{padding:"6px 12px"},"aria-label":i("newProject.back.aria"),children:[c.jsx(ZN,{size:14,strokeWidth:3}),i("newProject.back")]}),c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:i("newProject.title")})]}),c.jsxs("form",{onSubmit:H=>{H.preventDefault(),M&&_.mutate(f)},className:n?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-4",children:[c.jsxs("div",{className:["grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",n?"min-h-0 flex-1 overflow-y-auto overscroll-contain pr-3 pt-4":""].join(" "),children:[c.jsx(Ui,{className:"md:col-span-2",label:i("newProject.field.mode"),hint:i(g?"newProject.field.mode.smartHint":"newProject.field.mode.pipelineHint"),children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:["pipeline","smartArrange"].map(H=>{const W=f.pipelineMode===H;return c.jsxs("button",{type:"button",onClick:()=>p({...f,pipelineMode:H}),"aria-pressed":W,className:["text-left rounded-xl border-2 p-3 transition-all",W?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[3px_3px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),children:[c.jsx("div",{className:"text-sm font-bold",children:i(H==="pipeline"?"newProject.field.mode.pipeline":"newProject.field.mode.smart")}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:i(H==="pipeline"?"newProject.field.mode.pipelineDesc":"newProject.field.mode.smartDesc")})]},H)})})}),g&&c.jsx(Ui,{className:"md:col-span-2",label:i("newProject.field.goal"),hint:i("newProject.field.goal.hint"),children:c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-sm",style:{minHeight:110,resize:"vertical"},placeholder:i("newProject.field.goal.placeholder"),value:f.goal??"",onChange:H=>p({...f,goal:H.target.value})})}),c.jsx(Ui,{label:"Worker 模型",hint:`默认:${y||"全局默认"}(留空用默认)`,children:c.jsxs("select",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:E,onChange:H=>{const W=H.target.value;if(!W)return p({...f,workerModel:void 0,workerProviderId:void 0});const[G,L]=W.split("::");p({...f,workerModel:L,workerProviderId:G||void 0})},children:[c.jsx("option",{value:"",children:"用全局默认模型"}),S.map(H=>c.jsx("option",{value:`${H.providerId}::${H.model}`,children:H.label},`${H.providerId}::${H.model}`))]})}),g&&c.jsxs(Ui,{label:"OpenAI Agent(监工)模型",hint:`默认:${b||"全局默认"}(留空用默认)`,children:[c.jsx("input",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",value:f.reviewerModel??"",onChange:H=>p({...f,reviewerModel:H.target.value}),placeholder:b,list:"np-reviewer-models",spellCheck:!1}),c.jsx("datalist",{id:"np-reviewer-models",children:k.map(H=>c.jsx("option",{value:H},H))})]}),c.jsxs(Ui,{label:i("newProject.field.name"),hint:i("newProject.field.name.derived"),children:[c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.name.placeholder"),value:f.name,onChange:H=>p({...f,name:H.target.value}),required:!0}),f.name&&!T&&c.jsx("p",{className:"text-xs text-[var(--color-crashed)] mt-1",children:i("newProject.field.name.invalid")})]}),c.jsxs(Ui,{className:"md:col-span-2",label:i("newProject.field.dir"),hint:i("newProject.field.dir.long"),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",className:"nb-input flex-1 font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.dir.placeholder"),value:f.projectDir,onChange:H=>{const W=H.target.value,G=Mf(W),L=Mf(f.projectDir),z=f.name&&f.name!==L;p({...f,projectDir:W,name:z?f.name:G})},required:!0}),c.jsxs("button",{type:"button",className:"nb-btn flex-shrink-0",onClick:()=>N(!0),"aria-label":i("newProject.dir.browseAria"),title:i("newProject.dir.browseAria"),children:[c.jsx(i_,{size:14,strokeWidth:2.5}),i("newProject.dir.browse")]})]}),B&&c.jsx("p",{className:"text-xs mt-1.5 font-bold text-[var(--color-text)]",children:i("newProject.field.dir.adopt")}),U&&O.startsWith("/")&&c.jsx("p",{className:"text-xs mt-1.5 text-[var(--color-text-muted)]",children:i("newProject.field.dir.fresh")}),c.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.createIfMissing!==!1,onChange:H=>p({...f,createIfMissing:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:i("newProject.field.dir.createIfMissing")})]})]}),c.jsx(Ui,{label:i("newProject.field.maxWorkers.short"),children:c.jsx("input",{type:"number",min:"1",max:"8",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.maxWorkers,onChange:H=>p({...f,maxWorkers:H.target.value})})}),c.jsx(Ui,{label:i("newProject.field.ackTimeout.minutes"),hint:i("newProject.field.ackTimeout.minutes.help"),children:c.jsx("input",{type:"number",min:"1",max:"30",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.ackTimeoutMin??"5",onChange:H=>p({...f,ackTimeoutMin:H.target.value})})}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsxs("label",{className:"flex items-center gap-3 mb-2 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.enableReview??!1,onChange:H=>p({...f,enableReview:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-sm font-bold",children:i("newProject.field.review.label")})]}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:i("newProject.field.review.detail")})]}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsxs("label",{className:"flex items-center gap-3 mb-3 cursor-pointer select-none",children:[c.jsx("input",{type:"checkbox",checked:f.enableGit??!0,onChange:H=>p({...f,enableGit:H.target.checked}),className:"w-4 h-4 cursor-pointer"}),c.jsx("span",{className:"text-sm font-bold",children:i("newProject.field.git.label")})]}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] mb-3",children:i("newProject.field.git.detail")}),f.enableGit!==!1&&c.jsxs("div",{className:"flex flex-col gap-4 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4",children:[c.jsx(Ui,{label:i("newProject.field.git.branch"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",value:f.mergeBranch??"main",onChange:H=>p({...f,mergeBranch:H.target.value})})}),c.jsx(Ui,{label:i("newProject.field.gitlabProject.label"),hint:i("newProject.field.gitlabProject.help2"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.gitlabProject.placeholder"),value:f.gitlabProject??"",onChange:H=>p({...f,gitlabProject:H.target.value})})}),f.gitlabProject&&c.jsx(Ui,{label:i("newProject.field.gitlabProjectId"),hint:i("newProject.field.gitlabProjectId.help"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.gitlabProjectId.placeholder"),value:f.gitlabProjectId??"",onChange:H=>p({...f,gitlabProjectId:H.target.value})})})]})]}),c.jsxs("div",{className:"md:col-span-2 pt-3 border-t-2 border-[var(--color-text)] border-dashed",children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-3 text-[var(--color-text-muted)]",children:i("newProject.section.notifications")}),c.jsx(Ui,{label:i("newProject.field.matrixRoom.label"),hint:i("newProject.field.matrixRoom.help2"),children:c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-mono)]",placeholder:i("newProject.field.matrixRoom.placeholder"),value:f.matrixRoomId??"",onChange:H=>p({...f,matrixRoomId:H.target.value})})})]})]}),c.jsxs("div",{className:n?"flex shrink-0 gap-3 justify-end border-t-2 border-dashed border-[var(--color-text)] pt-4 mt-4":"flex gap-3 justify-end pt-3",children:[c.jsx("button",{type:"button",className:"nb-btn",onClick:d,disabled:_.isPending,children:i("common.cancel")}),c.jsx("button",{type:"submit",className:"nb-btn nb-btn-primary",disabled:!M,"aria-label":i("newProject.submit"),children:_.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}),i("newProject.creating")]}):c.jsxs(c.Fragment,{children:[c.jsx(hi,{size:14,strokeWidth:3}),i("common.create")]})})]})]})]}),C&&c.jsx(hx,{title:i("newProject.field.dir.pickerTitle"),initialPath:f.projectDir.trim()||void 0,onCancel:()=>N(!1),onSelect:H=>{const W=Mf(H),G=Mf(f.projectDir),L=f.name&&f.name!==G;p({...f,projectDir:H,name:L?f.name:W}),N(!1)}})]})}function Ui({label:e,hint:t,children:n,className:i}){return c.jsxs("label",{className:`flex flex-col gap-1.5 ${i??""}`,children:[c.jsx("span",{className:"text-sm font-bold",children:e}),n,t&&c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:t})]})}function O4({onClose:e,onCreated:t}){return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4 overflow-hidden",children:c.jsx("div",{className:"w-full max-w-6xl h-[calc(100vh-2rem)] min-h-0",children:c.jsx(C2,{dialogMode:!0,onCancel:e,onCreated:n=>{e(),t(n)}})})})}const Rk="projects.last",R4=["activity","date","name"];function Lk(){const e=Pe(),t=ks(),{name:n}=Lb(),[i,a]=Wb("projects.sort","activity"),[l,o]=j.useState(!1),[d,f]=j.useState(!1),{data:p,isLoading:g,isError:m,error:y,refetch:b}=Ve({queryKey:["projects"],queryFn:Es}),k=T=>t(`/projects/${encodeURIComponent(T)}`),v=p?N_(p.data,i):[],S=i!=="name",{recent:E,older:C}=S?NI(v,T=>T.lastActivityAt):{recent:v,older:[]},N=l?C:C.filter(T=>T.name===n),_=C.length-N.length;return j.useEffect(()=>{if(n)try{localStorage.setItem(Rk,n)}catch{}},[n]),j.useEffect(()=>{if(n||!p)return;let T=null;try{T=localStorage.getItem(Rk)}catch{}T&&p.data.some(M=>M.name===T)&&t(`/projects/${encodeURIComponent(T)}`,{replace:!0})},[n,p,t]),c.jsxs("div",{className:"flex flex-col flex-1 min-h-0 w-full",children:[m?c.jsxs("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-2",children:e("projects.load.failed")}),c.jsx("p",{className:"text-sm text-[var(--color-text)]",children:y instanceof Error?y.message:String(y)}),c.jsx("button",{className:"nb-btn mt-4",onClick:()=>b(),type:"button",children:e("common.retry")})]}):p&&p.data.length===0?c.jsx(P4,{onNew:()=>f(!0)}):c.jsxs("div",{className:"flex gap-5 flex-1 min-h-0",children:[c.jsxs("aside",{className:"w-80 shrink-0 flex flex-col min-h-0",children:[c.jsxs("div",{className:"shrink-0 flex flex-col gap-2 pb-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold truncate",children:e("projects.title")}),c.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:p?e("projects.count",{count:p.data.length}):e("common.loading")})]}),c.jsxs("button",{className:"nb-btn nb-btn-primary shrink-0",type:"button",onClick:()=>f(!0),"aria-label":e("projects.new"),children:[c.jsx(hi,{size:16,strokeWidth:3}),e("projects.new")]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"inline-flex flex-1 rounded-full overflow-hidden bg-color-bg-soft",role:"group","aria-label":e("projects.sort.label"),children:R4.map(T=>c.jsx("button",{type:"button","aria-pressed":i===T,onClick:()=>a(T),className:["flex-1 px-2 py-1.5 text-xs font-bold font-[family-name:var(--font-mono)] focus-visible:outline focus-visible:outline-2",i===T?"bg-surface-input text-[var(--color-text)]":"bg-transparent text-[var(--color-text-muted)] hover:bg-[rgba(255,255,255,0.08)]"].join(" "),children:e(`projects.sort.${T}`)},T))}),c.jsx("button",{className:"nb-btn nb-btn-yellow shrink-0",style:{padding:"6px 10px"},onClick:()=>b(),type:"button","aria-label":e("common.refresh"),children:c.jsx(qp,{size:16,strokeWidth:2.5})})]})]}),c.jsx("ul",{className:"flex-1 min-h-0 overflow-y-auto flex flex-col gap-0.5 pr-1",children:g?c.jsx(z4,{}):c.jsxs(c.Fragment,{children:[[...E,...N].map(T=>c.jsx(L4,{project:T,selected:T.name===n,onClick:()=>k(T.name)},T.name)),(_>0||l&&C.length>0)&&c.jsx("button",{type:"button",className:"nb-btn text-xs self-start mt-1",onClick:()=>o(T=>!T),"aria-label":l?"收起更早项目":"显示更早项目",children:l?"收起更早":`含更早 (${_})`})]})})]}),c.jsx("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col",children:n?c.jsx(S4,{name:n,embedded:!0}):c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-[var(--color-text-muted)]",children:e("projects.selectHint")})})})]}),d&&c.jsx(O4,{onClose:()=>f(!1),onCreated:k})]})}function L4({project:e,selected:t,onClick:n}){return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:n,className:["dimension-menu-item w-full text-left flex-col items-stretch gap-1 px-3 py-2 pl-4",t?"dimension-menu-item-active":""].join(" "),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] font-bold truncate",children:e.name}),c.jsx(I4,{status:e.pipelineStatus})]}),e.repoDir&&c.jsx("p",{className:"text-[10px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] truncate mt-0.5",children:e.repoDir}),c.jsxs("div",{className:"flex gap-3 text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] mt-1.5",children:[c.jsxs("span",{children:[e.cards.total," cards"]}),c.jsxs("span",{children:[e.cards.inprogress," run"]}),c.jsxs("span",{children:[e.workers.active,"/",e.workers.total," w"]})]})]})})}function I4({status:e}){const t={running:{bg:"var(--color-running-bg)",label:"running"},idle:{bg:"var(--color-idle-bg)",label:"idle"},stopping:{bg:"var(--color-stuck-bg)",label:"stopping"},error:{bg:"var(--color-crashed-bg)",label:"error"}},{bg:n,label:i}=t[e],a=e==="running"?"var(--color-running)":e==="error"?"var(--color-crashed)":e==="stopping"?"var(--color-stuck)":"var(--color-idle)";return c.jsx("span",{className:"nb-status",style:{background:n,color:a},children:i})}function z4(){return c.jsx(c.Fragment,{children:[0,1,2].map(e=>c.jsxs("div",{className:"nb-card opacity-60 animate-pulse",style:{padding:"10px 12px"},children:[c.jsx("div",{className:"h-5 w-28 bg-[var(--color-border-light)] rounded-md mb-2"}),c.jsx("div",{className:"h-3 w-2/3 bg-[var(--color-border-light)] rounded-md"})]},e))})}function P4({onNew:e}){const t=Pe(),n=t("projects.empty.hint",{cmd:"__CMD__"}),[i,a]=n.split("__CMD__");return c.jsxs("div",{className:"nb-card bg-[var(--color-accent-yellow)] flex items-center gap-6 p-8",children:[c.jsx("div",{className:"w-20 h-20 rounded-3xl bg-[rgba(255,255,255,0.12)] text-[var(--color-text)] flex items-center justify-center shadow-[rgba(255,255,255,0.10)_0_0_0_1px_inset]",children:c.jsx(m_,{size:32,strokeWidth:2.5})}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold mb-2",children:t("projects.empty.title")}),c.jsxs("p",{className:"text-sm text-[var(--color-text)] mb-4",children:[i,c.jsx("code",{className:"bg-[rgba(0,0,0,0.35)] px-2 py-0.5 rounded-md font-[family-name:var(--font-mono)]",children:"sps project init <name>"}),a]}),c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",onClick:e,children:[c.jsx(hi,{size:16,strokeWidth:3}),t("projects.new")]})]})]})}function B4({project:e,isPending:t,onCancel:n,onCreate:i}){var N;const a=Pe(),[l,o]=j.useState(""),[d,f]=j.useState(""),[p,g]=j.useState(new Set),[m,y]=j.useState(!1),b=Ve({queryKey:["skills-all",e],queryFn:()=>fx(e)});j.useEffect(()=>{const _=T=>{T.key==="Escape"&&n()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[n]);const v=l.trim().length>0&&l.trim().length<=200&&!t,S=_=>{const T=new Set(p);T.has(_)?T.delete(_):T.add(_),g(T)},E=()=>{v&&i({title:l.trim(),description:d.trim(),skills:[...p],labels:["AI-PIPELINE"],initialState:m?"Backlog":"Planning"})},C=((N=b.data)==null?void 0:N.data)??[];return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-40 flex items-center justify-center p-4 md:p-6 bg-black/30 overflow-hidden",children:c.jsxs("div",{className:"nb-card w-full max-w-5xl flex flex-col",style:{maxHeight:"calc(100vh - 48px)"},children:[c.jsxs("header",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:a("newCard.title")}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",onClick:n,type:"button","aria-label":a("common.close"),children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsx("form",{onSubmit:_=>{_.preventDefault(),E()},className:"flex min-h-0 flex-1 flex-col",children:c.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-4 overflow-y-auto pr-1 md:grid-cols-[minmax(0,1fr)_minmax(280px,380px)] md:overflow-hidden md:pr-0",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4 md:overflow-y-auto md:pr-1",children:[c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.title")}),c.jsx("input",{type:"text",className:"nb-input w-full",placeholder:a("newCard.field.title.placeholder"),value:l,onChange:_=>o(_.target.value),maxLength:200,autoFocus:!0,required:!0}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.title.help")})]}),c.jsxs("label",{className:"flex flex-col gap-1.5",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.description")}),c.jsx("textarea",{className:"nb-input w-full",style:{minHeight:160,resize:"vertical"},placeholder:a("newCard.field.description.placeholder"),value:d,onChange:_=>f(_.target.value)}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.description.help")})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.dispatch")}),c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none p-3 border-[2px] border-[var(--color-text)] rounded-lg bg-[var(--color-bg-cream)]",children:[c.jsx("input",{type:"checkbox",className:"w-4 h-4 accent-[var(--color-cta)] cursor-pointer",checked:m,onChange:_=>y(_.target.checked)}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"text-sm font-bold",children:a("newCard.field.dispatch.label")}),c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:a("newCard.field.dispatch.help")})]})]})]})]}),c.jsxs("section",{className:"flex min-h-[240px] flex-col gap-2 md:min-h-0 md:overflow-hidden",children:[c.jsx("span",{className:"text-sm font-bold",children:a("newCard.field.skills")}),c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:a("newCard.field.skills.help")}),c.jsx("div",{className:"scroll-frame min-h-0 flex-1 rounded-lg border-2 border-[var(--color-border-light)] bg-[var(--color-bg-cream)]",children:c.jsxs("div",{className:"scroll-frame-body h-full p-2",children:[b.isLoading&&c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("newCard.field.skills.loading")}),b.isError&&c.jsx("p",{className:"text-xs text-[var(--color-crashed)]",children:a("newCard.field.skills.error",{detail:b.error instanceof Error?b.error.message:String(b.error)})}),C.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(_=>{const T=p.has(_.name);return c.jsx("button",{type:"button",onClick:()=>S(_.name),className:["max-w-full break-all px-2.5 py-1 text-left text-xs font-[family-name:var(--font-mono)] rounded-full border-2 transition-all",T?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[2px_2px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),"aria-pressed":T,children:_.name},_.name)})})]})}),p.size>0&&c.jsx("p",{className:"max-h-14 overflow-y-auto break-words text-xs text-[var(--color-text-muted)]",children:a("newCard.field.skills.selected",{count:p.size,names:[...p].join(", ")})})]})]})}),c.jsxs("div",{className:"flex gap-2 justify-end mt-4 pt-3 border-t-2 border-dashed border-[var(--color-text)] flex-shrink-0",children:[c.jsx("button",{className:"nb-btn",style:{padding:"6px 14px"},onClick:n,disabled:t,type:"button",children:a("common.cancel")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 14px"},onClick:E,disabled:!v,type:"button","aria-label":a("newCard.create.aria"),children:[t?c.jsx(Xe,{size:13,strokeWidth:3,className:"animate-spin"}):c.jsx(hi,{size:13,strokeWidth:3}),a("common.create")]})]})]})})}function $4(e){return ct(`/api/projects/${encodeURIComponent(e)}/cards`)}function U4(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/cards/${t}`)}function F4(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/cards/${t}/prompt`)}async function sc(e,t){const n=await fetch(e,{method:"POST",headers:t?{"Content-Type":"application/json"}:void 0,body:t?JSON.stringify(t):void 0});if(!n.ok){const i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json().catch(()=>({}))}function q4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/cards/${t}/reset`)}async function H4(e,t){const n=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"DELETE"});if(!n.ok){const i=await n.text();throw new Error(`${n.status}: ${i}`)}}function K4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/cards/${t}/launch`)}function G4(e,t){const n=typeof t=="string"?{title:t}:t;return sc(`/api/projects/${encodeURIComponent(e)}/cards`,n)}async function V4(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n})});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}}async function Y4(e,t,n){const i=await fetch(`/api/projects/${encodeURIComponent(e)}/cards/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok){const a=await i.text();throw new Error(`${i.status}: ${a}`)}return i.json()}function A2(e){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/start`)}function T2(e){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/stop`)}function W4(e,t){return sc(`/api/projects/${encodeURIComponent(e)}/pipeline/reset`,t??{})}function Q4(e){const t=Ft();j.useEffect(()=>{if(!e)return;const n=`/stream/projects/${encodeURIComponent(e)}`,i=new EventSource(n),a=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["cards",f.project]}),t.invalidateQueries({queryKey:["card",f.project,f.seq]}),t.invalidateQueries({queryKey:["projects"]})}catch{}},l=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["workers",f.project]}),t.invalidateQueries({queryKey:["projects"]})}catch{}},o=d=>{try{const f=JSON.parse(d.data);t.invalidateQueries({queryKey:["pipeline-status",f.project]}),t.invalidateQueries({queryKey:["projects"]})}catch{}};return i.addEventListener("card.created",a),i.addEventListener("card.updated",a),i.addEventListener("card.moved",a),i.addEventListener("card.deleted",a),i.addEventListener("worker.updated",l),i.addEventListener("worker.added",l),i.addEventListener("worker.deleted",l),i.addEventListener("pipeline.status",o),i.addEventListener("pipeline.started",o),i.addEventListener("pipeline.stopped",o),()=>i.close()},[e,t])}const X4=new Set(["python","typescript","golang","rust","kotlin","swift","java"]),Z4=new Set(["frontend","backend","mobile","database","devops"]),J4=new Set(["backend-architect","frontend-developer","code-reviewer","database-optimizer","devops-automator","security-engineer","qa-tester","security","qa","architect","db-opt"]),eP=new Set(["coding-standards","tdd-workflow","git-workflow","architecture-decision-records","debugging-workflow"]);function tP(e){return X4.has(e)?"lang":Z4.has(e)?"end":J4.has(e)?"persona":eP.has(e)?"workflow":"other"}const nP={lang:"var(--skill-badge-lang-bg, var(--color-accent-purple))",end:"var(--skill-badge-end-bg, var(--color-secondary))",persona:"var(--skill-badge-persona-bg, var(--color-primary))",workflow:"var(--skill-badge-workflow-bg, var(--color-accent-mint))",other:"var(--skill-badge-other-bg, var(--color-bg))"};function mx({name:e}){const t=nP[tP(e)];return c.jsx("span",{className:"nb-badge",style:{background:t},children:e})}function M2({label:e,kind:t="default"}){const n=t==="warn"?"var(--color-accent-pink)":t==="accent"?"var(--color-accent-yellow)":"var(--color-bg-cream)";return c.jsx("span",{className:"nb-badge",style:{background:n},children:e})}function iP({card:e,onClick:t,done:n,draggable:i}){const a=Pe(),l=e.labels.some(o=>o.startsWith("STARTED-"))&&!n;return c.jsxs("article",{onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())},draggable:i,onDragStart:o=>{o.dataTransfer.setData("application/x-sps-card-seq",String(e.seq)),o.dataTransfer.effectAllowed="move"},tabIndex:0,role:"button","aria-label":`Card #${e.seq}: ${e.title}`,className:["nb-card nb-card-interactive p-3 cursor-pointer","transition-[transform,background-color,border-color] duration-[180ms] ease-out","focus:outline-none focus-visible:ring-[3px] focus-visible:ring-offset-2 focus-visible:ring-[var(--color-text)]",n?"opacity-60":"",i?"active:cursor-grabbing":""].join(" "),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[c.jsxs("span",{className:"nb-badge font-[family-name:var(--font-mono)] text-[11px] px-2 py-0.5",children:["#",e.seq]}),l&&c.jsx("span",{className:"nb-status",style:{background:"var(--color-running-bg)",color:"var(--color-running)"},children:"running"})]}),c.jsx("p",{className:`font-bold text-sm leading-5 mb-2 line-clamp-2 ${n?"line-through decoration-2":""}`,children:e.title}),(e.skills.length>0||e.labels.length>0)&&c.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[e.skills.slice(0,3).map(o=>c.jsx(mx,{name:o},o)),e.labels.filter(o=>o==="NEEDS-FIX").map(o=>c.jsx(M2,{label:o,kind:"warn"},o))]}),e.checklist&&e.checklist.total>0&&c.jsx(rP,{stats:e.checklist}),c.jsxs("div",{className:"pt-2 border-t-[1.5px] border-dashed border-[var(--color-border-light)] flex items-center gap-2 text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-subtle)]",children:[c.jsx("span",{children:aP(e.updatedAt??e.createdAt,a)}),e.branch&&c.jsxs("span",{className:"truncate",children:["· ",e.branch]})]})]})}function rP({stats:e}){const t=Pe();return c.jsxs("div",{className:"mb-2",children:[c.jsxs("div",{className:"flex items-center justify-between text-[11px] font-[family-name:var(--font-mono)] mb-1",children:[c.jsx("span",{className:"font-bold",children:t("kanban.checklist.label",{done:e.done,total:e.total})}),c.jsxs("span",{className:"text-[var(--color-text-subtle)]",children:[e.percent,"%"]})]}),c.jsx("div",{className:"w-full h-1.5 bg-[rgba(255,255,255,0.08)] rounded-full overflow-hidden mb-1.5",children:c.jsx("div",{className:"h-full bg-[var(--color-snow-white)] transition-[width] duration-200",style:{width:`${e.percent}%`}})}),c.jsxs("ul",{className:"text-[11px] space-y-0.5",children:[e.items.slice(0,3).map((n,i)=>c.jsxs("li",{className:`flex items-start gap-1 ${n.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{className:"flex-shrink-0 mt-0.5",children:n.done?"✓":"○"}),c.jsx("span",{className:"line-clamp-1",children:n.text})]},i)),e.items.length>3&&c.jsx("li",{className:"text-[var(--color-text-subtle)] italic pl-3",children:t("kanban.checklist.more",{count:e.items.length-3})})]})]})}function aP(e,t){if(!e)return"—";const n=new Date(e),i=Date.now()-n.getTime();return i<6e4?t("kanban.time.justNow"):i<36e5?t("kanban.time.minutes",{n:Math.floor(i/6e4)}):i<864e5?t("kanban.time.hours",{n:Math.floor(i/36e5)}):n.toLocaleDateString()}function sP({label:e,bg:t,badgeVars:n,cards:i,onCardClick:a,onDropCard:l}){const o=Pe(),[d,f]=j.useState(!1);return c.jsxs("div",{className:["nb-card flex flex-col p-3 min-h-[280px] h-full min-h-0 overflow-hidden","transition-all",d?"bg-[rgba(255,255,255,0.16)]":""].join(" "),style:{background:t,...n},onDragOver:p=>{!l||!p.dataTransfer.types.includes("application/x-sps-card-seq")||(p.preventDefault(),p.dataTransfer.dropEffect="move",d||f(!0))},onDragLeave:()=>f(!1),onDrop:p=>{if(f(!1),!l)return;const g=p.dataTransfer.getData("application/x-sps-card-seq"),m=Number.parseInt(g,10);Number.isFinite(m)&&(p.preventDefault(),l(m))},children:[c.jsxs("div",{className:"flex items-center justify-between px-1 pb-2 mb-2 border-b border-[var(--color-border-light)] shrink-0",children:[c.jsx("span",{className:"font-[family-name:var(--font-heading)] font-bold text-sm uppercase tracking-wider",children:e}),c.jsx("span",{className:"nb-badge font-[family-name:var(--font-mono)] text-xs px-2 py-0.5",children:i.length})]}),c.jsxs("div",{className:"flex flex-col gap-2 flex-1 min-h-0 overflow-y-auto pr-1 -mr-1",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(229,229,229,0.36) transparent"},children:[i.length===0&&c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] text-center py-6 italic",children:o("kanban.column.empty")}),i.map(p=>c.jsx(iP,{card:p,onClick:()=>a(p),done:e==="Done",draggable:!!l},p.seq))]})]})}function Jy(e,t){if(!e)return"";const n=e.split(`
|
|
618
618
|
`),i=new RegExp(`^##\\s+${t}\\s*$`),a=n.findIndex(o=>i.test(o));if(a===-1)return"";let l=n.length;for(let o=a+1;o<n.length;o++)if(/^##\s+/.test(n[o]??"")){l=o;break}return n.slice(a+1,l).join(`
|
|
619
|
-
`).trim()}function Fg(e){return Jy(e,"描述")}function l5({project:e,seq:t,onClose:n,onChanged:i}){var G,L,z,V,P,le,xe,ke,Ne,se,ve;const a=Pe(),l=Ft(),{confirm:o,alert:d}=un(),{data:f,isLoading:p,isError:g,error:m,refetch:y}=Ve({queryKey:["card",e,t],queryFn:()=>U4(e,t)}),[b,k]=j.useState(!1),[v,S]=j.useState(!1),[E,C]=j.useState(""),[N,_]=j.useState(""),[T,M]=j.useState(new Set),[O,R]=j.useState([]),[B,U]=j.useState(""),K=Ve({queryKey:["skills-all",e],queryFn:()=>fx(e),enabled:b}),Y=((L=(G=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:1e4}).data)==null?void 0:G.data.find(ue=>ue.name===e))==null?void 0:L.pipelineStatus)==="running";j.useEffect(()=>{b&&f&&(C(f.title),_(Fg(f.body)),M(new Set(f.skills)),R([...f.labels]))},[b,f]),j.useEffect(()=>{const ue=J=>{J.key==="Escape"&&(b?k(!1):n())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[n,b]);const D=Et({mutationFn:()=>{if(!f)throw new Error("no data");const ue={},J=E.trim();J&&J!==f.title&&(ue.title=J);const we=Fg(f.body);N!==we&&(ue.description=N);const re=[...T].sort(),Ce=[...f.skills].sort();return JSON.stringify(re)!==JSON.stringify(Ce)&&(ue.skills=re),JSON.stringify(O)!==JSON.stringify(f.labels)&&(ue.labels=O),Object.keys(ue).length===0?Promise.resolve({ok:!0,noop:!0}):Y4(e,t,ue)},onSuccess:()=>{l.invalidateQueries({queryKey:["card",e,t]}),l.invalidateQueries({queryKey:["cards",e]}),k(!1),i()},onError:ue=>{d({title:a("cardModal.error.save.title"),body:ue instanceof Error?ue.message:String(ue)})}}),F=j.useMemo(()=>{if(!b||!f)return!1;if(E.trim()!==f.title||N!==Fg(f.body))return!0;const ue=[...T].sort(),J=[...f.skills].sort();return JSON.stringify(ue)!==JSON.stringify(J)||JSON.stringify(O)!==JSON.stringify(f.labels)},[b,f,E,N,T,O]),I=ue=>{const J=new Set(T);J.has(ue)?J.delete(ue):J.add(ue),M(J)},H=()=>{const ue=B.trim();if(ue){if(O.includes(ue)){U("");return}R([...O,ue]),U("")}},W=ue=>{R(O.filter(J=>J!==ue))};return c.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"card-modal-title",className:"fixed inset-0 z-40 flex items-start justify-center p-6 bg-black/30 overflow-auto",children:[c.jsxs("div",{className:"nb-card mt-12 w-full max-w-3xl bg-[var(--color-bg)]",children:[c.jsxs("header",{className:"flex items-start justify-between gap-4 mb-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-xs px-2 py-0.5 bg-[var(--color-accent-purple)] border-2 border-[var(--color-text)] rounded-full",children:["#",t]}),(f==null?void 0:f.state)&&c.jsx("span",{className:"font-[family-name:var(--font-mono)] text-xs px-2 py-0.5 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-full font-semibold",children:f.state}),b&&c.jsx("span",{className:"text-xs font-bold text-[var(--color-stuck)]",children:a("cardModal.editing")})]}),b?c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-heading)] text-xl font-bold",value:E,onChange:ue=>C(ue.target.value),maxLength:200,"aria-label":a("cardModal.title.aria")}):c.jsx("h2",{id:"card-modal-title",className:"font-[family-name:var(--font-heading)] text-2xl font-bold break-words",children:(f==null?void 0:f.title)??a("common.loading")})]}),c.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[!b&&f&&c.jsxs("button",{onClick:()=>k(!0),className:"nb-btn",style:{padding:"6px 12px"},type:"button","aria-label":a("cardModal.editAria"),children:[c.jsx(Kp,{size:12,strokeWidth:2.5})," ",a("cardModal.edit")]}),c.jsx("button",{onClick:n,className:"nb-btn nb-btn-mint p-2","aria-label":a("cardModal.close.aria"),type:"button",children:c.jsx(gn,{size:14,strokeWidth:3})})]})]}),p&&c.jsx("p",{className:"text-[var(--color-text-muted)]",children:a("common.loading")}),g&&c.jsx("p",{className:"text-[var(--color-crashed)]",children:a("cardModal.error.load",{detail:m instanceof Error?m.message:String(m)})}),f&&c.jsxs("div",{className:"flex flex-col gap-4",children:[f.branch&&!b&&c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx(SL,{size:14}),c.jsx("span",{className:"font-[family-name:var(--font-mono)]",children:f.branch})]}),b?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Skills"}),K.isLoading&&c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("cardModal.skills.loading")}),K.data&&K.data.data.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.data.data.map(ue=>{const J=T.has(ue.name);return c.jsx("button",{type:"button",onClick:()=>I(ue.name),"aria-pressed":J,className:["px-2.5 py-1 text-xs font-[family-name:var(--font-mono)] rounded-full border-2 transition-all",J?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[2px_2px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),children:ue.name},ue.name)})})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Labels"}),c.jsxs("div",{className:"flex flex-wrap gap-1.5 items-center",children:[O.map(ue=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-[family-name:var(--font-mono)] bg-[var(--color-accent-yellow)] border-2 border-[var(--color-text)] rounded-full",children:[ue,c.jsx("button",{type:"button",onClick:()=>W(ue),className:"hover:text-[var(--color-crashed)]","aria-label":a("cardModal.label.removeAria",{label:ue}),children:c.jsx(gn,{size:10,strokeWidth:3})})]},ue)),c.jsx("input",{type:"text",className:"nb-input",style:{padding:"4px 8px",fontSize:12,width:140},placeholder:a("cardModal.label.addPlaceholder"),value:B,onChange:ue=>U(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&!ue.nativeEvent.isComposing&&(ue.preventDefault(),H())}}),B&&c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"2px 6px",fontSize:11},onClick:H,"aria-label":a("cardModal.label.addAria"),children:c.jsx(hi,{size:10,strokeWidth:3})})]}),c.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:a("cardModal.label.note")})]})]}):c.jsxs(c.Fragment,{children:[f.skills.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Skills"}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:f.skills.map(ue=>c.jsx(mx,{name:ue},ue))})]}),f.labels.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Labels"}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:f.labels.map(ue=>c.jsx(M2,{label:ue,kind:ue==="NEEDS-FIX"?"warn":"default"},ue))})]})]}),b?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.description")}),c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",style:{minHeight:180,resize:"vertical"},value:N,onChange:ue=>_(ue.target.value),"aria-label":a("cardModal.body.aria")}),c.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:a("cardModal.body.replaceNote")})]}),(((ke=f.checklist)==null?void 0:ke.total)??0)>0&&c.jsxs("div",{className:"nb-card bg-[var(--color-bg-cream)] p-3",children:[c.jsx("div",{className:"flex items-center justify-between mb-2",children:c.jsxs("span",{className:"font-bold text-sm",children:[a("cardModal.section.checklist")," ",((Ne=f.checklist)==null?void 0:Ne.done)??0,"/",((se=f.checklist)==null?void 0:se.total)??0]})}),c.jsx("ul",{className:"text-sm space-y-1",children:(((ve=f.checklist)==null?void 0:ve.items)??[]).map((ue,J)=>c.jsxs("li",{className:`flex items-start gap-2 ${ue.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{children:ue.done?"✓":"○"}),c.jsx("span",{children:ue.text})]},J))})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.description")}),c.jsx("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4 max-h-64 overflow-auto",children:Jy(f.body,"描述")||a("cardModal.section.empty")})]}),c.jsxs("div",{children:[c.jsxs("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:[a("cardModal.section.checklist")," ",c.jsxs("span",{className:"text-[var(--color-text-muted)] normal-case tracking-normal",children:[((z=f.checklist)==null?void 0:z.done)??0,"/",((V=f.checklist)==null?void 0:V.total)??0]})]}),c.jsx("div",{className:"nb-card bg-[var(--color-bg-cream)] p-3",children:(((P=f.checklist)==null?void 0:P.total)??0)>0?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-end mb-2",children:c.jsx("div",{className:"w-24 h-2 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-[var(--color-cta)]",style:{width:`${((le=f.checklist)==null?void 0:le.percent)??0}%`}})})}),c.jsx("ul",{className:"text-sm space-y-1",children:(((xe=f.checklist)==null?void 0:xe.items)??[]).map((ue,J)=>c.jsxs("li",{className:`flex items-start gap-2 ${ue.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{children:ue.done?"✓":"○"}),c.jsx("span",{children:ue.text})]},J))})]}):c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("cardModal.checklist.empty")})})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.log")}),c.jsx("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4 max-h-64 overflow-auto",children:Jy(f.body,"日志")||a("cardModal.section.empty")})]})]}),c.jsx("div",{className:"flex gap-2 pt-2 border-t-2 border-[var(--color-border-light)] justify-end flex-wrap",children:b?c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"nb-btn",type:"button",onClick:()=>{k(!1),y()},disabled:D.isPending,children:a("common.cancel")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",onClick:()=>D.mutate(),disabled:!F||!E.trim()||D.isPending,"aria-label":a("cardDetail.save"),children:[D.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(mr,{size:14,strokeWidth:3}),a("common.save")]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",disabled:f.state==="Done"||Y,title:f.state==="Done"?a("cardModal.action.launch.disabledDone"):Y?a("cardModal.action.launch.disabledRunning"):void 0,onClick:async()=>{try{await K4(e,t),i()}catch(ue){d({title:a("cardModal.action.launch.error"),body:ue instanceof Error?ue.message:String(ue)})}},children:[c.jsx(Qu,{size:14,strokeWidth:3}),a("cardModal.action.launch")]}),c.jsxs("button",{className:"nb-btn nb-btn-yellow",type:"button",onClick:async()=>{if(await o({title:a("cardModal.action.reset.confirm.title",{seq:t}),body:a("cardModal.action.reset.confirm.body"),confirm:a("cardModal.action.reset.confirm.button"),danger:!0}))try{await q4(e,t),i(),n()}catch(J){d({title:a("cardModal.action.reset.error"),body:J instanceof Error?J.message:String(J)})}},children:[c.jsx(Fb,{size:14,strokeWidth:2.5}),a("cardModal.action.reset")]}),c.jsxs("button",{className:"nb-btn nb-btn-lilac",type:"button",onClick:()=>S(!0),children:[c.jsx(Wu,{size:14,strokeWidth:2.5}),a("cardModal.action.viewPrompt")]}),c.jsxs("button",{className:"nb-btn",style:{background:"var(--color-crashed)",color:"var(--color-bg)"},type:"button",onClick:async()=>{if(!(!await o({title:a("cardModal.action.delete.confirm1.title",{seq:t}),body:a("cardModal.action.delete.confirm1.body",{title:f.title}),confirm:a("cardModal.action.delete.confirm1.button"),danger:!0})||!await o({title:a("cardModal.action.delete.confirm2.title"),body:a("cardModal.action.delete.confirm2.body",{seq:t}),confirm:a("cardModal.action.delete"),danger:!0})))try{await H4(e,t),i(),n()}catch(we){d({title:a("projectDetail.pipelines.delete.error"),body:we instanceof Error?we.message:String(we)})}},"aria-label":a("cardModal.action.delete"),children:[c.jsx(Vi,{size:14,strokeWidth:2.5}),a("cardModal.action.delete")]})]})})]})]}),v&&c.jsx(o5,{project:e,seq:t,onClose:()=>S(!1)})]})}function o5({project:e,seq:t,onClose:n}){const i=Pe(),[a,l]=j.useState(!1),{data:o,isLoading:d,isError:f,error:p}=Ve({queryKey:["card-prompt",e,t],queryFn:()=>F4(e,t),staleTime:0});j.useEffect(()=>{const m=y=>{y.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const g=()=>{o!=null&&o.prompt&&navigator.clipboard.writeText(o.prompt).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})};return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-start justify-center p-6 bg-black/40 overflow-auto",onClick:n,children:c.jsxs("div",{className:"nb-card mt-8 w-full max-w-4xl",onClick:m=>m.stopPropagation(),children:[c.jsxs("header",{className:"flex items-center justify-between gap-4 mb-3",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:i("cardModal.prompt.title")}),c.jsxs("div",{className:"flex items-center gap-2",children:[(o==null?void 0:o.prompt)&&c.jsxs("button",{className:"nb-btn px-3 py-2 text-sm flex items-center gap-1.5",type:"button",onClick:g,children:[c.jsx(n_,{size:14,strokeWidth:2.5}),i(a?"cardModal.prompt.copied":"cardModal.prompt.copy")]}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",type:"button",onClick:n,"aria-label":i("skillDetail.close.aria"),children:c.jsx(gn,{size:16,strokeWidth:3})})]})]}),d&&c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:i("cardModal.prompt.loading")}),f&&c.jsx("p",{className:"text-sm text-[var(--color-crashed)]",children:i("cardModal.prompt.error",{detail:p instanceof Error?p.message:String(p)})}),o&&c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[c.jsx("span",{className:"nb-badge",children:i("cardModal.prompt.metaSkills",{skills:o.meta.skills.length?o.meta.skills.join(", "):"—"})}),o.meta.memoryIncluded&&c.jsx("span",{className:"nb-badge",children:i("cardModal.prompt.metaMemory")}),c.jsx("span",{className:"nb-badge",children:o.meta.git?i("cardModal.prompt.metaGit"):i("cardModal.prompt.metaNonGit")})]}),c.jsx("div",{className:"scroll-frame max-h-[60vh] rounded-lg border-2 border-[var(--color-text)] bg-surface-input",children:c.jsx("pre",{className:"scroll-frame-body max-h-[60vh] p-4 text-xs font-[family-name:var(--font-mono)] whitespace-pre-wrap break-words",children:o.prompt})}),o.meta.nativeContext.length>0&&c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)]",children:[c.jsx("p",{className:"font-bold mb-1",children:i("cardModal.prompt.nativeTitle")}),c.jsx("ul",{className:"list-disc pl-5 flex flex-col gap-0.5",children:o.meta.nativeContext.map(m=>c.jsx("li",{children:m},m))})]}),o.meta.notes.map(m=>c.jsx("p",{className:"text-xs text-[var(--color-text-subtle)] italic",children:m},m))]})]})})}function c5({current:e,onChange:t}){const[n,i]=j.useState(!1),a=j.useRef(null),{data:l}=Ve({queryKey:["projects"],queryFn:Es});return j.useEffect(()=>{const o=d=>{var f;(f=a.current)!=null&&f.contains(d.target)||i(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[]),c.jsxs("div",{className:"relative",ref:a,children:[c.jsxs("button",{type:"button",className:"nb-btn font-[family-name:var(--font-mono)] text-sm",onClick:()=>i(o=>!o),children:[e,c.jsx(Yu,{size:14,strokeWidth:2.5})]}),n&&l&&c.jsx("div",{className:"absolute right-0 mt-2 z-20 min-w-[200px] nb-card p-1 overflow-hidden",children:c.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:N_(l.data,"activity").map(o=>{const d=o.pipelineStatus==="running";return c.jsxs("button",{type:"button",onClick:()=>{t(o.name),i(!1)},className:["dimension-menu-item w-full text-left px-4 py-2 text-sm font-semibold flex items-center gap-2",o.name===e?"dimension-menu-item-active":""].join(" "),children:[d&&c.jsx(Qu,{size:12,strokeWidth:3,className:"text-[var(--color-running)] shrink-0","aria-label":"运行中"}),c.jsx("span",{className:"font-[family-name:var(--font-mono)]",children:o.name}),c.jsxs("span",{className:"ml-auto text-xs text-[var(--color-text-muted)]",children:[o.cards.total," cards"]})]},o.name)})})})]})}const u5=[{state:"Planning",labelKey:"board.col.planning",bg:"linear-gradient(180deg, rgba(139, 117, 255, 0.20), rgba(188, 166, 255, 0.075))",badgeVars:{"--skill-badge-lang-bg":"rgba(172, 153, 255, 0.30)","--skill-badge-end-bg":"rgba(151, 133, 239, 0.26)","--skill-badge-persona-bg":"rgba(193, 178, 255, 0.24)","--skill-badge-workflow-bg":"rgba(159, 146, 220, 0.27)","--skill-badge-other-bg":"rgba(126, 107, 206, 0.30)"}},{state:"Backlog",labelKey:"board.col.backlog",bg:"linear-gradient(180deg, rgba(147, 158, 190, 0.14), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(149, 160, 198, 0.24)","--skill-badge-end-bg":"rgba(128, 141, 176, 0.25)","--skill-badge-persona-bg":"rgba(165, 172, 199, 0.22)","--skill-badge-workflow-bg":"rgba(138, 152, 184, 0.26)","--skill-badge-other-bg":"rgba(116, 127, 158, 0.28)"}},{state:"Todo",labelKey:"board.col.todo",bg:"linear-gradient(180deg, rgba(239, 201, 126, 0.18), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(245, 207, 135, 0.28)","--skill-badge-end-bg":"rgba(226, 182, 101, 0.25)","--skill-badge-persona-bg":"rgba(249, 221, 159, 0.23)","--skill-badge-workflow-bg":"rgba(232, 193, 118, 0.27)","--skill-badge-other-bg":"rgba(204, 159, 84, 0.29)"}},{state:"Inprogress",labelKey:"board.col.inprogress",bg:"linear-gradient(180deg, rgba(98, 176, 242, 0.18), rgba(188, 166, 255, 0.065))",badgeVars:{"--skill-badge-lang-bg":"rgba(104, 181, 246, 0.28)","--skill-badge-end-bg":"rgba(79, 153, 223, 0.26)","--skill-badge-persona-bg":"rgba(136, 198, 250, 0.22)","--skill-badge-workflow-bg":"rgba(91, 166, 228, 0.27)","--skill-badge-other-bg":"rgba(67, 128, 197, 0.29)"}},{state:"QA",labelKey:"board.col.qa",bg:"linear-gradient(180deg, rgba(222, 171, 222, 0.18), rgba(188, 166, 255, 0.065))",badgeVars:{"--skill-badge-lang-bg":"rgba(226, 174, 226, 0.28)","--skill-badge-end-bg":"rgba(206, 145, 213, 0.25)","--skill-badge-persona-bg":"rgba(236, 197, 236, 0.22)","--skill-badge-workflow-bg":"rgba(215, 158, 218, 0.27)","--skill-badge-other-bg":"rgba(184, 125, 196, 0.29)"}},{state:"Done",labelKey:"board.col.done",bg:"linear-gradient(180deg, rgba(120, 214, 163, 0.18), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(125, 216, 166, 0.27)","--skill-badge-end-bg":"rgba(93, 190, 139, 0.25)","--skill-badge-persona-bg":"rgba(154, 226, 185, 0.22)","--skill-badge-workflow-bg":"rgba(107, 202, 150, 0.28)","--skill-badge-other-bg":"rgba(75, 166, 120, 0.29)"}}],D2="sps-console:last-board-project";function d5(){if(typeof window>"u")return null;try{return localStorage.getItem(D2)}catch{return null}}function f5(e){if(!(typeof window>"u"))try{localStorage.setItem(D2,e)}catch{}}function p5(){var I,H,W;const e=Pe(),[t,n]=QN(),i=t.get("project"),[a,l]=j.useState(null),[o,d]=j.useState(""),[f,p]=j.useState(()=>new Set),[g,m]=j.useState(()=>new Set),{confirm:y,alert:b}=un();Q4(i);const k=Ve({queryKey:["projects"],queryFn:Es}),v=Ve({queryKey:["cards",i],queryFn:()=>$4(i??""),enabled:!!i,refetchInterval:3e3}),S=Ft(),E=()=>{S.invalidateQueries({queryKey:["cards",i]}),S.invalidateQueries({queryKey:["projects"]}),S.invalidateQueries({queryKey:["pipeline-status",i]})},C=G=>{n({project:G})};j.useEffect(()=>{var L;if(i){f5(i);return}const G=d5();G&&((L=k.data)!=null&&L.data.some(z=>z.name===G))&&n({project:G},{replace:!0})},[i,k.data,n]);const N=Et({mutationFn:()=>A2(i),onSuccess:()=>{E()},onError:G=>{b({title:e("board.action.startError"),body:G instanceof Error?G.message:String(G)})}}),_=Et({mutationFn:()=>T2(i),onSuccess:()=>E(),onError:G=>{b({title:e("board.action.stopError"),body:G instanceof Error?G.message:String(G)})}}),T=Et({mutationFn:()=>W4(i,{all:!0}),onSuccess:()=>E(),onError:G=>{b({title:e("board.action.resetError"),body:G instanceof Error?G.message:String(G)})}}),[M,O]=j.useState(!1),R=Et({mutationFn:G=>G4(i,G),onSuccess:()=>{E(),O(!1)},onError:G=>{b({title:e("board.action.newCard.error"),body:G instanceof Error?G.message:String(G)})}}),B=Et({mutationFn:({seq:G,state:L})=>V4(i,G,L),onMutate:async({seq:G,state:L})=>{await S.cancelQueries({queryKey:["cards",i]});const z=S.getQueryData(["cards",i]);return z&&S.setQueryData(["cards",i],{...z,data:z.data.map(V=>V.seq===G?{...V,state:L}:V)}),{prev:z}},onError:(G,L,z)=>{z!=null&&z.prev&&S.setQueryData(["cards",i],z.prev),b({title:e("board.action.moveCard.error"),body:G instanceof Error?G.message:String(G)})},onSettled:()=>{S.invalidateQueries({queryKey:["cards",i]})}}),U=((I=v.data)==null?void 0:I.data)??[],{allSkills:K,allLabels:q}=j.useMemo(()=>{const G=new Set,L=new Set;for(const z of U){for(const V of z.skills)G.add(V);for(const V of z.labels)L.add(V)}return{allSkills:[...G].sort(),allLabels:[...L].sort()}},[U]);if(!i)return c.jsxs("div",{className:"flex flex-col gap-6 w-full",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold",children:e("board.title.bare")}),c.jsxs("div",{className:"nb-card bg-[var(--color-accent-yellow)] max-w-2xl",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-3",children:e("board.pickPrompt.title")}),c.jsx("p",{className:"text-sm mb-4 text-[var(--color-text-muted)]",children:e("board.pickPrompt.body")}),c.jsx("div",{className:"flex flex-wrap gap-2",children:(H=k.data)==null?void 0:H.data.map(G=>c.jsx("button",{className:"nb-btn nb-btn-blue",onClick:()=>C(G.name),type:"button",children:G.name},G.name))})]})]});const Y=U.filter(G=>{if(o){const L=o.toLowerCase();if(!(G.title.toLowerCase().includes(L)||G.skills.some(V=>V.toLowerCase().includes(L))||G.labels.some(V=>V.toLowerCase().includes(L))))return!1}return!(f.size>0&&!G.skills.some(z=>f.has(z))||g.size>0&&!G.labels.some(z=>g.has(z)))}),D=(W=k.data)==null?void 0:W.data.find(G=>G.name===i),F=(D==null?void 0:D.pipelineStatus)==="running";return c.jsxs("div",{className:"flex flex-col gap-4 max-w-full flex-1 min-h-0",children:[c.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3 shrink-0",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold tracking-tight",children:e("board.title")}),c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm mt-1",children:D?e("board.subtitle",{name:D.name,cards:D.cards.total,workers:D.workers.active}):e("common.loading")})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c.jsx(c5,{current:i,onChange:C}),c.jsxs("button",{className:F?"nb-btn nb-btn-danger":"nb-btn nb-btn-primary",onClick:()=>F?_.mutate():N.mutate(),disabled:N.isPending||_.isPending,type:"button","aria-label":e(F?"board.action.stopAria":"board.action.startAria"),title:e(F?"board.action.stopAria":"board.action.startAria"),children:[N.isPending||_.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):F?c.jsx(Hb,{size:14,strokeWidth:3}):c.jsx(Qu,{size:14,strokeWidth:3}),e(F?"board.action.stop":"board.action.start")]}),c.jsxs("button",{className:"nb-btn nb-btn-yellow",type:"button",onClick:async()=>{await y({title:e("board.action.reset.confirm.title"),body:e("board.action.reset.confirm.body"),confirm:e("board.action.reset.confirm.button"),danger:!0})&&T.mutate()},disabled:T.isPending,children:[T.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(Fb,{size:14,strokeWidth:2.5}),e("board.action.reset")]}),c.jsxs("button",{className:"nb-btn nb-btn-mint",type:"button",onClick:()=>O(!0),disabled:R.isPending,children:[R.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(hi,{size:14,strokeWidth:3}),e("board.action.newCard")]})]})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap shrink-0",children:[c.jsxs("div",{className:"relative flex-1 max-w-md",children:[c.jsx(fl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-subtle)]"}),c.jsx("input",{className:"nb-input pl-9 w-full",placeholder:e("board.search.placeholder"),value:o,onChange:G=>d(G.target.value),"aria-label":e("board.search.aria")})]}),c.jsx(Ik,{label:"skill",options:K,selected:f,onChange:p}),c.jsx(Ik,{label:"label",options:q,selected:g,onChange:m}),(o||f.size>0||g.size>0)&&c.jsxs("button",{className:"nb-btn",style:{padding:"4px 10px",fontSize:11},onClick:()=>{d(""),p(new Set),m(new Set)},type:"button","aria-label":e("board.filter.clearAria"),children:[c.jsx(gn,{size:11,strokeWidth:3}),e("board.filter.clear")]}),c.jsxs("span",{className:"text-xs text-[var(--color-text-muted)] flex items-center gap-1 font-[family-name:var(--font-mono)]",children:[c.jsx(kL,{size:12}),Y.length," / ",U.length]})]}),v.isError&&c.jsxs("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:[c.jsx("p",{className:"font-semibold",children:e("board.error.loadCards")}),c.jsx("p",{className:"text-sm mt-1 text-[var(--color-text-muted)]",children:v.error instanceof Error?v.error.message:String(v.error)})]}),!v.isError&&c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 auto-rows-fr gap-3 flex-1 min-h-0",children:u5.map(G=>c.jsx(s5,{label:e(G.labelKey),bg:G.bg,badgeVars:G.badgeVars,cards:Y.filter(h5(G.state)),onCardClick:L=>l(L.seq),onDropCard:L=>B.mutate({seq:L,state:G.state})},G.state))}),a!==null&&c.jsx(l5,{project:i,seq:a,onClose:()=>l(null),onChanged:E}),M&&c.jsx(B4,{project:i,isPending:R.isPending,onCancel:()=>O(!1),onCreate:G=>R.mutate(G)})]})}function h5(e){return t=>e==="QA"?t.state==="QA"||t.state==="Review":e==="Done"?t.state==="Done"||t.state==="Canceled":t.state===e}function Ik({label:e,options:t,selected:n,onChange:i}){const a=Pe(),[l,o]=j.useState(!1),d=j.useRef(null);j.useEffect(()=>{if(!l)return;const m=b=>{var k;(k=d.current)!=null&&k.contains(b.target)||o(!1)},y=b=>{b.key==="Escape"&&o(!1)};return window.addEventListener("click",m),window.addEventListener("keydown",y),()=>{window.removeEventListener("click",m),window.removeEventListener("keydown",y)}},[l]);const f=m=>{const y=new Set(n);y.has(m)?y.delete(m):y.add(m),i(y)},p=t.length===0,g=n.size;return c.jsxs("div",{ref:d,className:"relative",children:[c.jsxs("button",{type:"button",className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>!p&&o(m=>!m),disabled:p,"aria-haspopup":"listbox","aria-expanded":l,"aria-label":a("board.filter.aria",{label:e}),children:[e,g>0&&c.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-[10px] font-bold rounded-full bg-[var(--color-primary)] text-[var(--color-text)] border border-[var(--color-text)]",children:g}),c.jsx(Yu,{size:11,strokeWidth:3,className:["transition-transform",l?"rotate-180":""].join(" ")})]}),l&&c.jsx("div",{className:"absolute left-0 top-full mt-2 z-20 min-w-[200px] nb-card p-2 overflow-hidden",style:{padding:8},children:c.jsxs("div",{role:"listbox",className:"max-h-64 overflow-auto",children:[t.map(m=>{const y=n.has(m);return c.jsxs("label",{className:["flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer text-sm font-[family-name:var(--font-mono)]",y?"bg-[var(--color-accent-mint)]":"hover:bg-[var(--color-bg-cream)]"].join(" "),children:[c.jsx("input",{type:"checkbox",checked:y,onChange:()=>f(m),className:"flex-shrink-0"}),c.jsx("span",{className:"truncate",children:m})]},m)}),g>0&&c.jsx("button",{type:"button",className:"w-full mt-2 pt-2 border-t-2 border-dashed border-[var(--color-text)] text-xs font-bold text-[var(--color-crashed)] text-center",onClick:()=>i(new Set),children:a("board.filter.clearSelection")})]})})]})}function m5(){return ct("/api/workers/all")}function g5(e){return ct(`/api/projects/${encodeURIComponent(e)}/workers`)}function y5(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/workers/${t}`)}async function O2(e,t){const n=await fetch(e,{method:"POST",headers:t?{"Content-Type":"application/json"}:void 0,body:t?JSON.stringify(t):void 0});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json().catch(()=>({}))}function zk(e,t){return O2(`/api/projects/${encodeURIComponent(e)}/workers/${t}/kill`)}function b5(e,t,n){return O2(`/api/projects/${encodeURIComponent(e)}/workers/${t}/launch`,n?{seq:n}:void 0)}function gx({state:e}){const n={running:{bg:"var(--color-running-bg)",color:"var(--color-running)",label:"running"},starting:{bg:"var(--color-secondary)",color:"var(--color-text)",label:"starting",icon:c.jsx(Xe,{size:9,strokeWidth:3,className:"animate-spin"})},stuck:{bg:"var(--color-stuck-bg)",color:"var(--color-stuck)",label:"stuck"},crashed:{bg:"var(--color-crashed-bg)",color:"var(--color-crashed)",label:"crashed",icon:c.jsx(v3,{size:9,strokeWidth:2.5})},idle:{bg:"var(--color-idle-bg)",color:"var(--color-idle)",label:"idle"}}[e];return c.jsxs("span",{className:"nb-status inline-flex items-center gap-1",style:{background:n.bg,color:n.color},children:[n.icon,n.label]})}function yx(e){if(e==null||e<=0)return"—";const t=Math.floor(e/1e3),n=Math.floor(t/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?`${n}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function x5(e){if(e==null||e<=0)return"text-[var(--color-text-muted)]";const t=e/6e4;return t<10?"text-[var(--color-running)]":t<60?"text-[var(--color-stuck)]":"text-[var(--color-crashed)]"}function bx(e){const t=Date.now()-new Date(e).getTime();return t<6e4?`${Math.floor(t/1e3)}s 前`:t<36e5?`${Math.floor(t/6e4)}m 前`:`${Math.floor(t/36e5)}h 前`}function v5({alerts:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?c.jsxs("div",{className:"nb-card bg-[var(--color-running-bg)] flex items-center gap-3",children:[c.jsx(Su,{size:18,strokeWidth:2.5,className:"text-[var(--color-running)]"}),c.jsx("span",{className:"text-sm font-bold text-[var(--color-running)]",children:i("workers.alerts.allHealthy")})]}):c.jsxs("section",{children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 flex items-center gap-2 text-[var(--color-crashed)]",children:[c.jsx(O3,{size:14,strokeWidth:2.5}),"Alerts (",e.length,")"]}),c.jsx("div",{className:"flex flex-col gap-2",children:e.map(a=>{const l=(t==null?void 0:t.project)===a.project&&(t==null?void 0:t.slot)===a.slot;return c.jsxs("button",{type:"button",onClick:()=>n(a.project,a.slot),className:["nb-card p-3 text-left",a.state==="crashed"?"bg-[var(--color-crashed-bg)]":"bg-[var(--color-stuck-bg)]",l?"ring-4 ring-[var(--color-text)]":""].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx(gx,{state:a.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold",children:[a.project,"/worker-",a.slot]}),a.card&&c.jsxs("span",{className:"truncate",children:["#",a.card.seq," ",a.card.title]}),c.jsxs("span",{className:"ml-auto text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] flex items-center gap-1",children:[c.jsx(t_,{size:10,strokeWidth:2.5}),yx(a.runtimeMs)]})]}),a.markerUpdatedAt&&c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-1 font-[family-name:var(--font-mono)]",children:a.state==="crashed"?i("workers.alerts.pidDead"):i("workers.alerts.markerStale",{ago:bx(a.markerUpdatedAt)})})]},`${a.project}-${a.slot}`)})})]})}function w5({active:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] italic",children:i("workers.active.empty")})}):c.jsxs("section",{children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 flex items-center gap-2",children:[c.jsx(qp,{size:14,strokeWidth:2.5}),"Active (",e.length,")"]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e.map(a=>{const l=(t==null?void 0:t.project)===a.project&&(t==null?void 0:t.slot)===a.slot;return c.jsxs("button",{type:"button",onClick:()=>n(a.project,a.slot),className:["nb-card p-3 text-left",a.state==="starting"?"bg-[var(--color-secondary)]":"bg-[var(--color-running-bg)]",l?"ring-4 ring-[var(--color-text)]":""].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(gx,{state:a.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-sm flex-1 truncate",children:[a.project,"/worker-",a.slot]}),c.jsx("span",{className:`text-xs font-[family-name:var(--font-mono)] ${x5(a.runtimeMs)}`,children:yx(a.runtimeMs)})]}),a.card&&c.jsxs("div",{className:"text-sm font-semibold mb-1 truncate",children:["#",a.card.seq," · ",a.card.title]}),c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] flex items-center gap-2 mb-1",children:[a.stage&&c.jsxs("span",{children:["stage: ",a.stage]}),a.markerUpdatedAt&&c.jsxs("span",{className:"ml-auto",children:["marker ",bx(a.markerUpdatedAt)]})]}),a.lastLogLine&&c.jsxs("div",{className:"text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded px-2 py-1 mt-2 truncate",children:[c.jsx(p_,{size:9,strokeWidth:2.5,className:"inline-block mr-1 align-text-bottom"}),a.lastLogLine.msg]})]},`${a.project}-${a.slot}`)})})]})}function k5({capacity:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?null:c.jsxs("section",{className:"flex flex-col min-h-0 flex-1",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 shrink-0",children:"Capacity"}),c.jsxs("div",{className:"scroll-frame min-h-0 flex-1 rounded-lg border-2 border-[var(--color-border-light)] bg-[var(--color-bg-cream)] flex flex-col",children:[c.jsxs("table",{className:"w-full table-fixed text-sm shrink-0",children:[c.jsx(Pk,{}),c.jsx("thead",{children:c.jsxs("tr",{className:"border-b-2 border-[var(--color-border-light)] bg-[var(--color-bg-soft)]",children:[c.jsx("th",{className:"px-3 py-2 text-left font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.project")}),c.jsx("th",{className:"px-3 py-2 text-left font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.usage")}),c.jsx("th",{className:"px-3 py-2 text-right font-bold text-xs uppercase tracking-wider",children:"running"}),c.jsx("th",{className:"px-3 py-2 text-right font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.other")}),c.jsx("th",{className:"px-3 py-2"})]})})]}),c.jsx("div",{className:"bg-color-bg-soft scroll-frame-body flex-1",children:c.jsxs("table",{className:"w-full table-fixed text-sm",children:[c.jsx(Pk,{}),c.jsx("tbody",{children:e.map(a=>c.jsx(E5,{capacity:a,selected:(t==null?void 0:t.project)===a.project,onSelect:()=>n(a.project)},a.project))})]})})]})]})}function Pk(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"w-[24%]"}),c.jsx("col",{className:"w-[28%]"}),c.jsx("col",{className:"w-[16%]"}),c.jsx("col",{className:"w-[20%]"}),c.jsx("col",{className:"w-[12%]"})]})}function E5({capacity:e,selected:t,onSelect:n}){const i=Pe(),a=e.running+e.starting+e.stuck+e.crashed;return c.jsxs("tr",{onClick:n,className:["border-b border-dashed border-[var(--color-border-light)] last:border-0 cursor-pointer hover:bg-[var(--color-accent-yellow)]",t?"bg-[var(--color-accent-yellow)]":""].join(" "),children:[c.jsx("td",{className:"px-3 py-2 font-[family-name:var(--font-mono)] font-bold",children:e.project}),c.jsx("td",{className:"px-3 py-2",children:c.jsx(S5,{total:e.total,cap:e})}),c.jsxs("td",{className:"px-3 py-2 text-right font-[family-name:var(--font-mono)]",children:[c.jsx("span",{className:"text-[var(--color-running)] font-bold",children:e.running}),c.jsxs("span",{className:"text-[var(--color-text-muted)]",children:["/",e.total]})]}),c.jsxs("td",{className:"px-3 py-2 text-right text-xs font-[family-name:var(--font-mono)] text-[var(--color-text-muted)]",children:[e.starting>0&&c.jsxs("span",{className:"mr-2",children:["starting ",e.starting]}),e.stuck>0&&c.jsxs("span",{className:"text-[var(--color-stuck)] font-bold mr-2",children:["stuck ",e.stuck]}),e.crashed>0&&c.jsxs("span",{className:"text-[var(--color-crashed)] font-bold mr-2",children:["crashed ",e.crashed]}),a===0&&c.jsx("span",{children:"idle"})]}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:i("workers.capacity.detailHint")})})]})}function S5({total:e,cap:t}){const n=[];for(let i=0;i<t.crashed;i++)n.push("crashed");for(let i=0;i<t.stuck;i++)n.push("stuck");for(let i=0;i<t.starting;i++)n.push("starting");for(let i=0;i<t.running;i++)n.push("running");for(let i=0;i<t.idle;i++)n.push("idle");return c.jsxs("div",{className:"flex gap-1 items-center",children:[n.map((i,a)=>c.jsx("span",{className:"inline-block w-3 h-3 rounded-full border-2 border-[var(--color-text)]",style:{background:N5(i)},title:i},a)),c.jsxs("span",{className:"text-xs text-[var(--color-text-muted)] ml-2 font-[family-name:var(--font-mono)]",children:[e," slot",e!==1?"s":""]})]})}function N5(e){switch(e){case"running":return"var(--color-running-bg)";case"starting":return"var(--color-secondary)";case"stuck":return"var(--color-stuck-bg)";case"crashed":return"var(--color-crashed-bg)";default:return"var(--color-idle-bg)"}}function _5({project:e,initialSlot:t,onChange:n}){var p;const i=Pe(),a=Ve({queryKey:["workers",e],queryFn:()=>g5(e),refetchInterval:3e3}),l=((p=a.data)==null?void 0:p.data)??[],[o,d]=j.useState(null);j.useEffect(()=>{if(l.length===0){d(null);return}const g=l[0].slot;d(m=>m!=null&&l.some(y=>y.slot===m)?m:t!=null&&l.some(y=>y.slot===t)?t:g)},[e,t,l.length]);const f=l.find(g=>g.slot===o)??null;return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"px-4 bg-color-bg-soft py-3 border-b-2 border-[var(--color-text)] bg-[var(--color-bg-cream)]",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("span",{className:"font-[family-name:var(--font-mono)] font-bold truncate",children:e}),c.jsx(vs,{to:`/board?project=${encodeURIComponent(e)}`,className:"text-xs underline text-[var(--color-text-muted)] hover:text-[var(--color-text)]",children:i("workers.panel.boardLink")})]}),a.isLoading&&l.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.loading")}):l.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.empty.slots")}):c.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(g=>c.jsx(j5,{worker:g,active:g.slot===o,onClick:()=>d(g.slot)},g.slot))})]}),f?c.jsx(C5,{project:e,worker:f,onChange:n}):c.jsx("div",{className:"flex-1 flex items-center justify-center p-6 text-center",children:c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:l.length===0?i("workers.panel.empty.noWorker"):i("workers.panel.empty.pickOne")})})]})}function j5({worker:e,active:t,onClick:n}){const i=Pe();return c.jsxs("button",{type:"button",onClick:n,className:["nb-card p-2 text-left min-w-[130px] transition-transform",t?"ring-4 ring-[var(--color-text)]":"opacity-80 hover:opacity-100"].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(gx,{state:e.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-xs",children:["worker-",e.slot]})]}),e.card?c.jsxs("div",{className:"text-[11px] truncate font-[family-name:var(--font-mono)]",children:["#",e.card.seq," ",e.card.title]}):c.jsx("div",{className:"text-[11px] text-[var(--color-text-muted)] italic",children:i("workers.panel.idle.short")})]})}function C5({project:e,worker:t,onChange:n}){var y,b;const i=Pe(),{confirm:a,alert:l}=un(),o=t.state==="crashed"||t.state==="stuck",d=Ve({queryKey:["worker-detail",e,t.slot],queryFn:()=>y5(e,t.slot),refetchInterval:3e3}),f=((y=d.data)==null?void 0:y.recentOutput)??[],p=((b=d.data)==null?void 0:b.recentLogs)??[],g=j.useRef(null),m=j.useRef(!0);return j.useEffect(()=>{const k=g.current;k&&m.current&&(k.scrollTop=k.scrollHeight)},[f]),c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex-1 overflow-auto p-4 flex flex-col gap-4",children:[t.card?c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-[var(--color-text-muted)] mb-1",children:i("workers.panel.section.currentCard")}),c.jsxs("div",{className:"text-sm font-semibold break-words",children:["#",t.card.seq," · ",t.card.title]})]}):c.jsx("div",{className:"text-sm text-[var(--color-text-muted)] italic",children:i("workers.panel.idle.full")}),c.jsxs("dl",{className:"grid grid-cols-[100px_1fr] gap-y-2 text-sm",children:[c.jsx("dt",{className:"font-bold",children:"Stage"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.stage??"—"}),c.jsx("dt",{className:"font-bold",children:"PID"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.pid??"—"}),c.jsx("dt",{className:"font-bold",children:"Runtime"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:yx(t.runtimeMs)}),c.jsx("dt",{className:"font-bold",children:"Started"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)] text-xs",children:t.startedAt?new Date(t.startedAt).toLocaleString():"—"}),c.jsx("dt",{className:"font-bold",children:"Marker"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)] text-xs",children:t.markerUpdatedAt?bx(t.markerUpdatedAt):"—"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-[var(--color-text-muted)] mb-1 flex items-center gap-1",children:[c.jsx(p_,{size:10,strokeWidth:2.5}),i("workers.panel.section.claudeOutput",{n:f.length})]}),d.isLoading&&f.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.output.loading")}):f.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.output.empty")}):c.jsx("pre",{ref:g,onScroll:k=>{const v=k.currentTarget;m.current=v.scrollHeight-v.scrollTop-v.clientHeight<24},className:"text-xs font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded p-2 max-h-80 overflow-auto whitespace-pre-wrap break-words",children:f.map(k=>`${k.ts?`${k.ts} [${k.kind}] `:`[${k.kind}] `}${k.text}`).join(`
|
|
619
|
+
`).trim()}function Fg(e){return Jy(e,"描述")}function lP({project:e,seq:t,onClose:n,onChanged:i}){var G,L,z,V,P,le,xe,ke,Ne,se,ve;const a=Pe(),l=Ft(),{confirm:o,alert:d}=un(),{data:f,isLoading:p,isError:g,error:m,refetch:y}=Ve({queryKey:["card",e,t],queryFn:()=>U4(e,t)}),[b,k]=j.useState(!1),[v,S]=j.useState(!1),[E,C]=j.useState(""),[N,_]=j.useState(""),[T,M]=j.useState(new Set),[O,R]=j.useState([]),[B,U]=j.useState(""),K=Ve({queryKey:["skills-all",e],queryFn:()=>fx(e),enabled:b}),Y=((L=(G=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:1e4}).data)==null?void 0:G.data.find(ue=>ue.name===e))==null?void 0:L.pipelineStatus)==="running";j.useEffect(()=>{b&&f&&(C(f.title),_(Fg(f.body)),M(new Set(f.skills)),R([...f.labels]))},[b,f]),j.useEffect(()=>{const ue=J=>{J.key==="Escape"&&(b?k(!1):n())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[n,b]);const D=Et({mutationFn:()=>{if(!f)throw new Error("no data");const ue={},J=E.trim();J&&J!==f.title&&(ue.title=J);const we=Fg(f.body);N!==we&&(ue.description=N);const re=[...T].sort(),Ce=[...f.skills].sort();return JSON.stringify(re)!==JSON.stringify(Ce)&&(ue.skills=re),JSON.stringify(O)!==JSON.stringify(f.labels)&&(ue.labels=O),Object.keys(ue).length===0?Promise.resolve({ok:!0,noop:!0}):Y4(e,t,ue)},onSuccess:()=>{l.invalidateQueries({queryKey:["card",e,t]}),l.invalidateQueries({queryKey:["cards",e]}),k(!1),i()},onError:ue=>{d({title:a("cardModal.error.save.title"),body:ue instanceof Error?ue.message:String(ue)})}}),F=j.useMemo(()=>{if(!b||!f)return!1;if(E.trim()!==f.title||N!==Fg(f.body))return!0;const ue=[...T].sort(),J=[...f.skills].sort();return JSON.stringify(ue)!==JSON.stringify(J)||JSON.stringify(O)!==JSON.stringify(f.labels)},[b,f,E,N,T,O]),I=ue=>{const J=new Set(T);J.has(ue)?J.delete(ue):J.add(ue),M(J)},H=()=>{const ue=B.trim();if(ue){if(O.includes(ue)){U("");return}R([...O,ue]),U("")}},W=ue=>{R(O.filter(J=>J!==ue))};return c.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"card-modal-title",className:"fixed inset-0 z-40 flex items-start justify-center p-6 bg-black/30 overflow-auto",children:[c.jsxs("div",{className:"nb-card mt-12 w-full max-w-3xl bg-[var(--color-bg)]",children:[c.jsxs("header",{className:"flex items-start justify-between gap-4 mb-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-xs px-2 py-0.5 bg-[var(--color-accent-purple)] border-2 border-[var(--color-text)] rounded-full",children:["#",t]}),(f==null?void 0:f.state)&&c.jsx("span",{className:"font-[family-name:var(--font-mono)] text-xs px-2 py-0.5 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-full font-semibold",children:f.state}),b&&c.jsx("span",{className:"text-xs font-bold text-[var(--color-stuck)]",children:a("cardModal.editing")})]}),b?c.jsx("input",{type:"text",className:"nb-input w-full font-[family-name:var(--font-heading)] text-xl font-bold",value:E,onChange:ue=>C(ue.target.value),maxLength:200,"aria-label":a("cardModal.title.aria")}):c.jsx("h2",{id:"card-modal-title",className:"font-[family-name:var(--font-heading)] text-2xl font-bold break-words",children:(f==null?void 0:f.title)??a("common.loading")})]}),c.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[!b&&f&&c.jsxs("button",{onClick:()=>k(!0),className:"nb-btn",style:{padding:"6px 12px"},type:"button","aria-label":a("cardModal.editAria"),children:[c.jsx(Kp,{size:12,strokeWidth:2.5})," ",a("cardModal.edit")]}),c.jsx("button",{onClick:n,className:"nb-btn nb-btn-mint p-2","aria-label":a("cardModal.close.aria"),type:"button",children:c.jsx(gn,{size:14,strokeWidth:3})})]})]}),p&&c.jsx("p",{className:"text-[var(--color-text-muted)]",children:a("common.loading")}),g&&c.jsx("p",{className:"text-[var(--color-crashed)]",children:a("cardModal.error.load",{detail:m instanceof Error?m.message:String(m)})}),f&&c.jsxs("div",{className:"flex flex-col gap-4",children:[f.branch&&!b&&c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx(SL,{size:14}),c.jsx("span",{className:"font-[family-name:var(--font-mono)]",children:f.branch})]}),b?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Skills"}),K.isLoading&&c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("cardModal.skills.loading")}),K.data&&K.data.data.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.data.data.map(ue=>{const J=T.has(ue.name);return c.jsx("button",{type:"button",onClick:()=>I(ue.name),"aria-pressed":J,className:["px-2.5 py-1 text-xs font-[family-name:var(--font-mono)] rounded-full border-2 transition-all",J?"bg-[var(--color-accent-mint)] border-[var(--color-text)] shadow-[2px_2px_0_var(--color-text)] font-bold":"bg-[var(--color-bg)] border-[var(--color-border-light)] hover:border-[var(--color-text)]"].join(" "),children:ue.name},ue.name)})})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Labels"}),c.jsxs("div",{className:"flex flex-wrap gap-1.5 items-center",children:[O.map(ue=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-[family-name:var(--font-mono)] bg-[var(--color-accent-yellow)] border-2 border-[var(--color-text)] rounded-full",children:[ue,c.jsx("button",{type:"button",onClick:()=>W(ue),className:"hover:text-[var(--color-crashed)]","aria-label":a("cardModal.label.removeAria",{label:ue}),children:c.jsx(gn,{size:10,strokeWidth:3})})]},ue)),c.jsx("input",{type:"text",className:"nb-input",style:{padding:"4px 8px",fontSize:12,width:140},placeholder:a("cardModal.label.addPlaceholder"),value:B,onChange:ue=>U(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&!ue.nativeEvent.isComposing&&(ue.preventDefault(),H())}}),B&&c.jsx("button",{type:"button",className:"nb-btn",style:{padding:"2px 6px",fontSize:11},onClick:H,"aria-label":a("cardModal.label.addAria"),children:c.jsx(hi,{size:10,strokeWidth:3})})]}),c.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:a("cardModal.label.note")})]})]}):c.jsxs(c.Fragment,{children:[f.skills.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Skills"}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:f.skills.map(ue=>c.jsx(mx,{name:ue},ue))})]}),f.labels.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:"Labels"}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:f.labels.map(ue=>c.jsx(M2,{label:ue,kind:ue==="NEEDS-FIX"?"warn":"default"},ue))})]})]}),b?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.description")}),c.jsx("textarea",{className:"nb-input w-full font-[family-name:var(--font-mono)] text-xs",style:{minHeight:180,resize:"vertical"},value:N,onChange:ue=>_(ue.target.value),"aria-label":a("cardModal.body.aria")}),c.jsx("p",{className:"text-[10px] text-[var(--color-text-muted)] mt-1",children:a("cardModal.body.replaceNote")})]}),(((ke=f.checklist)==null?void 0:ke.total)??0)>0&&c.jsxs("div",{className:"nb-card bg-[var(--color-bg-cream)] p-3",children:[c.jsx("div",{className:"flex items-center justify-between mb-2",children:c.jsxs("span",{className:"font-bold text-sm",children:[a("cardModal.section.checklist")," ",((Ne=f.checklist)==null?void 0:Ne.done)??0,"/",((se=f.checklist)==null?void 0:se.total)??0]})}),c.jsx("ul",{className:"text-sm space-y-1",children:(((ve=f.checklist)==null?void 0:ve.items)??[]).map((ue,J)=>c.jsxs("li",{className:`flex items-start gap-2 ${ue.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{children:ue.done?"✓":"○"}),c.jsx("span",{children:ue.text})]},J))})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.description")}),c.jsx("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4 max-h-64 overflow-auto",children:Jy(f.body,"描述")||a("cardModal.section.empty")})]}),c.jsxs("div",{children:[c.jsxs("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:[a("cardModal.section.checklist")," ",c.jsxs("span",{className:"text-[var(--color-text-muted)] normal-case tracking-normal",children:[((z=f.checklist)==null?void 0:z.done)??0,"/",((V=f.checklist)==null?void 0:V.total)??0]})]}),c.jsx("div",{className:"nb-card bg-[var(--color-bg-cream)] p-3",children:(((P=f.checklist)==null?void 0:P.total)??0)>0?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-end mb-2",children:c.jsx("div",{className:"w-24 h-2 bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-[var(--color-cta)]",style:{width:`${((le=f.checklist)==null?void 0:le.percent)??0}%`}})})}),c.jsx("ul",{className:"text-sm space-y-1",children:(((xe=f.checklist)==null?void 0:xe.items)??[]).map((ue,J)=>c.jsxs("li",{className:`flex items-start gap-2 ${ue.done?"opacity-60 line-through":""}`,children:[c.jsx("span",{children:ue.done?"✓":"○"}),c.jsx("span",{children:ue.text})]},J))})]}):c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:a("cardModal.checklist.empty")})})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:a("cardModal.section.log")}),c.jsx("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4 max-h-64 overflow-auto",children:Jy(f.body,"日志")||a("cardModal.section.empty")})]})]}),c.jsx("div",{className:"flex gap-2 pt-2 border-t-2 border-[var(--color-border-light)] justify-end flex-wrap",children:b?c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"nb-btn",type:"button",onClick:()=>{k(!1),y()},disabled:D.isPending,children:a("common.cancel")}),c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",onClick:()=>D.mutate(),disabled:!F||!E.trim()||D.isPending,"aria-label":a("cardDetail.save"),children:[D.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(mr,{size:14,strokeWidth:3}),a("common.save")]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"nb-btn nb-btn-primary",type:"button",disabled:f.state==="Done"||Y,title:f.state==="Done"?a("cardModal.action.launch.disabledDone"):Y?a("cardModal.action.launch.disabledRunning"):void 0,onClick:async()=>{try{await K4(e,t),i()}catch(ue){d({title:a("cardModal.action.launch.error"),body:ue instanceof Error?ue.message:String(ue)})}},children:[c.jsx(Qu,{size:14,strokeWidth:3}),a("cardModal.action.launch")]}),c.jsxs("button",{className:"nb-btn nb-btn-yellow",type:"button",onClick:async()=>{if(await o({title:a("cardModal.action.reset.confirm.title",{seq:t}),body:a("cardModal.action.reset.confirm.body"),confirm:a("cardModal.action.reset.confirm.button"),danger:!0}))try{await q4(e,t),i(),n()}catch(J){d({title:a("cardModal.action.reset.error"),body:J instanceof Error?J.message:String(J)})}},children:[c.jsx(Fb,{size:14,strokeWidth:2.5}),a("cardModal.action.reset")]}),c.jsxs("button",{className:"nb-btn nb-btn-lilac",type:"button",onClick:()=>S(!0),children:[c.jsx(Wu,{size:14,strokeWidth:2.5}),a("cardModal.action.viewPrompt")]}),c.jsxs("button",{className:"nb-btn",style:{background:"var(--color-crashed)",color:"var(--color-bg)"},type:"button",onClick:async()=>{if(!(!await o({title:a("cardModal.action.delete.confirm1.title",{seq:t}),body:a("cardModal.action.delete.confirm1.body",{title:f.title}),confirm:a("cardModal.action.delete.confirm1.button"),danger:!0})||!await o({title:a("cardModal.action.delete.confirm2.title"),body:a("cardModal.action.delete.confirm2.body",{seq:t}),confirm:a("cardModal.action.delete"),danger:!0})))try{await H4(e,t),i(),n()}catch(we){d({title:a("projectDetail.pipelines.delete.error"),body:we instanceof Error?we.message:String(we)})}},"aria-label":a("cardModal.action.delete"),children:[c.jsx(Vi,{size:14,strokeWidth:2.5}),a("cardModal.action.delete")]})]})})]})]}),v&&c.jsx(oP,{project:e,seq:t,onClose:()=>S(!1)})]})}function oP({project:e,seq:t,onClose:n}){const i=Pe(),[a,l]=j.useState(!1),{data:o,isLoading:d,isError:f,error:p}=Ve({queryKey:["card-prompt",e,t],queryFn:()=>F4(e,t),staleTime:0});j.useEffect(()=>{const m=y=>{y.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const g=()=>{o!=null&&o.prompt&&navigator.clipboard.writeText(o.prompt).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})};return c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-start justify-center p-6 bg-black/40 overflow-auto",onClick:n,children:c.jsxs("div",{className:"nb-card mt-8 w-full max-w-4xl",onClick:m=>m.stopPropagation(),children:[c.jsxs("header",{className:"flex items-center justify-between gap-4 mb-3",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold",children:i("cardModal.prompt.title")}),c.jsxs("div",{className:"flex items-center gap-2",children:[(o==null?void 0:o.prompt)&&c.jsxs("button",{className:"nb-btn px-3 py-2 text-sm flex items-center gap-1.5",type:"button",onClick:g,children:[c.jsx(n_,{size:14,strokeWidth:2.5}),i(a?"cardModal.prompt.copied":"cardModal.prompt.copy")]}),c.jsx("button",{className:"nb-btn nb-btn-mint p-2",type:"button",onClick:n,"aria-label":i("skillDetail.close.aria"),children:c.jsx(gn,{size:16,strokeWidth:3})})]})]}),d&&c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:i("cardModal.prompt.loading")}),f&&c.jsx("p",{className:"text-sm text-[var(--color-crashed)]",children:i("cardModal.prompt.error",{detail:p instanceof Error?p.message:String(p)})}),o&&c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("div",{className:"text-xs font-bold px-3 py-2 rounded-lg border-2 border-[var(--color-text)]",style:{background:o.meta.source==="actual"?"var(--color-accent-mint)":"var(--color-accent-yellow)"},children:o.meta.source==="actual"?i("cardModal.prompt.sourceActual",{time:o.meta.dispatchedAt?new Date(o.meta.dispatchedAt).toLocaleString():"—"}):i("cardModal.prompt.sourcePreview")}),o.meta.source==="preview"&&c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[c.jsx("span",{className:"nb-badge",children:i("cardModal.prompt.metaSkills",{skills:o.meta.skills.length?o.meta.skills.join(", "):"—"})}),o.meta.memoryIncluded&&c.jsx("span",{className:"nb-badge",children:i("cardModal.prompt.metaMemory")}),c.jsx("span",{className:"nb-badge",children:o.meta.git?i("cardModal.prompt.metaGit"):i("cardModal.prompt.metaNonGit")})]}),c.jsx("div",{className:"scroll-frame max-h-[60vh] rounded-lg border-2 border-[var(--color-text)] bg-surface-input",children:c.jsx("pre",{className:"scroll-frame-body max-h-[60vh] p-4 text-xs font-[family-name:var(--font-mono)] whitespace-pre-wrap break-words",children:o.prompt})}),o.meta.nativeContext.length>0&&c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)]",children:[c.jsx("p",{className:"font-bold mb-1",children:i("cardModal.prompt.nativeTitle")}),c.jsx("ul",{className:"list-disc pl-5 flex flex-col gap-0.5",children:o.meta.nativeContext.map(m=>c.jsx("li",{children:m},m))})]}),o.meta.notes.map(m=>c.jsx("p",{className:"text-xs text-[var(--color-text-subtle)] italic",children:m},m))]})]})})}function cP({current:e,onChange:t}){const[n,i]=j.useState(!1),a=j.useRef(null),{data:l}=Ve({queryKey:["projects"],queryFn:Es});return j.useEffect(()=>{const o=d=>{var f;(f=a.current)!=null&&f.contains(d.target)||i(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[]),c.jsxs("div",{className:"relative",ref:a,children:[c.jsxs("button",{type:"button",className:"nb-btn font-[family-name:var(--font-mono)] text-sm",onClick:()=>i(o=>!o),children:[e,c.jsx(Yu,{size:14,strokeWidth:2.5})]}),n&&l&&c.jsx("div",{className:"absolute right-0 mt-2 z-20 min-w-[200px] nb-card p-1 overflow-hidden",children:c.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:N_(l.data,"activity").map(o=>{const d=o.pipelineStatus==="running";return c.jsxs("button",{type:"button",onClick:()=>{t(o.name),i(!1)},className:["dimension-menu-item w-full text-left px-4 py-2 text-sm font-semibold flex items-center gap-2",o.name===e?"dimension-menu-item-active":""].join(" "),children:[d&&c.jsx(Qu,{size:12,strokeWidth:3,className:"text-[var(--color-running)] shrink-0","aria-label":"运行中"}),c.jsx("span",{className:"font-[family-name:var(--font-mono)]",children:o.name}),c.jsxs("span",{className:"ml-auto text-xs text-[var(--color-text-muted)]",children:[o.cards.total," cards"]})]},o.name)})})})]})}const uP=[{state:"Planning",labelKey:"board.col.planning",bg:"linear-gradient(180deg, rgba(139, 117, 255, 0.20), rgba(188, 166, 255, 0.075))",badgeVars:{"--skill-badge-lang-bg":"rgba(172, 153, 255, 0.30)","--skill-badge-end-bg":"rgba(151, 133, 239, 0.26)","--skill-badge-persona-bg":"rgba(193, 178, 255, 0.24)","--skill-badge-workflow-bg":"rgba(159, 146, 220, 0.27)","--skill-badge-other-bg":"rgba(126, 107, 206, 0.30)"}},{state:"Backlog",labelKey:"board.col.backlog",bg:"linear-gradient(180deg, rgba(147, 158, 190, 0.14), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(149, 160, 198, 0.24)","--skill-badge-end-bg":"rgba(128, 141, 176, 0.25)","--skill-badge-persona-bg":"rgba(165, 172, 199, 0.22)","--skill-badge-workflow-bg":"rgba(138, 152, 184, 0.26)","--skill-badge-other-bg":"rgba(116, 127, 158, 0.28)"}},{state:"Todo",labelKey:"board.col.todo",bg:"linear-gradient(180deg, rgba(239, 201, 126, 0.18), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(245, 207, 135, 0.28)","--skill-badge-end-bg":"rgba(226, 182, 101, 0.25)","--skill-badge-persona-bg":"rgba(249, 221, 159, 0.23)","--skill-badge-workflow-bg":"rgba(232, 193, 118, 0.27)","--skill-badge-other-bg":"rgba(204, 159, 84, 0.29)"}},{state:"Inprogress",labelKey:"board.col.inprogress",bg:"linear-gradient(180deg, rgba(98, 176, 242, 0.18), rgba(188, 166, 255, 0.065))",badgeVars:{"--skill-badge-lang-bg":"rgba(104, 181, 246, 0.28)","--skill-badge-end-bg":"rgba(79, 153, 223, 0.26)","--skill-badge-persona-bg":"rgba(136, 198, 250, 0.22)","--skill-badge-workflow-bg":"rgba(91, 166, 228, 0.27)","--skill-badge-other-bg":"rgba(67, 128, 197, 0.29)"}},{state:"QA",labelKey:"board.col.qa",bg:"linear-gradient(180deg, rgba(222, 171, 222, 0.18), rgba(188, 166, 255, 0.065))",badgeVars:{"--skill-badge-lang-bg":"rgba(226, 174, 226, 0.28)","--skill-badge-end-bg":"rgba(206, 145, 213, 0.25)","--skill-badge-persona-bg":"rgba(236, 197, 236, 0.22)","--skill-badge-workflow-bg":"rgba(215, 158, 218, 0.27)","--skill-badge-other-bg":"rgba(184, 125, 196, 0.29)"}},{state:"Done",labelKey:"board.col.done",bg:"linear-gradient(180deg, rgba(120, 214, 163, 0.18), rgba(188, 166, 255, 0.055))",badgeVars:{"--skill-badge-lang-bg":"rgba(125, 216, 166, 0.27)","--skill-badge-end-bg":"rgba(93, 190, 139, 0.25)","--skill-badge-persona-bg":"rgba(154, 226, 185, 0.22)","--skill-badge-workflow-bg":"rgba(107, 202, 150, 0.28)","--skill-badge-other-bg":"rgba(75, 166, 120, 0.29)"}}],D2="sps-console:last-board-project";function dP(){if(typeof window>"u")return null;try{return localStorage.getItem(D2)}catch{return null}}function fP(e){if(!(typeof window>"u"))try{localStorage.setItem(D2,e)}catch{}}function pP(){var I,H,W;const e=Pe(),[t,n]=QN(),i=t.get("project"),[a,l]=j.useState(null),[o,d]=j.useState(""),[f,p]=j.useState(()=>new Set),[g,m]=j.useState(()=>new Set),{confirm:y,alert:b}=un();Q4(i);const k=Ve({queryKey:["projects"],queryFn:Es}),v=Ve({queryKey:["cards",i],queryFn:()=>$4(i??""),enabled:!!i,refetchInterval:3e3}),S=Ft(),E=()=>{S.invalidateQueries({queryKey:["cards",i]}),S.invalidateQueries({queryKey:["projects"]}),S.invalidateQueries({queryKey:["pipeline-status",i]})},C=G=>{n({project:G})};j.useEffect(()=>{var L;if(i){fP(i);return}const G=dP();G&&((L=k.data)!=null&&L.data.some(z=>z.name===G))&&n({project:G},{replace:!0})},[i,k.data,n]);const N=Et({mutationFn:()=>A2(i),onSuccess:()=>{E()},onError:G=>{b({title:e("board.action.startError"),body:G instanceof Error?G.message:String(G)})}}),_=Et({mutationFn:()=>T2(i),onSuccess:()=>E(),onError:G=>{b({title:e("board.action.stopError"),body:G instanceof Error?G.message:String(G)})}}),T=Et({mutationFn:()=>W4(i,{all:!0}),onSuccess:()=>E(),onError:G=>{b({title:e("board.action.resetError"),body:G instanceof Error?G.message:String(G)})}}),[M,O]=j.useState(!1),R=Et({mutationFn:G=>G4(i,G),onSuccess:()=>{E(),O(!1)},onError:G=>{b({title:e("board.action.newCard.error"),body:G instanceof Error?G.message:String(G)})}}),B=Et({mutationFn:({seq:G,state:L})=>V4(i,G,L),onMutate:async({seq:G,state:L})=>{await S.cancelQueries({queryKey:["cards",i]});const z=S.getQueryData(["cards",i]);return z&&S.setQueryData(["cards",i],{...z,data:z.data.map(V=>V.seq===G?{...V,state:L}:V)}),{prev:z}},onError:(G,L,z)=>{z!=null&&z.prev&&S.setQueryData(["cards",i],z.prev),b({title:e("board.action.moveCard.error"),body:G instanceof Error?G.message:String(G)})},onSettled:()=>{S.invalidateQueries({queryKey:["cards",i]})}}),U=((I=v.data)==null?void 0:I.data)??[],{allSkills:K,allLabels:q}=j.useMemo(()=>{const G=new Set,L=new Set;for(const z of U){for(const V of z.skills)G.add(V);for(const V of z.labels)L.add(V)}return{allSkills:[...G].sort(),allLabels:[...L].sort()}},[U]);if(!i)return c.jsxs("div",{className:"flex flex-col gap-6 w-full",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold",children:e("board.title.bare")}),c.jsxs("div",{className:"nb-card bg-[var(--color-accent-yellow)] max-w-2xl",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-xl font-bold mb-3",children:e("board.pickPrompt.title")}),c.jsx("p",{className:"text-sm mb-4 text-[var(--color-text-muted)]",children:e("board.pickPrompt.body")}),c.jsx("div",{className:"flex flex-wrap gap-2",children:(H=k.data)==null?void 0:H.data.map(G=>c.jsx("button",{className:"nb-btn nb-btn-blue",onClick:()=>C(G.name),type:"button",children:G.name},G.name))})]})]});const Y=U.filter(G=>{if(o){const L=o.toLowerCase();if(!(G.title.toLowerCase().includes(L)||G.skills.some(V=>V.toLowerCase().includes(L))||G.labels.some(V=>V.toLowerCase().includes(L))))return!1}return!(f.size>0&&!G.skills.some(z=>f.has(z))||g.size>0&&!G.labels.some(z=>g.has(z)))}),D=(W=k.data)==null?void 0:W.data.find(G=>G.name===i),F=(D==null?void 0:D.pipelineStatus)==="running";return c.jsxs("div",{className:"flex flex-col gap-4 max-w-full flex-1 min-h-0",children:[c.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3 shrink-0",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold tracking-tight",children:e("board.title")}),c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm mt-1",children:D?e("board.subtitle",{name:D.name,cards:D.cards.total,workers:D.workers.active}):e("common.loading")})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c.jsx(cP,{current:i,onChange:C}),c.jsxs("button",{className:F?"nb-btn nb-btn-danger":"nb-btn nb-btn-primary",onClick:()=>F?_.mutate():N.mutate(),disabled:N.isPending||_.isPending,type:"button","aria-label":e(F?"board.action.stopAria":"board.action.startAria"),title:e(F?"board.action.stopAria":"board.action.startAria"),children:[N.isPending||_.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):F?c.jsx(Hb,{size:14,strokeWidth:3}):c.jsx(Qu,{size:14,strokeWidth:3}),e(F?"board.action.stop":"board.action.start")]}),c.jsxs("button",{className:"nb-btn nb-btn-yellow",type:"button",onClick:async()=>{await y({title:e("board.action.reset.confirm.title"),body:e("board.action.reset.confirm.body"),confirm:e("board.action.reset.confirm.button"),danger:!0})&&T.mutate()},disabled:T.isPending,children:[T.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(Fb,{size:14,strokeWidth:2.5}),e("board.action.reset")]}),c.jsxs("button",{className:"nb-btn nb-btn-mint",type:"button",onClick:()=>O(!0),disabled:R.isPending,children:[R.isPending?c.jsx(Xe,{size:14,strokeWidth:3,className:"animate-spin"}):c.jsx(hi,{size:14,strokeWidth:3}),e("board.action.newCard")]})]})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap shrink-0",children:[c.jsxs("div",{className:"relative flex-1 max-w-md",children:[c.jsx(fl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-subtle)]"}),c.jsx("input",{className:"nb-input pl-9 w-full",placeholder:e("board.search.placeholder"),value:o,onChange:G=>d(G.target.value),"aria-label":e("board.search.aria")})]}),c.jsx(Ik,{label:"skill",options:K,selected:f,onChange:p}),c.jsx(Ik,{label:"label",options:q,selected:g,onChange:m}),(o||f.size>0||g.size>0)&&c.jsxs("button",{className:"nb-btn",style:{padding:"4px 10px",fontSize:11},onClick:()=>{d(""),p(new Set),m(new Set)},type:"button","aria-label":e("board.filter.clearAria"),children:[c.jsx(gn,{size:11,strokeWidth:3}),e("board.filter.clear")]}),c.jsxs("span",{className:"text-xs text-[var(--color-text-muted)] flex items-center gap-1 font-[family-name:var(--font-mono)]",children:[c.jsx(kL,{size:12}),Y.length," / ",U.length]})]}),v.isError&&c.jsxs("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:[c.jsx("p",{className:"font-semibold",children:e("board.error.loadCards")}),c.jsx("p",{className:"text-sm mt-1 text-[var(--color-text-muted)]",children:v.error instanceof Error?v.error.message:String(v.error)})]}),!v.isError&&c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 auto-rows-fr gap-3 flex-1 min-h-0",children:uP.map(G=>c.jsx(sP,{label:e(G.labelKey),bg:G.bg,badgeVars:G.badgeVars,cards:Y.filter(hP(G.state)),onCardClick:L=>l(L.seq),onDropCard:L=>B.mutate({seq:L,state:G.state})},G.state))}),a!==null&&c.jsx(lP,{project:i,seq:a,onClose:()=>l(null),onChanged:E}),M&&c.jsx(B4,{project:i,isPending:R.isPending,onCancel:()=>O(!1),onCreate:G=>R.mutate(G)})]})}function hP(e){return t=>e==="QA"?t.state==="QA"||t.state==="Review":e==="Done"?t.state==="Done"||t.state==="Canceled":t.state===e}function Ik({label:e,options:t,selected:n,onChange:i}){const a=Pe(),[l,o]=j.useState(!1),d=j.useRef(null);j.useEffect(()=>{if(!l)return;const m=b=>{var k;(k=d.current)!=null&&k.contains(b.target)||o(!1)},y=b=>{b.key==="Escape"&&o(!1)};return window.addEventListener("click",m),window.addEventListener("keydown",y),()=>{window.removeEventListener("click",m),window.removeEventListener("keydown",y)}},[l]);const f=m=>{const y=new Set(n);y.has(m)?y.delete(m):y.add(m),i(y)},p=t.length===0,g=n.size;return c.jsxs("div",{ref:d,className:"relative",children:[c.jsxs("button",{type:"button",className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>!p&&o(m=>!m),disabled:p,"aria-haspopup":"listbox","aria-expanded":l,"aria-label":a("board.filter.aria",{label:e}),children:[e,g>0&&c.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-[10px] font-bold rounded-full bg-[var(--color-primary)] text-[var(--color-text)] border border-[var(--color-text)]",children:g}),c.jsx(Yu,{size:11,strokeWidth:3,className:["transition-transform",l?"rotate-180":""].join(" ")})]}),l&&c.jsx("div",{className:"absolute left-0 top-full mt-2 z-20 min-w-[200px] nb-card p-2 overflow-hidden",style:{padding:8},children:c.jsxs("div",{role:"listbox",className:"max-h-64 overflow-auto",children:[t.map(m=>{const y=n.has(m);return c.jsxs("label",{className:["flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer text-sm font-[family-name:var(--font-mono)]",y?"bg-[var(--color-accent-mint)]":"hover:bg-[var(--color-bg-cream)]"].join(" "),children:[c.jsx("input",{type:"checkbox",checked:y,onChange:()=>f(m),className:"flex-shrink-0"}),c.jsx("span",{className:"truncate",children:m})]},m)}),g>0&&c.jsx("button",{type:"button",className:"w-full mt-2 pt-2 border-t-2 border-dashed border-[var(--color-text)] text-xs font-bold text-[var(--color-crashed)] text-center",onClick:()=>i(new Set),children:a("board.filter.clearSelection")})]})})]})}function mP(){return ct("/api/workers/all")}function gP(e){return ct(`/api/projects/${encodeURIComponent(e)}/workers`)}function yP(e,t){return ct(`/api/projects/${encodeURIComponent(e)}/workers/${t}`)}async function O2(e,t){const n=await fetch(e,{method:"POST",headers:t?{"Content-Type":"application/json"}:void 0,body:t?JSON.stringify(t):void 0});if(!n.ok)throw new Error(`${n.status}: ${await n.text()}`);return n.json().catch(()=>({}))}function zk(e,t){return O2(`/api/projects/${encodeURIComponent(e)}/workers/${t}/kill`)}function bP(e,t,n){return O2(`/api/projects/${encodeURIComponent(e)}/workers/${t}/launch`,n?{seq:n}:void 0)}function gx({state:e}){const n={running:{bg:"var(--color-running-bg)",color:"var(--color-running)",label:"running"},starting:{bg:"var(--color-secondary)",color:"var(--color-text)",label:"starting",icon:c.jsx(Xe,{size:9,strokeWidth:3,className:"animate-spin"})},stuck:{bg:"var(--color-stuck-bg)",color:"var(--color-stuck)",label:"stuck"},crashed:{bg:"var(--color-crashed-bg)",color:"var(--color-crashed)",label:"crashed",icon:c.jsx(v3,{size:9,strokeWidth:2.5})},idle:{bg:"var(--color-idle-bg)",color:"var(--color-idle)",label:"idle"}}[e];return c.jsxs("span",{className:"nb-status inline-flex items-center gap-1",style:{background:n.bg,color:n.color},children:[n.icon,n.label]})}function yx(e){if(e==null||e<=0)return"—";const t=Math.floor(e/1e3),n=Math.floor(t/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?`${n}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function xP(e){if(e==null||e<=0)return"text-[var(--color-text-muted)]";const t=e/6e4;return t<10?"text-[var(--color-running)]":t<60?"text-[var(--color-stuck)]":"text-[var(--color-crashed)]"}function bx(e){const t=Date.now()-new Date(e).getTime();return t<6e4?`${Math.floor(t/1e3)}s 前`:t<36e5?`${Math.floor(t/6e4)}m 前`:`${Math.floor(t/36e5)}h 前`}function vP({alerts:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?c.jsxs("div",{className:"nb-card bg-[var(--color-running-bg)] flex items-center gap-3",children:[c.jsx(Su,{size:18,strokeWidth:2.5,className:"text-[var(--color-running)]"}),c.jsx("span",{className:"text-sm font-bold text-[var(--color-running)]",children:i("workers.alerts.allHealthy")})]}):c.jsxs("section",{children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 flex items-center gap-2 text-[var(--color-crashed)]",children:[c.jsx(O3,{size:14,strokeWidth:2.5}),"Alerts (",e.length,")"]}),c.jsx("div",{className:"flex flex-col gap-2",children:e.map(a=>{const l=(t==null?void 0:t.project)===a.project&&(t==null?void 0:t.slot)===a.slot;return c.jsxs("button",{type:"button",onClick:()=>n(a.project,a.slot),className:["nb-card p-3 text-left",a.state==="crashed"?"bg-[var(--color-crashed-bg)]":"bg-[var(--color-stuck-bg)]",l?"ring-4 ring-[var(--color-text)]":""].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx(gx,{state:a.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold",children:[a.project,"/worker-",a.slot]}),a.card&&c.jsxs("span",{className:"truncate",children:["#",a.card.seq," ",a.card.title]}),c.jsxs("span",{className:"ml-auto text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] flex items-center gap-1",children:[c.jsx(t_,{size:10,strokeWidth:2.5}),yx(a.runtimeMs)]})]}),a.markerUpdatedAt&&c.jsx("div",{className:"text-xs text-[var(--color-text-muted)] mt-1 font-[family-name:var(--font-mono)]",children:a.state==="crashed"?i("workers.alerts.pidDead"):i("workers.alerts.markerStale",{ago:bx(a.markerUpdatedAt)})})]},`${a.project}-${a.slot}`)})})]})}function wP({active:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?c.jsx("div",{className:"nb-card",children:c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] italic",children:i("workers.active.empty")})}):c.jsxs("section",{children:[c.jsxs("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 flex items-center gap-2",children:[c.jsx(qp,{size:14,strokeWidth:2.5}),"Active (",e.length,")"]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e.map(a=>{const l=(t==null?void 0:t.project)===a.project&&(t==null?void 0:t.slot)===a.slot;return c.jsxs("button",{type:"button",onClick:()=>n(a.project,a.slot),className:["nb-card p-3 text-left",a.state==="starting"?"bg-[var(--color-secondary)]":"bg-[var(--color-running-bg)]",l?"ring-4 ring-[var(--color-text)]":""].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(gx,{state:a.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-sm flex-1 truncate",children:[a.project,"/worker-",a.slot]}),c.jsx("span",{className:`text-xs font-[family-name:var(--font-mono)] ${xP(a.runtimeMs)}`,children:yx(a.runtimeMs)})]}),a.card&&c.jsxs("div",{className:"text-sm font-semibold mb-1 truncate",children:["#",a.card.seq," · ",a.card.title]}),c.jsxs("div",{className:"text-xs text-[var(--color-text-muted)] font-[family-name:var(--font-mono)] flex items-center gap-2 mb-1",children:[a.stage&&c.jsxs("span",{children:["stage: ",a.stage]}),a.markerUpdatedAt&&c.jsxs("span",{className:"ml-auto",children:["marker ",bx(a.markerUpdatedAt)]})]}),a.lastLogLine&&c.jsxs("div",{className:"text-[11px] font-[family-name:var(--font-mono)] text-[var(--color-text-muted)] bg-[var(--color-bg)] border-2 border-[var(--color-text)] rounded px-2 py-1 mt-2 truncate",children:[c.jsx(p_,{size:9,strokeWidth:2.5,className:"inline-block mr-1 align-text-bottom"}),a.lastLogLine.msg]})]},`${a.project}-${a.slot}`)})})]})}function kP({capacity:e,selected:t,onSelect:n}){const i=Pe();return e.length===0?null:c.jsxs("section",{className:"flex flex-col min-h-0 flex-1",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-sm font-bold uppercase tracking-wider mb-2 shrink-0",children:"Capacity"}),c.jsxs("div",{className:"scroll-frame min-h-0 flex-1 rounded-lg border-2 border-[var(--color-border-light)] bg-[var(--color-bg-cream)] flex flex-col",children:[c.jsxs("table",{className:"w-full table-fixed text-sm shrink-0",children:[c.jsx(Pk,{}),c.jsx("thead",{children:c.jsxs("tr",{className:"border-b-2 border-[var(--color-border-light)] bg-[var(--color-bg-soft)]",children:[c.jsx("th",{className:"px-3 py-2 text-left font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.project")}),c.jsx("th",{className:"px-3 py-2 text-left font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.usage")}),c.jsx("th",{className:"px-3 py-2 text-right font-bold text-xs uppercase tracking-wider",children:"running"}),c.jsx("th",{className:"px-3 py-2 text-right font-bold text-xs uppercase tracking-wider",children:i("workers.capacity.col.other")}),c.jsx("th",{className:"px-3 py-2"})]})})]}),c.jsx("div",{className:"bg-color-bg-soft scroll-frame-body flex-1",children:c.jsxs("table",{className:"w-full table-fixed text-sm",children:[c.jsx(Pk,{}),c.jsx("tbody",{children:e.map(a=>c.jsx(EP,{capacity:a,selected:(t==null?void 0:t.project)===a.project,onSelect:()=>n(a.project)},a.project))})]})})]})]})}function Pk(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"w-[24%]"}),c.jsx("col",{className:"w-[28%]"}),c.jsx("col",{className:"w-[16%]"}),c.jsx("col",{className:"w-[20%]"}),c.jsx("col",{className:"w-[12%]"})]})}function EP({capacity:e,selected:t,onSelect:n}){const i=Pe(),a=e.running+e.starting+e.stuck+e.crashed;return c.jsxs("tr",{onClick:n,className:["border-b border-dashed border-[var(--color-border-light)] last:border-0 cursor-pointer hover:bg-[var(--color-accent-yellow)]",t?"bg-[var(--color-accent-yellow)]":""].join(" "),children:[c.jsx("td",{className:"px-3 py-2 font-[family-name:var(--font-mono)] font-bold",children:e.project}),c.jsx("td",{className:"px-3 py-2",children:c.jsx(SP,{total:e.total,cap:e})}),c.jsxs("td",{className:"px-3 py-2 text-right font-[family-name:var(--font-mono)]",children:[c.jsx("span",{className:"text-[var(--color-running)] font-bold",children:e.running}),c.jsxs("span",{className:"text-[var(--color-text-muted)]",children:["/",e.total]})]}),c.jsxs("td",{className:"px-3 py-2 text-right text-xs font-[family-name:var(--font-mono)] text-[var(--color-text-muted)]",children:[e.starting>0&&c.jsxs("span",{className:"mr-2",children:["starting ",e.starting]}),e.stuck>0&&c.jsxs("span",{className:"text-[var(--color-stuck)] font-bold mr-2",children:["stuck ",e.stuck]}),e.crashed>0&&c.jsxs("span",{className:"text-[var(--color-crashed)] font-bold mr-2",children:["crashed ",e.crashed]}),a===0&&c.jsx("span",{children:"idle"})]}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("span",{className:"text-xs text-[var(--color-text-muted)]",children:i("workers.capacity.detailHint")})})]})}function SP({total:e,cap:t}){const n=[];for(let i=0;i<t.crashed;i++)n.push("crashed");for(let i=0;i<t.stuck;i++)n.push("stuck");for(let i=0;i<t.starting;i++)n.push("starting");for(let i=0;i<t.running;i++)n.push("running");for(let i=0;i<t.idle;i++)n.push("idle");return c.jsxs("div",{className:"flex gap-1 items-center",children:[n.map((i,a)=>c.jsx("span",{className:"inline-block w-3 h-3 rounded-full border-2 border-[var(--color-text)]",style:{background:NP(i)},title:i},a)),c.jsxs("span",{className:"text-xs text-[var(--color-text-muted)] ml-2 font-[family-name:var(--font-mono)]",children:[e," slot",e!==1?"s":""]})]})}function NP(e){switch(e){case"running":return"var(--color-running-bg)";case"starting":return"var(--color-secondary)";case"stuck":return"var(--color-stuck-bg)";case"crashed":return"var(--color-crashed-bg)";default:return"var(--color-idle-bg)"}}function _P({project:e,initialSlot:t,onChange:n}){var p;const i=Pe(),a=Ve({queryKey:["workers",e],queryFn:()=>gP(e),refetchInterval:3e3}),l=((p=a.data)==null?void 0:p.data)??[],[o,d]=j.useState(null);j.useEffect(()=>{if(l.length===0){d(null);return}const g=l[0].slot;d(m=>m!=null&&l.some(y=>y.slot===m)?m:t!=null&&l.some(y=>y.slot===t)?t:g)},[e,t,l.length]);const f=l.find(g=>g.slot===o)??null;return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"px-4 bg-color-bg-soft py-3 border-b-2 border-[var(--color-text)] bg-[var(--color-bg-cream)]",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("span",{className:"font-[family-name:var(--font-mono)] font-bold truncate",children:e}),c.jsx(vs,{to:`/board?project=${encodeURIComponent(e)}`,className:"text-xs underline text-[var(--color-text-muted)] hover:text-[var(--color-text)]",children:i("workers.panel.boardLink")})]}),a.isLoading&&l.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.loading")}):l.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.empty.slots")}):c.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(g=>c.jsx(jP,{worker:g,active:g.slot===o,onClick:()=>d(g.slot)},g.slot))})]}),f?c.jsx(CP,{project:e,worker:f,onChange:n}):c.jsx("div",{className:"flex-1 flex items-center justify-center p-6 text-center",children:c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:l.length===0?i("workers.panel.empty.noWorker"):i("workers.panel.empty.pickOne")})})]})}function jP({worker:e,active:t,onClick:n}){const i=Pe();return c.jsxs("button",{type:"button",onClick:n,className:["nb-card p-2 text-left min-w-[130px] transition-transform",t?"ring-4 ring-[var(--color-text)]":"opacity-80 hover:opacity-100"].join(" "),children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(gx,{state:e.state}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-xs",children:["worker-",e.slot]})]}),e.card?c.jsxs("div",{className:"text-[11px] truncate font-[family-name:var(--font-mono)]",children:["#",e.card.seq," ",e.card.title]}):c.jsx("div",{className:"text-[11px] text-[var(--color-text-muted)] italic",children:i("workers.panel.idle.short")})]})}function CP({project:e,worker:t,onChange:n}){var y,b;const i=Pe(),{confirm:a,alert:l}=un(),o=t.state==="crashed"||t.state==="stuck",d=Ve({queryKey:["worker-detail",e,t.slot],queryFn:()=>yP(e,t.slot),refetchInterval:3e3}),f=((y=d.data)==null?void 0:y.recentOutput)??[],p=((b=d.data)==null?void 0:b.recentLogs)??[],g=j.useRef(null),m=j.useRef(!0);return j.useEffect(()=>{const k=g.current;k&&m.current&&(k.scrollTop=k.scrollHeight)},[f]),c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex-1 overflow-auto p-4 flex flex-col gap-4",children:[t.card?c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-[var(--color-text-muted)] mb-1",children:i("workers.panel.section.currentCard")}),c.jsxs("div",{className:"text-sm font-semibold break-words",children:["#",t.card.seq," · ",t.card.title]})]}):c.jsx("div",{className:"text-sm text-[var(--color-text-muted)] italic",children:i("workers.panel.idle.full")}),c.jsxs("dl",{className:"grid grid-cols-[100px_1fr] gap-y-2 text-sm",children:[c.jsx("dt",{className:"font-bold",children:"Stage"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.stage??"—"}),c.jsx("dt",{className:"font-bold",children:"PID"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:t.pid??"—"}),c.jsx("dt",{className:"font-bold",children:"Runtime"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)]",children:yx(t.runtimeMs)}),c.jsx("dt",{className:"font-bold",children:"Started"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)] text-xs",children:t.startedAt?new Date(t.startedAt).toLocaleString():"—"}),c.jsx("dt",{className:"font-bold",children:"Marker"}),c.jsx("dd",{className:"font-[family-name:var(--font-mono)] text-xs",children:t.markerUpdatedAt?bx(t.markerUpdatedAt):"—"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-[var(--color-text-muted)] mb-1 flex items-center gap-1",children:[c.jsx(p_,{size:10,strokeWidth:2.5}),i("workers.panel.section.claudeOutput",{n:f.length})]}),d.isLoading&&f.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.output.loading")}):f.length===0?c.jsx("p",{className:"text-xs text-[var(--color-text-muted)] italic",children:i("workers.panel.output.empty")}):c.jsx("pre",{ref:g,onScroll:k=>{const v=k.currentTarget;m.current=v.scrollHeight-v.scrollTop-v.clientHeight<24},className:"text-xs font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded p-2 max-h-80 overflow-auto whitespace-pre-wrap break-words",children:f.map(k=>`${k.ts?`${k.ts} [${k.kind}] `:`[${k.kind}] `}${k.text}`).join(`
|
|
620
620
|
`)})]}),p.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-[var(--color-text-muted)] mb-1 opacity-60",children:i("workers.panel.section.heartbeat",{n:p.length})}),c.jsx("pre",{className:"text-xs font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap break-words opacity-80",children:p.map(k=>`${k.ts??""} [${k.level}] ${k.msg}`).join(`
|
|
621
|
-
`)}),c.jsx(vs,{to:`/projects/${encodeURIComponent(e)}?tab=logs&worker=${t.slot}`,className:"text-xs underline text-[var(--color-running)] mt-1 inline-block",children:i("workers.panel.heartbeat.fullLog")})]})]}),c.jsxs("div",{className:"px-4 py-3 border-t-2 border-[var(--color-text)] bg-[var(--color-bg-cream)] flex gap-2 justify-end flex-wrap",children:[o&&t.card&&c.jsxs("button",{type:"button",className:"nb-btn nb-btn-mint",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{if(await a({title:i("workers.panel.action.restart.confirm.title",{slot:t.slot}),body:i("workers.panel.action.restart.confirm.body",{seq:t.card.seq}),confirm:i("workers.panel.action.restart.confirm.button")})){try{await zk(e,t.slot)}catch{}try{await b5(e,t.slot,t.card.seq),n()}catch(v){l({title:i("workers.panel.action.restart.error"),body:v instanceof Error?v.message:String(v)})}}},children:[c.jsx(C3,{size:11,strokeWidth:2.5})," ",i("workers.panel.action.restart")]}),t.state!=="idle"&&c.jsxs("button",{type:"button",className:"nb-btn nb-btn-danger",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{if(await a({title:i("workers.panel.action.kill.confirm.title",{slot:t.slot}),body:i("workers.panel.action.kill.confirm.body"),confirm:i("workers.panel.action.kill.confirm.button"),danger:!0}))try{await zk(e,t.slot),n()}catch(v){l({title:i("workers.panel.action.kill.error"),body:v instanceof Error?v.message:String(v)})}},children:[c.jsx($3,{size:11,strokeWidth:2.5})," ",i("workers.panel.action.kill")]})]})]})}function A5(){var o;const e=Pe(),t=Ft(),[n,i]=j.useState(null),a=Ve({queryKey:["workers-agg"],queryFn:m5,refetchInterval:5e3});j.useEffect(()=>{if(!a.data)return;const d=a.data.capacity.map(p=>p.project),f=[];for(const p of d){const g=new EventSource(`/stream/projects/${encodeURIComponent(p)}`),m=()=>{t.invalidateQueries({queryKey:["workers-agg"]})};g.addEventListener("worker.updated",m),g.addEventListener("worker.added",m),g.addEventListener("worker.deleted",m),g.addEventListener("card.updated",m),f.push(g)}return()=>{for(const p of f)p.close()}},[(o=a.data)==null?void 0:o.capacity.map(d=>d.project).join(","),t]);const l=j.useMemo(()=>{if(!a.data)return{projects:0,running:0,starting:0,stuck:0,crashed:0,idle:0};const d={projects:a.data.capacity.length,running:0,starting:0,stuck:0,crashed:0,idle:0};for(const f of a.data.capacity)d.running+=f.running,d.starting+=f.starting,d.stuck+=f.stuck,d.crashed+=f.crashed,d.idle+=f.idle;return d},[a.data]);return c.jsxs("div",{className:"flex flex-col gap-4 h-[calc(100vh-140px)]",children:[c.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold tracking-tight",children:e("workers.title")}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:e("workers.summary",{projects:l.projects,running:l.running,starting:l.starting,stuck:l.stuck,crashed:l.crashed,idle:l.idle})})]}),c.jsxs("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>a.refetch(),disabled:a.isFetching,type:"button","aria-label":e("workers.refresh.aria"),children:[a.isFetching?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(ya,{size:12,strokeWidth:2.5}),e("workers.refresh")]})]}),c.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0",children:[c.jsxs("div",{className:"flex flex-col gap-4 min-h-0 pr-2",children:[a.isLoading&&c.jsx("p",{className:"text-[var(--color-text-muted)] italic",children:e("common.loading")}),a.isError&&c.jsx("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:c.jsx("p",{children:e("workers.error.load",{detail:a.error instanceof Error?a.error.message:String(a.error)})})}),a.data&&c.jsxs(c.Fragment,{children:[c.jsx(v5,{alerts:a.data.alerts,selected:n,onSelect:(d,f)=>i({project:d,slot:f})}),c.jsx(w5,{active:a.data.active,selected:n,onSelect:(d,f)=>i({project:d,slot:f})}),c.jsx(k5,{capacity:a.data.capacity,selected:n,onSelect:d=>i({project:d})})]})]}),c.jsx("aside",{className:"nb-card p-0 overflow-hidden flex flex-col h-full",children:n?c.jsx(_5,{project:n.project,initialSlot:n.slot,onChange:()=>t.invalidateQueries({queryKey:["workers-agg"]})}):c.jsx("div",{className:"flex-1 bg-color-bg-soft bg-surface-input flex items-center justify-center p-6 text-center",children:c.jsxs("div",{children:[c.jsx(qp,{size:32,className:"mx-auto mb-3 text-[var(--color-text-subtle)]",strokeWidth:2}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:e("workers.empty.hint")})]})})})]})]})}function R2(){return ct("/api/gen/jobs")}function T5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const M5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,D5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O5={};function Bk(e,t){return(O5.jsx?D5:M5).test(e)}const R5=/[ \t\n\f\r]/g;function L5(e){return typeof e=="object"?e.type==="text"?$k(e.value):!1:$k(e)}function $k(e){return e.replace(R5,"")===""}class ed{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}ed.prototype.normal={};ed.prototype.property={};ed.prototype.space=void 0;function L2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new ed(n,i,t)}function eb(e){return e.toLowerCase()}class mi{constructor(t,n){this.attribute=n,this.property=t}}mi.prototype.attribute="";mi.prototype.booleanish=!1;mi.prototype.boolean=!1;mi.prototype.commaOrSpaceSeparated=!1;mi.prototype.commaSeparated=!1;mi.prototype.defined=!1;mi.prototype.mustUseProperty=!1;mi.prototype.number=!1;mi.prototype.overloadedBoolean=!1;mi.prototype.property="";mi.prototype.spaceSeparated=!1;mi.prototype.space=void 0;let I5=0;const ft=El(),Nn=El(),tb=El(),Te=El(),Yt=El(),So=El(),Ei=El();function El(){return 2**++I5}const nb=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:Nn,commaOrSpaceSeparated:Ei,commaSeparated:So,number:Te,overloadedBoolean:tb,spaceSeparated:Yt},Symbol.toStringTag,{value:"Module"})),qg=Object.keys(nb);class xx extends mi{constructor(t,n,i,a){let l=-1;if(super(t,n),Uk(this,"space",a),typeof i=="number")for(;++l<qg.length;){const o=qg[l];Uk(this,qg[l],(i&nb[o])===nb[o])}}}xx.prototype.defined=!0;function Uk(e,t,n){n&&(e[t]=n)}function lc(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const l=new xx(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(l.mustUseProperty=!0),t[i]=l,n[eb(i)]=i,n[eb(l.attribute)]=i}return new ed(t,n,e.space)}const I2=lc({properties:{ariaActiveDescendant:null,ariaAtomic:Nn,ariaAutoComplete:null,ariaBusy:Nn,ariaChecked:Nn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:Yt,ariaCurrent:null,ariaDescribedBy:Yt,ariaDetails:null,ariaDisabled:Nn,ariaDropEffect:Yt,ariaErrorMessage:null,ariaExpanded:Nn,ariaFlowTo:Yt,ariaGrabbed:Nn,ariaHasPopup:null,ariaHidden:Nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Yt,ariaLevel:Te,ariaLive:null,ariaModal:Nn,ariaMultiLine:Nn,ariaMultiSelectable:Nn,ariaOrientation:null,ariaOwns:Yt,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:Nn,ariaReadOnly:Nn,ariaRelevant:null,ariaRequired:Nn,ariaRoleDescription:Yt,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:Nn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function z2(e,t){return t in e?e[t]:t}function P2(e,t){return z2(e,t.toLowerCase())}const z5=lc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:So,acceptCharset:Yt,accessKey:Yt,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:Yt,autoFocus:ft,autoPlay:ft,blocking:Yt,capture:null,charSet:null,checked:ft,cite:null,className:Yt,cols:Te,colSpan:null,content:null,contentEditable:Nn,controls:ft,controlsList:Yt,coords:Te|So,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:tb,draggable:Nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:Yt,height:Te,hidden:tb,high:Te,href:null,hrefLang:null,htmlFor:Yt,httpEquiv:Yt,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:Yt,itemRef:Yt,itemScope:ft,itemType:Yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:ft,muted:ft,name:null,nonce:null,noModule:ft,noValidate:ft,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ft,optimum:Te,pattern:null,ping:Yt,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:Yt,required:ft,reversed:ft,rows:Te,rowSpan:Te,sandbox:Yt,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:Nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:Nn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Yt,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ft,declare:ft,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:Nn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:P2}),P5=lc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ei,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:Yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:So,g2:So,glyphName:So,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:Ei,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ei,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ei,rev:Ei,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ei,requiredFeatures:Ei,requiredFonts:Ei,requiredFormats:Ei,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:Ei,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ei,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ei,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:z2}),B2=lc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$2=lc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:P2}),U2=lc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),B5={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$5=/[A-Z]/g,Fk=/-[a-z]/g,U5=/^data[-\w.:]+$/i;function F5(e,t){const n=eb(t);let i=t,a=mi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&U5.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Fk,H5);i="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Fk.test(l)){let o=l.replace($5,q5);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=xx}return new a(i,t)}function q5(e){return"-"+e.toLowerCase()}function H5(e){return e.charAt(1).toUpperCase()}const K5=L2([I2,z5,B2,$2,U2],"html"),vx=L2([I2,P5,B2,$2,U2],"svg");function G5(e){return e.join(" ").trim()}var oo={},Hg,qk;function V5(){if(qk)return Hg;qk=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
622
|
-
`,p="/",g="*",m="",y="comment",b="declaration";function k(S,E){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];E=E||{};var C=1,N=1;function _(D){var F=D.match(t);F&&(C+=F.length);var I=D.lastIndexOf(f);N=~I?D.length-I:N+D.length}function T(){var D={line:C,column:N};return function(F){return F.position=new M(D),B(),F}}function M(D){this.start=D,this.end={line:C,column:N},this.source=E.source}M.prototype.content=S;function O(D){var F=new Error(E.source+":"+C+":"+N+": "+D);if(F.reason=D,F.filename=E.source,F.line=C,F.column=N,F.source=S,!E.silent)throw F}function R(D){var F=D.exec(S);if(F){var I=F[0];return _(I),S=S.slice(I.length),F}}function B(){R(n)}function U(D){var F;for(D=D||[];F=K();)F!==!1&&D.push(F);return D}function K(){var D=T();if(!(p!=S.charAt(0)||g!=S.charAt(1))){for(var F=2;m!=S.charAt(F)&&(g!=S.charAt(F)||p!=S.charAt(F+1));)++F;if(F+=2,m===S.charAt(F-1))return O("End of comment missing");var I=S.slice(2,F-2);return N+=2,_(I),S=S.slice(F),N+=2,D({type:y,comment:I})}}function q(){var D=T(),F=R(i);if(F){if(K(),!R(a))return O("property missing ':'");var I=R(l),H=D({type:b,property:v(F[0].replace(e,m)),value:I?v(I[0].replace(e,m)):m});return R(o),H}}function Y(){var D=[];U(D);for(var F;F=q();)F!==!1&&(D.push(F),U(D));return D}return B(),Y()}function v(S){return S?S.replace(d,m):m}return Hg=k,Hg}var Hk;function Y5(){if(Hk)return oo;Hk=1;var e=oo&&oo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(oo,"__esModule",{value:!0}),oo.default=n;const t=e(V5());function n(i,a){let l=null;if(!i||typeof i!="string")return l;const o=(0,t.default)(i),d=typeof a=="function";return o.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:g}=f;d?a(p,g,f):g&&(l=l||{},l[p]=g)}),l}return oo}var nu={},Kk;function W5(){if(Kk)return nu;Kk=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(p){return!p||n.test(p)||e.test(p)},o=function(p,g){return g.toUpperCase()},d=function(p,g){return"".concat(g,"-")},f=function(p,g){return g===void 0&&(g={}),l(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,d):p=p.replace(i,d),p.replace(t,o))};return nu.camelCase=f,nu}var iu,Gk;function Q5(){if(Gk)return iu;Gk=1;var e=iu&&iu.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(Y5()),n=W5();function i(a,l){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(d,f){d&&f&&(o[(0,n.camelCase)(d,l)]=f)}),o}return i.default=i,iu=i,iu}var X5=Q5();const Z5=Hu(X5),F2=q2("end"),wx=q2("start");function q2(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function J5(e){const t=wx(e),n=F2(e);if(t&&n)return{start:t,end:n}}function hu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vk(e.position):"start"in e||"end"in e?Vk(e):"line"in e||"column"in e?ib(e):""}function ib(e){return Yk(e&&e.line)+":"+Yk(e&&e.column)}function Vk(e){return ib(e&&e.start)+"-"+ib(e&&e.end)}function Yk(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(o=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?l.ruleId=i:(l.source=i.slice(0,f),l.ruleId=i.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=hu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const kx={}.hasOwnProperty,eP=new Map,tP=/[A-Z]/g,nP=new Set(["table","tbody","thead","tfoot","tr"]),iP=new Set(["td","th"]),H2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function rP(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=fP(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=dP(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?vx:K5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=K2(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function K2(e,t,n){if(t.type==="element")return aP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return sP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return oP(e,t,n);if(t.type==="mdxjsEsm")return lP(e,t);if(t.type==="root")return cP(e,t,n);if(t.type==="text")return uP(e,t)}function aP(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=vx,e.schema=a),e.ancestors.push(t);const l=V2(e,t.tagName,!1),o=pP(e,t);let d=Sx(e,t);return nP.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!L5(f):!0})),G2(e,o,l,t),Ex(o,d),e.ancestors.pop(),e.schema=i,e.create(t,l,o,n)}function sP(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Cu(e,t.position)}function lP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cu(e,t.position)}function oP(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=vx,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:V2(e,t.name,!0),o=hP(e,t),d=Sx(e,t);return G2(e,o,l,t),Ex(o,d),e.ancestors.pop(),e.schema=i,e.create(t,l,o,n)}function cP(e,t,n){const i={};return Ex(i,Sx(e,t)),e.create(t,e.Fragment,i,n)}function uP(e,t){return t.value}function G2(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Ex(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function dP(e,t,n){return i;function i(a,l,o,d){const p=Array.isArray(o.children)?n:t;return d?p(l,o,d):p(l,o)}}function fP(e,t){return n;function n(i,a,l,o){const d=Array.isArray(l.children),f=wx(i);return t(a,l,o,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function pP(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&kx.call(t.properties,a)){const l=mP(e,a,t.properties[a]);if(l){const[o,d]=l;e.tableCellAlignToStyle&&o==="align"&&typeof d=="string"&&iP.has(t.tagName)?i=d:n[o]=d}}if(i){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function hP(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];l.type;const o=l.expression;o.type;const d=o.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Cu(e,t.position);else{const a=i.name;let l;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const d=i.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Cu(e,t.position);else l=i.value===null?!0:i.value;n[a]=l}return n}function Sx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:eP;for(;++i<t.children.length;){const l=t.children[i];let o;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const p=a.get(f)||0;o=f+"-"+p,a.set(f,p+1)}}const d=K2(e,l,o);d!==void 0&&n.push(d)}return n}function mP(e,t,n){const i=F5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?T5(n):G5(n)),i.property==="style"){let a=typeof n=="object"?n:gP(e,String(n));return e.stylePropertyNameCase==="css"&&(a=yP(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?B5[i.property]||i.property:i.attribute,n]}}function gP(e,t){try{return Z5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=H2+"#cannot-parse-style-attribute",a}}function V2(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,o;for(;++l<a.length;){const d=Bk(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};o=o?{type:"MemberExpression",object:o,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}i=o}else i=Bk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return kx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Cu(e)}function Cu(e,t){const n=new Yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=H2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function yP(e){const t={};let n;for(n in e)kx.call(e,n)&&(t[bP(n)]=e[n]);return t}function bP(e){let t=e.replace(tP,xP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xP(e){return"-"+e.toLowerCase()}const Kg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vP={};function Nx(e,t){const n=vP,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Y2(e,i,a)}function Y2(e,t,n){if(wP(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wk(e.children,t,n)}return Array.isArray(e)?Wk(e,t,n):""}function Wk(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=Y2(e[a],t,n);return i.join("")}function wP(e){return!!(e&&typeof e=="object")}const Qk=document.createElement("i");function _x(e){const t="&"+e+";";Qk.innerHTML=t;const n=Qk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ji(e,t,n,i){const a=e.length;let l=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<i.length;)o=i.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}function Hi(e,t){return e.length>0?(ji(e,e.length,0,t),e):t}const Xk={}.hasOwnProperty;function W2(e){const t={};let n=-1;for(;++n<e.length;)kP(t,e[n]);return t}function kP(e,t){let n;for(n in t){const a=(Xk.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let o;if(l)for(o in l){Xk.call(a,o)||(a[o]=[]);const d=l[o];EP(a[o],Array.isArray(d)?d:d?[d]:[])}}}function EP(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);ji(e,0,0,i)}function Q2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function fr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ni=Ns(/[A-Za-z]/),Gn=Ns(/[\dA-Za-z]/),SP=Ns(/[#-'*+\--9=?A-Z^-~]/);function kp(e){return e!==null&&(e<32||e===127)}const rb=Ns(/\d/),NP=Ns(/[\dA-Fa-f]/),_P=Ns(/[!-/:-@[-`{-~]/);function Je(e){return e!==null&&e<-2}function Kt(e){return e!==null&&(e<0||e===32)}function gt(e){return e===-2||e===-1||e===32}const sh=Ns(new RegExp("\\p{P}|\\p{S}","u")),ml=Ns(/\s/);function Ns(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function oc(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let o="";if(l===37&&Gn(e.charCodeAt(n+1))&&Gn(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(o=String.fromCharCode(l,d),a=1):o="�"}else o=String.fromCharCode(l);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function St(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(f){return gt(f)?(e.enter(n),d(f)):t(f)}function d(f){return gt(f)&&l++<a?(e.consume(f),d):(e.exit(n),t(f))}}const jP={tokenize:CP};function CP(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),St(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),l(d)}function l(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,o(d)}function o(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Je(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),o)}}const AP={tokenize:TP},Zk={tokenize:MP};function TP(e){const t=this,n=[];let i=0,a,l,o;return d;function d(N){if(i<n.length){const _=n[i];return t.containerState=_[1],e.attempt(_[0].continuation,f,p)(N)}return p(N)}function f(N){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const _=t.events.length;let T=_,M;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){M=t.events[T][1].end;break}E(i);let O=_;for(;O<t.events.length;)t.events[O][1].end={...M},O++;return ji(t.events,T+1,0,t.events.slice(_)),t.events.length=O,p(N)}return d(N)}function p(N){if(i===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return k(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zk,g,m)(N)}function g(N){return a&&C(),E(i),y(N)}function m(N){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,k(N)}function y(N){return t.containerState={},e.attempt(Zk,b,k)(N)}function b(N){return i++,n.push([t.currentConstruct,t.containerState]),y(N)}function k(N){if(N===null){a&&C(),E(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),v(N)}function v(N){if(N===null){S(e.exit("chunkFlow"),!0),E(0),e.consume(N);return}return Je(N)?(e.consume(N),S(e.exit("chunkFlow")),i=0,t.interrupt=void 0,d):(e.consume(N),v)}function S(N,_){const T=t.sliceStream(N);if(_&&T.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write(T),t.parser.lazy[N.start.line]){let M=a.events.length;for(;M--;)if(a.events[M][1].start.offset<o&&(!a.events[M][1].end||a.events[M][1].end.offset>o))return;const O=t.events.length;let R=O,B,U;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(B){U=t.events[R][1].end;break}B=!0}for(E(i),M=O;M<t.events.length;)t.events[M][1].end={...U},M++;ji(t.events,R+1,0,t.events.slice(O)),t.events.length=M}}function E(N){let _=n.length;for(;_-- >N;){const T=n[_];t.containerState=T[1],T[0].exit.call(t,e)}n.length=N}function C(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function MP(e,t,n){return St(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fo(e){if(e===null||Kt(e)||ml(e))return 1;if(sh(e))return 2}function lh(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!i.includes(l)&&(t=l(t,n),i.push(l))}return t}const ab={name:"attention",resolveAll:DP,tokenize:OP};function DP(e,t){let n=-1,i,a,l,o,d,f,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[i][1].end},y={...e[n][1].start};Jk(m,-f),Jk(y,f),o={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[i][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...o.start},end:{...d.end}},e[i][1].end={...o.start},e[n][1].start={...d.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Hi(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Hi(p,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",l,t]]),p=Hi(p,lh(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Hi(p,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Hi(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,ji(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function OP(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Fo(i);let l;return o;function o(f){return l=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===l)return e.consume(f),d;const p=e.exit("attentionSequence"),g=Fo(f),m=!g||g===2&&a||n.includes(f),y=!a||a===2&&g||n.includes(i);return p._open=!!(l===42?m:m&&(a||!y)),p._close=!!(l===42?y:y&&(g||!m)),t(f)}}function Jk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const RP={name:"autolink",tokenize:LP};function LP(e,t,n){let i=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return ni(b)?(e.consume(b),o):b===64?n(b):p(b)}function o(b){return b===43||b===45||b===46||Gn(b)?(i=1,d(b)):p(b)}function d(b){return b===58?(e.consume(b),i=0,f):(b===43||b===45||b===46||Gn(b))&&i++<32?(e.consume(b),d):(i=0,p(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||kp(b)?n(b):(e.consume(b),f)}function p(b){return b===64?(e.consume(b),g):SP(b)?(e.consume(b),p):n(b)}function g(b){return Gn(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Gn(b))&&i++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const td={partial:!0,tokenize:IP};function IP(e,t,n){return i;function i(l){return gt(l)?St(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||Je(l)?t(l):n(l)}}const X2={continuation:{tokenize:PP},exit:BP,name:"blockQuote",tokenize:zP};function zP(e,t,n){const i=this;return a;function a(o){if(o===62){const d=i.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return n(o)}function l(o){return gt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function PP(e,t,n){const i=this;return a;function a(o){return gt(o)?St(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(X2,t,n)(o)}}function BP(e){e.exit("blockQuote")}const Z2={name:"characterEscape",tokenize:$P};function $P(e,t,n){return i;function i(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return _P(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const J2={name:"characterReference",tokenize:UP};function UP(e,t,n){const i=this;let a=0,l,o;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),l=31,o=Gn,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=NP,g):(e.enter("characterReferenceValue"),l=7,o=rb,g(m))}function g(m){if(m===59&&a){const y=e.exit("characterReferenceValue");return o===Gn&&!_x(i.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&a++<l?(e.consume(m),g):n(m)}}const eE={partial:!0,tokenize:qP},tE={concrete:!0,name:"codeFenced",tokenize:FP};function FP(e,t,n){const i=this,a={partial:!0,tokenize:T};let l=0,o=0,d;return f;function f(M){return p(M)}function p(M){const O=i.events[i.events.length-1];return l=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,d=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(M)}function g(M){return M===d?(o++,e.consume(M),g):o<3?n(M):(e.exit("codeFencedFenceSequence"),gt(M)?St(e,m,"whitespace")(M):m(M))}function m(M){return M===null||Je(M)?(e.exit("codeFencedFence"),i.interrupt?t(M):e.check(eE,v,_)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(M))}function y(M){return M===null||Je(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(M)):gt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),St(e,b,"whitespace")(M)):M===96&&M===d?n(M):(e.consume(M),y)}function b(M){return M===null||Je(M)?m(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(M))}function k(M){return M===null||Je(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(M)):M===96&&M===d?n(M):(e.consume(M),k)}function v(M){return e.attempt(a,_,S)(M)}function S(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),E}function E(M){return l>0&>(M)?St(e,C,"linePrefix",l+1)(M):C(M)}function C(M){return M===null||Je(M)?e.check(eE,v,_)(M):(e.enter("codeFlowValue"),N(M))}function N(M){return M===null||Je(M)?(e.exit("codeFlowValue"),C(M)):(e.consume(M),N)}function _(M){return e.exit("codeFenced"),t(M)}function T(M,O,R){let B=0;return U;function U(F){return M.enter("lineEnding"),M.consume(F),M.exit("lineEnding"),K}function K(F){return M.enter("codeFencedFence"),gt(F)?St(M,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):q(F)}function q(F){return F===d?(M.enter("codeFencedFenceSequence"),Y(F)):R(F)}function Y(F){return F===d?(B++,M.consume(F),Y):B>=o?(M.exit("codeFencedFenceSequence"),gt(F)?St(M,D,"whitespace")(F):D(F)):R(F)}function D(F){return F===null||Je(F)?(M.exit("codeFencedFence"),O(F)):R(F)}}}function qP(e,t,n){const i=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const Gg={name:"codeIndented",tokenize:KP},HP={partial:!0,tokenize:GP};function KP(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),St(e,l,"linePrefix",5)(p)}function l(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?o(p):n(p)}function o(p){return p===null?f(p):Je(p)?e.attempt(HP,o,f)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||Je(p)?(e.exit("codeFlowValue"),o(p)):(e.consume(p),d)}function f(p){return e.exit("codeIndented"),t(p)}}function GP(e,t,n){const i=this;return a;function a(o){return i.parser.lazy[i.now().line]?n(o):Je(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):St(e,l,"linePrefix",5)(o)}function l(o){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(o):Je(o)?a(o):n(o)}}const VP={name:"codeText",previous:WP,resolve:YP,tokenize:QP};function YP(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function WP(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function QP(e,t,n){let i=0,a,l;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),i++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(l=e.enter("codeTextSequence"),a=0,g(m)):Je(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||Je(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",p(m))}}class XP{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&ru(this.left,i),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ru(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ru(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ru(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ru(this.left,n.reverse())}}}function ru(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ej(e){const t={};let n=-1,i,a,l,o,d,f,p;const g=new XP(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,ZP(g,n)),n=t[n],p=!0);else if(i[1]._container){for(l=n,a=void 0;l--;)if(o=g.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},d=g.slice(a,n),d.unshift(i),g.splice(a,n-a+1,d))}}return ji(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function ZP(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const l=[];let o=n._tokenizer;o||(o=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const d=o.events,f=[],p={};let g,m,y=-1,b=n,k=0,v=0;const S=[v];for(;b;){for(;e.get(++a)[1]!==b;);l.push(a),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),m&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(g),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(v=y+1,S.push(v),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):S.pop(),y=S.length;y--;){const E=d.slice(S[y],S[y+1]),C=l.pop();f.push([C,C+E.length-1]),e.splice(C,2,E)}for(f.reverse(),y=-1;++y<f.length;)p[k+f[y][0]]=k+f[y][1],k+=f[y][1]-f[y][0]-1;return p}const JP={resolve:tB,tokenize:nB},eB={partial:!0,tokenize:iB};function tB(e){return ej(e),e}function nB(e,t){let n;return i;function i(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?l(d):Je(d)?e.check(eB,o,l)(d):(e.consume(d),a)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function o(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function iB(e,t,n){const i=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),St(e,l,"linePrefix")}function l(o){if(o===null||Je(o))return n(o);const d=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(o):e.interrupt(i.parser.constructs.flow,n,t)(o)}}function tj(e,t,n,i,a,l,o,d,f){const p=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(E){return E===60?(e.enter(i),e.enter(a),e.enter(l),e.consume(E),e.exit(l),y):E===null||E===32||E===41||kp(E)?n(E):(e.enter(i),e.enter(o),e.enter(d),e.enter("chunkString",{contentType:"string"}),v(E))}function y(E){return E===62?(e.enter(l),e.consume(E),e.exit(l),e.exit(a),e.exit(i),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(e.exit("chunkString"),e.exit(d),y(E)):E===null||E===60||Je(E)?n(E):(e.consume(E),E===92?k:b)}function k(E){return E===60||E===62||E===92?(e.consume(E),b):b(E)}function v(E){return!g&&(E===null||E===41||Kt(E))?(e.exit("chunkString"),e.exit(d),e.exit(o),e.exit(i),t(E)):g<p&&E===40?(e.consume(E),g++,v):E===41?(e.consume(E),g--,v):E===null||E===32||E===40||kp(E)?n(E):(e.consume(E),E===92?S:v)}function S(E){return E===40||E===41||E===92?(e.consume(E),v):v(E)}}function nj(e,t,n,i,a,l){const o=this;let d=0,f;return p;function p(b){return e.enter(i),e.enter(a),e.consume(b),e.exit(a),e.enter(l),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in o.parser.constructs?n(b):b===93?(e.exit(l),e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):Je(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Je(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!gt(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function ij(e,t,n,i,a,l){let o;return d;function d(y){return y===34||y===39||y===40?(e.enter(i),e.enter(a),e.consume(y),e.exit(a),o=y===40?41:y,f):n(y)}function f(y){return y===o?(e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):(e.enter(l),p(y))}function p(y){return y===o?(e.exit(l),f(o)):y===null?n(y):Je(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),St(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===o||y===null||Je(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?m:g)}function m(y){return y===o||y===92?(e.consume(y),g):g(y)}}function mu(e,t){let n;return i;function i(a){return Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):gt(a)?St(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const rB={name:"definition",tokenize:sB},aB={partial:!0,tokenize:lB};function sB(e,t,n){const i=this;let a;return l;function l(b){return e.enter("definition"),o(b)}function o(b){return nj.call(i,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return a=fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Kt(b)?mu(e,p)(b):p(b)}function p(b){return tj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(aB,m,m)(b)}function m(b){return gt(b)?St(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Je(b)?(e.exit("definition"),i.parser.defined.push(a),t(b)):n(b)}}function lB(e,t,n){return i;function i(d){return Kt(d)?mu(e,a)(d):n(d)}function a(d){return ij(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return gt(d)?St(e,o,"whitespace")(d):o(d)}function o(d){return d===null||Je(d)?t(d):n(d)}}const oB={name:"hardBreakEscape",tokenize:cB};function cB(e,t,n){return i;function i(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Je(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const uB={name:"headingAtx",resolve:dB,tokenize:fB};function dB(e,t){let n=e.length-2,i=3,a,l;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},l={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},ji(e,i,n-i+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function fB(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),o(g)}function o(g){return g===35&&i++<6?(e.consume(g),o):g===null||Kt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Je(g)?(e.exit("atxHeading"),t(g)):gt(g)?St(e,d,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),d(g))}function p(g){return g===null||g===35||Kt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),p)}}const pB=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],nE=["pre","script","style","textarea"],hB={concrete:!0,name:"htmlFlow",resolveTo:yB,tokenize:bB},mB={partial:!0,tokenize:vB},gB={partial:!0,tokenize:xB};function yB(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function bB(e,t,n){const i=this;let a,l,o,d,f;return p;function p(P){return g(P)}function g(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),m}function m(P){return P===33?(e.consume(P),y):P===47?(e.consume(P),l=!0,v):P===63?(e.consume(P),a=3,i.interrupt?t:L):ni(P)?(e.consume(P),o=String.fromCharCode(P),S):n(P)}function y(P){return P===45?(e.consume(P),a=2,b):P===91?(e.consume(P),a=5,d=0,k):ni(P)?(e.consume(P),a=4,i.interrupt?t:L):n(P)}function b(P){return P===45?(e.consume(P),i.interrupt?t:L):n(P)}function k(P){const le="CDATA[";return P===le.charCodeAt(d++)?(e.consume(P),d===le.length?i.interrupt?t:q:k):n(P)}function v(P){return ni(P)?(e.consume(P),o=String.fromCharCode(P),S):n(P)}function S(P){if(P===null||P===47||P===62||Kt(P)){const le=P===47,xe=o.toLowerCase();return!le&&!l&&nE.includes(xe)?(a=1,i.interrupt?t(P):q(P)):pB.includes(o.toLowerCase())?(a=6,le?(e.consume(P),E):i.interrupt?t(P):q(P)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(P):l?C(P):N(P))}return P===45||Gn(P)?(e.consume(P),o+=String.fromCharCode(P),S):n(P)}function E(P){return P===62?(e.consume(P),i.interrupt?t:q):n(P)}function C(P){return gt(P)?(e.consume(P),C):U(P)}function N(P){return P===47?(e.consume(P),U):P===58||P===95||ni(P)?(e.consume(P),_):gt(P)?(e.consume(P),N):U(P)}function _(P){return P===45||P===46||P===58||P===95||Gn(P)?(e.consume(P),_):T(P)}function T(P){return P===61?(e.consume(P),M):gt(P)?(e.consume(P),T):N(P)}function M(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),f=P,O):gt(P)?(e.consume(P),M):R(P)}function O(P){return P===f?(e.consume(P),f=null,B):P===null||Je(P)?n(P):(e.consume(P),O)}function R(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Kt(P)?T(P):(e.consume(P),R)}function B(P){return P===47||P===62||gt(P)?N(P):n(P)}function U(P){return P===62?(e.consume(P),K):n(P)}function K(P){return P===null||Je(P)?q(P):gt(P)?(e.consume(P),K):n(P)}function q(P){return P===45&&a===2?(e.consume(P),I):P===60&&a===1?(e.consume(P),H):P===62&&a===4?(e.consume(P),z):P===63&&a===3?(e.consume(P),L):P===93&&a===5?(e.consume(P),G):Je(P)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(mB,V,Y)(P)):P===null||Je(P)?(e.exit("htmlFlowData"),Y(P)):(e.consume(P),q)}function Y(P){return e.check(gB,D,V)(P)}function D(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),F}function F(P){return P===null||Je(P)?Y(P):(e.enter("htmlFlowData"),q(P))}function I(P){return P===45?(e.consume(P),L):q(P)}function H(P){return P===47?(e.consume(P),o="",W):q(P)}function W(P){if(P===62){const le=o.toLowerCase();return nE.includes(le)?(e.consume(P),z):q(P)}return ni(P)&&o.length<8?(e.consume(P),o+=String.fromCharCode(P),W):q(P)}function G(P){return P===93?(e.consume(P),L):q(P)}function L(P){return P===62?(e.consume(P),z):P===45&&a===2?(e.consume(P),L):q(P)}function z(P){return P===null||Je(P)?(e.exit("htmlFlowData"),V(P)):(e.consume(P),z)}function V(P){return e.exit("htmlFlow"),t(P)}}function xB(e,t,n){const i=this;return a;function a(o){return Je(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):n(o)}function l(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function vB(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(td,t,n)}}const wB={name:"htmlText",tokenize:kB};function kB(e,t,n){const i=this;let a,l,o;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),T):L===63?(e.consume(L),N):ni(L)?(e.consume(L),R):n(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),l=0,k):ni(L)?(e.consume(L),C):n(L)}function g(L){return L===45?(e.consume(L),b):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):Je(L)?(o=m,H(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),b):m(L)}function b(L){return L===62?I(L):L===45?y(L):m(L)}function k(L){const z="CDATA[";return L===z.charCodeAt(l++)?(e.consume(L),l===z.length?v:k):n(L)}function v(L){return L===null?n(L):L===93?(e.consume(L),S):Je(L)?(o=v,H(L)):(e.consume(L),v)}function S(L){return L===93?(e.consume(L),E):v(L)}function E(L){return L===62?I(L):L===93?(e.consume(L),E):v(L)}function C(L){return L===null||L===62?I(L):Je(L)?(o=C,H(L)):(e.consume(L),C)}function N(L){return L===null?n(L):L===63?(e.consume(L),_):Je(L)?(o=N,H(L)):(e.consume(L),N)}function _(L){return L===62?I(L):N(L)}function T(L){return ni(L)?(e.consume(L),M):n(L)}function M(L){return L===45||Gn(L)?(e.consume(L),M):O(L)}function O(L){return Je(L)?(o=O,H(L)):gt(L)?(e.consume(L),O):I(L)}function R(L){return L===45||Gn(L)?(e.consume(L),R):L===47||L===62||Kt(L)?B(L):n(L)}function B(L){return L===47?(e.consume(L),I):L===58||L===95||ni(L)?(e.consume(L),U):Je(L)?(o=B,H(L)):gt(L)?(e.consume(L),B):I(L)}function U(L){return L===45||L===46||L===58||L===95||Gn(L)?(e.consume(L),U):K(L)}function K(L){return L===61?(e.consume(L),q):Je(L)?(o=K,H(L)):gt(L)?(e.consume(L),K):B(L)}function q(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,Y):Je(L)?(o=q,H(L)):gt(L)?(e.consume(L),q):(e.consume(L),D)}function Y(L){return L===a?(e.consume(L),a=void 0,F):L===null?n(L):Je(L)?(o=Y,H(L)):(e.consume(L),Y)}function D(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Kt(L)?B(L):(e.consume(L),D)}function F(L){return L===47||L===62||Kt(L)?B(L):n(L)}function I(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function H(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),W}function W(L){return gt(L)?St(e,G,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):G(L)}function G(L){return e.enter("htmlTextData"),o(L)}}const jx={name:"labelEnd",resolveAll:_B,resolveTo:jB,tokenize:CB},EB={tokenize:AB},SB={tokenize:TB},NB={tokenize:MB};function _B(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&ji(e,0,e.length,n),e}function jB(e,t){let n=e.length,i=0,a,l,o,d;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(o=n);const f={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},g={type:"labelText",start:{...e[l+i+2][1].end},end:{...e[o-2][1].start}};return d=[["enter",f,t],["enter",p,t]],d=Hi(d,e.slice(l+1,l+i+3)),d=Hi(d,[["enter",g,t]]),d=Hi(d,lh(t.parser.constructs.insideSpan.null,e.slice(l+i+4,o-3),t)),d=Hi(d,[["exit",g,t],e[o-2],e[o-1],["exit",p,t]]),d=Hi(d,e.slice(o+1)),d=Hi(d,[["exit",f,t]]),ji(e,l,e.length,d),e}function CB(e,t,n){const i=this;let a=i.events.length,l,o;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){l=i.events[a][1];break}return d;function d(y){return l?l._inactive?m(y):(o=i.parser.defined.includes(fr(i.sliceSerialize({start:l.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(EB,g,o?g:m)(y):y===91?e.attempt(SB,g,o?p:m)(y):o?g(y):m(y)}function p(y){return e.attempt(NB,g,m)(y)}function g(y){return t(y)}function m(y){return l._balanced=!0,n(y)}}function AB(e,t,n){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Kt(m)?mu(e,l)(m):l(m)}function l(m){return m===41?g(m):tj(e,o,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return Kt(m)?mu(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?ij(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return Kt(m)?mu(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function TB(e,t,n){const i=this;return a;function a(d){return nj.call(i,e,l,o,"reference","referenceMarker","referenceString")(d)}function l(d){return i.parser.defined.includes(fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function o(d){return n(d)}}function MB(e,t,n){return i;function i(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const DB={name:"labelStartImage",resolveAll:jx.resolveAll,tokenize:OB};function OB(e,t,n){const i=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),o):n(d)}function o(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(d):t(d)}}const RB={name:"labelStartLink",resolveAll:jx.resolveAll,tokenize:LB};function LB(e,t,n){const i=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(o):t(o)}}const Vg={name:"lineEnding",tokenize:IB};function IB(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),St(e,t,"linePrefix")}}const ap={name:"thematicBreak",tokenize:zB};function zB(e,t,n){let i=0,a;return l;function l(p){return e.enter("thematicBreak"),o(p)}function o(p){return a=p,d(p)}function d(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):i>=3&&(p===null||Je(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),i++,f):(e.exit("thematicBreakSequence"),gt(p)?St(e,d,"whitespace")(p):d(p))}}const ci={continuation:{tokenize:UB},exit:qB,name:"list",tokenize:$B},PB={partial:!0,tokenize:HB},BB={partial:!0,tokenize:FB};function $B(e,t,n){const i=this,a=i.events[i.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return d;function d(b){const k=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:rb(b)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(ap,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return rb(b)&&++o<10?(e.consume(b),f):(!i.interrupt||o<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(td,i.interrupt?n:g,e.attempt(PB,y,m))}function g(b){return i.containerState.initialBlankLine=!0,l++,y(b)}function m(b){return gt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=l+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function UB(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(td,a,l);function a(d){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,St(e,t,"listItemIndent",i.containerState.size+1)(d)}function l(d){return i.containerState.furtherBlankLines||!gt(d)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(d)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(BB,t,o)(d))}function o(d){return i.containerState._closeFlow=!0,i.interrupt=void 0,St(e,e.attempt(ci,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function FB(e,t,n){const i=this;return St(e,a,"listItemIndent",i.containerState.size+1);function a(l){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(l):n(l)}}function qB(e){e.exit(this.containerState.type)}function HB(e,t,n){const i=this;return St(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const o=i.events[i.events.length-1];return!gt(l)&&o&&o[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const iE={name:"setextUnderline",resolveTo:KB,tokenize:GB};function KB(e,t){let n=e.length,i,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",o,t]),e.splice(l+1,0,["exit",e[i][1],t]),e[i][1].end={...e[l][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function GB(e,t,n){const i=this;let a;return l;function l(p){let g=i.events.length,m;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){m=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),a=p,o(p)):n(p)}function o(p){return e.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===a?(e.consume(p),d):(e.exit("setextHeadingLineSequence"),gt(p)?St(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Je(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const VB={tokenize:YB};function YB(e){const t=this,n=e.attempt(td,i,e.attempt(this.parser.constructs.flowInitial,a,St(e,e.attempt(this.parser.constructs.flow,a,e.attempt(JP,a)),"linePrefix")));return n;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const WB={resolveAll:aj()},QB=rj("string"),XB=rj("text");function rj(e){return{resolveAll:aj(e==="text"?ZB:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],l=n.attempt(a,o,d);return o;function o(g){return p(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return p(g)?(n.exit("data"),l(g)):(n.consume(g),f)}function p(g){if(g===null)return!0;const m=a[g];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function aj(e){return t;function t(n,i){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,i):n}}function ZB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let l=a.length,o=-1,d=0,f;for(;l--;){const p=a[l];if(typeof p=="string"){for(o=p.length;p.charCodeAt(o-1)===32;)d++,o--;if(o)break;o=-1}else if(p===-2)f=!0,d++;else if(p!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const p={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:i.start._bufferIndex+o,_index:i.start._index+l,line:i.end.line,column:i.end.column-d,offset:i.end.offset-d},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const JB={42:ci,43:ci,45:ci,48:ci,49:ci,50:ci,51:ci,52:ci,53:ci,54:ci,55:ci,56:ci,57:ci,62:X2},e6={91:rB},t6={[-2]:Gg,[-1]:Gg,32:Gg},n6={35:uB,42:ap,45:[iE,ap],60:hB,61:iE,95:ap,96:tE,126:tE},i6={38:J2,92:Z2},r6={[-5]:Vg,[-4]:Vg,[-3]:Vg,33:DB,38:J2,42:ab,60:[RP,wB],91:RB,92:[oB,Z2],93:jx,95:ab,96:VP},a6={null:[ab,WB]},s6={null:[42,95]},l6={null:[]},o6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:s6,contentInitial:e6,disable:l6,document:JB,flow:n6,flowInitial:t6,insideSpan:a6,string:i6,text:r6},Symbol.toStringTag,{value:"Module"}));function c6(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let o=[],d=[];const f={attempt:O(T),check:O(M),consume:C,enter:N,exit:_,interrupt:O(M,{interrupt:!0})},p={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:m};let g=t.tokenize.call(p,f);return t.resolveAll&&l.push(t),p;function m(K){return o=Hi(o,K),S(),o[o.length-1]!==null?[]:(R(t,0),p.events=lh(l,p.events,p),p.events)}function y(K,q){return d6(b(K),q)}function b(K){return u6(o,K)}function k(){const{_bufferIndex:K,_index:q,line:Y,column:D,offset:F}=i;return{_bufferIndex:K,_index:q,line:Y,column:D,offset:F}}function v(K){a[K.line]=K.column,U()}function S(){let K;for(;i._index<o.length;){const q=o[i._index];if(typeof q=="string")for(K=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===K&&i._bufferIndex<q.length;)E(q.charCodeAt(i._bufferIndex));else E(q)}}function E(K){g=g(K)}function C(K){Je(K)?(i.line++,i.column=1,i.offset+=K===-3?2:1,U()):K!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=K}function N(K,q){const Y=q||{};return Y.type=K,Y.start=k(),p.events.push(["enter",Y,p]),d.push(Y),Y}function _(K){const q=d.pop();return q.end=k(),p.events.push(["exit",q,p]),q}function T(K,q){R(K,q.from)}function M(K,q){q.restore()}function O(K,q){return Y;function Y(D,F,I){let H,W,G,L;return Array.isArray(D)?V(D):"tokenize"in D?V([D]):z(D);function z(ke){return Ne;function Ne(se){const ve=se!==null&&ke[se],ue=se!==null&&ke.null,J=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return V(J)(se)}}function V(ke){return H=ke,W=0,ke.length===0?I:P(ke[W])}function P(ke){return Ne;function Ne(se){return L=B(),G=ke,ke.partial||(p.currentConstruct=ke),ke.name&&p.parser.constructs.disable.null.includes(ke.name)?xe():ke.tokenize.call(q?Object.assign(Object.create(p),q):p,f,le,xe)(se)}}function le(ke){return K(G,L),F}function xe(ke){return L.restore(),++W<H.length?P(H[W]):I}}}function R(K,q){K.resolveAll&&!l.includes(K)&&l.push(K),K.resolve&&ji(p.events,q,p.events.length-q,K.resolve(p.events.slice(q),p)),K.resolveTo&&(p.events=K.resolveTo(p.events,p))}function B(){const K=k(),q=p.previous,Y=p.currentConstruct,D=p.events.length,F=Array.from(d);return{from:D,restore:I};function I(){i=K,p.previous=q,p.currentConstruct=Y,p.events.length=D,d=F,U()}}function U(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function u6(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(i,l)];else{if(o=e.slice(n,a),i>-1){const d=o[0];typeof d=="string"?o[0]=d.slice(i):o.shift()}l>0&&o.push(e[a].slice(0,l))}return o}function d6(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const l=e[n];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
|
|
621
|
+
`)}),c.jsx(vs,{to:`/projects/${encodeURIComponent(e)}?tab=logs&worker=${t.slot}`,className:"text-xs underline text-[var(--color-running)] mt-1 inline-block",children:i("workers.panel.heartbeat.fullLog")})]})]}),c.jsxs("div",{className:"px-4 py-3 border-t-2 border-[var(--color-text)] bg-[var(--color-bg-cream)] flex gap-2 justify-end flex-wrap",children:[o&&t.card&&c.jsxs("button",{type:"button",className:"nb-btn nb-btn-mint",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{if(await a({title:i("workers.panel.action.restart.confirm.title",{slot:t.slot}),body:i("workers.panel.action.restart.confirm.body",{seq:t.card.seq}),confirm:i("workers.panel.action.restart.confirm.button")})){try{await zk(e,t.slot)}catch{}try{await bP(e,t.slot,t.card.seq),n()}catch(v){l({title:i("workers.panel.action.restart.error"),body:v instanceof Error?v.message:String(v)})}}},children:[c.jsx(C3,{size:11,strokeWidth:2.5})," ",i("workers.panel.action.restart")]}),t.state!=="idle"&&c.jsxs("button",{type:"button",className:"nb-btn nb-btn-danger",style:{padding:"4px 10px",fontSize:11},onClick:async()=>{if(await a({title:i("workers.panel.action.kill.confirm.title",{slot:t.slot}),body:i("workers.panel.action.kill.confirm.body"),confirm:i("workers.panel.action.kill.confirm.button"),danger:!0}))try{await zk(e,t.slot),n()}catch(v){l({title:i("workers.panel.action.kill.error"),body:v instanceof Error?v.message:String(v)})}},children:[c.jsx($3,{size:11,strokeWidth:2.5})," ",i("workers.panel.action.kill")]})]})]})}function AP(){var o;const e=Pe(),t=Ft(),[n,i]=j.useState(null),a=Ve({queryKey:["workers-agg"],queryFn:mP,refetchInterval:5e3});j.useEffect(()=>{if(!a.data)return;const d=a.data.capacity.map(p=>p.project),f=[];for(const p of d){const g=new EventSource(`/stream/projects/${encodeURIComponent(p)}`),m=()=>{t.invalidateQueries({queryKey:["workers-agg"]})};g.addEventListener("worker.updated",m),g.addEventListener("worker.added",m),g.addEventListener("worker.deleted",m),g.addEventListener("card.updated",m),f.push(g)}return()=>{for(const p of f)p.close()}},[(o=a.data)==null?void 0:o.capacity.map(d=>d.project).join(","),t]);const l=j.useMemo(()=>{if(!a.data)return{projects:0,running:0,starting:0,stuck:0,crashed:0,idle:0};const d={projects:a.data.capacity.length,running:0,starting:0,stuck:0,crashed:0,idle:0};for(const f of a.data.capacity)d.running+=f.running,d.starting+=f.starting,d.stuck+=f.stuck,d.crashed+=f.crashed,d.idle+=f.idle;return d},[a.data]);return c.jsxs("div",{className:"flex flex-col gap-4 h-[calc(100vh-140px)]",children:[c.jsxs("header",{className:"flex items-center justify-between flex-wrap gap-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold tracking-tight",children:e("workers.title")}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mt-1",children:e("workers.summary",{projects:l.projects,running:l.running,starting:l.starting,stuck:l.stuck,crashed:l.crashed,idle:l.idle})})]}),c.jsxs("button",{className:"nb-btn",style:{padding:"6px 12px",fontSize:12},onClick:()=>a.refetch(),disabled:a.isFetching,type:"button","aria-label":e("workers.refresh.aria"),children:[a.isFetching?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(ya,{size:12,strokeWidth:2.5}),e("workers.refresh")]})]}),c.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0",children:[c.jsxs("div",{className:"flex flex-col gap-4 min-h-0 pr-2",children:[a.isLoading&&c.jsx("p",{className:"text-[var(--color-text-muted)] italic",children:e("common.loading")}),a.isError&&c.jsx("div",{className:"nb-card bg-[var(--color-crashed-bg)]",children:c.jsx("p",{children:e("workers.error.load",{detail:a.error instanceof Error?a.error.message:String(a.error)})})}),a.data&&c.jsxs(c.Fragment,{children:[c.jsx(vP,{alerts:a.data.alerts,selected:n,onSelect:(d,f)=>i({project:d,slot:f})}),c.jsx(wP,{active:a.data.active,selected:n,onSelect:(d,f)=>i({project:d,slot:f})}),c.jsx(kP,{capacity:a.data.capacity,selected:n,onSelect:d=>i({project:d})})]})]}),c.jsx("aside",{className:"nb-card p-0 overflow-hidden flex flex-col h-full",children:n?c.jsx(_P,{project:n.project,initialSlot:n.slot,onChange:()=>t.invalidateQueries({queryKey:["workers-agg"]})}):c.jsx("div",{className:"flex-1 bg-color-bg-soft bg-surface-input flex items-center justify-center p-6 text-center",children:c.jsxs("div",{children:[c.jsx(qp,{size:32,className:"mx-auto mb-3 text-[var(--color-text-subtle)]",strokeWidth:2}),c.jsx("p",{className:"text-sm text-[var(--color-text-muted)]",children:e("workers.empty.hint")})]})})})]})]})}function R2(){return ct("/api/gen/jobs")}function TP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const MP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OP={};function Bk(e,t){return(OP.jsx?DP:MP).test(e)}const RP=/[ \t\n\f\r]/g;function LP(e){return typeof e=="object"?e.type==="text"?$k(e.value):!1:$k(e)}function $k(e){return e.replace(RP,"")===""}class ed{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}ed.prototype.normal={};ed.prototype.property={};ed.prototype.space=void 0;function L2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new ed(n,i,t)}function eb(e){return e.toLowerCase()}class mi{constructor(t,n){this.attribute=n,this.property=t}}mi.prototype.attribute="";mi.prototype.booleanish=!1;mi.prototype.boolean=!1;mi.prototype.commaOrSpaceSeparated=!1;mi.prototype.commaSeparated=!1;mi.prototype.defined=!1;mi.prototype.mustUseProperty=!1;mi.prototype.number=!1;mi.prototype.overloadedBoolean=!1;mi.prototype.property="";mi.prototype.spaceSeparated=!1;mi.prototype.space=void 0;let IP=0;const ft=El(),Nn=El(),tb=El(),Te=El(),Yt=El(),So=El(),Ei=El();function El(){return 2**++IP}const nb=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:Nn,commaOrSpaceSeparated:Ei,commaSeparated:So,number:Te,overloadedBoolean:tb,spaceSeparated:Yt},Symbol.toStringTag,{value:"Module"})),qg=Object.keys(nb);class xx extends mi{constructor(t,n,i,a){let l=-1;if(super(t,n),Uk(this,"space",a),typeof i=="number")for(;++l<qg.length;){const o=qg[l];Uk(this,qg[l],(i&nb[o])===nb[o])}}}xx.prototype.defined=!0;function Uk(e,t,n){n&&(e[t]=n)}function lc(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const l=new xx(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(l.mustUseProperty=!0),t[i]=l,n[eb(i)]=i,n[eb(l.attribute)]=i}return new ed(t,n,e.space)}const I2=lc({properties:{ariaActiveDescendant:null,ariaAtomic:Nn,ariaAutoComplete:null,ariaBusy:Nn,ariaChecked:Nn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:Yt,ariaCurrent:null,ariaDescribedBy:Yt,ariaDetails:null,ariaDisabled:Nn,ariaDropEffect:Yt,ariaErrorMessage:null,ariaExpanded:Nn,ariaFlowTo:Yt,ariaGrabbed:Nn,ariaHasPopup:null,ariaHidden:Nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Yt,ariaLevel:Te,ariaLive:null,ariaModal:Nn,ariaMultiLine:Nn,ariaMultiSelectable:Nn,ariaOrientation:null,ariaOwns:Yt,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:Nn,ariaReadOnly:Nn,ariaRelevant:null,ariaRequired:Nn,ariaRoleDescription:Yt,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:Nn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function z2(e,t){return t in e?e[t]:t}function P2(e,t){return z2(e,t.toLowerCase())}const zP=lc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:So,acceptCharset:Yt,accessKey:Yt,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:Yt,autoFocus:ft,autoPlay:ft,blocking:Yt,capture:null,charSet:null,checked:ft,cite:null,className:Yt,cols:Te,colSpan:null,content:null,contentEditable:Nn,controls:ft,controlsList:Yt,coords:Te|So,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:tb,draggable:Nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:Yt,height:Te,hidden:tb,high:Te,href:null,hrefLang:null,htmlFor:Yt,httpEquiv:Yt,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:Yt,itemRef:Yt,itemScope:ft,itemType:Yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:ft,muted:ft,name:null,nonce:null,noModule:ft,noValidate:ft,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ft,optimum:Te,pattern:null,ping:Yt,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:Yt,required:ft,reversed:ft,rows:Te,rowSpan:Te,sandbox:Yt,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:Nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:Nn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Yt,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ft,declare:ft,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:Nn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:P2}),PP=lc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ei,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:Yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:So,g2:So,glyphName:So,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:Ei,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ei,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ei,rev:Ei,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ei,requiredFeatures:Ei,requiredFonts:Ei,requiredFormats:Ei,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:Ei,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ei,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ei,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:z2}),B2=lc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$2=lc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:P2}),U2=lc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),BP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$P=/[A-Z]/g,Fk=/-[a-z]/g,UP=/^data[-\w.:]+$/i;function FP(e,t){const n=eb(t);let i=t,a=mi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&UP.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Fk,HP);i="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Fk.test(l)){let o=l.replace($P,qP);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=xx}return new a(i,t)}function qP(e){return"-"+e.toLowerCase()}function HP(e){return e.charAt(1).toUpperCase()}const KP=L2([I2,zP,B2,$2,U2],"html"),vx=L2([I2,PP,B2,$2,U2],"svg");function GP(e){return e.join(" ").trim()}var oo={},Hg,qk;function VP(){if(qk)return Hg;qk=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
622
|
+
`,p="/",g="*",m="",y="comment",b="declaration";function k(S,E){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];E=E||{};var C=1,N=1;function _(D){var F=D.match(t);F&&(C+=F.length);var I=D.lastIndexOf(f);N=~I?D.length-I:N+D.length}function T(){var D={line:C,column:N};return function(F){return F.position=new M(D),B(),F}}function M(D){this.start=D,this.end={line:C,column:N},this.source=E.source}M.prototype.content=S;function O(D){var F=new Error(E.source+":"+C+":"+N+": "+D);if(F.reason=D,F.filename=E.source,F.line=C,F.column=N,F.source=S,!E.silent)throw F}function R(D){var F=D.exec(S);if(F){var I=F[0];return _(I),S=S.slice(I.length),F}}function B(){R(n)}function U(D){var F;for(D=D||[];F=K();)F!==!1&&D.push(F);return D}function K(){var D=T();if(!(p!=S.charAt(0)||g!=S.charAt(1))){for(var F=2;m!=S.charAt(F)&&(g!=S.charAt(F)||p!=S.charAt(F+1));)++F;if(F+=2,m===S.charAt(F-1))return O("End of comment missing");var I=S.slice(2,F-2);return N+=2,_(I),S=S.slice(F),N+=2,D({type:y,comment:I})}}function q(){var D=T(),F=R(i);if(F){if(K(),!R(a))return O("property missing ':'");var I=R(l),H=D({type:b,property:v(F[0].replace(e,m)),value:I?v(I[0].replace(e,m)):m});return R(o),H}}function Y(){var D=[];U(D);for(var F;F=q();)F!==!1&&(D.push(F),U(D));return D}return B(),Y()}function v(S){return S?S.replace(d,m):m}return Hg=k,Hg}var Hk;function YP(){if(Hk)return oo;Hk=1;var e=oo&&oo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(oo,"__esModule",{value:!0}),oo.default=n;const t=e(VP());function n(i,a){let l=null;if(!i||typeof i!="string")return l;const o=(0,t.default)(i),d=typeof a=="function";return o.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:g}=f;d?a(p,g,f):g&&(l=l||{},l[p]=g)}),l}return oo}var nu={},Kk;function WP(){if(Kk)return nu;Kk=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(p){return!p||n.test(p)||e.test(p)},o=function(p,g){return g.toUpperCase()},d=function(p,g){return"".concat(g,"-")},f=function(p,g){return g===void 0&&(g={}),l(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,d):p=p.replace(i,d),p.replace(t,o))};return nu.camelCase=f,nu}var iu,Gk;function QP(){if(Gk)return iu;Gk=1;var e=iu&&iu.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(YP()),n=WP();function i(a,l){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(d,f){d&&f&&(o[(0,n.camelCase)(d,l)]=f)}),o}return i.default=i,iu=i,iu}var XP=QP();const ZP=Hu(XP),F2=q2("end"),wx=q2("start");function q2(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function JP(e){const t=wx(e),n=F2(e);if(t&&n)return{start:t,end:n}}function hu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vk(e.position):"start"in e||"end"in e?Vk(e):"line"in e||"column"in e?ib(e):""}function ib(e){return Yk(e&&e.line)+":"+Yk(e&&e.column)}function Vk(e){return ib(e&&e.start)+"-"+ib(e&&e.end)}function Yk(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(o=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?l.ruleId=i:(l.source=i.slice(0,f),l.ruleId=i.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=hu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const kx={}.hasOwnProperty,e5=new Map,t5=/[A-Z]/g,n5=new Set(["table","tbody","thead","tfoot","tr"]),i5=new Set(["td","th"]),H2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function r5(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=f5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=d5(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?vx:KP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=K2(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function K2(e,t,n){if(t.type==="element")return a5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return s5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return o5(e,t,n);if(t.type==="mdxjsEsm")return l5(e,t);if(t.type==="root")return c5(e,t,n);if(t.type==="text")return u5(e,t)}function a5(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=vx,e.schema=a),e.ancestors.push(t);const l=V2(e,t.tagName,!1),o=p5(e,t);let d=Sx(e,t);return n5.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!LP(f):!0})),G2(e,o,l,t),Ex(o,d),e.ancestors.pop(),e.schema=i,e.create(t,l,o,n)}function s5(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Cu(e,t.position)}function l5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cu(e,t.position)}function o5(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=vx,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:V2(e,t.name,!0),o=h5(e,t),d=Sx(e,t);return G2(e,o,l,t),Ex(o,d),e.ancestors.pop(),e.schema=i,e.create(t,l,o,n)}function c5(e,t,n){const i={};return Ex(i,Sx(e,t)),e.create(t,e.Fragment,i,n)}function u5(e,t){return t.value}function G2(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Ex(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function d5(e,t,n){return i;function i(a,l,o,d){const p=Array.isArray(o.children)?n:t;return d?p(l,o,d):p(l,o)}}function f5(e,t){return n;function n(i,a,l,o){const d=Array.isArray(l.children),f=wx(i);return t(a,l,o,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function p5(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&kx.call(t.properties,a)){const l=m5(e,a,t.properties[a]);if(l){const[o,d]=l;e.tableCellAlignToStyle&&o==="align"&&typeof d=="string"&&i5.has(t.tagName)?i=d:n[o]=d}}if(i){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function h5(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];l.type;const o=l.expression;o.type;const d=o.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Cu(e,t.position);else{const a=i.name;let l;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const d=i.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Cu(e,t.position);else l=i.value===null?!0:i.value;n[a]=l}return n}function Sx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:e5;for(;++i<t.children.length;){const l=t.children[i];let o;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const p=a.get(f)||0;o=f+"-"+p,a.set(f,p+1)}}const d=K2(e,l,o);d!==void 0&&n.push(d)}return n}function m5(e,t,n){const i=FP(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?TP(n):GP(n)),i.property==="style"){let a=typeof n=="object"?n:g5(e,String(n));return e.stylePropertyNameCase==="css"&&(a=y5(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?BP[i.property]||i.property:i.attribute,n]}}function g5(e,t){try{return ZP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=H2+"#cannot-parse-style-attribute",a}}function V2(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,o;for(;++l<a.length;){const d=Bk(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};o=o?{type:"MemberExpression",object:o,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}i=o}else i=Bk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return kx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Cu(e)}function Cu(e,t){const n=new Yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=H2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function y5(e){const t={};let n;for(n in e)kx.call(e,n)&&(t[b5(n)]=e[n]);return t}function b5(e){let t=e.replace(t5,x5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function x5(e){return"-"+e.toLowerCase()}const Kg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},v5={};function Nx(e,t){const n=v5,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Y2(e,i,a)}function Y2(e,t,n){if(w5(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wk(e.children,t,n)}return Array.isArray(e)?Wk(e,t,n):""}function Wk(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=Y2(e[a],t,n);return i.join("")}function w5(e){return!!(e&&typeof e=="object")}const Qk=document.createElement("i");function _x(e){const t="&"+e+";";Qk.innerHTML=t;const n=Qk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ji(e,t,n,i){const a=e.length;let l=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<i.length;)o=i.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}function Hi(e,t){return e.length>0?(ji(e,e.length,0,t),e):t}const Xk={}.hasOwnProperty;function W2(e){const t={};let n=-1;for(;++n<e.length;)k5(t,e[n]);return t}function k5(e,t){let n;for(n in t){const a=(Xk.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let o;if(l)for(o in l){Xk.call(a,o)||(a[o]=[]);const d=l[o];E5(a[o],Array.isArray(d)?d:d?[d]:[])}}}function E5(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);ji(e,0,0,i)}function Q2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function fr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ni=Ns(/[A-Za-z]/),Gn=Ns(/[\dA-Za-z]/),S5=Ns(/[#-'*+\--9=?A-Z^-~]/);function kp(e){return e!==null&&(e<32||e===127)}const rb=Ns(/\d/),N5=Ns(/[\dA-Fa-f]/),_5=Ns(/[!-/:-@[-`{-~]/);function Je(e){return e!==null&&e<-2}function Kt(e){return e!==null&&(e<0||e===32)}function gt(e){return e===-2||e===-1||e===32}const sh=Ns(new RegExp("\\p{P}|\\p{S}","u")),ml=Ns(/\s/);function Ns(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function oc(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let o="";if(l===37&&Gn(e.charCodeAt(n+1))&&Gn(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(o=String.fromCharCode(l,d),a=1):o="�"}else o=String.fromCharCode(l);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function St(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(f){return gt(f)?(e.enter(n),d(f)):t(f)}function d(f){return gt(f)&&l++<a?(e.consume(f),d):(e.exit(n),t(f))}}const j5={tokenize:C5};function C5(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),St(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),l(d)}function l(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,o(d)}function o(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Je(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),o)}}const A5={tokenize:T5},Zk={tokenize:M5};function T5(e){const t=this,n=[];let i=0,a,l,o;return d;function d(N){if(i<n.length){const _=n[i];return t.containerState=_[1],e.attempt(_[0].continuation,f,p)(N)}return p(N)}function f(N){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const _=t.events.length;let T=_,M;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){M=t.events[T][1].end;break}E(i);let O=_;for(;O<t.events.length;)t.events[O][1].end={...M},O++;return ji(t.events,T+1,0,t.events.slice(_)),t.events.length=O,p(N)}return d(N)}function p(N){if(i===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return k(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zk,g,m)(N)}function g(N){return a&&C(),E(i),y(N)}function m(N){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,k(N)}function y(N){return t.containerState={},e.attempt(Zk,b,k)(N)}function b(N){return i++,n.push([t.currentConstruct,t.containerState]),y(N)}function k(N){if(N===null){a&&C(),E(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),v(N)}function v(N){if(N===null){S(e.exit("chunkFlow"),!0),E(0),e.consume(N);return}return Je(N)?(e.consume(N),S(e.exit("chunkFlow")),i=0,t.interrupt=void 0,d):(e.consume(N),v)}function S(N,_){const T=t.sliceStream(N);if(_&&T.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write(T),t.parser.lazy[N.start.line]){let M=a.events.length;for(;M--;)if(a.events[M][1].start.offset<o&&(!a.events[M][1].end||a.events[M][1].end.offset>o))return;const O=t.events.length;let R=O,B,U;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(B){U=t.events[R][1].end;break}B=!0}for(E(i),M=O;M<t.events.length;)t.events[M][1].end={...U},M++;ji(t.events,R+1,0,t.events.slice(O)),t.events.length=M}}function E(N){let _=n.length;for(;_-- >N;){const T=n[_];t.containerState=T[1],T[0].exit.call(t,e)}n.length=N}function C(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function M5(e,t,n){return St(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fo(e){if(e===null||Kt(e)||ml(e))return 1;if(sh(e))return 2}function lh(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!i.includes(l)&&(t=l(t,n),i.push(l))}return t}const ab={name:"attention",resolveAll:D5,tokenize:O5};function D5(e,t){let n=-1,i,a,l,o,d,f,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[i][1].end},y={...e[n][1].start};Jk(m,-f),Jk(y,f),o={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[i][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...o.start},end:{...d.end}},e[i][1].end={...o.start},e[n][1].start={...d.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Hi(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Hi(p,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",l,t]]),p=Hi(p,lh(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Hi(p,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Hi(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,ji(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function O5(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Fo(i);let l;return o;function o(f){return l=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===l)return e.consume(f),d;const p=e.exit("attentionSequence"),g=Fo(f),m=!g||g===2&&a||n.includes(f),y=!a||a===2&&g||n.includes(i);return p._open=!!(l===42?m:m&&(a||!y)),p._close=!!(l===42?y:y&&(g||!m)),t(f)}}function Jk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const R5={name:"autolink",tokenize:L5};function L5(e,t,n){let i=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return ni(b)?(e.consume(b),o):b===64?n(b):p(b)}function o(b){return b===43||b===45||b===46||Gn(b)?(i=1,d(b)):p(b)}function d(b){return b===58?(e.consume(b),i=0,f):(b===43||b===45||b===46||Gn(b))&&i++<32?(e.consume(b),d):(i=0,p(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||kp(b)?n(b):(e.consume(b),f)}function p(b){return b===64?(e.consume(b),g):S5(b)?(e.consume(b),p):n(b)}function g(b){return Gn(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Gn(b))&&i++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const td={partial:!0,tokenize:I5};function I5(e,t,n){return i;function i(l){return gt(l)?St(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||Je(l)?t(l):n(l)}}const X2={continuation:{tokenize:P5},exit:B5,name:"blockQuote",tokenize:z5};function z5(e,t,n){const i=this;return a;function a(o){if(o===62){const d=i.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return n(o)}function l(o){return gt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function P5(e,t,n){const i=this;return a;function a(o){return gt(o)?St(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(X2,t,n)(o)}}function B5(e){e.exit("blockQuote")}const Z2={name:"characterEscape",tokenize:$5};function $5(e,t,n){return i;function i(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return _5(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const J2={name:"characterReference",tokenize:U5};function U5(e,t,n){const i=this;let a=0,l,o;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),l=31,o=Gn,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=N5,g):(e.enter("characterReferenceValue"),l=7,o=rb,g(m))}function g(m){if(m===59&&a){const y=e.exit("characterReferenceValue");return o===Gn&&!_x(i.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&a++<l?(e.consume(m),g):n(m)}}const eE={partial:!0,tokenize:q5},tE={concrete:!0,name:"codeFenced",tokenize:F5};function F5(e,t,n){const i=this,a={partial:!0,tokenize:T};let l=0,o=0,d;return f;function f(M){return p(M)}function p(M){const O=i.events[i.events.length-1];return l=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,d=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(M)}function g(M){return M===d?(o++,e.consume(M),g):o<3?n(M):(e.exit("codeFencedFenceSequence"),gt(M)?St(e,m,"whitespace")(M):m(M))}function m(M){return M===null||Je(M)?(e.exit("codeFencedFence"),i.interrupt?t(M):e.check(eE,v,_)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(M))}function y(M){return M===null||Je(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(M)):gt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),St(e,b,"whitespace")(M)):M===96&&M===d?n(M):(e.consume(M),y)}function b(M){return M===null||Je(M)?m(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(M))}function k(M){return M===null||Je(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(M)):M===96&&M===d?n(M):(e.consume(M),k)}function v(M){return e.attempt(a,_,S)(M)}function S(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),E}function E(M){return l>0&>(M)?St(e,C,"linePrefix",l+1)(M):C(M)}function C(M){return M===null||Je(M)?e.check(eE,v,_)(M):(e.enter("codeFlowValue"),N(M))}function N(M){return M===null||Je(M)?(e.exit("codeFlowValue"),C(M)):(e.consume(M),N)}function _(M){return e.exit("codeFenced"),t(M)}function T(M,O,R){let B=0;return U;function U(F){return M.enter("lineEnding"),M.consume(F),M.exit("lineEnding"),K}function K(F){return M.enter("codeFencedFence"),gt(F)?St(M,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):q(F)}function q(F){return F===d?(M.enter("codeFencedFenceSequence"),Y(F)):R(F)}function Y(F){return F===d?(B++,M.consume(F),Y):B>=o?(M.exit("codeFencedFenceSequence"),gt(F)?St(M,D,"whitespace")(F):D(F)):R(F)}function D(F){return F===null||Je(F)?(M.exit("codeFencedFence"),O(F)):R(F)}}}function q5(e,t,n){const i=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const Gg={name:"codeIndented",tokenize:K5},H5={partial:!0,tokenize:G5};function K5(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),St(e,l,"linePrefix",5)(p)}function l(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?o(p):n(p)}function o(p){return p===null?f(p):Je(p)?e.attempt(H5,o,f)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||Je(p)?(e.exit("codeFlowValue"),o(p)):(e.consume(p),d)}function f(p){return e.exit("codeIndented"),t(p)}}function G5(e,t,n){const i=this;return a;function a(o){return i.parser.lazy[i.now().line]?n(o):Je(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):St(e,l,"linePrefix",5)(o)}function l(o){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(o):Je(o)?a(o):n(o)}}const V5={name:"codeText",previous:W5,resolve:Y5,tokenize:Q5};function Y5(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function W5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Q5(e,t,n){let i=0,a,l;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),i++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(l=e.enter("codeTextSequence"),a=0,g(m)):Je(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||Je(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",p(m))}}class X5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&ru(this.left,i),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ru(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ru(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ru(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ru(this.left,n.reverse())}}}function ru(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ej(e){const t={};let n=-1,i,a,l,o,d,f,p;const g=new X5(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,Z5(g,n)),n=t[n],p=!0);else if(i[1]._container){for(l=n,a=void 0;l--;)if(o=g.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},d=g.slice(a,n),d.unshift(i),g.splice(a,n-a+1,d))}}return ji(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function Z5(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const l=[];let o=n._tokenizer;o||(o=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const d=o.events,f=[],p={};let g,m,y=-1,b=n,k=0,v=0;const S=[v];for(;b;){for(;e.get(++a)[1]!==b;);l.push(a),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),m&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(g),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(v=y+1,S.push(v),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):S.pop(),y=S.length;y--;){const E=d.slice(S[y],S[y+1]),C=l.pop();f.push([C,C+E.length-1]),e.splice(C,2,E)}for(f.reverse(),y=-1;++y<f.length;)p[k+f[y][0]]=k+f[y][1],k+=f[y][1]-f[y][0]-1;return p}const J5={resolve:tB,tokenize:nB},eB={partial:!0,tokenize:iB};function tB(e){return ej(e),e}function nB(e,t){let n;return i;function i(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?l(d):Je(d)?e.check(eB,o,l)(d):(e.consume(d),a)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function o(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function iB(e,t,n){const i=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),St(e,l,"linePrefix")}function l(o){if(o===null||Je(o))return n(o);const d=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(o):e.interrupt(i.parser.constructs.flow,n,t)(o)}}function tj(e,t,n,i,a,l,o,d,f){const p=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(E){return E===60?(e.enter(i),e.enter(a),e.enter(l),e.consume(E),e.exit(l),y):E===null||E===32||E===41||kp(E)?n(E):(e.enter(i),e.enter(o),e.enter(d),e.enter("chunkString",{contentType:"string"}),v(E))}function y(E){return E===62?(e.enter(l),e.consume(E),e.exit(l),e.exit(a),e.exit(i),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(e.exit("chunkString"),e.exit(d),y(E)):E===null||E===60||Je(E)?n(E):(e.consume(E),E===92?k:b)}function k(E){return E===60||E===62||E===92?(e.consume(E),b):b(E)}function v(E){return!g&&(E===null||E===41||Kt(E))?(e.exit("chunkString"),e.exit(d),e.exit(o),e.exit(i),t(E)):g<p&&E===40?(e.consume(E),g++,v):E===41?(e.consume(E),g--,v):E===null||E===32||E===40||kp(E)?n(E):(e.consume(E),E===92?S:v)}function S(E){return E===40||E===41||E===92?(e.consume(E),v):v(E)}}function nj(e,t,n,i,a,l){const o=this;let d=0,f;return p;function p(b){return e.enter(i),e.enter(a),e.consume(b),e.exit(a),e.enter(l),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in o.parser.constructs?n(b):b===93?(e.exit(l),e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):Je(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Je(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!gt(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function ij(e,t,n,i,a,l){let o;return d;function d(y){return y===34||y===39||y===40?(e.enter(i),e.enter(a),e.consume(y),e.exit(a),o=y===40?41:y,f):n(y)}function f(y){return y===o?(e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):(e.enter(l),p(y))}function p(y){return y===o?(e.exit(l),f(o)):y===null?n(y):Je(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),St(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===o||y===null||Je(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?m:g)}function m(y){return y===o||y===92?(e.consume(y),g):g(y)}}function mu(e,t){let n;return i;function i(a){return Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):gt(a)?St(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const rB={name:"definition",tokenize:sB},aB={partial:!0,tokenize:lB};function sB(e,t,n){const i=this;let a;return l;function l(b){return e.enter("definition"),o(b)}function o(b){return nj.call(i,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return a=fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Kt(b)?mu(e,p)(b):p(b)}function p(b){return tj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(aB,m,m)(b)}function m(b){return gt(b)?St(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Je(b)?(e.exit("definition"),i.parser.defined.push(a),t(b)):n(b)}}function lB(e,t,n){return i;function i(d){return Kt(d)?mu(e,a)(d):n(d)}function a(d){return ij(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return gt(d)?St(e,o,"whitespace")(d):o(d)}function o(d){return d===null||Je(d)?t(d):n(d)}}const oB={name:"hardBreakEscape",tokenize:cB};function cB(e,t,n){return i;function i(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Je(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const uB={name:"headingAtx",resolve:dB,tokenize:fB};function dB(e,t){let n=e.length-2,i=3,a,l;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},l={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},ji(e,i,n-i+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function fB(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),o(g)}function o(g){return g===35&&i++<6?(e.consume(g),o):g===null||Kt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Je(g)?(e.exit("atxHeading"),t(g)):gt(g)?St(e,d,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),d(g))}function p(g){return g===null||g===35||Kt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),p)}}const pB=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],nE=["pre","script","style","textarea"],hB={concrete:!0,name:"htmlFlow",resolveTo:yB,tokenize:bB},mB={partial:!0,tokenize:vB},gB={partial:!0,tokenize:xB};function yB(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function bB(e,t,n){const i=this;let a,l,o,d,f;return p;function p(P){return g(P)}function g(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),m}function m(P){return P===33?(e.consume(P),y):P===47?(e.consume(P),l=!0,v):P===63?(e.consume(P),a=3,i.interrupt?t:L):ni(P)?(e.consume(P),o=String.fromCharCode(P),S):n(P)}function y(P){return P===45?(e.consume(P),a=2,b):P===91?(e.consume(P),a=5,d=0,k):ni(P)?(e.consume(P),a=4,i.interrupt?t:L):n(P)}function b(P){return P===45?(e.consume(P),i.interrupt?t:L):n(P)}function k(P){const le="CDATA[";return P===le.charCodeAt(d++)?(e.consume(P),d===le.length?i.interrupt?t:q:k):n(P)}function v(P){return ni(P)?(e.consume(P),o=String.fromCharCode(P),S):n(P)}function S(P){if(P===null||P===47||P===62||Kt(P)){const le=P===47,xe=o.toLowerCase();return!le&&!l&&nE.includes(xe)?(a=1,i.interrupt?t(P):q(P)):pB.includes(o.toLowerCase())?(a=6,le?(e.consume(P),E):i.interrupt?t(P):q(P)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(P):l?C(P):N(P))}return P===45||Gn(P)?(e.consume(P),o+=String.fromCharCode(P),S):n(P)}function E(P){return P===62?(e.consume(P),i.interrupt?t:q):n(P)}function C(P){return gt(P)?(e.consume(P),C):U(P)}function N(P){return P===47?(e.consume(P),U):P===58||P===95||ni(P)?(e.consume(P),_):gt(P)?(e.consume(P),N):U(P)}function _(P){return P===45||P===46||P===58||P===95||Gn(P)?(e.consume(P),_):T(P)}function T(P){return P===61?(e.consume(P),M):gt(P)?(e.consume(P),T):N(P)}function M(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),f=P,O):gt(P)?(e.consume(P),M):R(P)}function O(P){return P===f?(e.consume(P),f=null,B):P===null||Je(P)?n(P):(e.consume(P),O)}function R(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Kt(P)?T(P):(e.consume(P),R)}function B(P){return P===47||P===62||gt(P)?N(P):n(P)}function U(P){return P===62?(e.consume(P),K):n(P)}function K(P){return P===null||Je(P)?q(P):gt(P)?(e.consume(P),K):n(P)}function q(P){return P===45&&a===2?(e.consume(P),I):P===60&&a===1?(e.consume(P),H):P===62&&a===4?(e.consume(P),z):P===63&&a===3?(e.consume(P),L):P===93&&a===5?(e.consume(P),G):Je(P)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(mB,V,Y)(P)):P===null||Je(P)?(e.exit("htmlFlowData"),Y(P)):(e.consume(P),q)}function Y(P){return e.check(gB,D,V)(P)}function D(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),F}function F(P){return P===null||Je(P)?Y(P):(e.enter("htmlFlowData"),q(P))}function I(P){return P===45?(e.consume(P),L):q(P)}function H(P){return P===47?(e.consume(P),o="",W):q(P)}function W(P){if(P===62){const le=o.toLowerCase();return nE.includes(le)?(e.consume(P),z):q(P)}return ni(P)&&o.length<8?(e.consume(P),o+=String.fromCharCode(P),W):q(P)}function G(P){return P===93?(e.consume(P),L):q(P)}function L(P){return P===62?(e.consume(P),z):P===45&&a===2?(e.consume(P),L):q(P)}function z(P){return P===null||Je(P)?(e.exit("htmlFlowData"),V(P)):(e.consume(P),z)}function V(P){return e.exit("htmlFlow"),t(P)}}function xB(e,t,n){const i=this;return a;function a(o){return Je(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):n(o)}function l(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function vB(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(td,t,n)}}const wB={name:"htmlText",tokenize:kB};function kB(e,t,n){const i=this;let a,l,o;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),T):L===63?(e.consume(L),N):ni(L)?(e.consume(L),R):n(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),l=0,k):ni(L)?(e.consume(L),C):n(L)}function g(L){return L===45?(e.consume(L),b):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):Je(L)?(o=m,H(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),b):m(L)}function b(L){return L===62?I(L):L===45?y(L):m(L)}function k(L){const z="CDATA[";return L===z.charCodeAt(l++)?(e.consume(L),l===z.length?v:k):n(L)}function v(L){return L===null?n(L):L===93?(e.consume(L),S):Je(L)?(o=v,H(L)):(e.consume(L),v)}function S(L){return L===93?(e.consume(L),E):v(L)}function E(L){return L===62?I(L):L===93?(e.consume(L),E):v(L)}function C(L){return L===null||L===62?I(L):Je(L)?(o=C,H(L)):(e.consume(L),C)}function N(L){return L===null?n(L):L===63?(e.consume(L),_):Je(L)?(o=N,H(L)):(e.consume(L),N)}function _(L){return L===62?I(L):N(L)}function T(L){return ni(L)?(e.consume(L),M):n(L)}function M(L){return L===45||Gn(L)?(e.consume(L),M):O(L)}function O(L){return Je(L)?(o=O,H(L)):gt(L)?(e.consume(L),O):I(L)}function R(L){return L===45||Gn(L)?(e.consume(L),R):L===47||L===62||Kt(L)?B(L):n(L)}function B(L){return L===47?(e.consume(L),I):L===58||L===95||ni(L)?(e.consume(L),U):Je(L)?(o=B,H(L)):gt(L)?(e.consume(L),B):I(L)}function U(L){return L===45||L===46||L===58||L===95||Gn(L)?(e.consume(L),U):K(L)}function K(L){return L===61?(e.consume(L),q):Je(L)?(o=K,H(L)):gt(L)?(e.consume(L),K):B(L)}function q(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,Y):Je(L)?(o=q,H(L)):gt(L)?(e.consume(L),q):(e.consume(L),D)}function Y(L){return L===a?(e.consume(L),a=void 0,F):L===null?n(L):Je(L)?(o=Y,H(L)):(e.consume(L),Y)}function D(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Kt(L)?B(L):(e.consume(L),D)}function F(L){return L===47||L===62||Kt(L)?B(L):n(L)}function I(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function H(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),W}function W(L){return gt(L)?St(e,G,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):G(L)}function G(L){return e.enter("htmlTextData"),o(L)}}const jx={name:"labelEnd",resolveAll:_B,resolveTo:jB,tokenize:CB},EB={tokenize:AB},SB={tokenize:TB},NB={tokenize:MB};function _B(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&ji(e,0,e.length,n),e}function jB(e,t){let n=e.length,i=0,a,l,o,d;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(o=n);const f={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},g={type:"labelText",start:{...e[l+i+2][1].end},end:{...e[o-2][1].start}};return d=[["enter",f,t],["enter",p,t]],d=Hi(d,e.slice(l+1,l+i+3)),d=Hi(d,[["enter",g,t]]),d=Hi(d,lh(t.parser.constructs.insideSpan.null,e.slice(l+i+4,o-3),t)),d=Hi(d,[["exit",g,t],e[o-2],e[o-1],["exit",p,t]]),d=Hi(d,e.slice(o+1)),d=Hi(d,[["exit",f,t]]),ji(e,l,e.length,d),e}function CB(e,t,n){const i=this;let a=i.events.length,l,o;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){l=i.events[a][1];break}return d;function d(y){return l?l._inactive?m(y):(o=i.parser.defined.includes(fr(i.sliceSerialize({start:l.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(EB,g,o?g:m)(y):y===91?e.attempt(SB,g,o?p:m)(y):o?g(y):m(y)}function p(y){return e.attempt(NB,g,m)(y)}function g(y){return t(y)}function m(y){return l._balanced=!0,n(y)}}function AB(e,t,n){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Kt(m)?mu(e,l)(m):l(m)}function l(m){return m===41?g(m):tj(e,o,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return Kt(m)?mu(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?ij(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return Kt(m)?mu(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function TB(e,t,n){const i=this;return a;function a(d){return nj.call(i,e,l,o,"reference","referenceMarker","referenceString")(d)}function l(d){return i.parser.defined.includes(fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function o(d){return n(d)}}function MB(e,t,n){return i;function i(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const DB={name:"labelStartImage",resolveAll:jx.resolveAll,tokenize:OB};function OB(e,t,n){const i=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),o):n(d)}function o(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(d):t(d)}}const RB={name:"labelStartLink",resolveAll:jx.resolveAll,tokenize:LB};function LB(e,t,n){const i=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(o):t(o)}}const Vg={name:"lineEnding",tokenize:IB};function IB(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),St(e,t,"linePrefix")}}const ap={name:"thematicBreak",tokenize:zB};function zB(e,t,n){let i=0,a;return l;function l(p){return e.enter("thematicBreak"),o(p)}function o(p){return a=p,d(p)}function d(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):i>=3&&(p===null||Je(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),i++,f):(e.exit("thematicBreakSequence"),gt(p)?St(e,d,"whitespace")(p):d(p))}}const ci={continuation:{tokenize:UB},exit:qB,name:"list",tokenize:$B},PB={partial:!0,tokenize:HB},BB={partial:!0,tokenize:FB};function $B(e,t,n){const i=this,a=i.events[i.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return d;function d(b){const k=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:rb(b)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(ap,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return rb(b)&&++o<10?(e.consume(b),f):(!i.interrupt||o<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(td,i.interrupt?n:g,e.attempt(PB,y,m))}function g(b){return i.containerState.initialBlankLine=!0,l++,y(b)}function m(b){return gt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=l+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function UB(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(td,a,l);function a(d){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,St(e,t,"listItemIndent",i.containerState.size+1)(d)}function l(d){return i.containerState.furtherBlankLines||!gt(d)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(d)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(BB,t,o)(d))}function o(d){return i.containerState._closeFlow=!0,i.interrupt=void 0,St(e,e.attempt(ci,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function FB(e,t,n){const i=this;return St(e,a,"listItemIndent",i.containerState.size+1);function a(l){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(l):n(l)}}function qB(e){e.exit(this.containerState.type)}function HB(e,t,n){const i=this;return St(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const o=i.events[i.events.length-1];return!gt(l)&&o&&o[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const iE={name:"setextUnderline",resolveTo:KB,tokenize:GB};function KB(e,t){let n=e.length,i,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",o,t]),e.splice(l+1,0,["exit",e[i][1],t]),e[i][1].end={...e[l][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function GB(e,t,n){const i=this;let a;return l;function l(p){let g=i.events.length,m;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){m=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),a=p,o(p)):n(p)}function o(p){return e.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===a?(e.consume(p),d):(e.exit("setextHeadingLineSequence"),gt(p)?St(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Je(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const VB={tokenize:YB};function YB(e){const t=this,n=e.attempt(td,i,e.attempt(this.parser.constructs.flowInitial,a,St(e,e.attempt(this.parser.constructs.flow,a,e.attempt(J5,a)),"linePrefix")));return n;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const WB={resolveAll:aj()},QB=rj("string"),XB=rj("text");function rj(e){return{resolveAll:aj(e==="text"?ZB:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],l=n.attempt(a,o,d);return o;function o(g){return p(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return p(g)?(n.exit("data"),l(g)):(n.consume(g),f)}function p(g){if(g===null)return!0;const m=a[g];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function aj(e){return t;function t(n,i){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,i):n}}function ZB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let l=a.length,o=-1,d=0,f;for(;l--;){const p=a[l];if(typeof p=="string"){for(o=p.length;p.charCodeAt(o-1)===32;)d++,o--;if(o)break;o=-1}else if(p===-2)f=!0,d++;else if(p!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const p={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:i.start._bufferIndex+o,_index:i.start._index+l,line:i.end.line,column:i.end.column-d,offset:i.end.offset-d},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const JB={42:ci,43:ci,45:ci,48:ci,49:ci,50:ci,51:ci,52:ci,53:ci,54:ci,55:ci,56:ci,57:ci,62:X2},e6={91:rB},t6={[-2]:Gg,[-1]:Gg,32:Gg},n6={35:uB,42:ap,45:[iE,ap],60:hB,61:iE,95:ap,96:tE,126:tE},i6={38:J2,92:Z2},r6={[-5]:Vg,[-4]:Vg,[-3]:Vg,33:DB,38:J2,42:ab,60:[R5,wB],91:RB,92:[oB,Z2],93:jx,95:ab,96:V5},a6={null:[ab,WB]},s6={null:[42,95]},l6={null:[]},o6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:s6,contentInitial:e6,disable:l6,document:JB,flow:n6,flowInitial:t6,insideSpan:a6,string:i6,text:r6},Symbol.toStringTag,{value:"Module"}));function c6(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let o=[],d=[];const f={attempt:O(T),check:O(M),consume:C,enter:N,exit:_,interrupt:O(M,{interrupt:!0})},p={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:m};let g=t.tokenize.call(p,f);return t.resolveAll&&l.push(t),p;function m(K){return o=Hi(o,K),S(),o[o.length-1]!==null?[]:(R(t,0),p.events=lh(l,p.events,p),p.events)}function y(K,q){return d6(b(K),q)}function b(K){return u6(o,K)}function k(){const{_bufferIndex:K,_index:q,line:Y,column:D,offset:F}=i;return{_bufferIndex:K,_index:q,line:Y,column:D,offset:F}}function v(K){a[K.line]=K.column,U()}function S(){let K;for(;i._index<o.length;){const q=o[i._index];if(typeof q=="string")for(K=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===K&&i._bufferIndex<q.length;)E(q.charCodeAt(i._bufferIndex));else E(q)}}function E(K){g=g(K)}function C(K){Je(K)?(i.line++,i.column=1,i.offset+=K===-3?2:1,U()):K!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=K}function N(K,q){const Y=q||{};return Y.type=K,Y.start=k(),p.events.push(["enter",Y,p]),d.push(Y),Y}function _(K){const q=d.pop();return q.end=k(),p.events.push(["exit",q,p]),q}function T(K,q){R(K,q.from)}function M(K,q){q.restore()}function O(K,q){return Y;function Y(D,F,I){let H,W,G,L;return Array.isArray(D)?V(D):"tokenize"in D?V([D]):z(D);function z(ke){return Ne;function Ne(se){const ve=se!==null&&ke[se],ue=se!==null&&ke.null,J=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return V(J)(se)}}function V(ke){return H=ke,W=0,ke.length===0?I:P(ke[W])}function P(ke){return Ne;function Ne(se){return L=B(),G=ke,ke.partial||(p.currentConstruct=ke),ke.name&&p.parser.constructs.disable.null.includes(ke.name)?xe():ke.tokenize.call(q?Object.assign(Object.create(p),q):p,f,le,xe)(se)}}function le(ke){return K(G,L),F}function xe(ke){return L.restore(),++W<H.length?P(H[W]):I}}}function R(K,q){K.resolveAll&&!l.includes(K)&&l.push(K),K.resolve&&ji(p.events,q,p.events.length-q,K.resolve(p.events.slice(q),p)),K.resolveTo&&(p.events=K.resolveTo(p.events,p))}function B(){const K=k(),q=p.previous,Y=p.currentConstruct,D=p.events.length,F=Array.from(d);return{from:D,restore:I};function I(){i=K,p.previous=q,p.currentConstruct=Y,p.events.length=D,d=F,U()}}function U(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function u6(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(i,l)];else{if(o=e.slice(n,a),i>-1){const d=o[0];typeof d=="string"?o[0]=d.slice(i):o.shift()}l>0&&o.push(e[a].slice(0,l))}return o}function d6(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const l=e[n];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
|
|
623
623
|
`;break}case-3:{o=`\r
|
|
624
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(l)}a=l===-2,i.push(o)}return i.join("")}function f6(e){const i={constructs:W2([o6,...(e||{}).extensions||[]]),content:a(jP),defined:[],document:a(AP),flow:a(VB),lazy:{},string:a(QB),text:a(XB)};return i;function a(l){return o;function o(d){return c6(i,l,d)}}}function p6(e){for(;!ej(e););return e}const rE=/[\0\t\n\r]/g;function h6(){let e=1,t="",n=!0,i;return a;function a(l,o,d){const f=[];let p,g,m,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(rE.lastIndex=m,p=rE.exec(l),y=p&&p.index!==void 0?p.index:l.length,b=l.charCodeAt(y),!p){t=l.slice(m);break}if(b===10&&m===y&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),m<y&&(f.push(l.slice(m,y)),e+=y-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}m=y+1}return d&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const m6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function g6(e){return e.replace(m6,y6)}function y6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return Q2(n.slice(l?2:1),l?16:10)}return _x(n)||e}const sj={}.hasOwnProperty;function b6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),x6(n)(p6(f6(n).document().write(h6()(e,t,!0))))}function x6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ce),autolinkProtocol:B,autolinkEmail:B,atxHeading:l(Me),blockQuote:l(ue),characterEscape:B,characterReference:B,codeFenced:l(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(J,o),codeText:l(we,o),codeTextData:B,data:B,codeFlowValue:B,definition:l(re),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Ce),hardBreakEscape:l(_e),hardBreakTrailing:l(_e),htmlFlow:l(Qe,o),htmlFlowData:B,htmlText:l(Qe,o),htmlTextData:B,image:l(Ue),label:o,link:l(ce),listItem:l(ge),listItemValue:y,listOrdered:l(be,m),listUnordered:l(be),paragraph:l(pe),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(Me),strong:l(Se),thematicBreak:l(He)},exit:{atxHeading:f(),atxHeadingSequence:T,autolink:f(),autolinkEmail:ve,autolinkProtocol:se,blockQuote:f(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:ke,characterReference:Ne,codeFenced:f(S),codeFencedFence:v,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:U,codeIndented:f(E),codeText:f(F),codeTextData:U,data:U,definition:f(),definitionDestinationString:_,definitionLabelString:C,definitionTitleString:N,emphasis:f(),hardBreakEscape:f(q),hardBreakTrailing:f(q),htmlFlow:f(Y),htmlFlowData:U,htmlText:f(D),htmlTextData:U,image:f(H),label:G,labelText:W,lineEnding:K,link:f(I),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:le,resourceDestinationString:L,resourceTitleString:z,resource:V,setextHeading:f(R),setextHeadingLineSequence:O,setextHeadingText:M,strong:f(),thematicBreak:f()}};lj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(te){let de={type:"root",children:[]};const Le={stack:[de],tokenStack:[],config:t,enter:d,exit:p,buffer:o,resume:g,data:n},Ze=[];let rt=-1;for(;++rt<te.length;)if(te[rt][1].type==="listOrdered"||te[rt][1].type==="listUnordered")if(te[rt][0]==="enter")Ze.push(rt);else{const At=Ze.pop();rt=a(te,At,rt)}for(rt=-1;++rt<te.length;){const At=t[te[rt][0]];sj.call(At,te[rt][1].type)&&At[te[rt][1].type].call(Object.assign({sliceSerialize:te[rt][2].sliceSerialize},Le),te[rt][1])}if(Le.tokenStack.length>0){const At=Le.tokenStack[Le.tokenStack.length-1];(At[1]||aE).call(Le,void 0,At[0])}for(de.position={start:ns(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:ns(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)de=t.transforms[rt](de)||de;return de}function a(te,de,Le){let Ze=de-1,rt=-1,At=!1,$n,dn,Mt,Wt;for(;++Ze<=Le;){const yt=te[Ze];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?rt++:rt--,Wt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&($n&&!Wt&&!rt&&!Mt&&(Mt=Ze),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!rt&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||rt===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if($n){let Ti=Ze;for(dn=void 0;Ti--;){const Rn=te[Ti];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;dn&&(te[dn][1].type="lineEndingBlank",At=!0),Rn[1].type="lineEnding",dn=Ti}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}Mt&&(!dn||Mt<dn)&&($n._spread=!0),$n.end=Object.assign({},dn?te[dn][1].start:yt[1].end),te.splice(dn||Ze,0,["exit",$n,yt[2]]),Ze++,Le++}if(yt[1].type==="listItemPrefix"){const Ti={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};$n=Ti,te.splice(Ze,0,["enter",Ti,yt[2]]),Ze++,Le++,Mt=void 0,Wt=!0}}}return te[de][1]._spread=At,Le}function l(te,de){return Le;function Le(Ze){d.call(this,te(Ze),Ze),de&&de.call(this,Ze)}}function o(){this.stack.push({type:"fragment",children:[]})}function d(te,de,Le){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([de,Le||void 0]),te.position={start:ns(de.start),end:void 0}}function f(te){return de;function de(Le){te&&te.call(this,Le),p.call(this,Le)}}function p(te,de){const Le=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==te.type&&(de?de.call(this,te,Ze[0]):(Ze[1]||aE).call(this,te,Ze[0]));else throw new Error("Cannot close `"+te.type+"` ("+hu({start:te.start,end:te.end})+"): it’s not open");Le.position.end=ns(te.end)}function g(){return Nx(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(te){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function b(){const te=this.resume(),de=this.stack[this.stack.length-1];de.lang=te}function k(){const te=this.resume(),de=this.stack[this.stack.length-1];de.meta=te}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/(\r?\n|\r)$/g,"")}function C(te){const de=this.resume(),Le=this.stack[this.stack.length-1];Le.label=de,Le.identifier=fr(this.sliceSerialize(te)).toLowerCase()}function N(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function _(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function T(te){const de=this.stack[this.stack.length-1];if(!de.depth){const Le=this.sliceSerialize(te).length;de.depth=Le}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function O(te){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function B(te){const Le=this.stack[this.stack.length-1].children;let Ze=Le[Le.length-1];(!Ze||Ze.type!=="text")&&(Ze=je(),Ze.position={start:ns(te.start),end:void 0},Le.push(Ze)),this.stack.push(Ze)}function U(te){const de=this.stack.pop();de.value+=this.sliceSerialize(te),de.position.end=ns(te.end)}function K(te){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=de.children[de.children.length-1];Le.position.end=ns(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(de.type)&&(B.call(this,te),U.call(this,te))}function q(){this.data.atHardBreak=!0}function Y(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function D(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function F(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function I(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function H(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function W(te){const de=this.sliceSerialize(te),Le=this.stack[this.stack.length-2];Le.label=g6(de),Le.identifier=fr(de).toLowerCase()}function G(){const te=this.stack[this.stack.length-1],de=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ze=te.children;Le.children=Ze}else Le.alt=de}function L(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function z(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function V(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function le(te){const de=this.resume(),Le=this.stack[this.stack.length-1];Le.label=de,Le.identifier=fr(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function xe(te){this.data.characterReferenceType=te.type}function ke(te){const de=this.sliceSerialize(te),Le=this.data.characterReferenceType;let Ze;Le?(Ze=Q2(de,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=_x(de);const rt=this.stack[this.stack.length-1];rt.value+=Ze}function Ne(te){const de=this.stack.pop();de.position.end=ns(te.end)}function se(te){U.call(this,te);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(te)}function ve(te){U.call(this,te);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(te)}function ue(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Qe(){return{type:"html",value:""}}function Ue(){return{type:"image",title:null,url:"",alt:null}}function ce(){return{type:"link",title:null,url:"",children:[]}}function be(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function ge(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function je(){return{type:"text",value:""}}function He(){return{type:"thematicBreak"}}}function ns(e){return{line:e.line,column:e.column,offset:e.offset}}function lj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?lj(e,i):v6(e,i)}}function v6(e,t){let n;for(n in t)if(sj.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function aE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is still open")}function w6(e){const t=this;t.parser=n;function n(i){return b6(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function k6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function E6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
624
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(l)}a=l===-2,i.push(o)}return i.join("")}function f6(e){const i={constructs:W2([o6,...(e||{}).extensions||[]]),content:a(j5),defined:[],document:a(A5),flow:a(VB),lazy:{},string:a(QB),text:a(XB)};return i;function a(l){return o;function o(d){return c6(i,l,d)}}}function p6(e){for(;!ej(e););return e}const rE=/[\0\t\n\r]/g;function h6(){let e=1,t="",n=!0,i;return a;function a(l,o,d){const f=[];let p,g,m,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(rE.lastIndex=m,p=rE.exec(l),y=p&&p.index!==void 0?p.index:l.length,b=l.charCodeAt(y),!p){t=l.slice(m);break}if(b===10&&m===y&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),m<y&&(f.push(l.slice(m,y)),e+=y-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}m=y+1}return d&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const m6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function g6(e){return e.replace(m6,y6)}function y6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return Q2(n.slice(l?2:1),l?16:10)}return _x(n)||e}const sj={}.hasOwnProperty;function b6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),x6(n)(p6(f6(n).document().write(h6()(e,t,!0))))}function x6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ce),autolinkProtocol:B,autolinkEmail:B,atxHeading:l(Me),blockQuote:l(ue),characterEscape:B,characterReference:B,codeFenced:l(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(J,o),codeText:l(we,o),codeTextData:B,data:B,codeFlowValue:B,definition:l(re),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Ce),hardBreakEscape:l(_e),hardBreakTrailing:l(_e),htmlFlow:l(Qe,o),htmlFlowData:B,htmlText:l(Qe,o),htmlTextData:B,image:l(Ue),label:o,link:l(ce),listItem:l(ge),listItemValue:y,listOrdered:l(be,m),listUnordered:l(be),paragraph:l(pe),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(Me),strong:l(Se),thematicBreak:l(He)},exit:{atxHeading:f(),atxHeadingSequence:T,autolink:f(),autolinkEmail:ve,autolinkProtocol:se,blockQuote:f(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:ke,characterReference:Ne,codeFenced:f(S),codeFencedFence:v,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:U,codeIndented:f(E),codeText:f(F),codeTextData:U,data:U,definition:f(),definitionDestinationString:_,definitionLabelString:C,definitionTitleString:N,emphasis:f(),hardBreakEscape:f(q),hardBreakTrailing:f(q),htmlFlow:f(Y),htmlFlowData:U,htmlText:f(D),htmlTextData:U,image:f(H),label:G,labelText:W,lineEnding:K,link:f(I),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:le,resourceDestinationString:L,resourceTitleString:z,resource:V,setextHeading:f(R),setextHeadingLineSequence:O,setextHeadingText:M,strong:f(),thematicBreak:f()}};lj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(te){let de={type:"root",children:[]};const Le={stack:[de],tokenStack:[],config:t,enter:d,exit:p,buffer:o,resume:g,data:n},Ze=[];let rt=-1;for(;++rt<te.length;)if(te[rt][1].type==="listOrdered"||te[rt][1].type==="listUnordered")if(te[rt][0]==="enter")Ze.push(rt);else{const At=Ze.pop();rt=a(te,At,rt)}for(rt=-1;++rt<te.length;){const At=t[te[rt][0]];sj.call(At,te[rt][1].type)&&At[te[rt][1].type].call(Object.assign({sliceSerialize:te[rt][2].sliceSerialize},Le),te[rt][1])}if(Le.tokenStack.length>0){const At=Le.tokenStack[Le.tokenStack.length-1];(At[1]||aE).call(Le,void 0,At[0])}for(de.position={start:ns(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:ns(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)de=t.transforms[rt](de)||de;return de}function a(te,de,Le){let Ze=de-1,rt=-1,At=!1,$n,dn,Mt,Wt;for(;++Ze<=Le;){const yt=te[Ze];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?rt++:rt--,Wt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&($n&&!Wt&&!rt&&!Mt&&(Mt=Ze),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!rt&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||rt===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if($n){let Ti=Ze;for(dn=void 0;Ti--;){const Rn=te[Ti];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;dn&&(te[dn][1].type="lineEndingBlank",At=!0),Rn[1].type="lineEnding",dn=Ti}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}Mt&&(!dn||Mt<dn)&&($n._spread=!0),$n.end=Object.assign({},dn?te[dn][1].start:yt[1].end),te.splice(dn||Ze,0,["exit",$n,yt[2]]),Ze++,Le++}if(yt[1].type==="listItemPrefix"){const Ti={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};$n=Ti,te.splice(Ze,0,["enter",Ti,yt[2]]),Ze++,Le++,Mt=void 0,Wt=!0}}}return te[de][1]._spread=At,Le}function l(te,de){return Le;function Le(Ze){d.call(this,te(Ze),Ze),de&&de.call(this,Ze)}}function o(){this.stack.push({type:"fragment",children:[]})}function d(te,de,Le){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([de,Le||void 0]),te.position={start:ns(de.start),end:void 0}}function f(te){return de;function de(Le){te&&te.call(this,Le),p.call(this,Le)}}function p(te,de){const Le=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==te.type&&(de?de.call(this,te,Ze[0]):(Ze[1]||aE).call(this,te,Ze[0]));else throw new Error("Cannot close `"+te.type+"` ("+hu({start:te.start,end:te.end})+"): it’s not open");Le.position.end=ns(te.end)}function g(){return Nx(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(te){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function b(){const te=this.resume(),de=this.stack[this.stack.length-1];de.lang=te}function k(){const te=this.resume(),de=this.stack[this.stack.length-1];de.meta=te}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/(\r?\n|\r)$/g,"")}function C(te){const de=this.resume(),Le=this.stack[this.stack.length-1];Le.label=de,Le.identifier=fr(this.sliceSerialize(te)).toLowerCase()}function N(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function _(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function T(te){const de=this.stack[this.stack.length-1];if(!de.depth){const Le=this.sliceSerialize(te).length;de.depth=Le}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function O(te){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function B(te){const Le=this.stack[this.stack.length-1].children;let Ze=Le[Le.length-1];(!Ze||Ze.type!=="text")&&(Ze=je(),Ze.position={start:ns(te.start),end:void 0},Le.push(Ze)),this.stack.push(Ze)}function U(te){const de=this.stack.pop();de.value+=this.sliceSerialize(te),de.position.end=ns(te.end)}function K(te){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=de.children[de.children.length-1];Le.position.end=ns(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(de.type)&&(B.call(this,te),U.call(this,te))}function q(){this.data.atHardBreak=!0}function Y(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function D(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function F(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function I(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function H(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function W(te){const de=this.sliceSerialize(te),Le=this.stack[this.stack.length-2];Le.label=g6(de),Le.identifier=fr(de).toLowerCase()}function G(){const te=this.stack[this.stack.length-1],de=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ze=te.children;Le.children=Ze}else Le.alt=de}function L(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function z(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function V(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function le(te){const de=this.resume(),Le=this.stack[this.stack.length-1];Le.label=de,Le.identifier=fr(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function xe(te){this.data.characterReferenceType=te.type}function ke(te){const de=this.sliceSerialize(te),Le=this.data.characterReferenceType;let Ze;Le?(Ze=Q2(de,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=_x(de);const rt=this.stack[this.stack.length-1];rt.value+=Ze}function Ne(te){const de=this.stack.pop();de.position.end=ns(te.end)}function se(te){U.call(this,te);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(te)}function ve(te){U.call(this,te);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(te)}function ue(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Qe(){return{type:"html",value:""}}function Ue(){return{type:"image",title:null,url:"",alt:null}}function ce(){return{type:"link",title:null,url:"",children:[]}}function be(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function ge(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function je(){return{type:"text",value:""}}function He(){return{type:"thematicBreak"}}}function ns(e){return{line:e.line,column:e.column,offset:e.offset}}function lj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?lj(e,i):v6(e,i)}}function v6(e,t){let n;for(n in t)if(sj.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function aE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is still open")}function w6(e){const t=this;t.parser=n;function n(i){return b6(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function k6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function E6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
625
625
|
`}]}function S6(e,t){const n=t.value?t.value+`
|
|
626
626
|
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function N6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=oc(i.toLowerCase()),l=e.footnoteOrder.indexOf(i);let o,d=e.footnoteCounts.get(i);d===void 0?(d=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=l+1,d+=1,e.footnoteCounts.set(i,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function C6(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 A6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function oj(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=i:a.push({type:"text",value:i}),a}function T6(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return oj(e,t);const a={src:oc(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function M6(e,t){const n={src:oc(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 i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function D6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function O6(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return oj(e,t);const a={href:oc(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function R6(e,t){const n={href:oc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function L6(e,t,n){const i=e.all(t),a=n?I6(n):cj(t),l={},o=[];if(typeof t.checked=="boolean"){const g=i[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},i.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<i.length;){const g=i[d];(a||d!==0||g.type!=="element"||g.tagName!=="p")&&o.push({type:"text",value:`
|
|
627
627
|
`}),g.type==="element"&&g.tagName==="p"&&!a?o.push(...g.children):o.push(g)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
|
|
628
628
|
`});const p={type:"element",tagName:"li",properties:l,children:o};return e.patch(t,p),e.applyData(t,p)}function I6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=cj(n[i])}return t}function cj(e){const t=e.spread;return t??e.children.length>1}function z6(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const o=i[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function P6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function B6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U6(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=wx(t.children[1]),f=F2(t.children[t.children.length-1]);d&&f&&(o.position={start:d,end:f}),a.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function F6(e,t,n){const i=n?n.children:void 0,l=(i?i.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,d=o?o.length:t.children.length;let f=-1;const p=[];for(;++f<d;){const m=t.children[f],y={},b=o?o[f]:void 0;b&&(y.align=b);let k={type:"element",tagName:l,properties:y,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),p.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function q6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const sE=9,lE=32;function H6(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const l=[];for(;i;)l.push(oE(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return l.push(oE(t.slice(a),a>0,!1)),l.join("")}function oE(e,t,n){let i=0,a=e.length;if(t){let l=e.codePointAt(i);for(;l===sE||l===lE;)i++,l=e.codePointAt(i)}if(n){let l=e.codePointAt(a-1);for(;l===sE||l===lE;)a--,l=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function K6(e,t){const n={type:"text",value:H6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function G6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const V6={blockquote:k6,break:E6,code:S6,delete:N6,emphasis:_6,footnoteReference:j6,heading:C6,html:A6,imageReference:T6,image:M6,inlineCode:D6,linkReference:O6,link:R6,listItem:L6,list:z6,paragraph:P6,root:B6,strong:$6,table:U6,tableCell:q6,tableRow:F6,text:K6,thematicBreak:G6,toml:Df,yaml:Df,definition:Df,footnoteDefinition:Df};function Df(){}const uj=-1,oh=0,gu=1,Ep=2,Cx=3,Ax=4,Tx=5,Mx=6,dj=7,fj=8,cE=typeof self=="object"?self:globalThis,Y6=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),i=a=>{if(e.has(a))return e.get(a);const[l,o]=t[a];switch(l){case oh:case uj:return n(o,a);case gu:{const d=n([],a);for(const f of o)d.push(i(f));return d}case Ep:{const d=n({},a);for(const[f,p]of o)d[i(f)]=i(p);return d}case Cx:return n(new Date(o),a);case Ax:{const{source:d,flags:f}=o;return n(new RegExp(d,f),a)}case Tx:{const d=n(new Map,a);for(const[f,p]of o)d.set(i(f),i(p));return d}case Mx:{const d=n(new Set,a);for(const f of o)d.add(i(f));return d}case dj:{const{name:d,message:f}=o;return n(new cE[d](f),a)}case fj:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:d}=new Uint8Array(o);return n(new DataView(d),o)}}return n(new cE[l](o),a)};return i},uE=e=>Y6(new Map,e)(0),co="",{toString:W6}={},{keys:Q6}=Object,au=e=>{const t=typeof e;if(t!=="object"||!e)return[oh,t];const n=W6.call(e).slice(8,-1);switch(n){case"Array":return[gu,co];case"Object":return[Ep,co];case"Date":return[Cx,co];case"RegExp":return[Ax,co];case"Map":return[Tx,co];case"Set":return[Mx,co];case"DataView":return[gu,n]}return n.includes("Array")?[gu,n]:n.includes("Error")?[dj,n]:[Ep,n]},Of=([e,t])=>e===oh&&(t==="function"||t==="symbol"),X6=(e,t,n,i)=>{const a=(o,d)=>{const f=i.push(o)-1;return n.set(d,f),f},l=o=>{if(n.has(o))return n.get(o);let[d,f]=au(o);switch(d){case oh:{let g=o;switch(f){case"bigint":d=fj,g=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return a([uj],o)}return a([d,g],o)}case gu:{if(f){let y=o;return f==="DataView"?y=new Uint8Array(o.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(o)),a([f,[...y]],o)}const g=[],m=a([d,g],o);for(const y of o)g.push(l(y));return m}case Ep:{if(f)switch(f){case"BigInt":return a([f,o.toString()],o);case"Boolean":case"Number":case"String":return a([f,o.valueOf()],o)}if(t&&"toJSON"in o)return l(o.toJSON());const g=[],m=a([d,g],o);for(const y of Q6(o))(e||!Of(au(o[y])))&&g.push([l(y),l(o[y])]);return m}case Cx:return a([d,o.toISOString()],o);case Ax:{const{source:g,flags:m}=o;return a([d,{source:g,flags:m}],o)}case Tx:{const g=[],m=a([d,g],o);for(const[y,b]of o)(e||!(Of(au(y))||Of(au(b))))&&g.push([l(y),l(b)]);return m}case Mx:{const g=[],m=a([d,g],o);for(const y of o)(e||!Of(au(y)))&&g.push(l(y));return m}}const{message:p}=o;return a([d,{name:f,message:p}],o)};return l},dE=(e,{json:t,lossy:n}={})=>{const i=[];return X6(!(t||n),!!t,new Map,i)(e),i},Sp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?uE(dE(e,t)):structuredClone(e):(e,t)=>uE(dE(e,t));function Z6(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function J6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function e$(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Z6,i=e.options.footnoteBackLabel||J6,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const g=e.all(p),m=String(p.identifier).toUpperCase(),y=oc(m.toLowerCase());let b=0;const k=[],v=e.footnoteCounts.get(m);for(;v!==void 0&&++b<=v;){k.length>0&&k.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,b);typeof C=="string"&&(C={type:"text",value:C}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,b),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const S=g[g.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const C=S.children[S.children.length-1];C&&C.type==="text"?C.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...k)}else g.push(...k);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(g,!0)};e.patch(p,E),d.push(E)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Sp(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
629
629
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
630
|
-
`}]}}const nd=(function(e){if(e==null)return r$;if(typeof e=="function")return ch(e);if(typeof e=="object")return Array.isArray(e)?t$(e):n$(e);if(typeof e=="string")return i$(e);throw new Error("Expected function, string, or object as test")});function t$(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=nd(e[n]);return ch(i);function i(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function n$(e){const t=e;return ch(n);function n(i){const a=i;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function i$(e){return ch(t);function t(n){return n&&n.type===e}}function ch(e){return t;function t(n,i,a){return!!(a$(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function r$(){return!0}function a$(e){return e!==null&&typeof e=="object"&&"type"in e}const pj=[],s$=!0,sb=!1,l$="skip";function hj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const l=nd(a),o=i?-1:1;d(e,void 0,[])();function d(f,p,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=pj,k,v,S;if((!t||l(f,p,g[g.length-1]||void 0))&&(b=o$(n(f,g)),b[0]===sb))return b;if("children"in f&&f.children){const E=f;if(E.children&&b[0]!==l$)for(v=(i?E.children.length:-1)+o,S=g.concat(E);v>-1&&v<E.children.length;){const C=E.children[v];if(k=d(C,v,S)(),k[0]===sb)return k;v=typeof k[1]=="number"?k[1]:v+o}}return b}}}function o$(e){return Array.isArray(e)?e:typeof e=="number"?[s$,e]:e==null?pj:[e]}function uh(e,t,n,i){let a,l,o;typeof t=="function"&&typeof n!="function"?(l=void 0,o=t,a=n):(l=t,o=n,a=i),hj(e,l,d,a);function d(f,p){const g=p[p.length-1],m=g?g.children.indexOf(f):void 0;return o(f,m,g)}}const lb={}.hasOwnProperty,c$={};function u$(e,t){const n=t||c$,i=new Map,a=new Map,l=new Map,o={...V6,...n.handlers},d={all:p,applyData:f$,definitionById:i,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:o,one:f,options:n,patch:d$,wrap:h$};return uh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?i:a,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,b=d.handlers[y];if(lb.call(d.handlers,y)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:v,...S}=g,E=Sp(S);return E.children=d.all(g),E}return Sp(g)}return(d.options.unknownHandler||p$)(d,g,m)}function p(g){const m=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const k=d.one(y[b],g);if(k){if(b&&y[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=fE(k.value)),!Array.isArray(k)&&k.type==="element")){const v=k.children[0];v&&v.type==="text"&&(v.value=fE(v.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function d$(e,t){e.position&&(t.position=
|
|
630
|
+
`}]}}const nd=(function(e){if(e==null)return r$;if(typeof e=="function")return ch(e);if(typeof e=="object")return Array.isArray(e)?t$(e):n$(e);if(typeof e=="string")return i$(e);throw new Error("Expected function, string, or object as test")});function t$(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=nd(e[n]);return ch(i);function i(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function n$(e){const t=e;return ch(n);function n(i){const a=i;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function i$(e){return ch(t);function t(n){return n&&n.type===e}}function ch(e){return t;function t(n,i,a){return!!(a$(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function r$(){return!0}function a$(e){return e!==null&&typeof e=="object"&&"type"in e}const pj=[],s$=!0,sb=!1,l$="skip";function hj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const l=nd(a),o=i?-1:1;d(e,void 0,[])();function d(f,p,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=pj,k,v,S;if((!t||l(f,p,g[g.length-1]||void 0))&&(b=o$(n(f,g)),b[0]===sb))return b;if("children"in f&&f.children){const E=f;if(E.children&&b[0]!==l$)for(v=(i?E.children.length:-1)+o,S=g.concat(E);v>-1&&v<E.children.length;){const C=E.children[v];if(k=d(C,v,S)(),k[0]===sb)return k;v=typeof k[1]=="number"?k[1]:v+o}}return b}}}function o$(e){return Array.isArray(e)?e:typeof e=="number"?[s$,e]:e==null?pj:[e]}function uh(e,t,n,i){let a,l,o;typeof t=="function"&&typeof n!="function"?(l=void 0,o=t,a=n):(l=t,o=n,a=i),hj(e,l,d,a);function d(f,p){const g=p[p.length-1],m=g?g.children.indexOf(f):void 0;return o(f,m,g)}}const lb={}.hasOwnProperty,c$={};function u$(e,t){const n=t||c$,i=new Map,a=new Map,l=new Map,o={...V6,...n.handlers},d={all:p,applyData:f$,definitionById:i,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:o,one:f,options:n,patch:d$,wrap:h$};return uh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?i:a,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,b=d.handlers[y];if(lb.call(d.handlers,y)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:v,...S}=g,E=Sp(S);return E.children=d.all(g),E}return Sp(g)}return(d.options.unknownHandler||p$)(d,g,m)}function p(g){const m=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const k=d.one(y[b],g);if(k){if(b&&y[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=fE(k.value)),!Array.isArray(k)&&k.type==="element")){const v=k.children[0];v&&v.type==="text"&&(v.value=fE(v.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function d$(e,t){e.position&&(t.position=JP(e))}function f$(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,l=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const o="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:o}}n.type==="element"&&l&&Object.assign(n.properties,Sp(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function p$(e,t){const n=t.data||{},i="value"in t&&!(lb.call(n,"hProperties")||lb.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function h$(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
631
631
|
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
632
632
|
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
633
633
|
`}),n}function fE(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pE(e,t){const n=u$(e,t),i=n.one(e,void 0),a=e$(n),l=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&l.children.push({type:"text",value:`
|
|
634
|
-
`},a),l}function m$(e,t){return e&&"run"in e?async function(n,i){const a=pE(n,{file:i,...t});await e.run(a,i)}:function(n,i){return pE(n,{file:i,...e||t})}}function hE(e){if(e)throw e}var Yg,mE;function g$(){if(mE)return Yg;mE=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},l=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},o=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},d=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return Yg=function f(){var p,g,m,y,b,k,v=arguments[0],S=1,E=arguments.length,C=!1;for(typeof v=="boolean"&&(C=v,v=arguments[1]||{},S=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});S<E;++S)if(p=arguments[S],p!=null)for(g in p)m=d(v,g),y=d(p,g),v!==y&&(C&&y&&(l(y)||(b=a(y)))?(b?(b=!1,k=m&&a(m)?m:[]):k=m&&l(m)?m:{},o(v,{name:g,newValue:f(C,k,y)})):typeof y<"u"&&o(v,{name:g,newValue:y}));return v},Yg}var y$=g$();const Wg=Hu(y$);function ob(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 b$(){const e=[],t={run:n,use:i};return t;function n(...a){let l=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);d(null,...a);function d(f,...p){const g=e[++l];let m=-1;if(f){o(f);return}for(;++m<a.length;)(p[m]===null||p[m]===void 0)&&(p[m]=a[m]);a=p,g?x$(g,d)(...p):o(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function x$(e,t){let n;return i;function i(...o){const d=e.length>o.length;let f;d&&o.push(a);try{f=e.apply(this,o)}catch(p){const g=p;if(d&&n)throw g;return a(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(l,a):f instanceof Error?a(f):l(f))}function a(o,...d){n||(n=!0,t(o,...d))}function l(o){a(null,o)}}const jr={basename:v$,dirname:w$,extname:k$,join:E$,sep:"/"};function v$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');id(e);let n=0,i=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else i<0&&(l=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else o<0&&(l=!0,o=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(i=a):(d=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function w$(e){if(id(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function k$(e){id(e);let t=e.length,n=-1,i=0,a=-1,l=0,o;for(;t--;){const d=e.codePointAt(t);if(d===47){if(o){i=t+1;break}continue}n<0&&(o=!0,n=t+1),d===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function E$(...e){let t=-1,n;for(;++t<e.length;)id(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S$(n)}function S$(e){id(e);const t=e.codePointAt(0)===47;let n=N$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function N$(e,t){let n="",i=0,a=-1,l=0,o=-1,d,f;for(;++o<=e.length;){if(o<e.length)d=e.codePointAt(o);else{if(d===47)break;d=47}if(d===47){if(!(a===o-1||l===1))if(a!==o-1&&l===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=o,l=0;continue}}else if(n.length>0){n="",i=0,a=o,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),i=o-a-1;a=o,l=0}else d===46&&l>-1?l++:l=-1}return n}function id(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _$={cwd:j$};function j$(){return"/"}function cb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function C$(e){if(typeof e=="string")e=new URL(e);else if(!cb(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 A$(e)}function A$(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Qg=["history","path","basename","stem","extname","dirname"];class mj{constructor(t){let n;t?cb(t)?n={path:t}:typeof t=="string"||T$(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":_$.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Qg.length;){const l=Qg[i];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let a;for(a in n)Qg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?jr.basename(this.path):void 0}set basename(t){Zg(t,"basename"),Xg(t,"basename"),this.path=jr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?jr.dirname(this.path):void 0}set dirname(t){gE(this.basename,"dirname"),this.path=jr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?jr.extname(this.path):void 0}set extname(t){if(Xg(t,"extname"),gE(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=jr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cb(t)&&(t=C$(t)),Zg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?jr.basename(this.path,this.extname):void 0}set stem(t){Zg(t,"stem"),Xg(t,"stem"),this.path=jr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Yn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xg(e,t){if(e&&e.includes(jr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+jr.sep+"`")}function Zg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function gE(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function T$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M$=(function(e){const i=this.constructor.prototype,a=i[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,i),l}),D$={}.hasOwnProperty;class Dx extends M${constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=b$()}copy(){const t=new Dx;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Wg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ty("data",this.frozen),this.namespace[t]=n,this):D$.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ty("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Rf(t),i=this.parser||this.Parser;return Jg("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Jg("process",this.parser||this.Parser),ey("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,o){const d=Rf(t),f=i.parse(d);i.run(f,d,function(g,m,y){if(g||!m||!y)return p(g);const b=m,k=i.stringify(b,y);L$(k)?y.value=k:y.result=k,p(g,y)});function p(g,m){g||!m?o(g):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,i;return this.freeze(),Jg("processSync",this.parser||this.Parser),ey("processSync",this.compiler||this.Compiler),this.process(t,a),bE("processSync","process",n),i;function a(l,o){n=!0,hE(l),i=o}}run(t,n,i){yE(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?l(void 0,i):new Promise(l);function l(o,d){const f=Rf(n);a.run(t,f,p);function p(g,m,y){const b=m||t;g?d(g):o?o(b):i(void 0,b,y)}}}runSync(t,n){let i=!1,a;return this.run(t,n,l),bE("runSync","run",i),a;function l(o,d){hE(o),a=d,i=!0}}stringify(t,n){this.freeze();const i=Rf(n),a=this.compiler||this.Compiler;return ey("stringify",a),yE(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(ty("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;f(g,m)}else o(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function o(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(p.plugins),p.settings&&(a.settings=Wg(!0,a.settings,p.settings))}function d(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];l(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,g){let m=-1,y=-1;for(;++m<i.length;)if(i[m][0]===p){y=m;break}if(y===-1)i.push([p,...g]);else if(g.length>0){let[b,...k]=g;const v=i[y][1];ob(v)&&ob(b)&&(b=Wg(!0,v,b)),i[y]=[p,b,...k]}}}}const O$=new Dx().freeze();function Jg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ey(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ty(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yE(e){if(!ob(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bE(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rf(e){return R$(e)?e:new mj(e)}function R$(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function L$(e){return typeof e=="string"||I$(e)}function I$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const z$="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xE=[],vE={allowDangerousHtml:!0},P$=/^(https?|ircs?|mailto|xmpp)$/i,B$=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ox(e){const t=$$(e),n=U$(e);return F$(t.runSync(t.parse(n),n),e)}function $$(e){const t=e.rehypePlugins||xE,n=e.remarkPlugins||xE,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vE}:vE;return O$().use(w6).use(n).use(m$,i).use(t)}function U$(e){const t=e.children||"",n=new mj;return typeof t=="string"&&(n.value=t),n}function F$(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,l=t.disallowedElements,o=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||q$;for(const g of B$)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+z$+g.id,void 0);return uh(e,p),rP(e,{Fragment:c.Fragment,components:a,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function p(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return o?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Kg)if(Object.hasOwn(Kg,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],v=Kg[b];(v===null||v.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!b&&i&&typeof m=="number"&&(b=!i(g,m,y)),b&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function q$(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||P$.test(e.slice(0,t))?e:""}function wE(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function H$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function K$(e,t,n){const a=nd((n||{}).ignore||[]),l=G$(t);let o=-1;for(;++o<l.length;)hj(e,"text",d);function d(p,g){let m=-1,y;for(;++m<g.length;){const b=g[m],k=y?y.children:void 0;if(a(b,k?k.indexOf(b):void 0,y))return;y=b}if(y)return f(p,g)}function f(p,g){const m=g[g.length-1],y=l[o][0],b=l[o][1];let k=0;const S=m.children.indexOf(p);let E=!1,C=[];y.lastIndex=0;let N=y.exec(p.value);for(;N;){const _=N.index,T={index:N.index,input:N.input,stack:[...g,p]};let M=b(...N,T);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?y.lastIndex=_+1:(k!==_&&C.push({type:"text",value:p.value.slice(k,_)}),Array.isArray(M)?C.push(...M):M&&C.push(M),k=_+N[0].length,E=!0),!y.global)break;N=y.exec(p.value)}return E?(k<p.value.length&&C.push({type:"text",value:p.value.slice(k)}),m.children.splice(S,1,...C)):C=[p],S+C.length}}function G$(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([V$(a[0]),Y$(a[1])])}return t}function V$(e){return typeof e=="string"?new RegExp(H$(e),"g"):e}function Y$(e){return typeof e=="function"?e:function(){return e}}const ny="phrasing",iy=["autolink","link","image","label"];function W$(){return{transforms:[nU],enter:{literalAutolink:X$,literalAutolinkEmail:ry,literalAutolinkHttp:ry,literalAutolinkWww:ry},exit:{literalAutolink:tU,literalAutolinkEmail:eU,literalAutolinkHttp:Z$,literalAutolinkWww:J$}}}function Q$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:iy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:iy},{character:":",before:"[ps]",after:"\\/",inConstruct:ny,notInConstruct:iy}]}}function X$(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ry(e){this.config.enter.autolinkProtocol.call(this,e)}function Z$(e){this.config.exit.autolinkProtocol.call(this,e)}function J$(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function eU(e){this.config.exit.autolinkEmail.call(this,e)}function tU(e){this.exit(e)}function nU(e){K$(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iU],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),rU]],{ignore:["link","linkReference"]})}function iU(e,t,n,i,a){let l="";if(!gj(a)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!aU(n)))return!1;const o=sU(n+i);if(!o[0])return!1;const d={type:"link",title:null,url:l+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[d,{type:"text",value:o[1]}]:d}function rU(e,t,n,i){return!gj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function aU(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function sU(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=wE(e,"(");let l=wE(e,")");for(;i!==-1&&a>l;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),l++;return[e,n]}function gj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ml(n)||sh(n))&&(!t||n!==47)}yj.peek=mU;function lU(){this.buffer()}function oU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function cU(){this.buffer()}function uU(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function dU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fU(e){this.exit(e)}function pU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hU(e){this.exit(e)}function mU(){return"["}function yj(e,t,n,i){const a=n.createTracker(i);let l=a.move("[^");const o=n.enter("footnoteReference"),d=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),o(),l+=a.move("]"),l}function gU(){return{enter:{gfmFootnoteCallString:lU,gfmFootnoteCall:oU,gfmFootnoteDefinitionLabelString:cU,gfmFootnoteDefinition:uU},exit:{gfmFootnoteCallString:dU,gfmFootnoteCall:fU,gfmFootnoteDefinitionLabelString:pU,gfmFootnoteDefinition:hU}}}function yU(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:yj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,l,o){const d=l.createTracker(o);let f=d.move("[^");const p=l.enter("footnoteDefinition"),g=l.enter("label");return f+=d.move(l.safe(l.associationId(i),{before:f,after:"]"})),g(),f+=d.move("]:"),i.children&&i.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
634
|
+
`},a),l}function m$(e,t){return e&&"run"in e?async function(n,i){const a=pE(n,{file:i,...t});await e.run(a,i)}:function(n,i){return pE(n,{file:i,...e||t})}}function hE(e){if(e)throw e}var Yg,mE;function g$(){if(mE)return Yg;mE=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},l=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},o=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},d=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return Yg=function f(){var p,g,m,y,b,k,v=arguments[0],S=1,E=arguments.length,C=!1;for(typeof v=="boolean"&&(C=v,v=arguments[1]||{},S=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});S<E;++S)if(p=arguments[S],p!=null)for(g in p)m=d(v,g),y=d(p,g),v!==y&&(C&&y&&(l(y)||(b=a(y)))?(b?(b=!1,k=m&&a(m)?m:[]):k=m&&l(m)?m:{},o(v,{name:g,newValue:f(C,k,y)})):typeof y<"u"&&o(v,{name:g,newValue:y}));return v},Yg}var y$=g$();const Wg=Hu(y$);function ob(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 b$(){const e=[],t={run:n,use:i};return t;function n(...a){let l=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);d(null,...a);function d(f,...p){const g=e[++l];let m=-1;if(f){o(f);return}for(;++m<a.length;)(p[m]===null||p[m]===void 0)&&(p[m]=a[m]);a=p,g?x$(g,d)(...p):o(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function x$(e,t){let n;return i;function i(...o){const d=e.length>o.length;let f;d&&o.push(a);try{f=e.apply(this,o)}catch(p){const g=p;if(d&&n)throw g;return a(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(l,a):f instanceof Error?a(f):l(f))}function a(o,...d){n||(n=!0,t(o,...d))}function l(o){a(null,o)}}const jr={basename:v$,dirname:w$,extname:k$,join:E$,sep:"/"};function v$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');id(e);let n=0,i=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else i<0&&(l=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else o<0&&(l=!0,o=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(i=a):(d=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function w$(e){if(id(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function k$(e){id(e);let t=e.length,n=-1,i=0,a=-1,l=0,o;for(;t--;){const d=e.codePointAt(t);if(d===47){if(o){i=t+1;break}continue}n<0&&(o=!0,n=t+1),d===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function E$(...e){let t=-1,n;for(;++t<e.length;)id(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S$(n)}function S$(e){id(e);const t=e.codePointAt(0)===47;let n=N$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function N$(e,t){let n="",i=0,a=-1,l=0,o=-1,d,f;for(;++o<=e.length;){if(o<e.length)d=e.codePointAt(o);else{if(d===47)break;d=47}if(d===47){if(!(a===o-1||l===1))if(a!==o-1&&l===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=o,l=0;continue}}else if(n.length>0){n="",i=0,a=o,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),i=o-a-1;a=o,l=0}else d===46&&l>-1?l++:l=-1}return n}function id(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _$={cwd:j$};function j$(){return"/"}function cb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function C$(e){if(typeof e=="string")e=new URL(e);else if(!cb(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 A$(e)}function A$(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Qg=["history","path","basename","stem","extname","dirname"];class mj{constructor(t){let n;t?cb(t)?n={path:t}:typeof t=="string"||T$(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":_$.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Qg.length;){const l=Qg[i];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let a;for(a in n)Qg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?jr.basename(this.path):void 0}set basename(t){Zg(t,"basename"),Xg(t,"basename"),this.path=jr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?jr.dirname(this.path):void 0}set dirname(t){gE(this.basename,"dirname"),this.path=jr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?jr.extname(this.path):void 0}set extname(t){if(Xg(t,"extname"),gE(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=jr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){cb(t)&&(t=C$(t)),Zg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?jr.basename(this.path,this.extname):void 0}set stem(t){Zg(t,"stem"),Xg(t,"stem"),this.path=jr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Yn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xg(e,t){if(e&&e.includes(jr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+jr.sep+"`")}function Zg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function gE(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function T$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M$=(function(e){const i=this.constructor.prototype,a=i[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,i),l}),D$={}.hasOwnProperty;class Dx extends M${constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=b$()}copy(){const t=new Dx;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Wg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ty("data",this.frozen),this.namespace[t]=n,this):D$.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ty("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Rf(t),i=this.parser||this.Parser;return Jg("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Jg("process",this.parser||this.Parser),ey("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,o){const d=Rf(t),f=i.parse(d);i.run(f,d,function(g,m,y){if(g||!m||!y)return p(g);const b=m,k=i.stringify(b,y);L$(k)?y.value=k:y.result=k,p(g,y)});function p(g,m){g||!m?o(g):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,i;return this.freeze(),Jg("processSync",this.parser||this.Parser),ey("processSync",this.compiler||this.Compiler),this.process(t,a),bE("processSync","process",n),i;function a(l,o){n=!0,hE(l),i=o}}run(t,n,i){yE(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?l(void 0,i):new Promise(l);function l(o,d){const f=Rf(n);a.run(t,f,p);function p(g,m,y){const b=m||t;g?d(g):o?o(b):i(void 0,b,y)}}}runSync(t,n){let i=!1,a;return this.run(t,n,l),bE("runSync","run",i),a;function l(o,d){hE(o),a=d,i=!0}}stringify(t,n){this.freeze();const i=Rf(n),a=this.compiler||this.Compiler;return ey("stringify",a),yE(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(ty("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;f(g,m)}else o(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function o(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(p.plugins),p.settings&&(a.settings=Wg(!0,a.settings,p.settings))}function d(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];l(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,g){let m=-1,y=-1;for(;++m<i.length;)if(i[m][0]===p){y=m;break}if(y===-1)i.push([p,...g]);else if(g.length>0){let[b,...k]=g;const v=i[y][1];ob(v)&&ob(b)&&(b=Wg(!0,v,b)),i[y]=[p,b,...k]}}}}const O$=new Dx().freeze();function Jg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ey(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ty(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yE(e){if(!ob(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bE(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rf(e){return R$(e)?e:new mj(e)}function R$(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function L$(e){return typeof e=="string"||I$(e)}function I$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const z$="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xE=[],vE={allowDangerousHtml:!0},P$=/^(https?|ircs?|mailto|xmpp)$/i,B$=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ox(e){const t=$$(e),n=U$(e);return F$(t.runSync(t.parse(n),n),e)}function $$(e){const t=e.rehypePlugins||xE,n=e.remarkPlugins||xE,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vE}:vE;return O$().use(w6).use(n).use(m$,i).use(t)}function U$(e){const t=e.children||"",n=new mj;return typeof t=="string"&&(n.value=t),n}function F$(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,l=t.disallowedElements,o=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||q$;for(const g of B$)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+z$+g.id,void 0);return uh(e,p),r5(e,{Fragment:c.Fragment,components:a,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function p(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return o?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Kg)if(Object.hasOwn(Kg,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],v=Kg[b];(v===null||v.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!b&&i&&typeof m=="number"&&(b=!i(g,m,y)),b&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function q$(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||P$.test(e.slice(0,t))?e:""}function wE(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function H$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function K$(e,t,n){const a=nd((n||{}).ignore||[]),l=G$(t);let o=-1;for(;++o<l.length;)hj(e,"text",d);function d(p,g){let m=-1,y;for(;++m<g.length;){const b=g[m],k=y?y.children:void 0;if(a(b,k?k.indexOf(b):void 0,y))return;y=b}if(y)return f(p,g)}function f(p,g){const m=g[g.length-1],y=l[o][0],b=l[o][1];let k=0;const S=m.children.indexOf(p);let E=!1,C=[];y.lastIndex=0;let N=y.exec(p.value);for(;N;){const _=N.index,T={index:N.index,input:N.input,stack:[...g,p]};let M=b(...N,T);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?y.lastIndex=_+1:(k!==_&&C.push({type:"text",value:p.value.slice(k,_)}),Array.isArray(M)?C.push(...M):M&&C.push(M),k=_+N[0].length,E=!0),!y.global)break;N=y.exec(p.value)}return E?(k<p.value.length&&C.push({type:"text",value:p.value.slice(k)}),m.children.splice(S,1,...C)):C=[p],S+C.length}}function G$(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([V$(a[0]),Y$(a[1])])}return t}function V$(e){return typeof e=="string"?new RegExp(H$(e),"g"):e}function Y$(e){return typeof e=="function"?e:function(){return e}}const ny="phrasing",iy=["autolink","link","image","label"];function W$(){return{transforms:[nU],enter:{literalAutolink:X$,literalAutolinkEmail:ry,literalAutolinkHttp:ry,literalAutolinkWww:ry},exit:{literalAutolink:tU,literalAutolinkEmail:eU,literalAutolinkHttp:Z$,literalAutolinkWww:J$}}}function Q$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:iy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:iy},{character:":",before:"[ps]",after:"\\/",inConstruct:ny,notInConstruct:iy}]}}function X$(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ry(e){this.config.enter.autolinkProtocol.call(this,e)}function Z$(e){this.config.exit.autolinkProtocol.call(this,e)}function J$(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function eU(e){this.config.exit.autolinkEmail.call(this,e)}function tU(e){this.exit(e)}function nU(e){K$(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iU],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),rU]],{ignore:["link","linkReference"]})}function iU(e,t,n,i,a){let l="";if(!gj(a)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!aU(n)))return!1;const o=sU(n+i);if(!o[0])return!1;const d={type:"link",title:null,url:l+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[d,{type:"text",value:o[1]}]:d}function rU(e,t,n,i){return!gj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function aU(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function sU(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=wE(e,"(");let l=wE(e,")");for(;i!==-1&&a>l;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),l++;return[e,n]}function gj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ml(n)||sh(n))&&(!t||n!==47)}yj.peek=mU;function lU(){this.buffer()}function oU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function cU(){this.buffer()}function uU(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function dU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fU(e){this.exit(e)}function pU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hU(e){this.exit(e)}function mU(){return"["}function yj(e,t,n,i){const a=n.createTracker(i);let l=a.move("[^");const o=n.enter("footnoteReference"),d=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),o(),l+=a.move("]"),l}function gU(){return{enter:{gfmFootnoteCallString:lU,gfmFootnoteCall:oU,gfmFootnoteDefinitionLabelString:cU,gfmFootnoteDefinition:uU},exit:{gfmFootnoteCallString:dU,gfmFootnoteCall:fU,gfmFootnoteDefinitionLabelString:pU,gfmFootnoteDefinition:hU}}}function yU(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:yj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,l,o){const d=l.createTracker(o);let f=d.move("[^");const p=l.enter("footnoteDefinition"),g=l.enter("label");return f+=d.move(l.safe(l.associationId(i),{before:f,after:"]"})),g(),f+=d.move("]:"),i.children&&i.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
635
635
|
`:" ")+l.indentLines(l.containerFlow(i,d.current()),t?bj:bU))),p(),f}}function bU(e,t,n){return t===0?e:bj(e,t,n)}function bj(e,t,n){return(n?"":" ")+e}const xU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];xj.peek=SU;function vU(){return{canContainEols:["delete"],enter:{strikethrough:kU},exit:{strikethrough:EU}}}function wU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xU}],handlers:{delete:xj}}}function kU(e){this.enter({type:"delete",children:[]},e)}function EU(e){this.exit(e)}function xj(e,t,n,i){const a=n.createTracker(i),l=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),l(),o}function SU(){return"~"}function NU(e){return e.length}function _U(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||NU,l=[],o=[],d=[],f=[];let p=0,g=-1;for(;++g<e.length;){const v=[],S=[];let E=-1;for(e[g].length>p&&(p=e[g].length);++E<e[g].length;){const C=jU(e[g][E]);if(n.alignDelimiters!==!1){const N=a(C);S[E]=N,(f[E]===void 0||N>f[E])&&(f[E]=N)}v.push(C)}o[g]=v,d[g]=S}let m=-1;if(typeof i=="object"&&"length"in i)for(;++m<p;)l[m]=kE(i[m]);else{const v=kE(i);for(;++m<p;)l[m]=v}m=-1;const y=[],b=[];for(;++m<p;){const v=l[m];let S="",E="";v===99?(S=":",E=":"):v===108?S=":":v===114&&(E=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[m]-S.length-E.length);const N=S+"-".repeat(C)+E;n.alignDelimiters!==!1&&(C=S.length+C+E.length,C>f[m]&&(f[m]=C),b[m]=C),y[m]=N}o.splice(1,0,y),d.splice(1,0,b),g=-1;const k=[];for(;++g<o.length;){const v=o[g],S=d[g];m=-1;const E=[];for(;++m<p;){const C=v[m]||"";let N="",_="";if(n.alignDelimiters!==!1){const T=f[m]-(S[m]||0),M=l[m];M===114?N=" ".repeat(T):M===99?T%2?(N=" ".repeat(T/2+.5),_=" ".repeat(T/2-.5)):(N=" ".repeat(T/2),_=N):_=" ".repeat(T)}n.delimiterStart!==!1&&!m&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||m)&&E.push(" "),n.alignDelimiters!==!1&&E.push(N),E.push(C),n.alignDelimiters!==!1&&E.push(_),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||m!==p-1)&&E.push("|")}k.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return k.join(`
|
|
636
636
|
`)}function jU(e){return e==null?"":String(e)}function kE(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 CU(e,t,n,i){const a=n.enter("blockquote"),l=n.createTracker(i);l.move("> "),l.shift(2);const o=n.indentLines(n.containerFlow(e,l.current()),AU);return a(),o}function AU(e,t,n){return">"+(n?"":" ")+e}function TU(e,t){return EE(e,t.inConstruct,!0)&&!EE(e,t.notInConstruct,!1)}function EE(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function SE(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
637
637
|
`&&TU(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
@@ -683,4 +683,4 @@ ${ce}`:ce)}),c.jsx("div",{className:"flex-1"}),ve?c.jsx("button",{className:"nb-
|
|
|
683
683
|
+`).split(`
|
|
684
684
|
`)),g=p.reduce((m,y)=>m.concat(...y),[]);return[p,g]}return[[],[]]},[e]);return j.useEffect(()=>{const f=(t==null?void 0:t.target)??BS,p=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const g=b=>{var S,E;if(a.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!a.current||a.current&&!p)&&eA(b))return!1;const v=US(b.code,d);if(l.current.add(b[v]),$S(o,l.current,!1)){const C=((E=(S=b.composedPath)==null?void 0:S.call(b))==null?void 0:E[0])||b.target,N=(C==null?void 0:C.nodeName)==="BUTTON"||(C==null?void 0:C.nodeName)==="A";t.preventDefault!==!1&&(a.current||!N)&&b.preventDefault(),i(!0)}},m=b=>{const k=US(b.code,d);$S(o,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(b[k]),b.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),i(!1)};return f==null||f.addEventListener("keydown",g),f==null||f.addEventListener("keyup",m),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{f==null||f.removeEventListener("keydown",g),f==null||f.removeEventListener("keyup",m),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,i]),n}function $S(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(a=>t.has(a)))}function US(e,t){return t.includes(e)?"code":"key"}const pY=()=>{const e=nn();return j.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,a,l],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??i,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:a,minZoom:l,maxZoom:o,panZoom:d}=e.getState(),f=Jx(t,i,a,l,o,(n==null?void 0:n.padding)??.1);return d?(await d.setViewport(f,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:a,snapToGrid:l,domNode:o}=e.getState();if(!o)return t;const{x:d,y:f}=o.getBoundingClientRect(),p={x:t.x-d,y:t.y-f},g=n.snapGrid??a,m=n.snapToGrid??l;return cd(p,i,m,g)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),o=Vo(t,n);return{x:o.x+a,y:o.y+l}}}),[])};function kA(e,t){const n=[],i=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")i.set(l.id,[l]);else{const o=i.get(l.id);o?o.push(l):i.set(l.id,[l])}for(const l of t){const o=i.get(l.id);if(!o){n.push(l);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const d={...l};for(const f of o)hY(f,d);n.push(d)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function hY(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 EA(e,t){return kA(e,t)}function SA(e,t){return kA(e,t)}function Ys(e,t){return{id:e,type:"select",selected:t}}function wo(e,t=new Set,n=!1){const i=[];for(const[a,l]of e){const o=t.has(a);!(l.selected===void 0&&!o)&&l.selected!==o&&(n&&(l.selected=o),i.push(Ys(l.id,o)))}return i}function FS({items:e=[],lookup:t}){var a;const n=[],i=new Map(e.map(l=>[l.id,l]));for(const[l,o]of e.entries()){const d=t.get(o.id),f=((a=d==null?void 0:d.internals)==null?void 0:a.userNode)??d;f!==void 0&&f!==o&&n.push({id:o.id,item:o,type:"replace"}),f===void 0&&n.push({item:o,type:"add",index:l})}for(const[l]of t)i.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function qS(e){return{id:e.id,type:"remove"}}const mY=QC();function gY(e,t,n={}){return tV(e,t,{...n,onError:n.onError??mY})}const HS=e=>$G(e),yY=e=>KC(e);function NA(e){return j.forwardRef(e)}const bY=typeof window<"u"?j.useLayoutEffect:j.useEffect;function KS(e){const[t,n]=j.useState(BigInt(0)),[i]=j.useState(()=>xY(()=>n(a=>a+BigInt(1))));return bY(()=>{const a=i.get();a.length&&(e(a),i.reset())},[t]),i}function xY(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const _A=j.createContext(null);function vY({children:e}){const t=nn(),n=j.useCallback(d=>{const{nodes:f=[],setNodes:p,hasDefaultNodes:g,onNodesChange:m,nodeLookup:y,fitViewQueued:b,onNodesChangeMiddlewareMap:k}=t.getState();let v=f;for(const E of d)v=typeof E=="function"?E(v):E;let S=FS({items:v,lookup:y});for(const E of k.values())S=E(S);g&&p(v),S.length>0?m==null||m(S):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:C,setNodes:N}=t.getState();E&&N(C)})},[]),i=KS(n),a=j.useCallback(d=>{const{edges:f=[],setEdges:p,hasDefaultEdges:g,onEdgesChange:m,edgeLookup:y}=t.getState();let b=f;for(const k of d)b=typeof k=="function"?k(b):k;g?p(b):m&&m(FS({items:b,lookup:y}))},[]),l=KS(a),o=j.useMemo(()=>({nodeQueue:i,edgeQueue:l}),[]);return c.jsx(_A.Provider,{value:o,children:e})}function wY(){const e=j.useContext(_A);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const kY=e=>!!e.panZoom;function wh(){const e=pY(),t=nn(),n=wY(),i=Nt(kY),a=j.useMemo(()=>{const l=m=>t.getState().nodeLookup.get(m),o=m=>{n.nodeQueue.push(m)},d=m=>{n.edgeQueue.push(m)},f=m=>{var E,C;const{nodeLookup:y,nodeOrigin:b}=t.getState(),k=HS(m)?m:y.get(m.id),v=k.parentId?ZC(k.position,k.measured,k.parentId,y,b):k.position,S={...k,position:v,width:((E=k.measured)==null?void 0:E.width)??k.width,height:((C=k.measured)==null?void 0:C.height)??k.height};return Iu(S)},p=(m,y,b={replace:!1})=>{o(k=>k.map(v=>{if(v.id===m){const S=typeof y=="function"?y(v):y;return b.replace&&HS(S)?S:{...v,...S}}return v}))},g=(m,y,b={replace:!1})=>{d(k=>k.map(v=>{if(v.id===m){const S=typeof y=="function"?y(v):y;return b.replace&&yY(S)?S:{...v,...S}}return v}))};return{getNodes:()=>t.getState().nodes.map(m=>({...m})),getNode:m=>{var y;return(y=l(m))==null?void 0:y.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:m=[]}=t.getState();return m.map(y=>({...y}))},getEdge:m=>t.getState().edgeLookup.get(m),setNodes:o,setEdges:d,addNodes:m=>{const y=Array.isArray(m)?m:[m];n.nodeQueue.push(b=>[...b,...y])},addEdges:m=>{const y=Array.isArray(m)?m:[m];n.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:m=[],edges:y=[],transform:b}=t.getState(),[k,v,S]=b;return{nodes:m.map(E=>({...E})),edges:y.map(E=>({...E})),viewport:{x:k,y:v,zoom:S}}},deleteElements:async({nodes:m=[],edges:y=[]})=>{const{nodes:b,edges:k,onNodesDelete:v,onEdgesDelete:S,triggerNodeChanges:E,triggerEdgeChanges:C,onDelete:N,onBeforeDelete:_}=t.getState(),{nodes:T,edges:M}=await KG({nodesToRemove:m,edgesToRemove:y,nodes:b,edges:k,onBeforeDelete:_}),O=M.length>0,R=T.length>0;if(O){const B=M.map(qS);S==null||S(M),C(B)}if(R){const B=T.map(qS);v==null||v(T),E(B)}return(R||O)&&(N==null||N({nodes:T,edges:M})),{deletedNodes:T,deletedEdges:M}},getIntersectingNodes:(m,y=!0,b)=>{const k=mS(m),v=k?m:f(m),S=b!==void 0;return v?(b||t.getState().nodes).filter(E=>{const C=t.getState().nodeLookup.get(E.id);if(C&&!k&&(E.id===m.id||!C.internals.positionAbsolute))return!1;const N=Iu(S?E:C),_=Pp(N,v);return y&&_>0||_>=N.width*N.height||_>=v.width*v.height}):[]},isNodeIntersecting:(m,y,b=!0)=>{const v=mS(m)?m:f(m);if(!v)return!1;const S=Pp(v,y);return b&&S>0||S>=y.width*y.height||S>=v.width*v.height},updateNode:p,updateNodeData:(m,y,b={replace:!1})=>{p(m,k=>{const v=typeof y=="function"?y(k):y;return b.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},b)},updateEdge:g,updateEdgeData:(m,y,b={replace:!1})=>{g(m,k=>{const v=typeof y=="function"?y(k):y;return b.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},b)},getNodesBounds:m=>{const{nodeLookup:y,nodeOrigin:b}=t.getState();return UG(m,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:m,id:y,nodeId:b})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${b}-${m}${y?`-${y}`:""}`))==null?void 0:k.values())??[])},getNodeConnections:({type:m,handleId:y,nodeId:b})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${b}${m?y?`-${m}-${y}`:`-${m}`:""}`))==null?void 0:k.values())??[])},fitView:async m=>{const y=t.getState().fitViewResolver??YG();return t.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:y}),n.nodeQueue.push(b=>[...b]),y.promise}}},[]);return j.useMemo(()=>({...a,...e,viewportInitialized:i}),[i])}const GS=e=>e.selected,EY=typeof window<"u"?window:void 0;function SY({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=nn(),{deleteElements:i}=wh(),a=Pu(e,{actInsideInputWithModifier:!1}),l=Pu(t,{target:EY});j.useEffect(()=>{if(a){const{edges:o,nodes:d}=n.getState();i({nodes:d.filter(GS),edges:o.filter(GS)}),n.setState({nodesSelectionActive:!1})}},[a]),j.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function NY(e){const t=nn();j.useEffect(()=>{const n=()=>{var a,l,o,d;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const i=ev(e.current);(i.height===0||i.width===0)&&((d=(o=t.getState()).onError)==null||d.call(o,"004",pr.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const kh={position:"absolute",width:"100%",height:"100%",top:0,left:0},_Y=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function jY({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=ul.Free,zoomOnDoubleClick:o=!0,panOnDrag:d=!0,defaultViewport:f,translateExtent:p,minZoom:g,maxZoom:m,zoomActivationKeyCode:y,preventScrolling:b=!0,children:k,noWheelClassName:v,noPanClassName:S,onViewportChange:E,isControlledViewport:C,paneClickDistance:N,selectionOnDrag:_}){const T=nn(),M=j.useRef(null),{userSelectionActive:O,lib:R,connectionInProgress:B}=Nt(_Y,tn),U=Pu(y),K=j.useRef();NY(M);const q=j.useCallback(Y=>{E==null||E({x:Y[0],y:Y[1],zoom:Y[2]}),C||T.setState({transform:Y})},[E,C]);return j.useEffect(()=>{if(M.current){K.current=MV({domNode:M.current,minZoom:g,maxZoom:m,translateExtent:p,viewport:f,onDraggingChange:I=>T.setState(H=>H.paneDragging===I?H:{paneDragging:I}),onPanZoomStart:(I,H)=>{const{onViewportChangeStart:W,onMoveStart:G}=T.getState();G==null||G(I,H),W==null||W(H)},onPanZoom:(I,H)=>{const{onViewportChange:W,onMove:G}=T.getState();G==null||G(I,H),W==null||W(H)},onPanZoomEnd:(I,H)=>{const{onViewportChangeEnd:W,onMoveEnd:G}=T.getState();G==null||G(I,H),W==null||W(H)}});const{x:Y,y:D,zoom:F}=K.current.getViewport();return T.setState({panZoom:K.current,transform:[Y,D,F],domNode:M.current.closest(".react-flow")}),()=>{var I;(I=K.current)==null||I.destroy()}}},[]),j.useEffect(()=>{var Y;(Y=K.current)==null||Y.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:o,panOnDrag:d,zoomActivationKeyPressed:U,preventScrolling:b,noPanClassName:S,userSelectionActive:O,noWheelClassName:v,lib:R,onTransformChange:q,connectionInProgress:B,selectionOnDrag:_,paneClickDistance:N})},[e,t,n,i,a,l,o,d,U,b,S,O,v,R,q,B,_,N]),c.jsx("div",{className:"react-flow__renderer",ref:M,style:kh,children:k})}const CY=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function AY(){const{userSelectionActive:e,userSelectionRect:t}=Nt(CY,tn);return e&&t?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Sy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},TY=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function MY({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Lu.Full,panOnDrag:i,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:o,onSelectionStart:d,onSelectionEnd:f,onPaneClick:p,onPaneContextMenu:g,onPaneScroll:m,onPaneMouseEnter:y,onPaneMouseMove:b,onPaneMouseLeave:k,children:v}){const S=j.useRef(0),E=nn(),{userSelectionActive:C,elementsSelectable:N,dragging:_,panBy:T,autoPanSpeed:M}=Nt(TY,tn),O=N&&(e||C),R=j.useRef(null),B=j.useRef(),U=j.useRef(new Set),K=j.useRef(new Set),q=j.useRef(!1),Y=j.useRef(!1),D=j.useRef({x:0,y:0}),F=j.useRef(!1),I=se=>{if(Y.current||q.current||E.getState().connection.inProgress){Y.current=!1,q.current=!1;return}p==null||p(se),E.getState().resetSelectedElements(),E.setState({nodesSelectionActive:!1})},H=se=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){se.preventDefault();return}g==null||g(se)},W=m?se=>m(se):void 0,G=se=>{Y.current&&(se.stopPropagation(),Y.current=!1)},L=se=>{var Qe,Ue;const{domNode:ve,transform:ue}=E.getState();if(B.current=ve==null?void 0:ve.getBoundingClientRect(),!B.current)return;const J=se.target===R.current;if(!J&&!!se.target.closest(".nokey")||!e||!(o&&J||t)||se.button!==0||!se.isPrimary)return;(Ue=(Qe=se.target)==null?void 0:Qe.setPointerCapture)==null||Ue.call(Qe,se.pointerId),Y.current=!1;const{x:Ce,y:Me}=ur(se.nativeEvent,B.current),_e=cd({x:Ce,y:Me},ue);E.setState({userSelectionRect:{width:0,height:0,startX:_e.x,startY:_e.y,x:Ce,y:Me}}),J||(se.stopPropagation(),se.preventDefault())};function z(se,ve){const{userSelectionRect:ue}=E.getState();if(!ue)return;const{transform:J,nodeLookup:we,edgeLookup:re,connectionLookup:Ce,triggerNodeChanges:Me,triggerEdgeChanges:_e,defaultEdgeOptions:Qe}=E.getState(),Ue={x:ue.startX,y:ue.startY},{x:ce,y:be}=Vo(Ue,J),ge={startX:Ue.x,startY:Ue.y,x:se<ce?se:ce,y:ve<be?ve:be,width:Math.abs(se-ce),height:Math.abs(ve-be)},pe=U.current,Se=K.current;U.current=new Set(Xx(we,ge,J,n===Lu.Partial,!0).map(He=>He.id)),K.current=new Set;const je=(Qe==null?void 0:Qe.selectable)??!0;for(const He of U.current){const te=Ce.get(He);if(te)for(const{edgeId:de}of te.values()){const Le=re.get(de);Le&&(Le.selectable??je)&&K.current.add(de)}}if(!gS(pe,U.current)){const He=wo(we,U.current,!0);Me(He)}if(!gS(Se,K.current)){const He=wo(re,K.current);_e(He)}E.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!a||!B.current)return;const[se,ve]=Zx(D.current,B.current,M);T({x:se,y:ve}).then(ue=>{if(!Y.current||!ue){S.current=requestAnimationFrame(V);return}const{x:J,y:we}=D.current;z(J,we),S.current=requestAnimationFrame(V)})}const P=()=>{cancelAnimationFrame(S.current),S.current=0,F.current=!1};j.useEffect(()=>()=>P(),[]);const le=se=>{const{userSelectionRect:ve,transform:ue,resetSelectedElements:J}=E.getState();if(!B.current||!ve)return;const{x:we,y:re}=ur(se.nativeEvent,B.current);D.current={x:we,y:re};const Ce=Vo({x:ve.startX,y:ve.startY},ue);if(!Y.current){const Me=t?0:l;if(Math.hypot(we-Ce.x,re-Ce.y)<=Me)return;J(),d==null||d(se)}Y.current=!0,F.current||(V(),F.current=!0),z(we,re)},xe=se=>{var ve,ue;if(!O){se.target===R.current&&E.getState().connection.inProgress&&(q.current=!0);return}se.button===0&&((ue=(ve=se.target)==null?void 0:ve.releasePointerCapture)==null||ue.call(ve,se.pointerId),!C&&se.target===R.current&&E.getState().userSelectionRect&&(I==null||I(se)),E.setState({userSelectionActive:!1,userSelectionRect:null}),Y.current&&(f==null||f(se),E.setState({nodesSelectionActive:U.current.size>0})),P())},ke=se=>{var ve,ue;(ue=(ve=se.target)==null?void 0:ve.releasePointerCapture)==null||ue.call(ve,se.pointerId),P()},Ne=i===!0||Array.isArray(i)&&i.includes(0);return c.jsxs("div",{className:_n(["react-flow__pane",{draggable:Ne,dragging:_,selection:e}]),onClick:O?void 0:Sy(I,R),onContextMenu:Sy(H,R),onWheel:Sy(W,R),onPointerEnter:O?void 0:y,onPointerMove:O?le:b,onPointerUp:xe,onPointerCancel:O?ke:void 0,onPointerDownCapture:O?L:void 0,onClickCapture:O?G:void 0,onPointerLeave:k,ref:R,style:kh,children:[v,c.jsx(AY,{})]})}function Nb({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:o,nodeLookup:d,onError:f}=t.getState(),p=d.get(e);if(!p){f==null||f("012",pr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&o)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var g;return(g=i==null?void 0:i.current)==null?void 0:g.blur()})):a([e])}function jA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:a,isSelectable:l,nodeClickDistance:o}){const d=nn(),[f,p]=j.useState(!1),g=j.useRef();return j.useEffect(()=>{g.current=yV({getStoreItems:()=>d.getState(),onNodeMouseDown:m=>{Nb({id:m,store:d,nodeRef:e})},onDragStart:()=>{p(!0)},onDragStop:()=>{p(!1)}})},[]),j.useEffect(()=>{if(!(t||!e.current||!g.current))return g.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:o}),()=>{var m;(m=g.current)==null||m.destroy()}},[n,i,t,l,e,a,o]),f}const DY=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function CA(){const e=nn();return j.useCallback(n=>{const{nodeExtent:i,snapToGrid:a,snapGrid:l,nodesDraggable:o,onError:d,updateNodePositions:f,nodeLookup:p,nodeOrigin:g}=e.getState(),m=new Map,y=DY(o),b=a?l[0]:5,k=a?l[1]:5,v=n.direction.x*b*n.factor,S=n.direction.y*k*n.factor;for(const[,E]of p){if(!y(E))continue;let C={x:E.internals.positionAbsolute.x+v,y:E.internals.positionAbsolute.y+S};a&&(C=od(C,l));const{position:N,positionAbsolute:_}=GC({nodeId:E.id,nextPosition:C,nodeLookup:p,nodeExtent:i,nodeOrigin:g,onError:d});E.position=N,E.internals.positionAbsolute=_,m.set(E.id,E)}f(m)},[])}const sv=j.createContext(null),OY=sv.Provider;sv.Consumer;const AA=()=>j.useContext(sv),RY=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TA=j.createContext(null);function LY({children:e}){const t=Nt(RY,tn);return c.jsx(TA.Provider,{value:t,children:e})}function IY(){const e=j.useContext(TA);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const zY={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},PY=(e,t,n)=>i=>{const{connectionClickStartHandle:a,connectionMode:l,connection:o}=i,{fromHandle:d,toHandle:f,isValid:p}=o;if(!d&&!a)return zY;const g=(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===n;return{connectingFrom:(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===n,connectingTo:g,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===Ko.Strict?(d==null?void 0:d.type)!==n:e!==(d==null?void 0:d.nodeId)||t!==(d==null?void 0:d.id),connectionInProcess:!!d,clickConnectionInProcess:!!a,valid:g&&p}};function BY({type:e="source",position:t=Ke.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:o,onConnect:d,children:f,className:p,onMouseDown:g,onTouchStart:m,...y},b){var F,I;const k=o||null,v=e==="target",S=nn(),E=AA(),{connectOnClick:C,noPanClassName:N,rfId:_}=IY(),{connectingFrom:T,connectingTo:M,clickConnecting:O,isPossibleEndHandle:R,connectionInProcess:B,clickConnectionInProcess:U,valid:K}=Nt(PY(E,k,e),tn);E||(I=(F=S.getState()).onError)==null||I.call(F,"010",pr.error010());const q=H=>{const{defaultEdgeOptions:W,onConnect:G,hasDefaultEdges:L}=S.getState(),z={...W,...H};if(L){const{edges:V,setEdges:P,onError:le}=S.getState();P(gY(z,V,{onError:le}))}G==null||G(z),d==null||d(z)},Y=H=>{if(!E)return;const W=tA(H.nativeEvent);if(a&&(W&&H.button===0||!W)){const G=S.getState();Sb.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:G.autoPanOnConnect,connectionMode:G.connectionMode,connectionRadius:G.connectionRadius,domNode:G.domNode,nodeLookup:G.nodeLookup,lib:G.lib,isTarget:v,handleId:k,nodeId:E,flowId:G.rfId,panBy:G.panBy,cancelConnection:G.cancelConnection,onConnectStart:G.onConnectStart,onConnectEnd:(...L)=>{var z,V;return(V=(z=S.getState()).onConnectEnd)==null?void 0:V.call(z,...L)},updateConnection:G.updateConnection,onConnect:q,isValidConnection:n||((...L)=>{var z,V;return((V=(z=S.getState()).isValidConnection)==null?void 0:V.call(z,...L))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:G.autoPanSpeed,dragThreshold:G.connectionDragThreshold})}W?g==null||g(H):m==null||m(H)},D=H=>{const{onClickConnectStart:W,onClickConnectEnd:G,connectionClickStartHandle:L,connectionMode:z,isValidConnection:V,lib:P,rfId:le,nodeLookup:xe,connection:ke}=S.getState();if(!E||!L&&!a)return;if(!L){W==null||W(H.nativeEvent,{nodeId:E,handleId:k,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:E,type:e,id:k}});return}const Ne=JC(H.target),se=n||V,{connection:ve,isValid:ue}=Sb.isValid(H.nativeEvent,{handle:{nodeId:E,id:k,type:e},connectionMode:z,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:se,flowId:le,doc:Ne,lib:P,nodeLookup:xe});ue&&ve&&q(ve);const J=structuredClone(ke);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,G==null||G(H,J),S.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":k,"data-nodeid":E,"data-handlepos":t,"data-id":`${_}-${E}-${k}-${e}`,className:_n(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,p,{source:!v,target:v,connectable:i,connectablestart:a,connectableend:l,clickconnecting:O,connectingfrom:T,connectingto:M,valid:K,connectionindicator:i&&(!B||R)&&(B||U?l:a)}]),onMouseDown:Y,onTouchStart:Y,onClick:C?D:void 0,ref:b,...y,children:f})}const Dr=j.memo(NA(BY));function $Y({data:e,isConnectable:t,sourcePosition:n=Ke.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Dr,{type:"source",position:n,isConnectable:t})]})}function UY({data:e,isConnectable:t,targetPosition:n=Ke.Top,sourcePosition:i=Ke.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Dr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,c.jsx(Dr,{type:"source",position:i,isConnectable:t})]})}function FY(){return null}function qY({data:e,isConnectable:t,targetPosition:n=Ke.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Dr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Bp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},VS={input:$Y,default:UY,output:qY,group:FY};function HY(e){var t,n,i,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const KY=e=>{const{width:t,height:n,x:i,y:a}=ld(e.nodeLookup,{filter:l=>!!l.selected});return{width:cr(t)?t:null,height:cr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${a}px)`}};function GY({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=nn(),{width:a,height:l,transformString:o,userSelectionActive:d}=Nt(KY,tn),f=CA(),p=j.useRef(null);j.useEffect(()=>{var b;n||(b=p.current)==null||b.focus({preventScroll:!0})},[n]);const g=!d&&a!==null&&l!==null;if(jA({nodeRef:p,disabled:!g}),!g)return null;const m=e?b=>{const k=i.getState().nodes.filter(v=>v.selected);e(b,k)}:void 0,y=b=>{Object.prototype.hasOwnProperty.call(Bp,b.key)&&(b.preventDefault(),f({direction:Bp[b.key],factor:b.shiftKey?4:1}))};return c.jsx("div",{className:_n(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:c.jsx("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:a,height:l}})})}const YS=typeof window<"u"?window:void 0,VY=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function MA({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:o,paneClickDistance:d,deleteKeyCode:f,selectionKeyCode:p,selectionOnDrag:g,selectionMode:m,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:k,panActivationKeyCode:v,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:N,panOnScroll:_,panOnScrollSpeed:T,panOnScrollMode:M,zoomOnDoubleClick:O,panOnDrag:R,autoPanOnSelection:B,defaultViewport:U,translateExtent:K,minZoom:q,maxZoom:Y,preventScrolling:D,onSelectionContextMenu:F,noWheelClassName:I,noPanClassName:H,disableKeyboardA11y:W,onViewportChange:G,isControlledViewport:L}){const{nodesSelectionActive:z,userSelectionActive:V}=Nt(VY,tn),P=Pu(p,{target:YS}),le=Pu(v,{target:YS}),xe=le||R,ke=le||_,Ne=g&&xe!==!0,se=P||V||Ne;return SY({deleteKeyCode:f,multiSelectionKeyCode:k}),c.jsx(jY,{onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:N,panOnScroll:ke,panOnScrollSpeed:T,panOnScrollMode:M,zoomOnDoubleClick:O,panOnDrag:!P&&xe,defaultViewport:U,translateExtent:K,minZoom:q,maxZoom:Y,zoomActivationKeyCode:S,preventScrolling:D,noWheelClassName:I,noPanClassName:H,onViewportChange:G,isControlledViewport:L,paneClickDistance:d,selectionOnDrag:Ne,children:c.jsxs(MY,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:o,panOnDrag:xe,autoPanOnSelection:B,isSelecting:!!se,selectionMode:m,selectionKeyPressed:P,paneClickDistance:d,selectionOnDrag:Ne,children:[e,z&&c.jsx(GY,{onSelectionContextMenu:F,noPanClassName:H,disableKeyboardA11y:W})]})})}MA.displayName="FlowRenderer";const YY=j.memo(MA),WY=e=>t=>e?Xx(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function QY(e){return Nt(j.useCallback(WY(e),[e]),tn)}const XY=e=>e.updateNodeInternals;function ZY(){const e=Nt(XY),[t]=j.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");i.set(l,{id:l,nodeElement:a.target,force:!0})}),e(i)}));return j.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function JY({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const a=nn(),l=j.useRef(null),o=j.useRef(null),d=j.useRef(e.sourcePosition),f=j.useRef(e.targetPosition),p=j.useRef(t),g=n&&!!e.internals.handleBounds;return j.useEffect(()=>{l.current&&!e.hidden&&(!g||o.current!==l.current)&&(o.current&&(i==null||i.unobserve(o.current)),i==null||i.observe(l.current),o.current=l.current)},[g,e.hidden]),j.useEffect(()=>()=>{o.current&&(i==null||i.unobserve(o.current),o.current=null)},[]),j.useEffect(()=>{if(l.current){const m=p.current!==t,y=d.current!==e.sourcePosition,b=f.current!==e.targetPosition;(m||y||b)&&(p.current=t,d.current=e.sourcePosition,f.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function eW({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:a,onContextMenu:l,onDoubleClick:o,nodesDraggable:d,elementsSelectable:f,nodesConnectable:p,nodesFocusable:g,resizeObserver:m,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:k,rfId:v,nodeTypes:S,nodeClickDistance:E,onError:C}){const{node:N,internals:_,isParent:T}=Nt(se=>{const ve=se.nodeLookup.get(e),ue=se.parentLookup.has(e);return{node:ve,internals:ve.internals,isParent:ue}},tn);let M=N.type||"default",O=(S==null?void 0:S[M])||VS[M];O===void 0&&(C==null||C("003",pr.error003(M)),M="default",O=(S==null?void 0:S.default)||VS.default);const R=!!(N.draggable||d&&typeof N.draggable>"u"),B=!!(N.selectable||f&&typeof N.selectable>"u"),U=!!(N.connectable||p&&typeof N.connectable>"u"),K=!!(N.focusable||g&&typeof N.focusable>"u"),q=nn(),Y=XC(N),D=JY({node:N,nodeType:M,hasDimensions:Y,resizeObserver:m}),F=jA({nodeRef:D,disabled:N.hidden||!R,noDragClassName:y,handleSelector:N.dragHandle,nodeId:e,isSelectable:B,nodeClickDistance:E}),I=CA();if(N.hidden)return null;const H=va(N),W=HY(N),G=B||R||t||n||i||a,L=n?se=>n(se,{..._.userNode}):void 0,z=i?se=>i(se,{..._.userNode}):void 0,V=a?se=>a(se,{..._.userNode}):void 0,P=l?se=>l(se,{..._.userNode}):void 0,le=o?se=>o(se,{..._.userNode}):void 0,xe=se=>{const{selectNodesOnDrag:ve,nodeDragThreshold:ue}=q.getState();B&&(!ve||!R||ue>0)&&Nb({id:e,store:q,nodeRef:D}),t&&t(se,{..._.userNode})},ke=se=>{if(!(eA(se.nativeEvent)||k)){if(UC.includes(se.key)&&B){const ve=se.key==="Escape";Nb({id:e,store:q,unselect:ve,nodeRef:D})}else if(R&&N.selected&&Object.prototype.hasOwnProperty.call(Bp,se.key)){se.preventDefault();const{ariaLabelConfig:ve}=q.getState();q.setState({ariaLiveMessage:ve["node.a11yDescription.ariaLiveMessage"]({direction:se.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),I({direction:Bp[se.key],factor:se.shiftKey?4:1})}}},Ne=()=>{var Ce;if(k||!((Ce=D.current)!=null&&Ce.matches(":focus-visible")))return;const{transform:se,width:ve,height:ue,autoPanOnNodeFocus:J,setCenter:we}=q.getState();if(!J)return;Xx(new Map([[e,N]]),{x:0,y:0,width:ve,height:ue},se,!0).length>0||we(N.position.x+H.width/2,N.position.y+H.height/2,{zoom:se[2]})};return c.jsx("div",{className:_n(["react-flow__node",`react-flow__node-${M}`,{[b]:R},N.className,{selected:N.selected,selectable:B,parent:T,draggable:R,dragging:F}]),ref:D,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:G?"all":"none",visibility:Y?"visible":"hidden",...N.style,...W},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:z,onMouseLeave:V,onContextMenu:P,onClick:xe,onDoubleClick:le,onKeyDown:K?ke:void 0,tabIndex:K?0:void 0,onFocus:K?Ne:void 0,role:N.ariaRole??(K?"group":void 0),"aria-roledescription":"node","aria-describedby":k?void 0:`${xA}-${v}`,"aria-label":N.ariaLabel,...N.domAttributes,children:c.jsx(OY,{value:e,children:c.jsx(O,{id:e,data:N.data,type:M,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:N.selected??!1,selectable:B,draggable:R,deletable:N.deletable??!0,isConnectable:U,sourcePosition:N.sourcePosition,targetPosition:N.targetPosition,dragging:F,dragHandle:N.dragHandle,zIndex:_.z,parentId:N.parentId,...H})})})}var tW=j.memo(eW);const nW=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function DA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:a,onError:l}=Nt(nW,tn),o=QY(e.onlyRenderVisibleElements),d=ZY();return c.jsx("div",{className:"react-flow__nodes",style:kh,children:o.map(f=>c.jsx(tW,{id:f,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:d,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:l},f))})}DA.displayName="NodeRenderer";const iW=j.memo(DA);function rW(e){return Nt(j.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const i=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),o=n.nodeLookup.get(a.target);l&&o&&ZG({sourceNode:l,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&i.push(a.id)}return i},[e]),tn)}const aW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},sW=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},WS={[Ip.Arrow]:aW,[Ip.ArrowClosed]:sW};function lW(e){const t=nn();return j.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(WS,e)?WS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",pr.error009(e)),null)},[e])}const oW=({id:e,type:t,color:n,width:i=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:o,orient:d="auto-start-reverse"})=>{const f=lW(t);return f?c.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0",children:c.jsx(f,{color:n,strokeWidth:o})}):null},OA=({defaultColor:e,rfId:t})=>{const n=Nt(l=>l.edges),i=Nt(l=>l.defaultEdgeOptions),a=j.useMemo(()=>sV(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return a.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:a.map(l=>c.jsx(oW,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};OA.displayName="MarkerDefinitions";var cW=j.memo(OA);function RA({x:e,y:t,label:n,labelStyle:i,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:o=[2,4],labelBgBorderRadius:d=2,children:f,className:p,...g}){const[m,y]=j.useState({x:1,y:0,width:0,height:0}),b=_n(["react-flow__edge-textwrapper",p]),k=j.useRef(null);return j.useEffect(()=>{if(k.current){const v=k.current.getBBox();y({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?c.jsxs("g",{transform:`translate(${e-m.width/2} ${t-m.height/2})`,className:b,visibility:m.width?"visible":"hidden",...g,children:[a&&c.jsx("rect",{width:m.width+2*o[0],x:-o[0],y:-o[1],height:m.height+2*o[1],className:"react-flow__edge-textbg",style:l,rx:d,ry:d}),c.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:k,style:i,children:n}),f]}):null}RA.displayName="EdgeText";const uW=j.memo(RA);function Eh({path:e,labelX:t,labelY:n,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:o,labelBgPadding:d,labelBgBorderRadius:f,interactionWidth:p=20,...g}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...g,d:e,fill:"none",className:_n(["react-flow__edge-path",g.className])}),p?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}):null,i&&cr(t)&&cr(n)?c.jsx(uW,{x:t,y:n,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:o,labelBgPadding:d,labelBgBorderRadius:f}):null]})}function QS({pos:e,x1:t,y1:n,x2:i,y2:a}){return e===Ke.Left||e===Ke.Right?[.5*(t+i),n]:[t,.5*(n+a)]}function LA({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:i,targetY:a,targetPosition:l=Ke.Top}){const[o,d]=QS({pos:n,x1:e,y1:t,x2:i,y2:a}),[f,p]=QS({pos:l,x1:i,y1:a,x2:e,y2:t}),[g,m,y,b]=nA({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:o,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${o},${d} ${f},${p} ${i},${a}`,g,m,y,b]}function IA(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:a,targetY:l,sourcePosition:o,targetPosition:d,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:k,markerEnd:v,markerStart:S,interactionWidth:E})=>{const[C,N,_]=LA({sourceX:n,sourceY:i,sourcePosition:o,targetX:a,targetY:l,targetPosition:d}),T=e.isInternal?void 0:t;return c.jsx(Eh,{id:T,path:C,labelX:N,labelY:_,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:k,markerEnd:v,markerStart:S,interactionWidth:E})})}const dW=IA({isInternal:!1}),zA=IA({isInternal:!0});dW.displayName="SimpleBezierEdge";zA.displayName="SimpleBezierEdgeInternal";function PA(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:a,targetY:l,label:o,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:m,style:y,sourcePosition:b=Ke.Bottom,targetPosition:k=Ke.Top,markerEnd:v,markerStart:S,pathOptions:E,interactionWidth:C})=>{const[N,_,T]=wb({sourceX:n,sourceY:i,sourcePosition:b,targetX:a,targetY:l,targetPosition:k,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset,stepPosition:E==null?void 0:E.stepPosition}),M=e.isInternal?void 0:t;return c.jsx(Eh,{id:M,path:N,labelX:_,labelY:T,label:o,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:S,interactionWidth:C})})}const BA=PA({isInternal:!1}),$A=PA({isInternal:!0});BA.displayName="SmoothStepEdge";$A.displayName="SmoothStepEdgeInternal";function UA(e){return j.memo(({id:t,...n})=>{var a;const i=e.isInternal?void 0:t;return c.jsx(BA,{...n,id:i,pathOptions:j.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const fW=UA({isInternal:!1}),FA=UA({isInternal:!0});fW.displayName="StepEdge";FA.displayName="StepEdgeInternal";function qA(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:a,targetY:l,label:o,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,interactionWidth:v})=>{const[S,E,C]=aA({sourceX:n,sourceY:i,targetX:a,targetY:l}),N=e.isInternal?void 0:t;return c.jsx(Eh,{id:N,path:S,labelX:E,labelY:C,label:o,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:k,interactionWidth:v})})}const pW=qA({isInternal:!1}),HA=qA({isInternal:!0});pW.displayName="StraightEdge";HA.displayName="StraightEdgeInternal";function KA(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:a,targetY:l,sourcePosition:o=Ke.Bottom,targetPosition:d=Ke.Top,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:k,markerEnd:v,markerStart:S,pathOptions:E,interactionWidth:C})=>{const[N,_,T]=iA({sourceX:n,sourceY:i,sourcePosition:o,targetX:a,targetY:l,targetPosition:d,curvature:E==null?void 0:E.curvature}),M=e.isInternal?void 0:t;return c.jsx(Eh,{id:M,path:N,labelX:_,labelY:T,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:k,markerEnd:v,markerStart:S,interactionWidth:C})})}const hW=KA({isInternal:!1}),GA=KA({isInternal:!0});hW.displayName="BezierEdge";GA.displayName="BezierEdgeInternal";const XS={default:GA,straight:HA,step:FA,smoothstep:$A,simplebezier:zA},ZS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},mW=(e,t,n)=>n===Ke.Left?e-t:n===Ke.Right?e+t:e,gW=(e,t,n)=>n===Ke.Top?e-t:n===Ke.Bottom?e+t:e,JS="react-flow__edgeupdater";function eN({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:a,onMouseEnter:l,onMouseOut:o,type:d}){return c.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:o,className:_n([JS,`${JS}-${d}`]),cx:mW(t,i,e),cy:gW(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function yW({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:a,targetX:l,targetY:o,sourcePosition:d,targetPosition:f,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,setReconnecting:y,setUpdateHover:b}){const k=nn(),v=(_,T)=>{if(_.button!==0)return;const{autoPanOnConnect:M,domNode:O,connectionMode:R,connectionRadius:B,lib:U,onConnectStart:K,cancelConnection:q,nodeLookup:Y,rfId:D,panBy:F,updateConnection:I}=k.getState(),H=T.type==="target",W=(z,V)=>{y(!1),m==null||m(z,n,T.type,V)},G=z=>p==null?void 0:p(n,z),L=(z,V)=>{y(!0),g==null||g(_,n,T.type),K==null||K(z,V)};Sb.onPointerDown(_.nativeEvent,{autoPanOnConnect:M,connectionMode:R,connectionRadius:B,domNode:O,handleId:T.id,nodeId:T.nodeId,nodeLookup:Y,isTarget:H,edgeUpdaterType:T.type,lib:U,flowId:D,cancelConnection:q,panBy:F,isValidConnection:(...z)=>{var V,P;return((P=(V=k.getState()).isValidConnection)==null?void 0:P.call(V,...z))??!0},onConnect:G,onConnectStart:L,onConnectEnd:(...z)=>{var V,P;return(P=(V=k.getState()).onConnectEnd)==null?void 0:P.call(V,...z)},onReconnectEnd:W,updateConnection:I,getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,dragThreshold:k.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},S=_=>v(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=_=>v(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>b(!0),N=()=>b(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(eN,{position:d,centerX:i,centerY:a,radius:t,onMouseDown:S,onMouseEnter:C,onMouseOut:N,type:"source"}),(e===!0||e==="target")&&c.jsx(eN,{position:f,centerX:l,centerY:o,radius:t,onMouseDown:E,onMouseEnter:C,onMouseOut:N,type:"target"})]})}function bW({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:a,onDoubleClick:l,onContextMenu:o,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,reconnectRadius:g,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,rfId:k,edgeTypes:v,noPanClassName:S,onError:E,disableKeyboardA11y:C}){let N=Nt(we=>we.edgeLookup.get(e));const _=Nt(we=>we.defaultEdgeOptions);N=_?{..._,...N}:N;let T=N.type||"default",M=(v==null?void 0:v[T])||XS[T];M===void 0&&(E==null||E("011",pr.error011(T)),T="default",M=(v==null?void 0:v.default)||XS.default);const O=!!(N.focusable||t&&typeof N.focusable>"u"),R=typeof m<"u"&&(N.reconnectable||n&&typeof N.reconnectable>"u"),B=!!(N.selectable||i&&typeof N.selectable>"u"),U=j.useRef(null),[K,q]=j.useState(!1),[Y,D]=j.useState(!1),F=nn(),{zIndex:I=N.zIndex,sourceX:H,sourceY:W,targetX:G,targetY:L,sourcePosition:z,targetPosition:V}=Nt(j.useCallback(we=>{const re=we.nodeLookup.get(N.source),Ce=we.nodeLookup.get(N.target);if(!re||!Ce)return ZS;const Me=aV({id:e,sourceNode:re,targetNode:Ce,sourceHandle:N.sourceHandle||null,targetHandle:N.targetHandle||null,connectionMode:we.connectionMode,onError:E}),_e=XG({selected:N.selected,zIndex:N.zIndex,sourceNode:re,targetNode:Ce,elevateOnSelect:we.elevateEdgesOnSelect,zIndexMode:we.zIndexMode});return{...Me||ZS,zIndex:_e}},[N.source,N.target,N.sourceHandle,N.targetHandle,N.selected,N.zIndex]),tn),P=j.useMemo(()=>N.markerStart?`url('#${kb(N.markerStart,k)}')`:void 0,[N.markerStart,k]),le=j.useMemo(()=>N.markerEnd?`url('#${kb(N.markerEnd,k)}')`:void 0,[N.markerEnd,k]);if(N.hidden||H===null||W===null||G===null||L===null)return null;const xe=we=>{var _e;const{addSelectedEdges:re,unselectNodesAndEdges:Ce,multiSelectionActive:Me}=F.getState();B&&(F.setState({nodesSelectionActive:!1}),N.selected&&Me?(Ce({nodes:[],edges:[N]}),(_e=U.current)==null||_e.blur()):re([e])),a&&a(we,N)},ke=l?we=>{l(we,{...N})}:void 0,Ne=o?we=>{o(we,{...N})}:void 0,se=d?we=>{d(we,{...N})}:void 0,ve=f?we=>{f(we,{...N})}:void 0,ue=p?we=>{p(we,{...N})}:void 0,J=we=>{var re;if(!C&&UC.includes(we.key)&&B){const{unselectNodesAndEdges:Ce,addSelectedEdges:Me}=F.getState();we.key==="Escape"?((re=U.current)==null||re.blur(),Ce({edges:[N]})):Me([e])}};return c.jsx("svg",{style:{zIndex:I},children:c.jsxs("g",{className:_n(["react-flow__edge",`react-flow__edge-${T}`,N.className,S,{selected:N.selected,animated:N.animated,inactive:!B&&!a,updating:K,selectable:B}]),onClick:xe,onDoubleClick:ke,onContextMenu:Ne,onMouseEnter:se,onMouseMove:ve,onMouseLeave:ue,onKeyDown:O?J:void 0,tabIndex:O?0:void 0,role:N.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":N.ariaLabel===null?void 0:N.ariaLabel||`Edge from ${N.source} to ${N.target}`,"aria-describedby":O?`${vA}-${k}`:void 0,ref:U,...N.domAttributes,children:[!Y&&c.jsx(M,{id:e,source:N.source,target:N.target,type:N.type,selected:N.selected,animated:N.animated,selectable:B,deletable:N.deletable??!0,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,sourceX:H,sourceY:W,targetX:G,targetY:L,sourcePosition:z,targetPosition:V,data:N.data,style:N.style,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerStart:P,markerEnd:le,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth}),R&&c.jsx(yW,{edge:N,isReconnectable:R,reconnectRadius:g,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,sourceX:H,sourceY:W,targetX:G,targetY:L,sourcePosition:z,targetPosition:V,setUpdateHover:q,setReconnecting:D})]})})}var xW=j.memo(bW);const vW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function VA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:a,onReconnect:l,onEdgeContextMenu:o,onEdgeMouseEnter:d,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:g,reconnectRadius:m,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:k,disableKeyboardA11y:v}){const{edgesFocusable:S,edgesReconnectable:E,elementsSelectable:C,onError:N}=Nt(vW,tn),_=rW(t);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(cW,{defaultColor:e,rfId:n}),_.map(T=>c.jsx(xW,{id:T,edgesFocusable:S,edgesReconnectable:E,elementsSelectable:C,noPanClassName:a,onReconnect:l,onContextMenu:o,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,onClick:g,reconnectRadius:m,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:k,rfId:n,onError:N,edgeTypes:i,disableKeyboardA11y:v},T))]})}VA.displayName="EdgeRenderer";const wW=j.memo(VA),kW=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function EW({children:e}){const t=Nt(kW);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function SW(e){const t=wh(),n=j.useRef(!1);j.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const NW=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function _W(e){const t=Nt(NW),n=nn();return j.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jW(e){return e.connection.inProgress?{...e.connection,to:cd(e.connection.to,e.transform)}:{...e.connection}}function CW(e){return jW}function AW(e){const t=CW();return Nt(t,tn)}const TW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function MW({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:a,width:l,height:o,isValid:d,inProgress:f}=Nt(TW,tn);return!(l&&a&&f)?null:c.jsx("svg",{style:e,width:l,height:o,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:_n(["react-flow__connection",HC(d)]),children:c.jsx(YA,{style:t,type:n,CustomComponent:i,isValid:d})})})}const YA=({style:e,type:t=os.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:a,from:l,fromNode:o,fromHandle:d,fromPosition:f,to:p,toNode:g,toHandle:m,toPosition:y,pointer:b}=AW();if(!a)return;if(n)return c.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:d,fromX:l.x,fromY:l.y,toX:p.x,toY:p.y,fromPosition:f,toPosition:y,connectionStatus:HC(i),toNode:g,toHandle:m,pointer:b});let k="";const v={sourceX:l.x,sourceY:l.y,sourcePosition:f,targetX:p.x,targetY:p.y,targetPosition:y};switch(t){case os.Bezier:[k]=iA(v);break;case os.SimpleBezier:[k]=LA(v);break;case os.Step:[k]=wb({...v,borderRadius:0});break;case os.SmoothStep:[k]=wb(v);break;default:[k]=aA(v)}return c.jsx("path",{d:k,fill:"none",className:"react-flow__connection-path",style:e})};YA.displayName="ConnectionLine";const DW={};function tN(e=DW){j.useRef(e),nn(),j.useEffect(()=>{},[e])}function OW(){nn(),j.useRef(!1),j.useEffect(()=>{},[])}function WA({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:o,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,onSelectionContextMenu:m,onSelectionStart:y,onSelectionEnd:b,connectionLineType:k,connectionLineStyle:v,connectionLineComponent:S,connectionLineContainerStyle:E,selectionKeyCode:C,selectionOnDrag:N,selectionMode:_,multiSelectionKeyCode:T,panActivationKeyCode:M,zoomActivationKeyCode:O,deleteKeyCode:R,onlyRenderVisibleElements:B,elementsSelectable:U,defaultViewport:K,translateExtent:q,minZoom:Y,maxZoom:D,preventScrolling:F,defaultMarkerColor:I,zoomOnScroll:H,zoomOnPinch:W,panOnScroll:G,panOnScrollSpeed:L,panOnScrollMode:z,zoomOnDoubleClick:V,panOnDrag:P,autoPanOnSelection:le,onPaneClick:xe,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:se,onPaneScroll:ve,onPaneContextMenu:ue,paneClickDistance:J,nodeClickDistance:we,onEdgeContextMenu:re,onEdgeMouseEnter:Ce,onEdgeMouseMove:Me,onEdgeMouseLeave:_e,reconnectRadius:Qe,onReconnect:Ue,onReconnectStart:ce,onReconnectEnd:be,noDragClassName:ge,noWheelClassName:pe,noPanClassName:Se,disableKeyboardA11y:je,nodeExtent:He,rfId:te,viewport:de,onViewportChange:Le}){return tN(e),tN(t),OW(),SW(n),_W(de),c.jsx(YY,{onPaneClick:xe,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:se,onPaneContextMenu:ue,onPaneScroll:ve,paneClickDistance:J,deleteKeyCode:R,selectionKeyCode:C,selectionOnDrag:N,selectionMode:_,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:T,panActivationKeyCode:M,zoomActivationKeyCode:O,elementsSelectable:U,zoomOnScroll:H,zoomOnPinch:W,zoomOnDoubleClick:V,panOnScroll:G,panOnScrollSpeed:L,panOnScrollMode:z,panOnDrag:P,autoPanOnSelection:le,defaultViewport:K,translateExtent:q,minZoom:Y,maxZoom:D,onSelectionContextMenu:m,preventScrolling:F,noDragClassName:ge,noWheelClassName:pe,noPanClassName:Se,disableKeyboardA11y:je,onViewportChange:Le,isControlledViewport:!!de,children:c.jsxs(EW,{children:[c.jsx(wW,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:o,onReconnect:Ue,onReconnectStart:ce,onReconnectEnd:be,onlyRenderVisibleElements:B,onEdgeContextMenu:re,onEdgeMouseEnter:Ce,onEdgeMouseMove:Me,onEdgeMouseLeave:_e,reconnectRadius:Qe,defaultMarkerColor:I,noPanClassName:Se,disableKeyboardA11y:je,rfId:te}),c.jsx(MW,{style:v,type:k,component:S,containerStyle:E}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(iW,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,nodeClickDistance:we,onlyRenderVisibleElements:B,noPanClassName:Se,noDragClassName:ge,disableKeyboardA11y:je,nodeExtent:He,rfId:te}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}WA.displayName="GraphView";const RW=j.memo(WA),LW=QC(),nN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:a,height:l,fitView:o,fitViewOptions:d,minZoom:f=.5,maxZoom:p=2,nodeOrigin:g,nodeExtent:m,zIndexMode:y="basic"}={})=>{const b=new Map,k=new Map,v=new Map,S=new Map,E=i??t??[],C=n??e??[],N=g??[0,0],_=m??Ru;oA(v,S,E);const{nodesInitialized:T}=Eb(C,b,k,{nodeOrigin:N,nodeExtent:_,zIndexMode:y});let M=[0,0,1];if(o&&a&&l){const O=ld(b,{filter:K=>!!((K.width||K.initialWidth)&&(K.height||K.initialHeight))}),{x:R,y:B,zoom:U}=Jx(O,a,l,f,p,(d==null?void 0:d.padding)??.1);M=[R,B,U]}return{rfId:"1",width:a??0,height:l??0,transform:M,nodes:C,nodesInitialized:T,nodeLookup:b,parentLookup:k,edges:E,edgeLookup:S,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:f,maxZoom:p,translateExtent:Ru,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ko.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:d,fitViewResolver:null,connection:{...qC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:LW,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:FC,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},IW=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:a,height:l,fitView:o,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:g,nodeExtent:m,zIndexMode:y})=>YV((b,k)=>{async function v(){const{nodeLookup:S,panZoom:E,fitViewOptions:C,fitViewResolver:N,width:_,height:T,minZoom:M,maxZoom:O}=k();E&&(await HG({nodes:S,width:_,height:T,panZoom:E,minZoom:M,maxZoom:O},C),N==null||N.resolve(!0),b({fitViewResolver:null}))}return{...nN({nodes:e,edges:t,width:a,height:l,fitView:o,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:g,nodeExtent:m,defaultNodes:n,defaultEdges:i,zIndexMode:y}),setNodes:S=>{const{nodeLookup:E,parentLookup:C,nodeOrigin:N,elevateNodesOnSelect:_,fitViewQueued:T,zIndexMode:M,nodesSelectionActive:O}=k(),{nodesInitialized:R,hasSelectedNodes:B}=Eb(S,E,C,{nodeOrigin:N,nodeExtent:m,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:M}),U=O&&B;T&&R?(v(),b({nodes:S,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:U})):b({nodes:S,nodesInitialized:R,nodesSelectionActive:U})},setEdges:S=>{const{connectionLookup:E,edgeLookup:C}=k();oA(E,C,S),b({edges:S})},setDefaultNodesAndEdges:(S,E)=>{if(S){const{setNodes:C}=k();C(S),b({hasDefaultNodes:!0})}if(E){const{setEdges:C}=k();C(E),b({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:E,nodeLookup:C,parentLookup:N,domNode:_,nodeOrigin:T,nodeExtent:M,debug:O,fitViewQueued:R,zIndexMode:B}=k(),{changes:U,updatedInternals:K}=pV(S,C,N,_,T,M,B);K&&(cV(C,N,{nodeOrigin:T,nodeExtent:M,zIndexMode:B}),R?(v(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),(U==null?void 0:U.length)>0&&(O&&console.log("React Flow: trigger node changes",U),E==null||E(U)))},updateNodePositions:(S,E=!1)=>{const C=[];let N=[];const{nodeLookup:_,triggerNodeChanges:T,connection:M,updateConnection:O,onNodesChangeMiddlewareMap:R}=k();for(const[B,U]of S){const K=_.get(B),q=!!(K!=null&&K.expandParent&&(K!=null&&K.parentId)&&(U!=null&&U.position)),Y={id:B,type:"position",position:q?{x:Math.max(0,U.position.x),y:Math.max(0,U.position.y)}:U.position,dragging:E};if(K&&M.inProgress&&M.fromNode.id===K.id){const D=vl(K,M.fromHandle,Ke.Left,!0);O({...M,from:D})}q&&K.parentId&&C.push({id:B,parentId:K.parentId,rect:{...U.internals.positionAbsolute,width:U.measured.width??0,height:U.measured.height??0}}),N.push(Y)}if(C.length>0){const{parentLookup:B,nodeOrigin:U}=k(),K=av(C,_,B,U);N.push(...K)}for(const B of R.values())N=B(N);T(N)},triggerNodeChanges:S=>{const{onNodesChange:E,setNodes:C,nodes:N,hasDefaultNodes:_,debug:T}=k();if(S!=null&&S.length){if(_){const M=EA(S,N);C(M)}T&&console.log("React Flow: trigger node changes",S),E==null||E(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:E,setEdges:C,edges:N,hasDefaultEdges:_,debug:T}=k();if(S!=null&&S.length){if(_){const M=SA(S,N);C(M)}T&&console.log("React Flow: trigger edge changes",S),E==null||E(S)}},addSelectedNodes:S=>{const{multiSelectionActive:E,edgeLookup:C,nodeLookup:N,triggerNodeChanges:_,triggerEdgeChanges:T}=k();if(E){const M=S.map(O=>Ys(O,!0));_(M);return}_(wo(N,new Set([...S]),!0)),T(wo(C))},addSelectedEdges:S=>{const{multiSelectionActive:E,edgeLookup:C,nodeLookup:N,triggerNodeChanges:_,triggerEdgeChanges:T}=k();if(E){const M=S.map(O=>Ys(O,!0));T(M);return}T(wo(C,new Set([...S]))),_(wo(N,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:E}={})=>{const{edges:C,nodes:N,nodeLookup:_,triggerNodeChanges:T,triggerEdgeChanges:M}=k(),O=S||N,R=E||C,B=[];for(const K of O){if(!K.selected)continue;const q=_.get(K.id);q&&(q.selected=!1),B.push(Ys(K.id,!1))}const U=[];for(const K of R)K.selected&&U.push(Ys(K.id,!1));T(B),M(U)},setMinZoom:S=>{const{panZoom:E,maxZoom:C}=k();E==null||E.setScaleExtent([S,C]),b({minZoom:S})},setMaxZoom:S=>{const{panZoom:E,minZoom:C}=k();E==null||E.setScaleExtent([C,S]),b({maxZoom:S})},setTranslateExtent:S=>{var E;(E=k().panZoom)==null||E.setTranslateExtent(S),b({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:E,triggerNodeChanges:C,triggerEdgeChanges:N,elementsSelectable:_}=k();if(!_)return;const T=E.reduce((O,R)=>R.selected?[...O,Ys(R.id,!1)]:O,[]),M=S.reduce((O,R)=>R.selected?[...O,Ys(R.id,!1)]:O,[]);C(T),N(M)},setNodeExtent:S=>{const{nodes:E,nodeLookup:C,parentLookup:N,nodeOrigin:_,elevateNodesOnSelect:T,nodeExtent:M,zIndexMode:O}=k();S[0][0]===M[0][0]&&S[0][1]===M[0][1]&&S[1][0]===M[1][0]&&S[1][1]===M[1][1]||(Eb(E,C,N,{nodeOrigin:_,nodeExtent:S,elevateNodesOnSelect:T,checkEquality:!1,zIndexMode:O}),b({nodeExtent:S}))},panBy:S=>{const{transform:E,width:C,height:N,panZoom:_,translateExtent:T}=k();return hV({delta:S,panZoom:_,transform:E,translateExtent:T,width:C,height:N})},setCenter:async(S,E,C)=>{const{width:N,height:_,maxZoom:T,panZoom:M}=k();if(!M)return!1;const O=typeof(C==null?void 0:C.zoom)<"u"?C.zoom:T;return await M.setViewport({x:N/2-S*O,y:_/2-E*O,zoom:O},{duration:C==null?void 0:C.duration,ease:C==null?void 0:C.ease,interpolate:C==null?void 0:C.interpolate}),!0},cancelConnection:()=>{b({connection:{...qC}})},updateConnection:S=>{b({connection:S})},reset:()=>b({...nN()})}},Object.is);function QA({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:a,initialHeight:l,initialMinZoom:o,initialMaxZoom:d,initialFitViewOptions:f,fitView:p,nodeOrigin:g,nodeExtent:m,zIndexMode:y,children:b}){const[k]=j.useState(()=>IW({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:a,height:l,fitView:p,minZoom:o,maxZoom:d,fitViewOptions:f,nodeOrigin:g,nodeExtent:m,zIndexMode:y}));return c.jsx(WV,{value:k,children:c.jsx(vY,{children:c.jsx(LY,{children:b})})})}function zW({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:a,width:l,height:o,fitView:d,fitViewOptions:f,minZoom:p,maxZoom:g,nodeOrigin:m,nodeExtent:y,zIndexMode:b}){return j.useContext(xh)?c.jsx(c.Fragment,{children:e}):c.jsx(QA,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:a,initialWidth:l,initialHeight:o,fitView:d,initialFitViewOptions:f,initialMinZoom:p,initialMaxZoom:g,nodeOrigin:m,nodeExtent:y,zIndexMode:b,children:e})}const PW={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function BW({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:a,nodeTypes:l,edgeTypes:o,onNodeClick:d,onEdgeClick:f,onInit:p,onMove:g,onMoveStart:m,onMoveEnd:y,onConnect:b,onConnectStart:k,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:E,onNodeMouseEnter:C,onNodeMouseMove:N,onNodeMouseLeave:_,onNodeContextMenu:T,onNodeDoubleClick:M,onNodeDragStart:O,onNodeDrag:R,onNodeDragStop:B,onNodesDelete:U,onEdgesDelete:K,onDelete:q,onSelectionChange:Y,onSelectionDragStart:D,onSelectionDrag:F,onSelectionDragStop:I,onSelectionContextMenu:H,onSelectionStart:W,onSelectionEnd:G,onBeforeDelete:L,connectionMode:z,connectionLineType:V=os.Bezier,connectionLineStyle:P,connectionLineComponent:le,connectionLineContainerStyle:xe,deleteKeyCode:ke="Backspace",selectionKeyCode:Ne="Shift",selectionOnDrag:se=!1,selectionMode:ve=Lu.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:J=zu()?"Meta":"Control",zoomActivationKeyCode:we=zu()?"Meta":"Control",snapToGrid:re,snapGrid:Ce,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:_e,nodesDraggable:Qe,autoPanOnNodeFocus:Ue,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:ge=wA,edgesFocusable:pe,edgesReconnectable:Se,elementsSelectable:je=!0,defaultViewport:He=oY,minZoom:te=.5,maxZoom:de=2,translateExtent:Le=Ru,preventScrolling:Ze=!0,nodeExtent:rt,defaultMarkerColor:At="#b1b1b7",zoomOnScroll:$n=!0,zoomOnPinch:dn=!0,panOnScroll:Mt=!1,panOnScrollSpeed:Wt=.5,panOnScrollMode:yt=ul.Free,zoomOnDoubleClick:Ti=!0,panOnDrag:Rn=!0,onPaneClick:Nl,onPaneMouseEnter:Pr,onPaneMouseMove:wa,onPaneMouseLeave:Br,onPaneScroll:Un,onPaneContextMenu:Z,paneClickDistance:me=1,nodeClickDistance:Oe=0,children:it,onReconnect:qt,onReconnectStart:Ot,onReconnectEnd:$e,onEdgeContextMenu:ze,onEdgeDoubleClick:et,onEdgeMouseEnter:rn,onEdgeMouseMove:Vt,onEdgeMouseLeave:Qi,reconnectRadius:ka=10,onNodesChange:Ea,onEdgesChange:Mi,noDragClassName:an="nodrag",noWheelClassName:Tn="nowheel",noPanClassName:Xi="nopan",fitView:Sa,fitViewOptions:_s,connectOnClick:Na,attributionPosition:_l,proOptions:$r,defaultEdgeOptions:js,elevateNodesOnSelect:Ln=!0,elevateEdgesOnSelect:Zi=!1,disableKeyboardA11y:Ji=!1,autoPanOnConnect:xr,autoPanOnNodeDrag:fn,autoPanOnSelection:jl=!0,autoPanSpeed:Ur,connectionRadius:er,isValidConnection:Ae,onError:Ge,style:pt,id:_t,nodeDragThreshold:sn,connectionDragThreshold:Mn,viewport:Wn,onViewportChange:Fn,width:zt,height:Qn,colorMode:Cl="light",debug:_a,onScroll:vr,ariaLabelConfig:ja,zIndexMode:Al="basic",...qn},Cs){const tr=_t||"1",Ca=fY(Cl),jn=j.useCallback(As=>{As.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vr==null||vr(As)},[vr]);return c.jsx("div",{"data-testid":"rf__wrapper",...qn,onScroll:jn,style:{...pt,...PW},ref:Cs,className:_n(["react-flow",a,Ca]),id:_t,role:"application",children:c.jsxs(zW,{nodes:e,edges:t,width:zt,height:Qn,fitView:Sa,fitViewOptions:_s,minZoom:te,maxZoom:de,nodeOrigin:ge,nodeExtent:rt,zIndexMode:Al,children:[c.jsx(dY,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:b,onConnectStart:k,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:E,nodesDraggable:Qe,autoPanOnNodeFocus:Ue,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:pe,edgesReconnectable:Se,elementsSelectable:je,elevateNodesOnSelect:Ln,elevateEdgesOnSelect:Zi,minZoom:te,maxZoom:de,nodeExtent:rt,onNodesChange:Ea,onEdgesChange:Mi,snapToGrid:re,snapGrid:Ce,connectionMode:z,translateExtent:Le,connectOnClick:Na,defaultEdgeOptions:js,fitView:Sa,fitViewOptions:_s,onNodesDelete:U,onEdgesDelete:K,onDelete:q,onNodeDragStart:O,onNodeDrag:R,onNodeDragStop:B,onSelectionDrag:F,onSelectionDragStart:D,onSelectionDragStop:I,onMove:g,onMoveStart:m,onMoveEnd:y,noPanClassName:Xi,nodeOrigin:ge,rfId:tr,autoPanOnConnect:xr,autoPanOnNodeDrag:fn,autoPanSpeed:Ur,onError:Ge,connectionRadius:er,isValidConnection:Ae,selectNodesOnDrag:_e,nodeDragThreshold:sn,connectionDragThreshold:Mn,onBeforeDelete:L,debug:_a,ariaLabelConfig:ja,zIndexMode:Al}),c.jsx(RW,{onInit:p,onNodeClick:d,onEdgeClick:f,onNodeMouseEnter:C,onNodeMouseMove:N,onNodeMouseLeave:_,onNodeContextMenu:T,onNodeDoubleClick:M,nodeTypes:l,edgeTypes:o,connectionLineType:V,connectionLineStyle:P,connectionLineComponent:le,connectionLineContainerStyle:xe,selectionKeyCode:Ne,selectionOnDrag:se,selectionMode:ve,deleteKeyCode:ke,multiSelectionKeyCode:J,panActivationKeyCode:ue,zoomActivationKeyCode:we,onlyRenderVisibleElements:Me,defaultViewport:He,translateExtent:Le,minZoom:te,maxZoom:de,preventScrolling:Ze,zoomOnScroll:$n,zoomOnPinch:dn,zoomOnDoubleClick:Ti,panOnScroll:Mt,panOnScrollSpeed:Wt,panOnScrollMode:yt,panOnDrag:Rn,autoPanOnSelection:jl,onPaneClick:Nl,onPaneMouseEnter:Pr,onPaneMouseMove:wa,onPaneMouseLeave:Br,onPaneScroll:Un,onPaneContextMenu:Z,paneClickDistance:me,nodeClickDistance:Oe,onSelectionContextMenu:H,onSelectionStart:W,onSelectionEnd:G,onReconnect:qt,onReconnectStart:Ot,onReconnectEnd:$e,onEdgeContextMenu:ze,onEdgeDoubleClick:et,onEdgeMouseEnter:rn,onEdgeMouseMove:Vt,onEdgeMouseLeave:Qi,reconnectRadius:ka,defaultMarkerColor:At,noDragClassName:an,noWheelClassName:Tn,noPanClassName:Xi,rfId:tr,disableKeyboardA11y:Ji,nodeExtent:rt,viewport:Wn,onViewportChange:Fn}),c.jsx(lY,{onSelectionChange:Y}),it,c.jsx(nY,{proOptions:$r,position:_l}),c.jsx(tY,{rfId:tr,disableKeyboardA11y:Ji})]})})}var $W=NA(BW);function UW(e){const[t,n]=j.useState(e),i=j.useCallback(a=>n(l=>EA(a,l)),[]);return[t,n,i]}function FW(e){const[t,n]=j.useState(e),i=j.useCallback(a=>n(l=>SA(a,l)),[]);return[t,n,i]}function qW({dimensions:e,lineWidth:t,variant:n,className:i}){return c.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:_n(["react-flow__background-pattern",n,i])})}function HW({radius:e,className:t}){return c.jsx("circle",{cx:e,cy:e,r:e,className:_n(["react-flow__background-pattern","dots",t])})}var ha;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ha||(ha={}));const KW={[ha.Dots]:1,[ha.Lines]:1,[ha.Cross]:6},GW=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function XA({id:e,variant:t=ha.Dots,gap:n=20,size:i,lineWidth:a=1,offset:l=0,color:o,bgColor:d,style:f,className:p,patternClassName:g}){const m=j.useRef(null),{transform:y,patternId:b}=Nt(GW,tn),k=i||KW[t],v=t===ha.Dots,S=t===ha.Cross,E=Array.isArray(n)?n:[n,n],C=[E[0]*y[2]||1,E[1]*y[2]||1],N=k*y[2],_=Array.isArray(l)?l:[l,l],T=S?[N,N]:C,M=[_[0]*y[2]||1+T[0]/2,_[1]*y[2]||1+T[1]/2],O=`${b}${e||""}`;return c.jsxs("svg",{className:_n(["react-flow__background",p]),style:{...f,...kh,"--xy-background-color-props":d,"--xy-background-pattern-color-props":o},ref:m,"data-testid":"rf__background",children:[c.jsx("pattern",{id:O,x:y[0]%C[0],y:y[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`,children:v?c.jsx(HW,{radius:N/2,className:g}):c.jsx(qW,{dimensions:T,lineWidth:a,variant:t,className:g})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}XA.displayName="Background";const VW=j.memo(XA);function YW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function WW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function QW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function XW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ZW(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Qf({children:e,className:t,...n}){return c.jsx("button",{type:"button",className:_n(["react-flow__controls-button",t]),...n,children:e})}const JW=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ZA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:o,onFitView:d,onInteractiveChange:f,className:p,children:g,position:m="bottom-left",orientation:y="vertical","aria-label":b}){const k=nn(),{isInteractive:v,minZoomReached:S,maxZoomReached:E,ariaLabelConfig:C}=Nt(JW,tn),{zoomIn:N,zoomOut:_,fitView:T}=wh(),M=()=>{N(),l==null||l()},O=()=>{_(),o==null||o()},R=()=>{T(a),d==null||d()},B=()=>{k.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),f==null||f(!v)},U=y==="horizontal"?"horizontal":"vertical";return c.jsxs(vh,{className:_n(["react-flow__controls",U,p]),position:m,style:e,"data-testid":"rf__controls","aria-label":b??C["controls.ariaLabel"],children:[t&&c.jsxs(c.Fragment,{children:[c.jsx(Qf,{onClick:M,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:E,children:c.jsx(YW,{})}),c.jsx(Qf,{onClick:O,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:S,children:c.jsx(WW,{})})]}),n&&c.jsx(Qf,{className:"react-flow__controls-fitview",onClick:R,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:c.jsx(QW,{})}),i&&c.jsx(Qf,{className:"react-flow__controls-interactive",onClick:B,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:v?c.jsx(ZW,{}):c.jsx(XW,{})}),g]})}ZA.displayName="Controls";const eQ=j.memo(ZA);function tQ({id:e,x:t,y:n,width:i,height:a,style:l,color:o,strokeColor:d,strokeWidth:f,className:p,borderRadius:g,shapeRendering:m,selected:y,onClick:b}){const{background:k,backgroundColor:v}=l||{},S=o||k||v;return c.jsx("rect",{className:_n(["react-flow__minimap-node",{selected:y},p]),x:t,y:n,rx:g,ry:g,width:i,height:a,style:{fill:S,stroke:d,strokeWidth:f},shapeRendering:m,onClick:b?E=>b(E,e):void 0})}const nQ=j.memo(tQ),iQ=e=>e.nodes.map(t=>t.id),Ny=e=>e instanceof Function?e:()=>e;function rQ({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l=nQ,onClick:o}){const d=Nt(iQ,tn),f=Ny(t),p=Ny(e),g=Ny(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:d.map(y=>c.jsx(sQ,{id:y,nodeColorFunc:f,nodeStrokeColorFunc:p,nodeClassNameFunc:g,nodeBorderRadius:i,nodeStrokeWidth:a,NodeComponent:l,onClick:o,shapeRendering:m},y))})}function aQ({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:o,NodeComponent:d,onClick:f}){const{node:p,x:g,y:m,width:y,height:b}=Nt(k=>{const v=k.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const S=v.internals.userNode,{x:E,y:C}=v.internals.positionAbsolute,{width:N,height:_}=va(S);return{node:S,x:E,y:C,width:N,height:_}},tn);return!p||p.hidden||!XC(p)?null:c.jsx(d,{x:g,y:m,width:y,height:b,style:p.style,selected:!!p.selected,className:i(p),color:t(p),borderRadius:a,strokeColor:n(p),strokeWidth:l,shapeRendering:o,onClick:f,id:p.id})}const sQ=j.memo(aQ);var lQ=j.memo(rQ);const oQ=200,cQ=150,uQ=e=>!e.hidden,dQ=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?YC(ld(e.nodeLookup,{filter:uQ}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},fQ="react-flow__minimap-desc";function JA({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:o,nodeComponent:d,bgColor:f,maskColor:p,maskStrokeColor:g,maskStrokeWidth:m,position:y="bottom-right",onClick:b,onNodeClick:k,pannable:v=!1,zoomable:S=!1,ariaLabel:E,inversePan:C,zoomStep:N=1,offsetScale:_=5}){const T=nn(),M=j.useRef(null),{boundingRect:O,viewBB:R,rfId:B,panZoom:U,translateExtent:K,flowWidth:q,flowHeight:Y,ariaLabelConfig:D}=Nt(dQ,tn),F=(e==null?void 0:e.width)??oQ,I=(e==null?void 0:e.height)??cQ,H=O.width/F,W=O.height/I,G=Math.max(H,W),L=G*F,z=G*I,V=_*G,P=O.x-(L-O.width)/2-V,le=O.y-(z-O.height)/2-V,xe=L+V*2,ke=z+V*2,Ne=`${fQ}-${B}`,se=j.useRef(0),ve=j.useRef();se.current=G,j.useEffect(()=>{if(M.current&&U)return ve.current=EV({domNode:M.current,panZoom:U,getTransform:()=>T.getState().transform,getViewScale:()=>se.current}),()=>{var re;(re=ve.current)==null||re.destroy()}},[U]),j.useEffect(()=>{var re;(re=ve.current)==null||re.update({translateExtent:K,width:q,height:Y,inversePan:C,pannable:v,zoomStep:N,zoomable:S})},[v,S,C,N,K,q,Y]);const ue=b?re=>{var _e;const[Ce,Me]=((_e=ve.current)==null?void 0:_e.pointer(re))||[0,0];b(re,{x:Ce,y:Me})}:void 0,J=k?j.useCallback((re,Ce)=>{const Me=T.getState().nodeLookup.get(Ce).internals.userNode;k(re,Me)},[]):void 0,we=E??D["minimap.ariaLabel"];return c.jsx(vh,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*G:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:_n(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:F,height:I,viewBox:`${P} ${le} ${xe} ${ke}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Ne,ref:M,onClick:ue,children:[we&&c.jsx("title",{id:Ne,children:we}),c.jsx(lQ,{onClick:J,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:o,nodeComponent:d}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-V},${le-V}h${xe+V*2}v${ke+V*2}h${-xe-V*2}z
|
|
685
685
|
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}JA.displayName="MiniMap";j.memo(JA);const pQ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,hQ={[Yo.Line]:"right",[Yo.Handle]:"bottom-right"};function mQ({nodeId:e,position:t,variant:n=Yo.Handle,className:i,style:a=void 0,children:l,color:o,minWidth:d=10,minHeight:f=10,maxWidth:p=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:y,autoScale:b=!0,shouldResize:k,onResizeStart:v,onResize:S,onResizeEnd:E}){const C=AA(),N=typeof e=="string"?e:C,_=nn(),T=j.useRef(null),M=n===Yo.Handle,O=Nt(j.useCallback(pQ(M&&b),[M,b]),tn),R=j.useRef(null),B=t??hQ[n];j.useEffect(()=>{if(!(!T.current||!N))return R.current||(R.current=IV({domNode:T.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:K,transform:q,snapGrid:Y,snapToGrid:D,nodeOrigin:F,domNode:I}=_.getState();return{nodeLookup:K,transform:q,snapGrid:Y,snapToGrid:D,nodeOrigin:F,paneDomNode:I}},onChange:(K,q)=>{const{triggerNodeChanges:Y,nodeLookup:D,parentLookup:F,nodeOrigin:I}=_.getState(),H=[],W={x:K.x,y:K.y},G=D.get(N);if(G&&G.expandParent&&G.parentId){const L=G.origin??I,z=K.width??G.measured.width??0,V=K.height??G.measured.height??0,P={id:G.id,parentId:G.parentId,rect:{width:z,height:V,...ZC({x:K.x??G.position.x,y:K.y??G.position.y},{width:z,height:V},G.parentId,D,L)}},le=av([P],D,F,I);H.push(...le),W.x=K.x?Math.max(L[0]*z,K.x):void 0,W.y=K.y?Math.max(L[1]*V,K.y):void 0}if(W.x!==void 0&&W.y!==void 0){const L={id:N,type:"position",position:{...W}};H.push(L)}if(K.width!==void 0&&K.height!==void 0){const z={id:N,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:K.width,height:K.height}};H.push(z)}for(const L of q){const z={...L,type:"position"};H.push(z)}Y(H)},onEnd:({width:K,height:q})=>{const Y={id:N,type:"dimensions",resizing:!1,dimensions:{width:K,height:q}};_.getState().triggerNodeChanges([Y])}})),R.current.update({controlPosition:B,boundaries:{minWidth:d,minHeight:f,maxWidth:p,maxHeight:g},keepAspectRatio:m,resizeDirection:y,onResizeStart:v,onResize:S,onResizeEnd:E,shouldResize:k}),()=>{var K;(K=R.current)==null||K.destroy()}},[B,d,f,p,g,m,v,S,E,k]);const U=B.split("-");return c.jsx("div",{className:_n(["react-flow__resize-control","nodrag",...U,n,i]),ref:T,style:{...a,scale:O,...o&&{[M?"backgroundColor":"borderColor"]:o}},children:l})}j.memo(mQ);function gQ(e){return ct(`/api/smartarrange/${encodeURIComponent(e)}`)}async function yQ(e){const t=await fetch(`/api/smartarrange/${encodeURIComponent(e)}/approve`,{method:"POST"});if(!t.ok)throw new Error(`${t.status}: ${await t.text()}`);return t.json()}const _y=["var(--color-accent-mint)","var(--color-accent-pink)","var(--color-accent-purple)","var(--color-accent-yellow)","var(--color-running-bg)","var(--color-idle-bg)","var(--color-stuck-bg)"];function iN(e,t){return _y[t%_y.length]??_y[0]}const eT={done:"var(--color-cta)",doing:"var(--color-secondary-dark)",todo:"var(--color-text-subtle)",stuck:"var(--color-crashed)"},fo={width:9,height:9,background:"var(--color-bg)",border:"1px solid var(--color-border-light)"},bQ=j.memo(function({data:t,selected:n}){var a;const i=t;return c.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-[var(--color-bg-soft)] overflow-hidden cursor-pointer flex flex-col",style:{width:260,height:158,boxShadow:n?"rgba(255, 255, 255, 0.22) 0 0 0 1px inset":"rgba(255, 255, 255, 0.10) 0 0 0 1px inset"},children:[c.jsx(Dr,{id:"l-t",type:"target",position:Ke.Left,style:fo}),c.jsx(Dr,{id:"r-t",type:"target",position:Ke.Right,style:fo}),c.jsx(Dr,{id:"t-t",type:"target",position:Ke.Top,style:fo}),c.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 border-b border-[var(--color-border-light)]",style:{background:i.color},children:[c.jsxs("span",{className:"font-[family-name:var(--font-mono)] text-xs font-bold text-[var(--color-text)]",children:["#",i.seq]}),c.jsx("span",{className:"text-[11px] text-[var(--color-text)] truncate",children:i.taskLabel}),c.jsx("span",{className:"w-2.5 h-2.5 rounded-full inline-block shrink-0 ml-auto",style:{background:eT[i.status]??"gray"},title:i.status})]}),c.jsxs("div",{className:"px-2.5 py-2 flex-1 min-h-0 overflow-hidden",children:[c.jsx("p",{className:"text-[13px] font-semibold text-[var(--color-text)] leading-snug line-clamp-3",children:i.title}),((a=i.skills)==null?void 0:a.length)>0&&c.jsx("div",{className:"flex flex-wrap gap-1 mt-2 max-h-[46px] overflow-hidden",children:i.skills.slice(0,6).map(l=>c.jsx("span",{className:"text-[10px] font-[family-name:var(--font-mono)] px-1.5 py-0.5 rounded bg-[rgba(255,255,255,0.08)] text-[var(--color-text)]",children:l},l))})]}),c.jsx(Dr,{id:"r-s",type:"source",position:Ke.Right,style:fo}),c.jsx(Dr,{id:"l-s",type:"source",position:Ke.Left,style:fo}),c.jsx(Dr,{id:"b-s",type:"source",position:Ke.Bottom,style:fo})]})});function xQ({card:e,status:t,onClose:n}){var a;const i=Pe();return j.useEffect(()=>{const l=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),c.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-40 flex items-start justify-center p-6 bg-black/30 overflow-auto",onClick:n,children:c.jsxs("div",{className:"nb-card mt-12 w-full max-w-2xl bg-[var(--color-bg)]",onClick:l=>l.stopPropagation(),children:[c.jsxs("header",{className:"flex items-start justify-between gap-4 mb-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[c.jsxs("span",{className:"font-[family-name:var(--font-mono)] font-bold text-xs px-2 py-0.5 bg-[var(--color-accent-purple)] border-2 border-[var(--color-text)] rounded-full",children:["#",e.seq]}),c.jsxs("span",{className:"font-[family-name:var(--font-mono)] text-xs px-2 py-0.5 bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-full font-semibold",children:[i("arrange.cardTask")," T",e.taskId]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs px-2 py-0.5 border-2 border-[var(--color-text)] rounded-full font-semibold",children:[c.jsx("span",{className:"w-2.5 h-2.5 rounded-full inline-block border border-[var(--color-text)]",style:{background:eT[t]??"gray"}}),t]})]}),c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-2xl font-bold break-words",children:e.title})]}),c.jsx("button",{onClick:n,className:"nb-btn nb-btn-mint p-2 flex-shrink-0","aria-label":i("arrange.close"),type:"button",children:c.jsx(gn,{size:14,strokeWidth:3})})]}),c.jsxs("div",{className:"flex flex-col gap-4",children:[e.at&&c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx(t_,{size:14,strokeWidth:2.5}),c.jsx("span",{className:"font-[family-name:var(--font-mono)]",children:e.at})]}),((a=e.skills)==null?void 0:a.length)>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-bold mb-1.5",children:i("arrange.cardSkills")}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:e.skills.map(l=>c.jsx(mx,{name:l},l))})]}),e.prompt&&c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:i("arrange.cardPrompt")}),c.jsx("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4 max-h-72 overflow-auto",children:e.prompt})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-[family-name:var(--font-heading)] text-sm font-bold mb-2 uppercase tracking-wider",children:i("arrange.cardLog")}),c.jsxs("pre",{className:"text-xs whitespace-pre-wrap font-[family-name:var(--font-mono)] bg-[var(--color-bg-cream)] border-2 border-[var(--color-text)] rounded-lg p-4",children:[e.at?`${e.at} [派发] #${e.seq} → ${i("arrange.cardTask")} T${e.taskId}`:"—",`
|
|
686
|
-
${e.at??""} [状态] ${t}`]})]})]})]})})}const vQ=j.memo(function({data:t}){const n=t;return c.jsxs("div",{className:"relative w-full h-full rounded-2xl border-2 border-dashed border-[var(--color-text)]",children:[c.jsx("div",{className:"absolute inset-0 rounded-2xl",style:{background:n.color,opacity:.16}}),c.jsx("span",{className:"absolute top-1.5 left-2.5 px-2 py-0.5 text-[11px] font-bold rounded-md border-2 border-[var(--color-text)] bg-[var(--color-bg)] text-[var(--color-text)] whitespace-nowrap max-w-[90%] truncate",children:n.label})]})}),wQ={card:bQ,laneBox:vQ},lv=260,tT=lv+36,kQ=200,EQ={todo:"var(--color-text-subtle)",doing:"var(--color-secondary-dark)",done:"var(--color-cta)",rework:"var(--color-secondary-dark)"};function _b(e,t,n){return e==="doing"&&t<n?"stuck":e}function SQ(e,t){const n=Math.floor(e/t),i=e%t;return{x:(n%2===0?i:t-1-i)*tT,y:n*kQ}}function NQ(e,t,n){const i=Math.floor(e/n),a=Math.floor(t/n);return i===a?i%2===0?{sourceHandle:"r-s",targetHandle:"l-t"}:{sourceHandle:"l-s",targetHandle:"r-t"}:{sourceHandle:"b-s",targetHandle:"t-t"}}function _Q(e){return e==="done"?{animated:!1,style:{stroke:"var(--color-cta)",strokeWidth:2.5}}:e==="doing"?{animated:!0,style:{stroke:"var(--color-secondary-dark)",strokeWidth:3}}:e==="stuck"?{animated:!1,style:{stroke:"var(--color-crashed)",strokeWidth:2.5,strokeDasharray:"6 4"}}:{animated:!1,style:{stroke:"var(--color-accent-yellow)",strokeWidth:2.5,strokeDasharray:"6 4"}}}const nT=158,rN=lv+60,aN=nT+28,sN=40;function jQ({cards:e,taskMeta:t,view:n,onSelect:i}){const a=j.useRef(null),[l,o]=j.useState(4),d=wh(),[f,p,g]=UW([]),[m,y]=FW([]),b=j.useRef("");return j.useEffect(()=>{const k=a.current;if(!k)return;const v=new ResizeObserver(S=>{var C;const E=((C=S[0])==null?void 0:C.contentRect.width)??800;o(Math.max(1,Math.min(8,Math.floor((E-40)/tT))))});return v.observe(k),()=>v.disconnect()},[]),j.useEffect(()=>{const k=[...e].sort((M,O)=>M.seq-O.seq),v=`${n}:${l}:${k.length}`,S=b.current!==v;b.current=v;const E=new Map,C=(M,O)=>{var R;if(n==="lane"){const B=((R=t.get(M.taskId))==null?void 0:R.order)??0,U=E.get(M.taskId)??0;return E.set(M.taskId,U+1),{x:B*rN,y:U*aN}}return SQ(O,l)},N=[];if(n==="lane"){const M=new Map;for(const O of k)M.set(O.taskId,(M.get(O.taskId)??0)+1);for(const[O,R]of M){const B=t.get(O),U=(B==null?void 0:B.order)??0;N.push({id:`lane-${O}`,type:"laneBox",position:{x:U*rN-16,y:-sN},data:{label:B!=null&&B.title?`T${O} · ${B.title}`:`T${O}`,color:(B==null?void 0:B.color)??"var(--color-bg-cream)"},style:{width:lv+32,height:sN+(R-1)*aN+nT+14},draggable:!1,selectable:!1,zIndex:0})}}const _=k.length?k[k.length-1].seq:0;p(M=>{const O=new Map(M.map(B=>[B.id,B])),R=k.map((B,U)=>{const K=t.get(B.taskId),q={seq:B.seq,title:B.title,skills:B.skills??[],taskLabel:`T${B.taskId}`,status:_b(B.status,B.seq,_),color:(K==null?void 0:K.color)??"var(--color-bg-cream)"},Y=String(B.seq),D=O.get(Y),F=C(B,U);return{...D&&!S?{...D,data:q}:{id:Y,type:"card",position:F,data:q},zIndex:1}});return[...N,...R]});const T=[];for(let M=1;M<k.length;M++){const O=k[M-1],R=k[M];if(!O||!R)continue;const B=n==="lane"?O.taskId===R.taskId?{sourceHandle:"b-s",targetHandle:"t-t"}:{sourceHandle:"r-s",targetHandle:"l-t"}:NQ(M-1,M,l);T.push({id:`e${O.seq}-${R.seq}`,source:String(O.seq),target:String(R.seq),...B,..._Q(_b(R.status,R.seq,_))})}y(T),S&&requestAnimationFrame(()=>d.fitView({padding:.2,maxZoom:1.1,duration:300}))},[e,l,t,n,p,y,d]),c.jsx("div",{ref:a,className:"w-full h-full",children:c.jsxs($W,{nodes:f,edges:m,onNodesChange:g,nodeTypes:wQ,onNodeClick:(k,v)=>i(Number(v.id)),fitView:!0,fitViewOptions:{padding:.2,maxZoom:1.1},proOptions:{hideAttribution:!0},minZoom:.15,children:[c.jsx(VW,{variant:ha.Dots,gap:20,size:1.5,color:"var(--color-border-light)"}),c.jsx(eQ,{showInteractive:!1})]})})}function CQ(){var U,K,q;const e=Pe(),t=Ft(),{alert:n}=un(),a=(((U=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:3e3}).data)==null?void 0:U.data)??[]).filter(Y=>Y.pipelineMode==="smartArrange"),l=a.map(Y=>Y.name),[o,d]=j.useState(()=>localStorage.getItem("arrange.project")??""),f=o&&l.includes(o)?o:l[0]??"";j.useEffect(()=>{o&&localStorage.setItem("arrange.project",o)},[o]);const p=a.find(Y=>Y.name===f),g=(p==null?void 0:p.pipelineStatus)==="running",m=Ve({queryKey:["smartarrange",f],queryFn:()=>gQ(f),enabled:!!f,refetchInterval:3e3}),y=Et({mutationFn:()=>yQ(f),onSuccess:()=>t.invalidateQueries({queryKey:["smartarrange",f]}),onError:Y=>void n({title:e("arrange.approveErr"),body:Y instanceof Error?Y.message:String(Y)})}),b=Et({mutationFn:()=>A2(f),onSuccess:()=>t.invalidateQueries({queryKey:["projects"]}),onError:Y=>void n({title:e("arrange.startErr"),body:Y instanceof Error?Y.message:String(Y)})}),k=Et({mutationFn:()=>T2(f),onSuccess:()=>t.invalidateQueries({queryKey:["projects"]}),onError:Y=>void n({title:e("arrange.startErr"),body:Y instanceof Error?Y.message:String(Y)})}),v=(K=m.data)==null?void 0:K.plan,S=j.useMemo(()=>{var Y;return((Y=m.data)==null?void 0:Y.cards)??[]},[(q=m.data)==null?void 0:q.cards]),[E,C]=j.useState(()=>localStorage.getItem("arrange.view")==="lane"?"lane":"free");j.useEffect(()=>{localStorage.setItem("arrange.view",E)},[E]);const N=j.useMemo(()=>{const Y=new Map;return((v==null?void 0:v.tasks)??[]).forEach((D,F)=>Y.set(D.id,{order:F,status:D.status,color:iN(D.id,F),title:D.title})),Y},[v==null?void 0:v.tasks]),[_,T]=j.useState(()=>localStorage.getItem("arrange.panel")!=="0");j.useEffect(()=>{localStorage.setItem("arrange.panel",_?"1":"0")},[_]);const[M,O]=j.useState(null),R=j.useMemo(()=>S.find(Y=>Y.seq===M),[S,M]),B=S.length?Math.max(...S.map(Y=>Y.seq)):0;return c.jsxs("div",{className:"flex flex-col gap-4 h-full min-h-0",children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 flex-wrap shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-3xl font-bold",children:e("arrange.h1")}),f&&c.jsxs("div",{className:"flex items-center gap-2",children:[g?c.jsxs("button",{className:"nb-btn nb-btn-yellow",style:{padding:"6px 12px",fontSize:12},onClick:()=>k.mutate(),disabled:k.isPending,type:"button","aria-label":e("arrange.stop"),children:[k.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(Hb,{size:12,strokeWidth:3}),e("arrange.stop")]}):c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>b.mutate(),disabled:b.isPending,type:"button","aria-label":e("arrange.start"),children:[b.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(Qu,{size:12,strokeWidth:3}),e("arrange.start")]}),v&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"nb-status",style:{background:"var(--color-bg-cream)",color:"var(--color-text)"},children:v.status}),c.jsxs("span",{className:"text-sm text-[var(--color-text-muted)]",children:["round ",v.round,"/",v.maxRounds]}),v.status==="awaiting-approval"&&c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>y.mutate(),disabled:y.isPending,type:"button","aria-label":e("arrange.approve"),children:[y.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(mp,{size:12,strokeWidth:2.5}),e("arrange.approve")]})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[v&&c.jsxs("button",{className:"nb-btn",style:{padding:"6px 10px",fontSize:12},onClick:()=>C(E==="free"?"lane":"free"),type:"button","aria-label":e("arrange.view"),children:[E==="lane"?c.jsx(p3,{size:14,strokeWidth:2.5}):c.jsx(r_,{size:14,strokeWidth:2.5}),e(E==="lane"?"arrange.viewLane":"arrange.viewFree")]}),c.jsxs("select",{className:"nb-input",style:{maxWidth:240},value:f,onChange:Y=>d(Y.target.value),"aria-label":e("arrange.project"),children:[l.length===0&&c.jsx("option",{value:"",children:"—"}),l.map(Y=>c.jsx("option",{value:Y,children:Y},Y))]})]})]}),v?c.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[c.jsxs("div",{className:"relative flex-1 min-h-0 rounded-2xl border-[3px] border-[var(--color-text)] overflow-hidden bg-[var(--color-bg-soft)]",style:{boxShadow:"4px 4px 0 var(--color-text)"},children:[S.length===0?c.jsx("div",{className:"absolute inset-0 grid place-items-center p-6",children:v.status==="running"?c.jsxs("div",{className:"flex flex-col items-center gap-3 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:28,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-sm",children:e("arrange.orchestrating")})]}):c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm text-center max-w-sm",children:e("arrange.noCards")})}):c.jsx(QA,{children:c.jsx(jQ,{cards:S,taskMeta:N,view:E,onSelect:O})}),!_&&c.jsxs("button",{className:"nb-btn absolute right-3 top-3 z-10",style:{padding:"6px 10px",fontSize:12},onClick:()=>T(!0),type:"button","aria-label":e("arrange.expand"),children:[c.jsx(Jo,{size:14,strokeWidth:3,className:"rotate-180"}),e("arrange.tasks")]})]}),_&&c.jsxs("aside",{className:"w-72 shrink-0 nb-card overflow-hidden flex flex-col gap-2 min-h-0",style:{padding:12},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-lg font-bold",children:e("arrange.tasks")}),c.jsx("button",{className:"nb-btn",style:{padding:"2px 6px"},onClick:()=>T(!1),type:"button","aria-label":e("arrange.collapse"),children:c.jsx(ZL,{size:14,strokeWidth:2.5})})]}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:v.tasks.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-10 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:22,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-xs text-center",children:e("arrange.planning")})]}):c.jsx("ul",{className:"flex flex-col gap-2",children:v.tasks.map((Y,D)=>c.jsxs("li",{className:"rounded-lg border-2 border-[var(--color-text)] p-2",style:{background:iN(Y.id,D)},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2.5 h-2.5 rounded-full inline-block shrink-0 border border-[var(--color-text)]",style:{background:EQ[Y.status]??"gray"}}),c.jsxs("span",{className:"font-bold text-xs text-[var(--color-text)]",children:["T",Y.id]}),c.jsxs("span",{className:"text-[11px] ml-auto font-[family-name:var(--font-mono)] text-[var(--color-text)]",children:[Y.cardSeqs.length," ",e("arrange.cardsCount")]})]}),c.jsx("p",{className:"text-xs text-[var(--color-text)] mt-1 leading-snug",children:Y.title})]},Y.id))})})]})]}):c.jsx("section",{className:"nb-card",children:g?c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Xe,{size:18,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-sm font-bold",children:e("arrange.starting")})]}):c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm",children:e("arrange.none")})}),R&&c.jsx(xQ,{card:R,status:_b(R.status,R.seq,B),onClose:()=>O(null)})]})}function AQ(){const e=Pe();return c.jsxs("div",{className:"nb-card max-w-2xl mt-12",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold mb-2",children:e("notFound.title")}),c.jsx("p",{className:"text-[var(--color-text-muted)] mb-6",children:e("notFound.body")}),c.jsx(vs,{to:"/",className:"nb-btn nb-btn-mint inline-flex",children:e("notFound.home")})]})}function TQ(){return c.jsx(SI,{children:c.jsxs(tR,{children:[c.jsxs(Sn,{element:c.jsx(bk,{contentMode:"workspace"}),children:[c.jsx(Sn,{index:!0,element:c.jsx(ZO,{to:"/projects",replace:!0})}),c.jsx(Sn,{path:"/projects",element:c.jsx(Lk,{})}),c.jsx(Sn,{path:"/projects/:name",element:c.jsx(Lk,{})}),c.jsx(Sn,{path:"/board",element:c.jsx(p5,{})}),c.jsx(Sn,{path:"/workers",element:c.jsx(A5,{})}),c.jsx(Sn,{path:"/prompts",element:c.jsx(J8,{})}),c.jsx(Sn,{path:"/chat",element:c.jsx(UE,{})}),c.jsx(Sn,{path:"/chat/:sessionId",element:c.jsx(UE,{})}),c.jsx(Sn,{path:"/arrange",element:c.jsx(CQ,{})})]}),c.jsxs(Sn,{element:c.jsx(bk,{contentMode:"document"}),children:[c.jsx(Sn,{path:"/projects/new",element:c.jsx(C2,{})}),c.jsx(Sn,{path:"/skills",element:c.jsx(V8,{})}),c.jsx(Sn,{path:"/system",element:c.jsx(rq,{})}),c.jsx(Sn,{path:"/processes",element:c.jsx(Mq,{})}),c.jsx(Sn,{path:"/audit",element:c.jsx(Lq,{})}),c.jsx(Sn,{path:"/memory",element:c.jsx(Fq,{})}),c.jsx(Sn,{path:"/plugins",element:c.jsx(Qq,{})}),c.jsx(Sn,{path:"*",element:c.jsx(AQ,{})})]})]})})}EI();Y3();const MQ=new FD({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}}),iT=document.getElementById("root");if(!iT)throw new Error("#root not found");yD.createRoot(iT).render(c.jsx(j.StrictMode,{children:c.jsx(K3,{children:c.jsx(qD,{client:MQ,children:c.jsx(_R,{children:c.jsx(RI,{children:c.jsx(TQ,{})})})})})}));
|
|
686
|
+
${e.at??""} [状态] ${t}`]})]})]})]})})}const vQ=j.memo(function({data:t}){const n=t;return c.jsxs("div",{className:"relative w-full h-full rounded-2xl border-2 border-dashed border-[var(--color-text)]",children:[c.jsx("div",{className:"absolute inset-0 rounded-2xl",style:{background:n.color,opacity:.16}}),c.jsx("span",{className:"absolute top-1.5 left-2.5 px-2 py-0.5 text-[11px] font-bold rounded-md border-2 border-[var(--color-text)] bg-[var(--color-bg)] text-[var(--color-text)] whitespace-nowrap max-w-[90%] truncate",children:n.label})]})}),wQ={card:bQ,laneBox:vQ},lv=260,tT=lv+36,kQ=200,EQ={todo:"var(--color-text-subtle)",doing:"var(--color-secondary-dark)",done:"var(--color-cta)",rework:"var(--color-secondary-dark)"};function _b(e,t,n){return e==="doing"&&t<n?"stuck":e}function SQ(e,t){const n=Math.floor(e/t),i=e%t;return{x:(n%2===0?i:t-1-i)*tT,y:n*kQ}}function NQ(e,t,n){const i=Math.floor(e/n),a=Math.floor(t/n);return i===a?i%2===0?{sourceHandle:"r-s",targetHandle:"l-t"}:{sourceHandle:"l-s",targetHandle:"r-t"}:{sourceHandle:"b-s",targetHandle:"t-t"}}function _Q(e){return e==="done"?{animated:!1,style:{stroke:"var(--color-cta)",strokeWidth:2.5}}:e==="doing"?{animated:!0,style:{stroke:"var(--color-secondary-dark)",strokeWidth:3}}:e==="stuck"?{animated:!1,style:{stroke:"var(--color-crashed)",strokeWidth:2.5,strokeDasharray:"6 4"}}:{animated:!1,style:{stroke:"var(--color-accent-yellow)",strokeWidth:2.5,strokeDasharray:"6 4"}}}const nT=158,rN=lv+60,aN=nT+28,sN=40;function jQ({cards:e,taskMeta:t,view:n,onSelect:i}){const a=j.useRef(null),[l,o]=j.useState(4),d=wh(),[f,p,g]=UW([]),[m,y]=FW([]),b=j.useRef("");return j.useEffect(()=>{const k=a.current;if(!k)return;const v=new ResizeObserver(S=>{var C;const E=((C=S[0])==null?void 0:C.contentRect.width)??800;o(Math.max(1,Math.min(8,Math.floor((E-40)/tT))))});return v.observe(k),()=>v.disconnect()},[]),j.useEffect(()=>{const k=[...e].sort((M,O)=>M.seq-O.seq),v=`${n}:${l}:${k.length}`,S=b.current!==v;b.current=v;const E=new Map,C=(M,O)=>{var R;if(n==="lane"){const B=((R=t.get(M.taskId))==null?void 0:R.order)??0,U=E.get(M.taskId)??0;return E.set(M.taskId,U+1),{x:B*rN,y:U*aN}}return SQ(O,l)},N=[];if(n==="lane"){const M=new Map;for(const O of k)M.set(O.taskId,(M.get(O.taskId)??0)+1);for(const[O,R]of M){const B=t.get(O),U=(B==null?void 0:B.order)??0;N.push({id:`lane-${O}`,type:"laneBox",position:{x:U*rN-16,y:-sN},data:{label:B!=null&&B.title?`T${O} · ${B.title}`:`T${O}`,color:(B==null?void 0:B.color)??"var(--color-bg-cream)"},style:{width:lv+32,height:sN+(R-1)*aN+nT+14},draggable:!1,selectable:!1,zIndex:0})}}const _=k.length?k[k.length-1].seq:0;p(M=>{const O=new Map(M.map(B=>[B.id,B])),R=k.map((B,U)=>{const K=t.get(B.taskId),q={seq:B.seq,title:B.title,skills:B.skills??[],taskLabel:`T${B.taskId}`,status:_b(B.status,B.seq,_),color:(K==null?void 0:K.color)??"var(--color-bg-cream)"},Y=String(B.seq),D=O.get(Y),F=C(B,U);return{...D&&!S?{...D,data:q}:{id:Y,type:"card",position:F,data:q},zIndex:1}});return[...N,...R]});const T=[];for(let M=1;M<k.length;M++){const O=k[M-1],R=k[M];if(!O||!R)continue;const B=n==="lane"?O.taskId===R.taskId?{sourceHandle:"b-s",targetHandle:"t-t"}:{sourceHandle:"r-s",targetHandle:"l-t"}:NQ(M-1,M,l);T.push({id:`e${O.seq}-${R.seq}`,source:String(O.seq),target:String(R.seq),...B,..._Q(_b(R.status,R.seq,_))})}y(T),S&&requestAnimationFrame(()=>d.fitView({padding:.2,maxZoom:1.1,duration:300}))},[e,l,t,n,p,y,d]),c.jsx("div",{ref:a,className:"w-full h-full",children:c.jsxs($W,{nodes:f,edges:m,onNodesChange:g,nodeTypes:wQ,onNodeClick:(k,v)=>i(Number(v.id)),fitView:!0,fitViewOptions:{padding:.2,maxZoom:1.1},proOptions:{hideAttribution:!0},minZoom:.15,children:[c.jsx(VW,{variant:ha.Dots,gap:20,size:1.5,color:"var(--color-border-light)"}),c.jsx(eQ,{showInteractive:!1})]})})}function CQ(){var U,K,q;const e=Pe(),t=Ft(),{alert:n}=un(),a=(((U=Ve({queryKey:["projects"],queryFn:Es,refetchInterval:3e3}).data)==null?void 0:U.data)??[]).filter(Y=>Y.pipelineMode==="smartArrange"),l=a.map(Y=>Y.name),[o,d]=j.useState(()=>localStorage.getItem("arrange.project")??""),f=o&&l.includes(o)?o:l[0]??"";j.useEffect(()=>{o&&localStorage.setItem("arrange.project",o)},[o]);const p=a.find(Y=>Y.name===f),g=(p==null?void 0:p.pipelineStatus)==="running",m=Ve({queryKey:["smartarrange",f],queryFn:()=>gQ(f),enabled:!!f,refetchInterval:3e3}),y=Et({mutationFn:()=>yQ(f),onSuccess:()=>t.invalidateQueries({queryKey:["smartarrange",f]}),onError:Y=>void n({title:e("arrange.approveErr"),body:Y instanceof Error?Y.message:String(Y)})}),b=Et({mutationFn:()=>A2(f),onSuccess:()=>t.invalidateQueries({queryKey:["projects"]}),onError:Y=>void n({title:e("arrange.startErr"),body:Y instanceof Error?Y.message:String(Y)})}),k=Et({mutationFn:()=>T2(f),onSuccess:()=>t.invalidateQueries({queryKey:["projects"]}),onError:Y=>void n({title:e("arrange.startErr"),body:Y instanceof Error?Y.message:String(Y)})}),v=(K=m.data)==null?void 0:K.plan,S=j.useMemo(()=>{var Y;return((Y=m.data)==null?void 0:Y.cards)??[]},[(q=m.data)==null?void 0:q.cards]),[E,C]=j.useState(()=>localStorage.getItem("arrange.view")==="lane"?"lane":"free");j.useEffect(()=>{localStorage.setItem("arrange.view",E)},[E]);const N=j.useMemo(()=>{const Y=new Map;return((v==null?void 0:v.tasks)??[]).forEach((D,F)=>Y.set(D.id,{order:F,status:D.status,color:iN(D.id,F),title:D.title})),Y},[v==null?void 0:v.tasks]),[_,T]=j.useState(()=>localStorage.getItem("arrange.panel")!=="0");j.useEffect(()=>{localStorage.setItem("arrange.panel",_?"1":"0")},[_]);const[M,O]=j.useState(null),R=j.useMemo(()=>S.find(Y=>Y.seq===M),[S,M]),B=S.length?Math.max(...S.map(Y=>Y.seq)):0;return c.jsxs("div",{className:"flex flex-col gap-4 h-full min-h-0",children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 flex-wrap shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-3xl font-bold",children:e("arrange.h1")}),f&&c.jsxs("div",{className:"flex items-center gap-2",children:[g?c.jsxs("button",{className:"nb-btn nb-btn-yellow",style:{padding:"6px 12px",fontSize:12},onClick:()=>k.mutate(),disabled:k.isPending,type:"button","aria-label":e("arrange.stop"),children:[k.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(Hb,{size:12,strokeWidth:3}),e("arrange.stop")]}):c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>b.mutate(),disabled:b.isPending,type:"button","aria-label":e("arrange.start"),children:[b.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(Qu,{size:12,strokeWidth:3}),e("arrange.start")]}),v&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"nb-status",style:{background:"var(--color-bg-cream)",color:"var(--color-text)"},children:v.status}),c.jsxs("span",{className:"text-sm text-[var(--color-text-muted)]",children:["round ",v.round,"/",v.maxRounds]}),v.status==="awaiting-approval"&&c.jsxs("button",{className:"nb-btn nb-btn-primary",style:{padding:"6px 12px",fontSize:12},onClick:()=>y.mutate(),disabled:y.isPending,type:"button","aria-label":e("arrange.approve"),children:[y.isPending?c.jsx(Xe,{size:12,strokeWidth:3,className:"animate-spin"}):c.jsx(mp,{size:12,strokeWidth:2.5}),e("arrange.approve")]})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[v&&c.jsxs("button",{className:"nb-btn",style:{padding:"6px 10px",fontSize:12},onClick:()=>C(E==="free"?"lane":"free"),type:"button","aria-label":e("arrange.view"),children:[E==="lane"?c.jsx(p3,{size:14,strokeWidth:2.5}):c.jsx(r_,{size:14,strokeWidth:2.5}),e(E==="lane"?"arrange.viewLane":"arrange.viewFree")]}),c.jsxs("select",{className:"nb-input",style:{maxWidth:240},value:f,onChange:Y=>d(Y.target.value),"aria-label":e("arrange.project"),children:[l.length===0&&c.jsx("option",{value:"",children:"—"}),l.map(Y=>c.jsx("option",{value:Y,children:Y},Y))]})]})]}),v?c.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[c.jsxs("div",{className:"relative flex-1 min-h-0 rounded-2xl border-[3px] border-[var(--color-text)] overflow-hidden bg-[var(--color-bg-soft)]",style:{boxShadow:"4px 4px 0 var(--color-text)"},children:[S.length===0?c.jsx("div",{className:"absolute inset-0 grid place-items-center p-6",children:v.status==="running"?c.jsxs("div",{className:"flex flex-col items-center gap-3 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:28,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-sm",children:e("arrange.orchestrating")})]}):c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm text-center max-w-sm",children:e("arrange.noCards")})}):c.jsx(QA,{children:c.jsx(jQ,{cards:S,taskMeta:N,view:E,onSelect:O})}),!_&&c.jsxs("button",{className:"nb-btn absolute right-3 top-3 z-10",style:{padding:"6px 10px",fontSize:12},onClick:()=>T(!0),type:"button","aria-label":e("arrange.expand"),children:[c.jsx(Jo,{size:14,strokeWidth:3,className:"rotate-180"}),e("arrange.tasks")]})]}),_&&c.jsxs("aside",{className:"w-72 shrink-0 nb-card overflow-hidden flex flex-col gap-2 min-h-0",style:{padding:12},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"font-[family-name:var(--font-heading)] text-lg font-bold",children:e("arrange.tasks")}),c.jsx("button",{className:"nb-btn",style:{padding:"2px 6px"},onClick:()=>T(!1),type:"button","aria-label":e("arrange.collapse"),children:c.jsx(ZL,{size:14,strokeWidth:2.5})})]}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:v.tasks.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-10 text-[var(--color-text-muted)]",children:[c.jsx(Xe,{size:22,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-xs text-center",children:e("arrange.planning")})]}):c.jsx("ul",{className:"flex flex-col gap-2",children:v.tasks.map((Y,D)=>c.jsxs("li",{className:"rounded-lg border-2 border-[var(--color-text)] p-2",style:{background:iN(Y.id,D)},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2.5 h-2.5 rounded-full inline-block shrink-0 border border-[var(--color-text)]",style:{background:EQ[Y.status]??"gray"}}),c.jsxs("span",{className:"font-bold text-xs text-[var(--color-text)]",children:["T",Y.id]}),c.jsxs("span",{className:"text-[11px] ml-auto font-[family-name:var(--font-mono)] text-[var(--color-text)]",children:[Y.cardSeqs.length," ",e("arrange.cardsCount")]})]}),c.jsx("p",{className:"text-xs text-[var(--color-text)] mt-1 leading-snug",children:Y.title})]},Y.id))})})]})]}):c.jsx("section",{className:"nb-card",children:g?c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Xe,{size:18,strokeWidth:3,className:"animate-spin"}),c.jsx("p",{className:"text-sm font-bold",children:e("arrange.starting")})]}):c.jsx("p",{className:"text-[var(--color-text-muted)] text-sm",children:e("arrange.none")})}),R&&c.jsx(xQ,{card:R,status:_b(R.status,R.seq,B),onClose:()=>O(null)})]})}function AQ(){const e=Pe();return c.jsxs("div",{className:"nb-card max-w-2xl mt-12",children:[c.jsx("h1",{className:"font-[family-name:var(--font-heading)] text-4xl font-bold mb-2",children:e("notFound.title")}),c.jsx("p",{className:"text-[var(--color-text-muted)] mb-6",children:e("notFound.body")}),c.jsx(vs,{to:"/",className:"nb-btn nb-btn-mint inline-flex",children:e("notFound.home")})]})}function TQ(){return c.jsx(SI,{children:c.jsxs(tR,{children:[c.jsxs(Sn,{element:c.jsx(bk,{contentMode:"workspace"}),children:[c.jsx(Sn,{index:!0,element:c.jsx(ZO,{to:"/projects",replace:!0})}),c.jsx(Sn,{path:"/projects",element:c.jsx(Lk,{})}),c.jsx(Sn,{path:"/projects/:name",element:c.jsx(Lk,{})}),c.jsx(Sn,{path:"/board",element:c.jsx(pP,{})}),c.jsx(Sn,{path:"/workers",element:c.jsx(AP,{})}),c.jsx(Sn,{path:"/prompts",element:c.jsx(J8,{})}),c.jsx(Sn,{path:"/chat",element:c.jsx(UE,{})}),c.jsx(Sn,{path:"/chat/:sessionId",element:c.jsx(UE,{})}),c.jsx(Sn,{path:"/arrange",element:c.jsx(CQ,{})})]}),c.jsxs(Sn,{element:c.jsx(bk,{contentMode:"document"}),children:[c.jsx(Sn,{path:"/projects/new",element:c.jsx(C2,{})}),c.jsx(Sn,{path:"/skills",element:c.jsx(V8,{})}),c.jsx(Sn,{path:"/system",element:c.jsx(rq,{})}),c.jsx(Sn,{path:"/processes",element:c.jsx(Mq,{})}),c.jsx(Sn,{path:"/audit",element:c.jsx(Lq,{})}),c.jsx(Sn,{path:"/memory",element:c.jsx(Fq,{})}),c.jsx(Sn,{path:"/plugins",element:c.jsx(Qq,{})}),c.jsx(Sn,{path:"*",element:c.jsx(AQ,{})})]})]})})}EI();Y3();const MQ=new FD({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}}),iT=document.getElementById("root");if(!iT)throw new Error("#root not found");yD.createRoot(iT).render(c.jsx(j.StrictMode,{children:c.jsx(K3,{children:c.jsx(qD,{client:MQ,children:c.jsx(_R,{children:c.jsx(RI,{children:c.jsx(TQ,{})})})})})}));
|