@kw-yeh/vibeflow 4.3.0 → 4.4.0

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/vibeflow.mjs CHANGED
@@ -280,7 +280,7 @@ var init_session_backend = __esm({
280
280
  });
281
281
 
282
282
  // packages/core/src/tmux-backend.ts
283
- import { execFile as execFile2, execFileSync as execFileSync2 } from "child_process";
283
+ import { execFile as execFile3, execFileSync as execFileSync2 } from "child_process";
284
284
  import fs3 from "fs";
285
285
  import path7 from "path";
286
286
  import * as nodePty2 from "node-pty";
@@ -289,7 +289,7 @@ function q(value) {
289
289
  }
290
290
  function defaultRun(env) {
291
291
  return (args) => new Promise((resolve) => {
292
- execFile2("tmux", args, { env }, (err, stdout) => {
292
+ execFile3("tmux", args, { env }, (err, stdout) => {
293
293
  const code2 = err ? typeof err.code === "number" ? err.code : 1 : 0;
294
294
  resolve({ code: code2, stdout: String(stdout ?? "") });
295
295
  });
@@ -1503,7 +1503,103 @@ function releaseLock(userDataDir) {
1503
1503
  }
1504
1504
 
1505
1505
  // packages/core/src/platform.ts
1506
+ import { execFile as execFile2 } from "child_process";
1507
+
1508
+ // packages/core/src/folder-dialog.ts
1506
1509
  import { execFile } from "child_process";
1510
+ var MAC_SCRIPT = [
1511
+ "on run argv",
1512
+ "activate",
1513
+ "if (count of argv) > 1 then",
1514
+ "return POSIX path of (choose folder with prompt (item 1 of argv) default location (POSIX file (item 2 of argv)))",
1515
+ "end if",
1516
+ "return POSIX path of (choose folder with prompt (item 1 of argv))",
1517
+ "end run"
1518
+ ];
1519
+ var WINDOWS_SCRIPT = [
1520
+ "[Console]::OutputEncoding = [Text.Encoding]::UTF8",
1521
+ "Add-Type -AssemblyName System.Windows.Forms",
1522
+ "$owner = New-Object System.Windows.Forms.Form -Property @{ TopMost = $true }",
1523
+ "$dialog = New-Object System.Windows.Forms.FolderBrowserDialog",
1524
+ "$dialog.Description = $env:VIBEFLOW_DIALOG_TITLE",
1525
+ "$dialog.ShowNewFolderButton = $true",
1526
+ "if ($env:VIBEFLOW_DIALOG_PATH) { $dialog.SelectedPath = $env:VIBEFLOW_DIALOG_PATH }",
1527
+ "if ($dialog.ShowDialog($owner) -eq [System.Windows.Forms.DialogResult]::OK) { $dialog.SelectedPath }"
1528
+ ].join("; ");
1529
+ function folderDialogCommands(platform, { title = "\u9078\u64C7\u8CC7\u6599\u593E", defaultPath } = {}) {
1530
+ if (platform === "darwin") {
1531
+ return [
1532
+ {
1533
+ cmd: "osascript",
1534
+ args: [...MAC_SCRIPT.flatMap((line) => ["-e", line]), title, ...defaultPath ? [defaultPath] : []],
1535
+ // osascript exits 1 on any script error; only -128 is "User canceled".
1536
+ cancelCodes: [1],
1537
+ cancelStderr: /-128/
1538
+ }
1539
+ ];
1540
+ }
1541
+ if (platform === "win32") {
1542
+ return [
1543
+ {
1544
+ cmd: "powershell.exe",
1545
+ args: ["-NoProfile", "-NonInteractive", "-STA", "-Command", WINDOWS_SCRIPT],
1546
+ env: { VIBEFLOW_DIALOG_TITLE: title, VIBEFLOW_DIALOG_PATH: defaultPath ?? "" },
1547
+ cancelCodes: []
1548
+ }
1549
+ ];
1550
+ }
1551
+ const start = defaultPath ? `${defaultPath.replace(/\/+$/, "")}/` : void 0;
1552
+ return [
1553
+ {
1554
+ cmd: "zenity",
1555
+ args: ["--file-selection", "--directory", `--title=${title}`, ...start ? [`--filename=${start}`] : []],
1556
+ cancelCodes: [1]
1557
+ },
1558
+ {
1559
+ cmd: "kdialog",
1560
+ args: ["--getexistingdirectory", defaultPath ?? ".", "--title", title],
1561
+ cancelCodes: [1]
1562
+ }
1563
+ ];
1564
+ }
1565
+ function parseFolderDialogOutput(stdout) {
1566
+ const line = stdout.trim();
1567
+ if (!line) return null;
1568
+ if (line === "/" || /^[A-Za-z]:[\\/]$/.test(line)) return line;
1569
+ return line.replace(/[\\/]+$/, "");
1570
+ }
1571
+ function run(command) {
1572
+ return new Promise((resolve, reject) => {
1573
+ execFile(
1574
+ command.cmd,
1575
+ command.args,
1576
+ { windowsHide: false, encoding: "utf8", env: { ...process.env, ...command.env } },
1577
+ (err, stdout, stderr) => {
1578
+ if (err) {
1579
+ const code2 = err.code;
1580
+ if (code2 === "ENOENT") return resolve("missing");
1581
+ const canceled = typeof code2 === "number" && command.cancelCodes.includes(code2) && (!command.cancelStderr || command.cancelStderr.test(stderr));
1582
+ if (canceled) return resolve({ canceled: true });
1583
+ return reject(new Error(`\u7121\u6CD5\u958B\u555F\u8CC7\u6599\u593E\u9078\u64C7\u8996\u7A97\uFF1A${stderr.trim() || err.message}`));
1584
+ }
1585
+ const picked = parseFolderDialogOutput(stdout);
1586
+ resolve(picked ? { path: picked } : { canceled: true });
1587
+ }
1588
+ );
1589
+ });
1590
+ }
1591
+ async function pickFolderWithOs(options = {}) {
1592
+ if (process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY) {
1593
+ return { unsupported: true };
1594
+ }
1595
+ for (const command of folderDialogCommands(process.platform, options)) {
1596
+ const result = await run(command);
1597
+ if (result !== "missing") return result;
1598
+ }
1599
+ return { unsupported: true };
1600
+ }
1601
+
1602
+ // packages/core/src/platform.ts
1507
1603
  import { homedir } from "os";
1508
1604
  import path2 from "path";
1509
1605
  var _platform = null;
@@ -1533,7 +1629,7 @@ function openCommand(target) {
1533
1629
  function openWithOs(target) {
1534
1630
  const [cmd, args] = openCommand(target);
1535
1631
  return new Promise((resolve) => {
1536
- execFile(cmd, args, { windowsHide: true }, (err) => resolve(err ? err.message : ""));
1632
+ execFile2(cmd, args, { windowsHide: true }, (err) => resolve(err ? err.message : ""));
1537
1633
  });
1538
1634
  }
1539
1635
  function createNodePlatform(options = {}) {
@@ -1553,7 +1649,8 @@ function createNodePlatform(options = {}) {
1553
1649
  const err = await openWithOs(url);
1554
1650
  if (err) throw new Error(err);
1555
1651
  },
1556
- openPath: (target) => openWithOs(target)
1652
+ openPath: (target) => openWithOs(target),
1653
+ pickFolder: (opts) => pickFolderWithOs(opts)
1557
1654
  };
1558
1655
  }
1559
1656
 
@@ -1857,6 +1954,8 @@ function createBridge(t) {
1857
1954
  getGithubCompareUrl: (taskId) => t.invoke("git:getGithubCompareUrl", taskId),
1858
1955
  /** Open a URL in the system default browser. */
1859
1956
  openExternal: (url) => t.invoke("shell:openExternal", url),
1957
+ /** The OS folder dialog, shown on the machine core runs on. */
1958
+ pickFolder: (options) => t.invoke("dialog:pickFolder", options),
1860
1959
  cleanupTask: (taskId) => t.invoke("vibeflow:cleanupTask", taskId),
1861
1960
  /** Live sub-agent updates pushed from main while a session runs. */
1862
1961
  onSubAgentsUpdate: (callback) => {
@@ -2096,7 +2195,7 @@ async function generateBranchName(title, description) {
2096
2195
  }
2097
2196
 
2098
2197
  // packages/core/src/git.ts
2099
- import { execFile as execFile3 } from "child_process";
2198
+ import { execFile as execFile4 } from "child_process";
2100
2199
  import { promisify } from "util";
2101
2200
  import path12 from "path";
2102
2201
  import fs8 from "fs/promises";
@@ -2417,7 +2516,7 @@ function deleteArtifacts(baseDir, worktreePath) {
2417
2516
  }
2418
2517
 
2419
2518
  // packages/core/src/git.ts
2420
- var pexec = promisify(execFile3);
2519
+ var pexec = promisify(execFile4);
2421
2520
  async function git(cwd, args) {
2422
2521
  const { stdout } = await pexec("git", args, {
2423
2522
  cwd,
@@ -3223,9 +3322,9 @@ function taskAttachmentStagingPath(workspacePath, taskId) {
3223
3322
 
3224
3323
  // packages/core/src/agents.ts
3225
3324
  init_env();
3226
- import { execFile as execFile4 } from "child_process";
3325
+ import { execFile as execFile5 } from "child_process";
3227
3326
  import { promisify as promisify2 } from "util";
3228
- var pexec2 = promisify2(execFile4);
3327
+ var pexec2 = promisify2(execFile5);
3229
3328
  var AGENT_EFFORTS = ["low", "medium", "high", "xhigh"];
3230
3329
  var DEFAULT_TASK_EFFORT = "medium";
3231
3330
  var AGENT_CLIS = [
@@ -4159,13 +4258,13 @@ import path20 from "path";
4159
4258
  import { randomUUID as randomUUID4 } from "crypto";
4160
4259
 
4161
4260
  // packages/core/src/agent-models.ts
4162
- import { execFile as execFile5 } from "child_process";
4261
+ import { execFile as execFile6 } from "child_process";
4163
4262
  import fs12 from "fs";
4164
4263
  import os4 from "os";
4165
4264
  import path16 from "path";
4166
4265
  import { promisify as promisify3 } from "util";
4167
4266
  init_env();
4168
- var pexec3 = promisify3(execFile5);
4267
+ var pexec3 = promisify3(execFile6);
4169
4268
  var CODEX_MODELS_TIMEOUT_MS = 2e4;
4170
4269
  function builtinModels(id) {
4171
4270
  return (AGENT_CLIS.find((a) => a.id === id) ?? AGENT_CLIS[0]).models;
@@ -4232,10 +4331,10 @@ async function listAgentModels(id, opts = {}) {
4232
4331
 
4233
4332
  // packages/core/src/github-auth.ts
4234
4333
  init_env();
4235
- import { execFile as execFile6 } from "child_process";
4334
+ import { execFile as execFile7 } from "child_process";
4236
4335
  import { promisify as promisify4 } from "util";
4237
4336
  import * as nodePty3 from "node-pty";
4238
- var pexec4 = promisify4(execFile6);
4337
+ var pexec4 = promisify4(execFile7);
4239
4338
  var GITHUB_HOST = "github.com";
4240
4339
  var DEVICE_URL = "https://github.com/login/device";
4241
4340
  var activeLogin = null;
@@ -5049,7 +5148,7 @@ function createCore({ sessions, bus, version }) {
5049
5148
  if (task.worktreePath) return Promise.resolve(task);
5050
5149
  const pending = provisioning.get(task.id);
5051
5150
  if (pending) return pending;
5052
- const run2 = (async () => {
5151
+ const run3 = (async () => {
5053
5152
  try {
5054
5153
  updateTask(task.id, { ...await provisionTaskWorktree(task), launchError: void 0 });
5055
5154
  bus.emit("state:changed", getState());
@@ -5061,8 +5160,8 @@ function createCore({ sessions, bus, version }) {
5061
5160
  if (!provisioned) throw new Error("\u627E\u4E0D\u5230\u8981\u57F7\u884C\u7684\u4EFB\u52D9");
5062
5161
  return provisioned;
5063
5162
  })().finally(() => provisioning.delete(task.id));
5064
- provisioning.set(task.id, run2);
5065
- return run2;
5163
+ provisioning.set(task.id, run3);
5164
+ return run3;
5066
5165
  }
5067
5166
  function returnUnstarted(taskId, launchError) {
5068
5167
  const current = findTask(taskId);
@@ -5079,6 +5178,7 @@ function createCore({ sessions, bus, version }) {
5079
5178
  setBoard(next);
5080
5179
  bus.emit("state:changed", getState());
5081
5180
  }
5181
+ let folderDialog = null;
5082
5182
  const handlers = {
5083
5183
  "vibeflow:getState": () => getState(),
5084
5184
  "app:getVersion": () => version,
@@ -5419,6 +5519,19 @@ function createCore({ sessions, bus, version }) {
5419
5519
  if (!task.worktreePath) return null;
5420
5520
  return getGithubCompareUrl(task.worktreePath, task.baseBranch ?? "main");
5421
5521
  },
5522
+ // One dialog at a time: a second click while it is open joins it instead
5523
+ // of stacking another window on the host.
5524
+ "dialog:pickFolder": (options) => {
5525
+ const o = options === void 0 || options === null ? {} : obj(options, "options");
5526
+ const title = o.title === void 0 ? void 0 : str(o.title, "title");
5527
+ const defaultPath = o.defaultPath === void 0 ? void 0 : str(o.defaultPath, "defaultPath");
5528
+ const pick = getPlatform().pickFolder;
5529
+ if (!pick) return { unsupported: true };
5530
+ folderDialog ??= pick({ title, defaultPath: defaultPath || void 0 }).finally(() => {
5531
+ folderDialog = null;
5532
+ });
5533
+ return folderDialog;
5534
+ },
5422
5535
  "shell:openExternal": (url) => {
5423
5536
  const u = str(url, "url");
5424
5537
  if (!/^https?:\/\//i.test(u)) invalid("only http(s) URLs can be opened");
@@ -5966,12 +6079,12 @@ function connectToHost(lock) {
5966
6079
  // packages/cli/src/doctor.ts
5967
6080
  import fs19 from "fs";
5968
6081
  import path23 from "path";
5969
- import { execFile as execFile7 } from "child_process";
6082
+ import { execFile as execFile8 } from "child_process";
5970
6083
  import { promisify as promisify5 } from "util";
5971
6084
  init_env();
5972
6085
  init_git_bash();
5973
6086
  init_tmux_backend();
5974
- var pexec5 = promisify5(execFile7);
6087
+ var pexec5 = promisify5(execFile8);
5975
6088
  function parseVersion(text) {
5976
6089
  const m = /(\d+)\.(\d+)(?:\.(\d+))?/.exec(text);
5977
6090
  return m ? [Number(m[1]), Number(m[2]), Number(m[3] ?? 0)] : [];
@@ -5983,7 +6096,7 @@ function versionAtLeast(have, want) {
5983
6096
  }
5984
6097
  return true;
5985
6098
  }
5986
- async function run(cmd, args) {
6099
+ async function run2(cmd, args) {
5987
6100
  try {
5988
6101
  const { stdout } = await pexec5(cmd, args, { env: execEnv(), timeout: 1e4, windowsHide: true });
5989
6102
  return String(stdout).trim();
@@ -6043,7 +6156,7 @@ async function runDoctor(options) {
6043
6156
  checks.push(
6044
6157
  versionAtLeast(nodeVersion, [22, 0]) ? { id: "node", name: "Node.js", level: "ok", detail: `v${process.versions.node}` } : { id: "node", name: "Node.js", level: "fail", detail: `v${process.versions.node}\uFF0C\u9700\u8981 22 \u4EE5\u4E0A`, fix: installHint("node") }
6045
6158
  );
6046
- const git2 = await run("git", ["--version"]);
6159
+ const git2 = await run2("git", ["--version"]);
6047
6160
  if (!git2) {
6048
6161
  checks.push({ id: "git", name: "Git", level: "fail", detail: "PATH \u4E2D\u627E\u4E0D\u5230 git", fix: installHint("git") });
6049
6162
  } else {
@@ -6071,7 +6184,7 @@ async function runDoctor(options) {
6071
6184
  fix: "\u8981\u8B93\u4EFB\u52D9\u5728\u80CC\u666F\u6301\u7E8C\u57F7\u884C\uFF0C\u8ACB\u5728 WSL \u5167\u4F7F\u7528 vibeflow"
6072
6185
  });
6073
6186
  } else {
6074
- const tmux = await run("tmux", ["-V"]);
6187
+ const tmux = await run2("tmux", ["-V"]);
6075
6188
  checks.push(
6076
6189
  tmux && hasTmux() ? { id: "tmux", name: "tmux", level: "ok", detail: `${tmux}\uFF08\u4EFB\u52D9\u53EF\u5728\u80CC\u666F\u6301\u7E8C\u57F7\u884C\uFF09` } : {
6077
6190
  id: "tmux",
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-014e95fe86cd1d39.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_buildManifest.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"_pjqayPqD9pDyPeTbc6L2","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-2a4ae532bdcab6f2.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_buildManifest.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"WryXzkD7rqukLA95d06Zt","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
package/dist/web/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-014e95fe86cd1d39.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_buildManifest.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"_pjqayPqD9pDyPeTbc6L2","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-2a4ae532bdcab6f2.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_buildManifest.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"WryXzkD7rqukLA95d06Zt","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},__routerFilterDynamic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-8f65b0f8749f42d2.js"],"/home":["static/chunks/2524-abaf3a55023f6066.js","static/chunks/pages/home-1fb1d1a49d28f6dd.js"],sortedPages:["/_app","/_error","/home"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},__routerFilterDynamic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-8f65b0f8749f42d2.js"],"/home":["static/chunks/2524-abaf3a55023f6066.js","static/chunks/pages/home-3c2a73bbb48cf9a2.js"],sortedPages:["/_app","/_error","/home"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{4416:(e,t,r)=>{"use strict";r.d(t,{cn:()=>ef});var o=r(73367);let n=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),s=[],a=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let o=e[t],n=r.nextPart.get(o);if(n){let r=a(e,t+1,n);if(r)return r}let s=r.validators;if(null===s)return;let l=0===t?e.join("-"):e.slice(t).join("-"),i=s.length;for(let e=0;e<i;e++){let t=s[e];if(t.validator(l))return t.classGroupId}},l=(e,t)=>{let r=n();for(let o in e)i(e[o],r,o,t);return r},i=(e,t,r,o)=>{let n=e.length;for(let s=0;s<n;s++)c(e[s],t,r,o)},c=(e,t,r,o)=>{"string"==typeof e?d(e,t,r):"function"==typeof e?m(e,t,r,o):u(e,t,r,o)},d=(e,t,r)=>{(""===e?t:p(t,e)).classGroupId=r},m=(e,t,r,o)=>{b(e)?i(e(o),t,r,o):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},u=(e,t,r,o)=>{let n=Object.entries(e),s=n.length;for(let e=0;e<s;e++){let[s,a]=n[e];i(a,p(t,s),r,o)}},p=(e,t)=>{let r=e,o=t.split("-"),s=o.length;for(let e=0;e<s;e++){let t=o[e],s=r.nextPart.get(t);s||(s=n(),r.nextPart.set(t,s)),r=s}return r},b=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,f=[],g=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),h=/\s+/,k=e=>{let t;if("string"==typeof e)return e;let r="";for(let o=0;o<e.length;o++)e[o]&&(t=k(e[o]))&&(r&&(r+=" "),r+=t);return r},v=[],w=e=>{let t=t=>t[e]||v;return t.isThemeGetter=!0,t},x=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,y=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,S=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,j=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,E=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,L=e=>z.test(e),T=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),M=e=>e.endsWith("%")&&T(e.slice(0,-1)),N=e=>S.test(e),D=()=>!0,_=e=>j.test(e)&&!E.test(e),W=()=>!1,P=e=>C.test(e),I=e=>A.test(e),O=e=>!R(e)&&!X(e),B=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),$=e=>en(e,ei,W),R=e=>x.test(e),V=e=>en(e,ec,_),F=e=>en(e,ed,T),q=e=>en(e,eu,D),J=e=>en(e,em,W),U=e=>en(e,ea,W),H=e=>en(e,el,I),Q=e=>en(e,ep,P),X=e=>y.test(e),K=e=>es(e,ec),Y=e=>es(e,em),Z=e=>es(e,ea),ee=e=>es(e,ei),et=e=>es(e,el),er=e=>es(e,ep,!0),eo=e=>es(e,eu,!0),en=(e,t,r)=>{let o=x.exec(e);return!!o&&(o[1]?t(o[1]):r(o[2]))},es=(e,t,r=!1)=>{let o=y.exec(e);return!!o&&(o[1]?t(o[1]):r)},ea=e=>"position"===e||"percentage"===e,el=e=>"image"===e||"url"===e,ei=e=>"length"===e||"size"===e||"bg-size"===e,ec=e=>"length"===e,ed=e=>"number"===e,em=e=>"family-name"===e,eu=e=>"number"===e||"weight"===e,ep=e=>"shadow"===e,eb=((e,...t)=>{let r,o,n,i,c=e=>{let t=o(e);if(t)return t;let s=((e,t)=>{let{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s,postfixLookupClassGroupIds:a}=t,l=[],i=e.trim().split(h),c="";for(let e=i.length-1;e>=0;e-=1){let t,d=i[e],{isExternal:m,modifiers:u,hasImportantModifier:p,baseClassName:b,maybePostfixModifierPosition:f}=r(d);if(m){c=d+(c.length>0?" "+c:c);continue}let g=!!f;if(g){let e=(t=o(b.substring(0,f)))&&a[t]?o(b):void 0;e&&e!==t&&(t=e,g=!1)}else t=o(b);if(!t){if(!g||!(t=o(b))){c=d+(c.length>0?" "+c:c);continue}g=!1}let h=0===u.length?"":1===u.length?u[0]:s(u).join(":"),k=p?h+"!":h,v=k+t;if(l.indexOf(v)>-1)continue;l.push(v);let w=n(t,g);for(let e=0;e<w.length;++e){let t=w[e];l.push(k+t)}c=d+(c.length>0?" "+c:c)}return c})(e,r);return n(e,s),s};return i=d=>{var m;let u;return o=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null),n=(n,s)=>{r[n]=s,++t>e&&(t=0,o=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=o[e])?(n(e,t),t):void 0},set(e,t){e in r?r[e]=t:n(e,t)}}})((m=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,o=e=>{let t,r=[],o=0,n=0,s=0,a=e.length;for(let l=0;l<a;l++){let a=e[l];if(0===o&&0===n){if(":"===a){r.push(e.slice(s,l)),s=l+1;continue}if("/"===a){t=l;continue}}"["===a?o++:"]"===a?o--:"("===a?n++:")"===a&&n--}let l=0===r.length?e:e.slice(s),i=l,c=!1;return l.endsWith("!")?(i=l.slice(0,-1),c=!0):l.startsWith("!")&&(i=l.slice(1),c=!0),g(r,c,i,t&&t>s?t-s:void 0)};if(t){let e=t+":",r=o;o=t=>t.startsWith(e)?r(t.slice(e.length)):g(f,!1,t,void 0,!0)}if(r){let e=o;o=t=>r({className:t,parseClassName:e})}return o})(m),sortModifiers:(u=new Map,m.orderSensitiveModifiers.forEach((e,t)=>{u.set(e,1e6+t)}),e=>{let t=[],r=[];for(let o=0;o<e.length;o++){let n=e[o],s="["===n[0],a=u.has(n);s||a?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(n)):r.push(n)}return r.length>0&&(r.sort(),t.push(...r)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let e=0;e<r.length;e++)t[r[e]]=!0;return t})(m),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return l(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,o,n;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(o=(t=r.slice(1,-1)).indexOf(":"),(n=t.slice(0,o))?"arbitrary.."+n:void 0)}let o=e.split("-"),n=+(""===o[0]&&o.length>1);return a(o,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=o[e],n=r[e];if(t){if(n){let e=Array(n.length+t.length);for(let t=0;t<n.length;t++)e[t]=n[t];for(let r=0;r<t.length;r++)e[n.length+r]=t[r];return e}return t}return n||s}return r[e]||s}}})(m)}).cache.get,n=r.cache.set,i=c,c(d)},(...e)=>i(((...e)=>{let t,r,o=0,n="";for(;o<e.length;)(t=e[o++])&&(r=k(t))&&(n&&(n+=" "),n+=r);return n})(...e))})(()=>{let e=w("color"),t=w("font"),r=w("text"),o=w("font-weight"),n=w("tracking"),s=w("leading"),a=w("breakpoint"),l=w("container"),i=w("spacing"),c=w("radius"),d=w("shadow"),m=w("inset-shadow"),u=w("text-shadow"),p=w("drop-shadow"),b=w("blur"),f=w("perspective"),g=w("aspect"),h=w("ease"),k=w("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...x(),X,R],z=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],j=()=>[X,R,i],E=()=>[L,"full","auto",...j()],C=()=>[G,"none","subgrid",X,R],A=()=>["auto",{span:["full",G,X,R]},G,X,R],_=()=>[G,"auto",X,R],W=()=>["auto","min","max","fr",X,R],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],en=()=>["auto",...j()],es=()=>[L,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],ea=()=>[L,"screen","full","dvw","lvw","svw","min","max","fit",...j()],el=()=>[L,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],ei=()=>[e,X,R],ec=()=>[...x(),Z,U,{position:[X,R]}],ed=()=>["no-repeat",{repeat:["","x","y","space","round"]}],em=()=>["auto","cover","contain",ee,$,{size:[X,R]}],eu=()=>[M,K,V],ep=()=>["","none","full",c,X,R],eb=()=>["",T,K,V],ef=()=>["solid","dashed","dotted","double"],eg=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],eh=()=>[T,M,Z,U],ek=()=>["","none",b,X,R],ev=()=>["none",T,X,R],ew=()=>["none",T,X,R],ex=()=>[T,X,R],ey=()=>[L,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[N],breakpoint:[N],color:[D],container:[N],"drop-shadow":[N],ease:["in","out","in-out"],font:[O],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[N],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[N],shadow:[N],spacing:["px",T],text:[N],"text-shadow":[N],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",L,R,X,g]}],container:["container"],"container-type":[{"@container":["","normal","size",X,R]}],"container-named":[B],columns:[{columns:[T,R,X,l]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[G,"auto",X,R]}],basis:[{basis:[L,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[T,L,"auto","initial","none",R]}],grow:[{grow:["",T,X,R]}],shrink:[{shrink:["",T,X,R]}],order:[{order:[G,"first","last","none",X,R]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:en()}],mx:[{mx:en()}],my:[{my:en()}],ms:[{ms:en()}],me:[{me:en()}],mbs:[{mbs:en()}],mbe:[{mbe:en()}],mt:[{mt:en()}],mr:[{mr:en()}],mb:[{mb:en()}],ml:[{ml:en()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:es()}],"inline-size":[{inline:["auto",...ea()]}],"min-inline-size":[{"min-inline":["auto",...ea()]}],"max-inline-size":[{"max-inline":["none",...ea()]}],"block-size":[{block:["auto",...el()]}],"min-block-size":[{"min-block":["auto",...el()]}],"max-block-size":[{"max-block":["none",...el()]}],w:[{w:[l,"screen",...es()]}],"min-w":[{"min-w":[l,"screen","none",...es()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...es()]}],h:[{h:["screen","lh",...es()]}],"min-h":[{"min-h":["screen","lh","none",...es()]}],"max-h":[{"max-h":["screen","lh",...es()]}],"font-size":[{text:["base",r,K,V]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,eo,q]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",M,R]}],"font-family":[{font:[Y,J,t]}],"font-features":[{"font-features":[R]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,X,R]}],"line-clamp":[{"line-clamp":[T,"none",X,F]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",X,R]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",X,R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ei()}],"text-color":[{text:ei()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ef(),"wavy"]}],"text-decoration-thickness":[{decoration:[T,"from-font","auto",X,V]}],"text-decoration-color":[{decoration:ei()}],"underline-offset":[{"underline-offset":[T,"auto",X,R]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[G,X,R]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",X,R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X,R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ec()}],"bg-repeat":[{bg:ed()}],"bg-size":[{bg:em()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},G,X,R],radial:["",X,R],conic:[G,X,R]},et,H]}],"bg-color":[{bg:ei()}],"gradient-from-pos":[{from:eu()}],"gradient-via-pos":[{via:eu()}],"gradient-to-pos":[{to:eu()}],"gradient-from":[{from:ei()}],"gradient-via":[{via:ei()}],"gradient-to":[{to:ei()}],rounded:[{rounded:ep()}],"rounded-s":[{"rounded-s":ep()}],"rounded-e":[{"rounded-e":ep()}],"rounded-t":[{"rounded-t":ep()}],"rounded-r":[{"rounded-r":ep()}],"rounded-b":[{"rounded-b":ep()}],"rounded-l":[{"rounded-l":ep()}],"rounded-ss":[{"rounded-ss":ep()}],"rounded-se":[{"rounded-se":ep()}],"rounded-ee":[{"rounded-ee":ep()}],"rounded-es":[{"rounded-es":ep()}],"rounded-tl":[{"rounded-tl":ep()}],"rounded-tr":[{"rounded-tr":ep()}],"rounded-br":[{"rounded-br":ep()}],"rounded-bl":[{"rounded-bl":ep()}],"border-w":[{border:eb()}],"border-w-x":[{"border-x":eb()}],"border-w-y":[{"border-y":eb()}],"border-w-s":[{"border-s":eb()}],"border-w-e":[{"border-e":eb()}],"border-w-bs":[{"border-bs":eb()}],"border-w-be":[{"border-be":eb()}],"border-w-t":[{"border-t":eb()}],"border-w-r":[{"border-r":eb()}],"border-w-b":[{"border-b":eb()}],"border-w-l":[{"border-l":eb()}],"divide-x":[{"divide-x":eb()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":eb()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ef(),"hidden","none"]}],"divide-style":[{divide:[...ef(),"hidden","none"]}],"border-color":[{border:ei()}],"border-color-x":[{"border-x":ei()}],"border-color-y":[{"border-y":ei()}],"border-color-s":[{"border-s":ei()}],"border-color-e":[{"border-e":ei()}],"border-color-bs":[{"border-bs":ei()}],"border-color-be":[{"border-be":ei()}],"border-color-t":[{"border-t":ei()}],"border-color-r":[{"border-r":ei()}],"border-color-b":[{"border-b":ei()}],"border-color-l":[{"border-l":ei()}],"divide-color":[{divide:ei()}],"outline-style":[{outline:[...ef(),"none","hidden"]}],"outline-offset":[{"outline-offset":[T,X,R]}],"outline-w":[{outline:["",T,K,V]}],"outline-color":[{outline:ei()}],shadow:[{shadow:["","none",d,er,Q]}],"shadow-color":[{shadow:ei()}],"inset-shadow":[{"inset-shadow":["none",m,er,Q]}],"inset-shadow-color":[{"inset-shadow":ei()}],"ring-w":[{ring:eb()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ei()}],"ring-offset-w":[{"ring-offset":[T,V]}],"ring-offset-color":[{"ring-offset":ei()}],"inset-ring-w":[{"inset-ring":eb()}],"inset-ring-color":[{"inset-ring":ei()}],"text-shadow":[{"text-shadow":["none",u,er,Q]}],"text-shadow-color":[{"text-shadow":ei()}],opacity:[{opacity:[T,X,R]}],"mix-blend":[{"mix-blend":[...eg(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":eg()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[T]}],"mask-image-linear-from-pos":[{"mask-linear-from":eh()}],"mask-image-linear-to-pos":[{"mask-linear-to":eh()}],"mask-image-linear-from-color":[{"mask-linear-from":ei()}],"mask-image-linear-to-color":[{"mask-linear-to":ei()}],"mask-image-t-from-pos":[{"mask-t-from":eh()}],"mask-image-t-to-pos":[{"mask-t-to":eh()}],"mask-image-t-from-color":[{"mask-t-from":ei()}],"mask-image-t-to-color":[{"mask-t-to":ei()}],"mask-image-r-from-pos":[{"mask-r-from":eh()}],"mask-image-r-to-pos":[{"mask-r-to":eh()}],"mask-image-r-from-color":[{"mask-r-from":ei()}],"mask-image-r-to-color":[{"mask-r-to":ei()}],"mask-image-b-from-pos":[{"mask-b-from":eh()}],"mask-image-b-to-pos":[{"mask-b-to":eh()}],"mask-image-b-from-color":[{"mask-b-from":ei()}],"mask-image-b-to-color":[{"mask-b-to":ei()}],"mask-image-l-from-pos":[{"mask-l-from":eh()}],"mask-image-l-to-pos":[{"mask-l-to":eh()}],"mask-image-l-from-color":[{"mask-l-from":ei()}],"mask-image-l-to-color":[{"mask-l-to":ei()}],"mask-image-x-from-pos":[{"mask-x-from":eh()}],"mask-image-x-to-pos":[{"mask-x-to":eh()}],"mask-image-x-from-color":[{"mask-x-from":ei()}],"mask-image-x-to-color":[{"mask-x-to":ei()}],"mask-image-y-from-pos":[{"mask-y-from":eh()}],"mask-image-y-to-pos":[{"mask-y-to":eh()}],"mask-image-y-from-color":[{"mask-y-from":ei()}],"mask-image-y-to-color":[{"mask-y-to":ei()}],"mask-image-radial":[{"mask-radial":[X,R]}],"mask-image-radial-from-pos":[{"mask-radial-from":eh()}],"mask-image-radial-to-pos":[{"mask-radial-to":eh()}],"mask-image-radial-from-color":[{"mask-radial-from":ei()}],"mask-image-radial-to-color":[{"mask-radial-to":ei()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[T]}],"mask-image-conic-from-pos":[{"mask-conic-from":eh()}],"mask-image-conic-to-pos":[{"mask-conic-to":eh()}],"mask-image-conic-from-color":[{"mask-conic-from":ei()}],"mask-image-conic-to-color":[{"mask-conic-to":ei()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ec()}],"mask-repeat":[{mask:ed()}],"mask-size":[{mask:em()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",X,R]}],filter:[{filter:["","none",X,R]}],blur:[{blur:ek()}],brightness:[{brightness:[T,X,R]}],contrast:[{contrast:[T,X,R]}],"drop-shadow":[{"drop-shadow":["","none",p,er,Q]}],"drop-shadow-color":[{"drop-shadow":ei()}],grayscale:[{grayscale:["",T,X,R]}],"hue-rotate":[{"hue-rotate":[T,X,R]}],invert:[{invert:["",T,X,R]}],saturate:[{saturate:[T,X,R]}],sepia:[{sepia:["",T,X,R]}],"backdrop-filter":[{"backdrop-filter":["","none",X,R]}],"backdrop-blur":[{"backdrop-blur":ek()}],"backdrop-brightness":[{"backdrop-brightness":[T,X,R]}],"backdrop-contrast":[{"backdrop-contrast":[T,X,R]}],"backdrop-grayscale":[{"backdrop-grayscale":["",T,X,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[T,X,R]}],"backdrop-invert":[{"backdrop-invert":["",T,X,R]}],"backdrop-opacity":[{"backdrop-opacity":[T,X,R]}],"backdrop-saturate":[{"backdrop-saturate":[T,X,R]}],"backdrop-sepia":[{"backdrop-sepia":["",T,X,R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",X,R]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[T,"initial",X,R]}],ease:[{ease:["linear","initial",h,X,R]}],delay:[{delay:[T,X,R]}],animate:[{animate:["none",k,X,R]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,X,R]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:ev()}],"rotate-x":[{"rotate-x":ev()}],"rotate-y":[{"rotate-y":ev()}],"rotate-z":[{"rotate-z":ev()}],scale:[{scale:ew()}],"scale-x":[{"scale-x":ew()}],"scale-y":[{"scale-y":ew()}],"scale-z":[{"scale-z":ew()}],"scale-3d":["scale-3d"],skew:[{skew:ex()}],"skew-x":[{"skew-x":ex()}],"skew-y":[{"skew-y":ex()}],transform:[{transform:[X,R,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ey()}],"translate-x":[{"translate-x":ey()}],"translate-y":[{"translate-y":ey()}],"translate-z":[{"translate-z":ey()}],"translate-none":["translate-none"],zoom:[{zoom:[G,X,R]}],accent:[{accent:ei()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ei()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",X,R]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":ei()}],"scrollbar-track-color":[{"scrollbar-track":ei()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",X,R]}],fill:[{fill:["none",...ei()]}],"stroke-w":[{stroke:[T,K,V,F]}],stroke:[{stroke:["none",...ei()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ef(...e){return eb((0,o.$)(e))}},8521:(e,t,r)=>{"use strict";r.d(t,{J:()=>i,D:()=>l});var o=r(51204);let n=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function s(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||n.has(e)}let a=e=>!s(e);function l(e){"function"==typeof e&&(a=t=>t.startsWith("on")?!s(t):e(t))}try{l(require("@emotion/is-prop-valid").default)}catch{}function i(e,t,r){let n={};for(let l in e)("values"!==l||"object"!=typeof e.values)&&!(0,o.S)(e[l])&&(a(l)||!0===r&&s(l)||!t&&!s(l)||e.draggable&&l.startsWith("onDrag"))&&(n[l]=e[l]);return n}},10293:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>f});var o=r(26514),n=r(24322),s=r.n(n),a=r(75834),l=r(29912),i=r(73533),c=r(8521),d=r(53214);function m({children:e,isValidProp:t,...r}){t&&(0,c.D)(t);let n=(0,a.useContext)(i.Q);(r={...n,...r}).transition=(0,l.K)(r.transition,n.transition),r.isStatic=(0,d.M)(()=>r.isStatic);let s=(0,a.useMemo)(()=>r,[JSON.stringify(r.transition),r.transformPagePoint,r.reducedMotion,r.skipAnimations]);return(0,o.jsx)(i.Q.Provider,{value:s,children:e})}var u=r(67492);let p="vibeflow:connection";function b(){let[e,t]=(0,a.useState)(!0);return((0,a.useEffect)(()=>{let e=e=>t(e.detail.connected);return window.addEventListener(p,e),()=>window.removeEventListener(p,e)},[]),e)?null:(0,o.jsx)("div",{role:"status",className:"fixed inset-x-0 top-0 z-50 bg-destructive px-4 py-1.5 text-center text-sm text-destructive-foreground",children:"與 VibeFlow core 的連線中斷,正在重新連線…(agent 仍在背景執行)"})}r(59630),r(19733),r(55e3),function(){if(window.vibeflow)return;let e=`${"https:"===window.location.protocol?"wss":"ws"}://${window.location.host}/ws`,t=function(e){let t=null,r=1,o=!1,n=!1,s=250,a=[],l=new Map,i=new Map;function c(e,t){for(let r of Array.from(i.get(e)??[]))r(t)}function d(e){let r=JSON.stringify(e);t&&1===t.readyState?t.send(r):a.push(r)}return!function r(){if(n)return;let i=e.connect();t=i,i.onopen=()=>{for(s=250,e.onStatus?.(!0);t&&1===t.readyState&&a.length>0;)t.send(a.shift());o&&e.onReconnect?.(),o=!0},i.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}if("string"==typeof t.event)return void c(t.event,t.payload);let r="number"==typeof t.id?l.get(t.id):void 0;r&&(l.delete(t.id),t.error?r.reject(Object.assign(Error(t.error.message),{code:t.error.code})):r.resolve(null===t.result?void 0:t.result))},i.onerror=()=>{},i.onclose=()=>{if(t===i){for(let[r,o]of(t=null,e.onStatus?.(!1),Array.from(l)))l.delete(r),o.reject(Error("與 VibeFlow core 的連線中斷"));n||(setTimeout(r,s),s=Math.min(2*s,5e3))}}}(),{kind:"ws",invoke(e,...t){let o=r++;return new Promise((r,n)=>{l.set(o,{resolve:r,reject:n}),d({id:o,method:e,params:t})})},send(e,...t){d({method:e,params:t})},on(e,t){let r=i.get(e);return r||i.set(e,r=new Set),r.add(t),()=>{r.delete(t)}},close(){n=!0,t?.close()},dispatch:c}}({connect:()=>new WebSocket(e),onReconnect:()=>{r.getState().then(e=>t.dispatch("state:changed",e))},onStatus:e=>{window.dispatchEvent(new CustomEvent(p,{detail:{connected:e}}))}}),r={transport:t.kind,getState:()=>t.invoke("vibeflow:getState"),getVersion:()=>t.invoke("app:getVersion"),onStateChanged:e=>t.on("state:changed",t=>e(t)),setBoard:e=>t.invoke("vibeflow:setBoard",e),setSettings:e=>t.invoke("vibeflow:setSettings",e),getGithubAuthStatus:()=>t.invoke("settings:githubAuthStatus"),startGithubAuthLogin:()=>t.invoke("settings:startGithubAuthLogin"),cancelGithubAuthLogin:()=>t.invoke("settings:cancelGithubAuthLogin"),logoutGithubAuth:()=>t.invoke("settings:logoutGithubAuth"),onGithubAuthEvent:e=>t.on("github-auth:event",t=>e(t)),getGitInfo:e=>t.invoke("git:getInfo",e),listRecentProjects:()=>t.invoke("projects:listRecent"),initRepository:e=>t.invoke("git:initRepository",e),detectAgents:()=>t.invoke("env:detectAgents"),listAgentModels:(e,r=!1)=>t.invoke("agents:listModels",{agentId:e,refresh:r}),createTask:e=>t.invoke("vibeflow:createTask",e),updateTask:e=>t.invoke("vibeflow:updateTask",e),resetTaskRun:e=>t.invoke("vibeflow:resetTaskRun",e),removeTask:e=>t.invoke("vibeflow:removeTask",e),getDiff:e=>t.invoke("git:getDiff",e),getDiffEntries:(e,r)=>t.invoke("git:getDiffEntries",e,r),getDiffFile:(e,r)=>t.invoke("git:getDiffFile",e,r),listArtifacts:e=>t.invoke("task:listArtifacts",e),readArtifact:(e,r)=>t.invoke("task:readArtifact",e,r),openArtifactsDir:e=>t.invoke("task:openArtifactsDir",e),getSpecs:e=>t.invoke("task:getSpecs",e),getBoardCliLaunchInfo:()=>t.invoke("board:getCliLaunchInfo"),listLibrary:()=>t.invoke("library:list"),importLibraryEntry:e=>t.invoke("library:import",e),createLibraryEntry:e=>t.invoke("library:create",e),readLibraryEntry:e=>t.invoke("library:read",e),updateLibraryEntry:e=>t.invoke("library:update",e),setLibraryEntryDescription:e=>t.invoke("library:setDescription",e),setLibraryEntryEnabled:e=>t.invoke("library:setEnabled",e),deleteLibraryEntry:e=>t.invoke("library:delete",e),restoreBuiltinSkill:e=>t.invoke("library:restoreBuiltin",e),listRemovedBuiltinSkills:()=>t.invoke("library:removedBuiltins"),approve:(e,r)=>t.invoke("git:approve",{taskId:e,message:r}),generateCommitMessage:e=>t.invoke("git:generateCommitMessage",e),getPrStatus:e=>t.invoke("git:getPrStatus",e),getGithubCompareUrl:e=>t.invoke("git:getGithubCompareUrl",e),openExternal:e=>t.invoke("shell:openExternal",e),cleanupTask:e=>t.invoke("vibeflow:cleanupTask",e),onSubAgentsUpdate:e=>t.on("subagents:update",t=>e(t)),deleteTask:e=>t.invoke("vibeflow:deleteTask",e),attachments:{write:e=>t.invoke("attachments:write",e)},chat:{load:e=>t.invoke("chat:load",e),send:e=>t.invoke("chat:send",e),cancel:e=>t.invoke("chat:cancel",e),compact:e=>t.invoke("chat:compact",e),onChunk:e=>t.on("chat:chunk",t=>e(t)),onPhase:e=>t.on("chat:phase",t=>e(t))},term:{start:e=>t.invoke("pty:start",e),peek:e=>t.invoke("pty:peek",e),list:()=>t.invoke("sessions:list"),input:(e,r)=>t.send("pty:input",{sessionKey:e,data:r}),resize:(e,r,o)=>t.send("pty:resize",{sessionKey:e,cols:r,rows:o}),kill:e=>t.send("pty:kill",e),isScrolledBack:e=>t.invoke("pty:scrolled",e),scrollToBottom:e=>t.invoke("pty:scroll-bottom",e),sessionExists:e=>t.invoke("claude:sessionExists",e),onData:e=>t.on("pty:data",t=>e(t)),onExit:e=>t.on("pty:exit",t=>e(t))}};window.vibeflow=r}();let f=function({Component:e,pageProps:t}){return(0,a.useEffect)(()=>{let e=requestIdleCallback(u.x);return()=>cancelIdleCallback(e)},[]),(0,o.jsxs)(m,{reducedMotion:"user",children:[(0,o.jsxs)(s(),{children:[(0,o.jsx)("link",{rel:"icon",href:"/favicon.ico",sizes:"any"}),(0,o.jsx)("link",{rel:"icon",href:"/logo.svg",type:"image/svg+xml"}),(0,o.jsx)("link",{rel:"apple-touch-icon",href:"/apple-touch-icon.png"})]}),(0,o.jsx)(b,{}),(0,o.jsx)(e,{...t})]})}},19733:()=>{},20446:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return r(10293)}])},24322:(e,t,r)=>{e.exports=r(2324)},29912:(e,t,r)=>{"use strict";function o(e,t){if(e?.inherit&&t){let{inherit:r,...o}=e;return{...t,...o}}return e}r.d(t,{K:()=>o})},51204:(e,t,r)=>{"use strict";r.d(t,{S:()=>o});let o=e=>!!(e&&e.getVelocity)},53214:(e,t,r)=>{"use strict";r.d(t,{M:()=>n});var o=r(75834);function n(e){let t=(0,o.useRef)(null);return null===t.current&&(t.current=e()),t.current}},55e3:()=>{},59630:()=>{},67492:(e,t,r)=>{"use strict";r.d(t,{A:()=>d,x:()=>i});var o=r(26514),n=r(75834),s=r(4416);let a=null;function l(e,t,r){return e.getPropertyValue(t).trim()||r}function i(){c().then(e=>e.render("mermaid-warmup","flowchart TD\n A--\x3eB")).catch(()=>{})}function c(){return a??=Promise.all([r.e(4120),r.e(1687),r.e(3927)]).then(r.bind(r,28996)).then(({default:e})=>{let t=getComputedStyle(document.documentElement);return e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,htmlLabels:!1,theme:"dark",darkMode:!0,fontFamily:l(t,"--font-sans","Inter, system-ui, sans-serif"),themeVariables:{background:l(t,"--card","#212121"),primaryColor:l(t,"--secondary","#262626"),primaryTextColor:l(t,"--foreground","#ededed"),lineColor:l(t,"--muted-foreground","#a1a1a1"),edgeLabelBackground:l(t,"--card","#212121")},flowchart:{useMaxWidth:!0}}),e}).catch(e=>{throw a=null,e})}function d({code:e,compact:t}){let r=`mermaid-${(0,n.useId)().replace(/[^a-zA-Z0-9]/g,"")}`,[a,l]=(0,n.useState)(null),[i,m]=(0,n.useState)(null);(0,n.useEffect)(()=>{let t=!1;return l(null),m(null),c().then(t=>t.render(r,e)).then(e=>{t||l(e.svg)}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,r]);let u=(0,o.jsx)("pre",{className:(0,s.cn)("max-w-full overflow-x-auto rounded-md bg-background/70 p-3",t?"text-xs leading-snug":"text-sm"),children:(0,o.jsx)("code",{children:e})});return i?(0,o.jsxs)("div",{className:"not-prose my-3 space-y-2",children:[(0,o.jsxs)("p",{className:"text-xs text-destructive",children:["圖表語法錯誤:",i]}),u]}):a?(0,o.jsx)("div",{className:"not-prose my-3 max-w-full overflow-x-auto rounded-md bg-card p-3 [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:a}}):(0,o.jsx)("div",{className:"not-prose my-3 rounded-md bg-background/70 p-3 text-xs text-muted-foreground",children:"繪製圖表中…"})}},73367:(e,t,r)=>{"use strict";function o(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=function e(t){var r,o,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(o=e(t[r]))&&(n&&(n+=" "),n+=o)}else for(o in t)t[o]&&(n&&(n+=" "),n+=o);return n}(e))&&(o&&(o+=" "),o+=t);return o}r.d(t,{$:()=>o})},73533:(e,t,r)=>{"use strict";r.d(t,{Q:()=>o});let o=(0,r(75834).createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"})}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8792],()=>(t(20446),t(77269))),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{4416:(e,t,r)=>{"use strict";r.d(t,{cn:()=>ef});var o=r(73367);let n=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),s=[],a=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let o=e[t],n=r.nextPart.get(o);if(n){let r=a(e,t+1,n);if(r)return r}let s=r.validators;if(null===s)return;let l=0===t?e.join("-"):e.slice(t).join("-"),i=s.length;for(let e=0;e<i;e++){let t=s[e];if(t.validator(l))return t.classGroupId}},l=(e,t)=>{let r=n();for(let o in e)i(e[o],r,o,t);return r},i=(e,t,r,o)=>{let n=e.length;for(let s=0;s<n;s++)c(e[s],t,r,o)},c=(e,t,r,o)=>{"string"==typeof e?d(e,t,r):"function"==typeof e?m(e,t,r,o):u(e,t,r,o)},d=(e,t,r)=>{(""===e?t:p(t,e)).classGroupId=r},m=(e,t,r,o)=>{b(e)?i(e(o),t,r,o):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},u=(e,t,r,o)=>{let n=Object.entries(e),s=n.length;for(let e=0;e<s;e++){let[s,a]=n[e];i(a,p(t,s),r,o)}},p=(e,t)=>{let r=e,o=t.split("-"),s=o.length;for(let e=0;e<s;e++){let t=o[e],s=r.nextPart.get(t);s||(s=n(),r.nextPart.set(t,s)),r=s}return r},b=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,f=[],g=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),h=/\s+/,k=e=>{let t;if("string"==typeof e)return e;let r="";for(let o=0;o<e.length;o++)e[o]&&(t=k(e[o]))&&(r&&(r+=" "),r+=t);return r},v=[],w=e=>{let t=t=>t[e]||v;return t.isThemeGetter=!0,t},x=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,y=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,S=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,j=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,E=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,L=e=>z.test(e),T=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),M=e=>e.endsWith("%")&&T(e.slice(0,-1)),N=e=>S.test(e),D=()=>!0,_=e=>j.test(e)&&!E.test(e),W=()=>!1,P=e=>C.test(e),I=e=>A.test(e),O=e=>!R(e)&&!X(e),B=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),$=e=>en(e,ei,W),R=e=>x.test(e),V=e=>en(e,ec,_),F=e=>en(e,ed,T),q=e=>en(e,eu,D),J=e=>en(e,em,W),U=e=>en(e,ea,W),H=e=>en(e,el,I),Q=e=>en(e,ep,P),X=e=>y.test(e),K=e=>es(e,ec),Y=e=>es(e,em),Z=e=>es(e,ea),ee=e=>es(e,ei),et=e=>es(e,el),er=e=>es(e,ep,!0),eo=e=>es(e,eu,!0),en=(e,t,r)=>{let o=x.exec(e);return!!o&&(o[1]?t(o[1]):r(o[2]))},es=(e,t,r=!1)=>{let o=y.exec(e);return!!o&&(o[1]?t(o[1]):r)},ea=e=>"position"===e||"percentage"===e,el=e=>"image"===e||"url"===e,ei=e=>"length"===e||"size"===e||"bg-size"===e,ec=e=>"length"===e,ed=e=>"number"===e,em=e=>"family-name"===e,eu=e=>"number"===e||"weight"===e,ep=e=>"shadow"===e,eb=((e,...t)=>{let r,o,n,i,c=e=>{let t=o(e);if(t)return t;let s=((e,t)=>{let{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s,postfixLookupClassGroupIds:a}=t,l=[],i=e.trim().split(h),c="";for(let e=i.length-1;e>=0;e-=1){let t,d=i[e],{isExternal:m,modifiers:u,hasImportantModifier:p,baseClassName:b,maybePostfixModifierPosition:f}=r(d);if(m){c=d+(c.length>0?" "+c:c);continue}let g=!!f;if(g){let e=(t=o(b.substring(0,f)))&&a[t]?o(b):void 0;e&&e!==t&&(t=e,g=!1)}else t=o(b);if(!t){if(!g||!(t=o(b))){c=d+(c.length>0?" "+c:c);continue}g=!1}let h=0===u.length?"":1===u.length?u[0]:s(u).join(":"),k=p?h+"!":h,v=k+t;if(l.indexOf(v)>-1)continue;l.push(v);let w=n(t,g);for(let e=0;e<w.length;++e){let t=w[e];l.push(k+t)}c=d+(c.length>0?" "+c:c)}return c})(e,r);return n(e,s),s};return i=d=>{var m;let u;return o=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null),n=(n,s)=>{r[n]=s,++t>e&&(t=0,o=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=o[e])?(n(e,t),t):void 0},set(e,t){e in r?r[e]=t:n(e,t)}}})((m=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,o=e=>{let t,r=[],o=0,n=0,s=0,a=e.length;for(let l=0;l<a;l++){let a=e[l];if(0===o&&0===n){if(":"===a){r.push(e.slice(s,l)),s=l+1;continue}if("/"===a){t=l;continue}}"["===a?o++:"]"===a?o--:"("===a?n++:")"===a&&n--}let l=0===r.length?e:e.slice(s),i=l,c=!1;return l.endsWith("!")?(i=l.slice(0,-1),c=!0):l.startsWith("!")&&(i=l.slice(1),c=!0),g(r,c,i,t&&t>s?t-s:void 0)};if(t){let e=t+":",r=o;o=t=>t.startsWith(e)?r(t.slice(e.length)):g(f,!1,t,void 0,!0)}if(r){let e=o;o=t=>r({className:t,parseClassName:e})}return o})(m),sortModifiers:(u=new Map,m.orderSensitiveModifiers.forEach((e,t)=>{u.set(e,1e6+t)}),e=>{let t=[],r=[];for(let o=0;o<e.length;o++){let n=e[o],s="["===n[0],a=u.has(n);s||a?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(n)):r.push(n)}return r.length>0&&(r.sort(),t.push(...r)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let e=0;e<r.length;e++)t[r[e]]=!0;return t})(m),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return l(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,o,n;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(o=(t=r.slice(1,-1)).indexOf(":"),(n=t.slice(0,o))?"arbitrary.."+n:void 0)}let o=e.split("-"),n=+(""===o[0]&&o.length>1);return a(o,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=o[e],n=r[e];if(t){if(n){let e=Array(n.length+t.length);for(let t=0;t<n.length;t++)e[t]=n[t];for(let r=0;r<t.length;r++)e[n.length+r]=t[r];return e}return t}return n||s}return r[e]||s}}})(m)}).cache.get,n=r.cache.set,i=c,c(d)},(...e)=>i(((...e)=>{let t,r,o=0,n="";for(;o<e.length;)(t=e[o++])&&(r=k(t))&&(n&&(n+=" "),n+=r);return n})(...e))})(()=>{let e=w("color"),t=w("font"),r=w("text"),o=w("font-weight"),n=w("tracking"),s=w("leading"),a=w("breakpoint"),l=w("container"),i=w("spacing"),c=w("radius"),d=w("shadow"),m=w("inset-shadow"),u=w("text-shadow"),p=w("drop-shadow"),b=w("blur"),f=w("perspective"),g=w("aspect"),h=w("ease"),k=w("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...x(),X,R],z=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],j=()=>[X,R,i],E=()=>[L,"full","auto",...j()],C=()=>[G,"none","subgrid",X,R],A=()=>["auto",{span:["full",G,X,R]},G,X,R],_=()=>[G,"auto",X,R],W=()=>["auto","min","max","fr",X,R],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],en=()=>["auto",...j()],es=()=>[L,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],ea=()=>[L,"screen","full","dvw","lvw","svw","min","max","fit",...j()],el=()=>[L,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],ei=()=>[e,X,R],ec=()=>[...x(),Z,U,{position:[X,R]}],ed=()=>["no-repeat",{repeat:["","x","y","space","round"]}],em=()=>["auto","cover","contain",ee,$,{size:[X,R]}],eu=()=>[M,K,V],ep=()=>["","none","full",c,X,R],eb=()=>["",T,K,V],ef=()=>["solid","dashed","dotted","double"],eg=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],eh=()=>[T,M,Z,U],ek=()=>["","none",b,X,R],ev=()=>["none",T,X,R],ew=()=>["none",T,X,R],ex=()=>[T,X,R],ey=()=>[L,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[N],breakpoint:[N],color:[D],container:[N],"drop-shadow":[N],ease:["in","out","in-out"],font:[O],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[N],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[N],shadow:[N],spacing:["px",T],text:[N],"text-shadow":[N],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",L,R,X,g]}],container:["container"],"container-type":[{"@container":["","normal","size",X,R]}],"container-named":[B],columns:[{columns:[T,R,X,l]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[G,"auto",X,R]}],basis:[{basis:[L,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[T,L,"auto","initial","none",R]}],grow:[{grow:["",T,X,R]}],shrink:[{shrink:["",T,X,R]}],order:[{order:[G,"first","last","none",X,R]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:en()}],mx:[{mx:en()}],my:[{my:en()}],ms:[{ms:en()}],me:[{me:en()}],mbs:[{mbs:en()}],mbe:[{mbe:en()}],mt:[{mt:en()}],mr:[{mr:en()}],mb:[{mb:en()}],ml:[{ml:en()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:es()}],"inline-size":[{inline:["auto",...ea()]}],"min-inline-size":[{"min-inline":["auto",...ea()]}],"max-inline-size":[{"max-inline":["none",...ea()]}],"block-size":[{block:["auto",...el()]}],"min-block-size":[{"min-block":["auto",...el()]}],"max-block-size":[{"max-block":["none",...el()]}],w:[{w:[l,"screen",...es()]}],"min-w":[{"min-w":[l,"screen","none",...es()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...es()]}],h:[{h:["screen","lh",...es()]}],"min-h":[{"min-h":["screen","lh","none",...es()]}],"max-h":[{"max-h":["screen","lh",...es()]}],"font-size":[{text:["base",r,K,V]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,eo,q]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",M,R]}],"font-family":[{font:[Y,J,t]}],"font-features":[{"font-features":[R]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,X,R]}],"line-clamp":[{"line-clamp":[T,"none",X,F]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",X,R]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",X,R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ei()}],"text-color":[{text:ei()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ef(),"wavy"]}],"text-decoration-thickness":[{decoration:[T,"from-font","auto",X,V]}],"text-decoration-color":[{decoration:ei()}],"underline-offset":[{"underline-offset":[T,"auto",X,R]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[G,X,R]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",X,R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X,R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ec()}],"bg-repeat":[{bg:ed()}],"bg-size":[{bg:em()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},G,X,R],radial:["",X,R],conic:[G,X,R]},et,H]}],"bg-color":[{bg:ei()}],"gradient-from-pos":[{from:eu()}],"gradient-via-pos":[{via:eu()}],"gradient-to-pos":[{to:eu()}],"gradient-from":[{from:ei()}],"gradient-via":[{via:ei()}],"gradient-to":[{to:ei()}],rounded:[{rounded:ep()}],"rounded-s":[{"rounded-s":ep()}],"rounded-e":[{"rounded-e":ep()}],"rounded-t":[{"rounded-t":ep()}],"rounded-r":[{"rounded-r":ep()}],"rounded-b":[{"rounded-b":ep()}],"rounded-l":[{"rounded-l":ep()}],"rounded-ss":[{"rounded-ss":ep()}],"rounded-se":[{"rounded-se":ep()}],"rounded-ee":[{"rounded-ee":ep()}],"rounded-es":[{"rounded-es":ep()}],"rounded-tl":[{"rounded-tl":ep()}],"rounded-tr":[{"rounded-tr":ep()}],"rounded-br":[{"rounded-br":ep()}],"rounded-bl":[{"rounded-bl":ep()}],"border-w":[{border:eb()}],"border-w-x":[{"border-x":eb()}],"border-w-y":[{"border-y":eb()}],"border-w-s":[{"border-s":eb()}],"border-w-e":[{"border-e":eb()}],"border-w-bs":[{"border-bs":eb()}],"border-w-be":[{"border-be":eb()}],"border-w-t":[{"border-t":eb()}],"border-w-r":[{"border-r":eb()}],"border-w-b":[{"border-b":eb()}],"border-w-l":[{"border-l":eb()}],"divide-x":[{"divide-x":eb()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":eb()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ef(),"hidden","none"]}],"divide-style":[{divide:[...ef(),"hidden","none"]}],"border-color":[{border:ei()}],"border-color-x":[{"border-x":ei()}],"border-color-y":[{"border-y":ei()}],"border-color-s":[{"border-s":ei()}],"border-color-e":[{"border-e":ei()}],"border-color-bs":[{"border-bs":ei()}],"border-color-be":[{"border-be":ei()}],"border-color-t":[{"border-t":ei()}],"border-color-r":[{"border-r":ei()}],"border-color-b":[{"border-b":ei()}],"border-color-l":[{"border-l":ei()}],"divide-color":[{divide:ei()}],"outline-style":[{outline:[...ef(),"none","hidden"]}],"outline-offset":[{"outline-offset":[T,X,R]}],"outline-w":[{outline:["",T,K,V]}],"outline-color":[{outline:ei()}],shadow:[{shadow:["","none",d,er,Q]}],"shadow-color":[{shadow:ei()}],"inset-shadow":[{"inset-shadow":["none",m,er,Q]}],"inset-shadow-color":[{"inset-shadow":ei()}],"ring-w":[{ring:eb()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ei()}],"ring-offset-w":[{"ring-offset":[T,V]}],"ring-offset-color":[{"ring-offset":ei()}],"inset-ring-w":[{"inset-ring":eb()}],"inset-ring-color":[{"inset-ring":ei()}],"text-shadow":[{"text-shadow":["none",u,er,Q]}],"text-shadow-color":[{"text-shadow":ei()}],opacity:[{opacity:[T,X,R]}],"mix-blend":[{"mix-blend":[...eg(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":eg()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[T]}],"mask-image-linear-from-pos":[{"mask-linear-from":eh()}],"mask-image-linear-to-pos":[{"mask-linear-to":eh()}],"mask-image-linear-from-color":[{"mask-linear-from":ei()}],"mask-image-linear-to-color":[{"mask-linear-to":ei()}],"mask-image-t-from-pos":[{"mask-t-from":eh()}],"mask-image-t-to-pos":[{"mask-t-to":eh()}],"mask-image-t-from-color":[{"mask-t-from":ei()}],"mask-image-t-to-color":[{"mask-t-to":ei()}],"mask-image-r-from-pos":[{"mask-r-from":eh()}],"mask-image-r-to-pos":[{"mask-r-to":eh()}],"mask-image-r-from-color":[{"mask-r-from":ei()}],"mask-image-r-to-color":[{"mask-r-to":ei()}],"mask-image-b-from-pos":[{"mask-b-from":eh()}],"mask-image-b-to-pos":[{"mask-b-to":eh()}],"mask-image-b-from-color":[{"mask-b-from":ei()}],"mask-image-b-to-color":[{"mask-b-to":ei()}],"mask-image-l-from-pos":[{"mask-l-from":eh()}],"mask-image-l-to-pos":[{"mask-l-to":eh()}],"mask-image-l-from-color":[{"mask-l-from":ei()}],"mask-image-l-to-color":[{"mask-l-to":ei()}],"mask-image-x-from-pos":[{"mask-x-from":eh()}],"mask-image-x-to-pos":[{"mask-x-to":eh()}],"mask-image-x-from-color":[{"mask-x-from":ei()}],"mask-image-x-to-color":[{"mask-x-to":ei()}],"mask-image-y-from-pos":[{"mask-y-from":eh()}],"mask-image-y-to-pos":[{"mask-y-to":eh()}],"mask-image-y-from-color":[{"mask-y-from":ei()}],"mask-image-y-to-color":[{"mask-y-to":ei()}],"mask-image-radial":[{"mask-radial":[X,R]}],"mask-image-radial-from-pos":[{"mask-radial-from":eh()}],"mask-image-radial-to-pos":[{"mask-radial-to":eh()}],"mask-image-radial-from-color":[{"mask-radial-from":ei()}],"mask-image-radial-to-color":[{"mask-radial-to":ei()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[T]}],"mask-image-conic-from-pos":[{"mask-conic-from":eh()}],"mask-image-conic-to-pos":[{"mask-conic-to":eh()}],"mask-image-conic-from-color":[{"mask-conic-from":ei()}],"mask-image-conic-to-color":[{"mask-conic-to":ei()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ec()}],"mask-repeat":[{mask:ed()}],"mask-size":[{mask:em()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",X,R]}],filter:[{filter:["","none",X,R]}],blur:[{blur:ek()}],brightness:[{brightness:[T,X,R]}],contrast:[{contrast:[T,X,R]}],"drop-shadow":[{"drop-shadow":["","none",p,er,Q]}],"drop-shadow-color":[{"drop-shadow":ei()}],grayscale:[{grayscale:["",T,X,R]}],"hue-rotate":[{"hue-rotate":[T,X,R]}],invert:[{invert:["",T,X,R]}],saturate:[{saturate:[T,X,R]}],sepia:[{sepia:["",T,X,R]}],"backdrop-filter":[{"backdrop-filter":["","none",X,R]}],"backdrop-blur":[{"backdrop-blur":ek()}],"backdrop-brightness":[{"backdrop-brightness":[T,X,R]}],"backdrop-contrast":[{"backdrop-contrast":[T,X,R]}],"backdrop-grayscale":[{"backdrop-grayscale":["",T,X,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[T,X,R]}],"backdrop-invert":[{"backdrop-invert":["",T,X,R]}],"backdrop-opacity":[{"backdrop-opacity":[T,X,R]}],"backdrop-saturate":[{"backdrop-saturate":[T,X,R]}],"backdrop-sepia":[{"backdrop-sepia":["",T,X,R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",X,R]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[T,"initial",X,R]}],ease:[{ease:["linear","initial",h,X,R]}],delay:[{delay:[T,X,R]}],animate:[{animate:["none",k,X,R]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,X,R]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:ev()}],"rotate-x":[{"rotate-x":ev()}],"rotate-y":[{"rotate-y":ev()}],"rotate-z":[{"rotate-z":ev()}],scale:[{scale:ew()}],"scale-x":[{"scale-x":ew()}],"scale-y":[{"scale-y":ew()}],"scale-z":[{"scale-z":ew()}],"scale-3d":["scale-3d"],skew:[{skew:ex()}],"skew-x":[{"skew-x":ex()}],"skew-y":[{"skew-y":ex()}],transform:[{transform:[X,R,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ey()}],"translate-x":[{"translate-x":ey()}],"translate-y":[{"translate-y":ey()}],"translate-z":[{"translate-z":ey()}],"translate-none":["translate-none"],zoom:[{zoom:[G,X,R]}],accent:[{accent:ei()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ei()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",X,R]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":ei()}],"scrollbar-track-color":[{"scrollbar-track":ei()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",X,R]}],fill:[{fill:["none",...ei()]}],"stroke-w":[{stroke:[T,K,V,F]}],stroke:[{stroke:["none",...ei()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ef(...e){return eb((0,o.$)(e))}},8521:(e,t,r)=>{"use strict";r.d(t,{J:()=>i,D:()=>l});var o=r(51204);let n=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function s(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||n.has(e)}let a=e=>!s(e);function l(e){"function"==typeof e&&(a=t=>t.startsWith("on")?!s(t):e(t))}try{l(require("@emotion/is-prop-valid").default)}catch{}function i(e,t,r){let n={};for(let l in e)("values"!==l||"object"!=typeof e.values)&&!(0,o.S)(e[l])&&(a(l)||!0===r&&s(l)||!t&&!s(l)||e.draggable&&l.startsWith("onDrag"))&&(n[l]=e[l]);return n}},10293:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>f});var o=r(26514),n=r(24322),s=r.n(n),a=r(75834),l=r(29912),i=r(73533),c=r(8521),d=r(53214);function m({children:e,isValidProp:t,...r}){t&&(0,c.D)(t);let n=(0,a.useContext)(i.Q);(r={...n,...r}).transition=(0,l.K)(r.transition,n.transition),r.isStatic=(0,d.M)(()=>r.isStatic);let s=(0,a.useMemo)(()=>r,[JSON.stringify(r.transition),r.transformPagePoint,r.reducedMotion,r.skipAnimations]);return(0,o.jsx)(i.Q.Provider,{value:s,children:e})}var u=r(67492);let p="vibeflow:connection";function b(){let[e,t]=(0,a.useState)(!0);return((0,a.useEffect)(()=>{let e=e=>t(e.detail.connected);return window.addEventListener(p,e),()=>window.removeEventListener(p,e)},[]),e)?null:(0,o.jsx)("div",{role:"status",className:"fixed inset-x-0 top-0 z-50 bg-destructive px-4 py-1.5 text-center text-sm text-destructive-foreground",children:"與 VibeFlow core 的連線中斷,正在重新連線…(agent 仍在背景執行)"})}r(59630),r(19733),r(55e3),function(){if(window.vibeflow)return;let e=`${"https:"===window.location.protocol?"wss":"ws"}://${window.location.host}/ws`,t=function(e){let t=null,r=1,o=!1,n=!1,s=250,a=[],l=new Map,i=new Map;function c(e,t){for(let r of Array.from(i.get(e)??[]))r(t)}function d(e){let r=JSON.stringify(e);t&&1===t.readyState?t.send(r):a.push(r)}return!function r(){if(n)return;let i=e.connect();t=i,i.onopen=()=>{for(s=250,e.onStatus?.(!0);t&&1===t.readyState&&a.length>0;)t.send(a.shift());o&&e.onReconnect?.(),o=!0},i.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}if("string"==typeof t.event)return void c(t.event,t.payload);let r="number"==typeof t.id?l.get(t.id):void 0;r&&(l.delete(t.id),t.error?r.reject(Object.assign(Error(t.error.message),{code:t.error.code})):r.resolve(null===t.result?void 0:t.result))},i.onerror=()=>{},i.onclose=()=>{if(t===i){for(let[r,o]of(t=null,e.onStatus?.(!1),Array.from(l)))l.delete(r),o.reject(Error("與 VibeFlow core 的連線中斷"));n||(setTimeout(r,s),s=Math.min(2*s,5e3))}}}(),{kind:"ws",invoke(e,...t){let o=r++;return new Promise((r,n)=>{l.set(o,{resolve:r,reject:n}),d({id:o,method:e,params:t})})},send(e,...t){d({method:e,params:t})},on(e,t){let r=i.get(e);return r||i.set(e,r=new Set),r.add(t),()=>{r.delete(t)}},close(){n=!0,t?.close()},dispatch:c}}({connect:()=>new WebSocket(e),onReconnect:()=>{r.getState().then(e=>t.dispatch("state:changed",e))},onStatus:e=>{window.dispatchEvent(new CustomEvent(p,{detail:{connected:e}}))}}),r={transport:t.kind,getState:()=>t.invoke("vibeflow:getState"),getVersion:()=>t.invoke("app:getVersion"),onStateChanged:e=>t.on("state:changed",t=>e(t)),setBoard:e=>t.invoke("vibeflow:setBoard",e),setSettings:e=>t.invoke("vibeflow:setSettings",e),getGithubAuthStatus:()=>t.invoke("settings:githubAuthStatus"),startGithubAuthLogin:()=>t.invoke("settings:startGithubAuthLogin"),cancelGithubAuthLogin:()=>t.invoke("settings:cancelGithubAuthLogin"),logoutGithubAuth:()=>t.invoke("settings:logoutGithubAuth"),onGithubAuthEvent:e=>t.on("github-auth:event",t=>e(t)),getGitInfo:e=>t.invoke("git:getInfo",e),listRecentProjects:()=>t.invoke("projects:listRecent"),initRepository:e=>t.invoke("git:initRepository",e),detectAgents:()=>t.invoke("env:detectAgents"),listAgentModels:(e,r=!1)=>t.invoke("agents:listModels",{agentId:e,refresh:r}),createTask:e=>t.invoke("vibeflow:createTask",e),updateTask:e=>t.invoke("vibeflow:updateTask",e),resetTaskRun:e=>t.invoke("vibeflow:resetTaskRun",e),removeTask:e=>t.invoke("vibeflow:removeTask",e),getDiff:e=>t.invoke("git:getDiff",e),getDiffEntries:(e,r)=>t.invoke("git:getDiffEntries",e,r),getDiffFile:(e,r)=>t.invoke("git:getDiffFile",e,r),listArtifacts:e=>t.invoke("task:listArtifacts",e),readArtifact:(e,r)=>t.invoke("task:readArtifact",e,r),openArtifactsDir:e=>t.invoke("task:openArtifactsDir",e),getSpecs:e=>t.invoke("task:getSpecs",e),getBoardCliLaunchInfo:()=>t.invoke("board:getCliLaunchInfo"),listLibrary:()=>t.invoke("library:list"),importLibraryEntry:e=>t.invoke("library:import",e),createLibraryEntry:e=>t.invoke("library:create",e),readLibraryEntry:e=>t.invoke("library:read",e),updateLibraryEntry:e=>t.invoke("library:update",e),setLibraryEntryDescription:e=>t.invoke("library:setDescription",e),setLibraryEntryEnabled:e=>t.invoke("library:setEnabled",e),deleteLibraryEntry:e=>t.invoke("library:delete",e),restoreBuiltinSkill:e=>t.invoke("library:restoreBuiltin",e),listRemovedBuiltinSkills:()=>t.invoke("library:removedBuiltins"),approve:(e,r)=>t.invoke("git:approve",{taskId:e,message:r}),generateCommitMessage:e=>t.invoke("git:generateCommitMessage",e),getPrStatus:e=>t.invoke("git:getPrStatus",e),getGithubCompareUrl:e=>t.invoke("git:getGithubCompareUrl",e),openExternal:e=>t.invoke("shell:openExternal",e),pickFolder:e=>t.invoke("dialog:pickFolder",e),cleanupTask:e=>t.invoke("vibeflow:cleanupTask",e),onSubAgentsUpdate:e=>t.on("subagents:update",t=>e(t)),deleteTask:e=>t.invoke("vibeflow:deleteTask",e),attachments:{write:e=>t.invoke("attachments:write",e)},chat:{load:e=>t.invoke("chat:load",e),send:e=>t.invoke("chat:send",e),cancel:e=>t.invoke("chat:cancel",e),compact:e=>t.invoke("chat:compact",e),onChunk:e=>t.on("chat:chunk",t=>e(t)),onPhase:e=>t.on("chat:phase",t=>e(t))},term:{start:e=>t.invoke("pty:start",e),peek:e=>t.invoke("pty:peek",e),list:()=>t.invoke("sessions:list"),input:(e,r)=>t.send("pty:input",{sessionKey:e,data:r}),resize:(e,r,o)=>t.send("pty:resize",{sessionKey:e,cols:r,rows:o}),kill:e=>t.send("pty:kill",e),isScrolledBack:e=>t.invoke("pty:scrolled",e),scrollToBottom:e=>t.invoke("pty:scroll-bottom",e),sessionExists:e=>t.invoke("claude:sessionExists",e),onData:e=>t.on("pty:data",t=>e(t)),onExit:e=>t.on("pty:exit",t=>e(t))}};window.vibeflow=r}();let f=function({Component:e,pageProps:t}){return(0,a.useEffect)(()=>{let e=requestIdleCallback(u.x);return()=>cancelIdleCallback(e)},[]),(0,o.jsxs)(m,{reducedMotion:"user",children:[(0,o.jsxs)(s(),{children:[(0,o.jsx)("link",{rel:"icon",href:"/favicon.ico",sizes:"any"}),(0,o.jsx)("link",{rel:"icon",href:"/logo.svg",type:"image/svg+xml"}),(0,o.jsx)("link",{rel:"apple-touch-icon",href:"/apple-touch-icon.png"})]}),(0,o.jsx)(b,{}),(0,o.jsx)(e,{...t})]})}},19733:()=>{},20446:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return r(10293)}])},24322:(e,t,r)=>{e.exports=r(2324)},29912:(e,t,r)=>{"use strict";function o(e,t){if(e?.inherit&&t){let{inherit:r,...o}=e;return{...t,...o}}return e}r.d(t,{K:()=>o})},51204:(e,t,r)=>{"use strict";r.d(t,{S:()=>o});let o=e=>!!(e&&e.getVelocity)},53214:(e,t,r)=>{"use strict";r.d(t,{M:()=>n});var o=r(75834);function n(e){let t=(0,o.useRef)(null);return null===t.current&&(t.current=e()),t.current}},55e3:()=>{},59630:()=>{},67492:(e,t,r)=>{"use strict";r.d(t,{A:()=>d,x:()=>i});var o=r(26514),n=r(75834),s=r(4416);let a=null;function l(e,t,r){return e.getPropertyValue(t).trim()||r}function i(){c().then(e=>e.render("mermaid-warmup","flowchart TD\n A--\x3eB")).catch(()=>{})}function c(){return a??=Promise.all([r.e(4120),r.e(1687),r.e(3927)]).then(r.bind(r,28996)).then(({default:e})=>{let t=getComputedStyle(document.documentElement);return e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,htmlLabels:!1,theme:"dark",darkMode:!0,fontFamily:l(t,"--font-sans","Inter, system-ui, sans-serif"),themeVariables:{background:l(t,"--card","#212121"),primaryColor:l(t,"--secondary","#262626"),primaryTextColor:l(t,"--foreground","#ededed"),lineColor:l(t,"--muted-foreground","#a1a1a1"),edgeLabelBackground:l(t,"--card","#212121")},flowchart:{useMaxWidth:!0}}),e}).catch(e=>{throw a=null,e})}function d({code:e,compact:t}){let r=`mermaid-${(0,n.useId)().replace(/[^a-zA-Z0-9]/g,"")}`,[a,l]=(0,n.useState)(null),[i,m]=(0,n.useState)(null);(0,n.useEffect)(()=>{let t=!1;return l(null),m(null),c().then(t=>t.render(r,e)).then(e=>{t||l(e.svg)}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,r]);let u=(0,o.jsx)("pre",{className:(0,s.cn)("max-w-full overflow-x-auto rounded-md bg-background/70 p-3",t?"text-xs leading-snug":"text-sm"),children:(0,o.jsx)("code",{children:e})});return i?(0,o.jsxs)("div",{className:"not-prose my-3 space-y-2",children:[(0,o.jsxs)("p",{className:"text-xs text-destructive",children:["圖表語法錯誤:",i]}),u]}):a?(0,o.jsx)("div",{className:"not-prose my-3 max-w-full overflow-x-auto rounded-md bg-card p-3 [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:a}}):(0,o.jsx)("div",{className:"not-prose my-3 rounded-md bg-background/70 p-3 text-xs text-muted-foreground",children:"繪製圖表中…"})}},73367:(e,t,r)=>{"use strict";function o(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=function e(t){var r,o,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(o=e(t[r]))&&(n&&(n+=" "),n+=o)}else for(o in t)t[o]&&(n&&(n+=" "),n+=o);return n}(e))&&(o&&(o+=" "),o+=t);return o}r.d(t,{$:()=>o})},73533:(e,t,r)=>{"use strict";r.d(t,{Q:()=>o});let o=(0,r(75834).createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"})}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8792],()=>(t(20446),t(77269))),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9845],{2908:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>s$});var n=s(26514),r=s(75834),a=s(24322),i=s.n(a),l=s(18690),o=s(80527),c=s(67297),d=s(5026),u=s(29334),m=s(71520),x=s(44416),f=s(58629),h=s(17329),p=s(70170),g=s(87854),b=s(78999),j=s(85781),v=s(38031),N=s(74567);let y="text-xs font-semibold uppercase tracking-wider text-muted-foreground";var k=s(4416);let w={default:"text-muted-foreground hover:bg-accent hover:text-foreground",primary:"text-muted-foreground hover:bg-accent hover:text-primary",danger:"text-muted-foreground hover:bg-destructive/15 hover:text-destructive"},C=r.forwardRef(({className:e,children:t,tone:s="default",type:r="button",...a},i)=>(0,n.jsx)("button",{ref:i,type:r,className:(0,k.cn)("inline-flex shrink-0 items-center justify-center rounded-full p-1.5 transition-colors outline-none active:scale-95 motion-reduce:transform-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100 [&_svg]:pointer-events-none",w[s],e),...a,children:t}));C.displayName="IconButton";let S=["backlog","in_progress","done"],A={backlog:"Backlog",in_progress:"In Progress",done:"Done"},z={backlog:"bg-muted-foreground/60",in_progress:"bg-warning animate-pulse",done:"bg-success"};function E(e){if(e.projectName)return e.projectName;let t=(e.projectPath??"").split(/[/\\]/).filter(Boolean);return t[t.length-1]??"未指定專案"}function I(e,t){let s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!e)return;let n=e=>{s.current?.contains(e.target)||t()},r=e=>{"Escape"===e.key&&t()};return window.addEventListener("mousedown",n),window.addEventListener("keydown",r),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("keydown",r)}},[e,t]),s}let P="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors motion-reduce:transition-none";function T({task:e,anchor:t,onEdit:s,onDelete:a,onClose:i}){let[l,o]=(0,r.useState)(!1),c=I(!0,i),d=Math.max(8,Math.min(t.right-208,window.innerWidth-208-8)),u=Math.max(8,Math.min(t.top,window.innerHeight-224));return(0,n.jsxs)("div",{ref:c,role:"menu",style:{top:u,left:d},onClick:e=>e.stopPropagation(),className:"fixed z-50 w-52 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg",children:[s&&(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{s(),i()},className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"hover:bg-accent hover:text-accent-foreground"),children:[(0,n.jsx)(m.A,{className:"size-3.5 shrink-0"}),"編輯任務"]}),l?(0,n.jsxs)("div",{className:"flex items-center gap-1 rounded-sm bg-destructive/10 p-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>o(!1),className:"rounded-sm px-2 py-1 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50",children:"取消"}),(0,n.jsx)("button",{type:"button",onClick:()=>{a(),i()},className:"ml-auto rounded-sm px-2 py-1 text-sm font-medium text-destructive outline-none transition-colors motion-reduce:transition-none hover:bg-destructive/15 focus-visible:ring-[3px] focus-visible:ring-ring/50",children:"確認刪除"})]}):(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>o(!0),className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"text-destructive hover:bg-destructive/15"),title:`刪除任務「${e.title}」(清理 worktree)`,children:[(0,n.jsx)(x.A,{className:"size-3.5 shrink-0"}),"刪除任務"]})]})}function $({task:e,column:t,subAgentCount:s,selected:a,onSelect:i,onEdit:l,onDelete:o}){let c=(0,r.useRef)(null),[d,u]=(0,r.useState)(null),m=null!==d,x="done"===t;return(0,n.jsxs)("div",{ref:c,role:"button",tabIndex:0,"aria-label":`開啟任務:${e.title}`,onClick:i,onKeyDown:e=>{e.target!==e.currentTarget||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),i())},className:(0,k.cn)("relative cursor-pointer rounded-md border bg-card p-3 outline-none transition-colors motion-reduce:transition-none focus-visible:ring-[3px] focus-visible:ring-ring/50",x&&"bg-card/60",a?"border-primary shadow-[0_0_0_2px] shadow-primary/20":"border-border hover:border-input"),children:[(0,n.jsxs)("div",{className:"group/head flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(f.A,{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:E(e)}),x?(0,n.jsxs)("span",{className:"flex shrink-0 items-center gap-1 rounded-xs bg-primary/15 px-1.5 py-0.5 font-medium text-primary",children:[(0,n.jsx)(h.A,{className:"size-2.5"}),"complete"]}):(0,n.jsxs)(n.Fragment,{children:[e.effort&&(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-xs bg-secondary px-1.5 py-0.5 font-medium",m?"hidden":"group-hover/head:hidden"),children:e.effort}),(0,n.jsx)(C,{"aria-label":`任務選項:${e.title}`,title:"移動、編輯或刪除",onClick:e=>{if(e.stopPropagation(),m)return void u(null);let t=c.current?.getBoundingClientRect();t&&u({top:t.top+32,right:t.right-4})},className:(0,k.cn)("size-5 p-0.5",m?"flex":"hidden group-hover/head:flex"),children:(0,n.jsx)(p.A,{className:"size-3.5"})})]})]}),(0,n.jsx)("div",{className:"mt-2",title:e.title,children:(0,n.jsx)("span",{className:(0,k.cn)("line-clamp-2 text-[15px] font-medium leading-[1.4]",x?"text-muted-foreground":"text-foreground"),children:e.title})}),(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,n.jsx)(g.A,{className:"size-3 shrink-0"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 truncate",title:"backlog"!==t||e.worktreePath?void 0:"分支會在開始執行時建立",children:[e.branch,"backlog"===t&&!e.worktreePath&&(0,n.jsx)("span",{className:"text-muted-foreground/70",children:"(開始時建立)"})]}),"in_progress"===t&&s>0&&(0,n.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,n.jsx)(b.A,{className:"size-3"}),s]})]}),"backlog"===t&&e.launchError&&(0,n.jsxs)("p",{className:"mt-1.5 truncate text-xs text-destructive",title:e.launchError,children:["開始失敗:",e.launchError]}),d&&(0,n.jsx)(T,{task:e,anchor:d,onEdit:l,onDelete:o,onClose:()=>u(null)})]})}function R({projects:e,value:t,onChange:s}){let[a,i]=(0,r.useState)(!1),l=I(a,()=>i(!1));return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(e=>!e),className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(f.A,{className:"size-3.5 shrink-0 text-muted-foreground"}),t??"所有專案",(0,n.jsx)(j.A,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),a&&(0,n.jsx)("div",{ref:l,role:"menu",className:"absolute left-0 top-8 z-20 w-56 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg",children:[null,...e].map(e=>(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{s(e),i(!1)},className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"hover:bg-accent hover:text-accent-foreground"),children:[(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e??"所有專案"}),e===t&&(0,n.jsx)(v.A,{className:"size-3 shrink-0"})]},e??"__all__"))})]})}function B({board:e,subAgents:t,selectedTaskId:s,onSelectTask:a,onEditTask:i,onDeleteTask:l,onNewTask:o}){let[c,d]=(0,r.useState)(null),u=[...e.backlog,...e.in_progress,...e.done],m=Array.from(new Set(u.map(E))).sort((e,t)=>e.localeCompare(t)),x=c&&m.includes(c)?c:null,f=u.length;return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[(0,n.jsxs)("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-5",children:[(0,n.jsx)(R,{projects:m,value:x,onChange:d}),(0,n.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[f," 個任務 \xb7 ",m.length," 個專案"]})]}),(0,n.jsx)("div",{className:"grid min-h-0 flex-1 grid-cols-3 gap-4 overflow-hidden px-5 pb-4 pt-3",children:S.map(r=>{let c=x?e[r].filter(e=>E(e)===x):e[r];return(0,n.jsxs)("section",{className:"flex min-h-0 flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2 px-1",children:[(0,n.jsx)("span",{className:(0,k.cn)("size-1.5 shrink-0 rounded-full",z[r])}),(0,n.jsx)("h2",{className:(0,k.cn)(y,"in_progress"===r&&"text-warning"),children:A[r]}),(0,n.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground/80",children:c.length})]}),(0,n.jsxs)("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto rounded-md p-1",children:[c.map(e=>(0,n.jsx)($,{task:e,column:r,subAgentCount:(t[e.id]??[]).length,selected:e.id===s,onSelect:()=>a(e.id),onEdit:"backlog"===r?()=>i(e.id):void 0,onDelete:()=>l(e.id)},e.id)),"backlog"===r&&(0,n.jsxs)("button",{type:"button",onClick:o,className:"flex w-full items-center justify-center gap-1.5 rounded-md px-3 py-2.5 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(N.A,{className:"size-3.5"}),"新增任務"]}),0===c.length&&"backlog"!==r&&(0,n.jsx)("p",{className:"px-2 py-1 text-sm text-muted-foreground/60",children:"尚無任務"})]})]},r)})})]})}var _=s(78141),D=s(26392),L=s(85320),M=s(37055);let F=(0,r.lazy)(()=>Promise.all([s.e(7045),s.e(7915)]).then(s.bind(s,37915)));function G({source:e,compact:t=!1,className:s}){return(0,n.jsx)("div",{className:(0,k.cn)("prose max-w-none break-words rounded-md bg-muted/30 p-3 text-muted-foreground",t?"prose-xs":"prose-sm",s),children:(0,n.jsx)(r.Suspense,{fallback:null,children:(0,n.jsx)(F,{source:e,compact:t})})})}var O=s(72975),H=s(41487);let V=0,Y={micro:.12,standard:.16,spatial:.18},K={enter:[.2,0,0,1],exit:[.4,0,1,1]};function W(e,t,s,n=Y[e]){return{duration:t?.01:n,ease:K[s]}}function U({timing:e,enterDuration:t,initialOpacity:s=0,transform:n,reducedMotion:r}){return{hidden:{opacity:s,...r?{}:n??{}},visible:{opacity:1,...r?{}:{...n?.x===void 0?{}:{x:0},...n?.y===void 0?{}:{y:0},...n?.scale===void 0?{}:{scale:1}},transition:W(e,r,"enter",t)}}}function X({timing:e,enterDuration:t,initialOpacity:s,exitTiming:n="micro",exitDuration:r,transform:a,exitTransform:i=a,reducedMotion:l}){return{...U({timing:e,enterDuration:t,initialOpacity:s,transform:a,reducedMotion:l}),exit:{opacity:0,...l?{}:i??{},transition:W(n,l,"exit",r)}}}function q({title:e,children:t,description:s,footer:a,showHeader:i=!1,className:l,contentClassName:o,bodyClassName:u,saving:m=!1,motionVariant:x="dialog",onClose:f}){let h=(0,r.useId)(),p=(0,r.useId)(),g=(0,r.useRef)(null),b=(0,r.useRef)("u">typeof document&&document.activeElement instanceof HTMLElement?document.activeElement:null),j=(0,r.useRef)(f),v=(0,r.useRef)(m),N=(0,H.tF)(),y=(0,c.I)()??!1,w=i||void 0!==s||void 0!==a||void 0!==u,S="drawer"===x,A=X({timing:"micro",enterDuration:.14,reducedMotion:y}),z=X({timing:S?"spatial":"standard",exitTiming:"micro",exitDuration:S?.14:void 0,transform:S?{x:16}:{scale:.98},reducedMotion:y});return(0,r.useEffect)(()=>{j.current=f,v.current=m},[f,m]),(0,r.useEffect)(()=>{let e;return V+=1,e=!1,()=>{e||(e=!0,V-=1)}},[]),(0,r.useEffect)(()=>{if(!N)return;g.current?.focus();let e=e=>{if("Escape"!==e.key||v.current)return;let t=document.querySelectorAll('[role="dialog"][aria-modal="true"]');t[t.length-1]===g.current&&j.current()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),b.current?.focus()}},[N]),(0,n.jsxs)(d.PY1.div,{initial:"hidden",animate:"visible",exit:"exit",inert:!N,"aria-hidden":!N||void 0,"data-dialog-state":N?"present":"exiting",className:(0,k.cn)("fixed inset-0 z-50 flex items-center justify-center p-4",!N&&"pointer-events-none",l),children:[(0,n.jsx)(d.PY1.div,{variants:A,className:"absolute inset-0 bg-background/80",onClick:m||!N?void 0:f}),(0,n.jsx)(d.PY1.div,{variants:z,ref:g,role:N?"dialog":void 0,"aria-modal":N?"true":void 0,"aria-labelledby":N?h:void 0,"aria-describedby":N&&s?p:void 0,tabIndex:-1,className:(0,k.cn)("relative z-10 w-full rounded-lg border bg-card text-card-foreground shadow-lg outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",w&&"flex max-h-[min(90vh,760px)] flex-col overflow-hidden",o),children:w?(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsxs)("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-border/70 px-5 py-4",children:[(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsx)("h2",{id:h,className:"truncate text-lg font-semibold tracking-tight",children:e}),s&&(0,n.jsx)("div",{id:p,className:"text-sm leading-5 text-muted-foreground",children:s})]}),(0,n.jsx)(C,{"aria-label":`關閉${e}`,onClick:f,disabled:m,className:"mt-0.5 shrink-0 p-1",children:(0,n.jsx)(O.A,{className:"size-4"})})]}),!i&&(0,n.jsx)("h2",{id:h,className:"sr-only",children:e}),(0,n.jsx)("div",{className:(0,k.cn)("min-h-0 flex-1 overflow-y-auto px-5 py-4",u),children:t}),a&&(0,n.jsx)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/70 bg-muted/20 px-5 py-3",children:a})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{id:h,className:"sr-only",children:e}),t]})})]})}let J={running:{label:"執行中",icon:_.A,tone:"text-warning",spin:!0},completed:{label:"已完成",icon:D.A,tone:"text-primary"},error:{label:"失敗",icon:u.A,tone:"text-destructive"}};function Q({text:e}){let[t,s]=(0,r.useState)(!1);return(0,n.jsxs)("button",{type:"button",onClick:()=>{"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{s(!0),window.setTimeout(()=>s(!1),1500)})},title:"複製",className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(L.A,{className:"size-3"}),t?"已複製":"複製"]})}function Z({label:e,text:t,defaultOpen:s,markdown:a=!1}){let[i,l]=(0,r.useState)(!!s),o=(0,r.useId)();return(0,n.jsxs)("div",{className:"rounded-md border border-border/40 bg-muted/30",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-1",children:[(0,n.jsxs)("button",{type:"button","aria-expanded":i,"aria-controls":o,onClick:()=>l(e=>!e),className:"inline-flex items-center gap-1 rounded-sm text-xs font-medium text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[i?(0,n.jsx)(j.A,{className:"size-3"}):(0,n.jsx)(M.A,{className:"size-3"}),e]}),i&&(0,n.jsx)(Q,{text:t})]}),i&&(a?(0,n.jsx)("div",{id:o,className:"border-t border-border/40",children:(0,n.jsx)(G,{source:t,compact:!0,className:"max-h-60 overflow-auto bg-transparent px-2.5 py-2 text-foreground/90"})}):(0,n.jsx)("pre",{id:o,className:"max-h-60 overflow-auto whitespace-pre-wrap break-words border-t border-border/40 px-2.5 py-2 text-xs leading-relaxed text-foreground/90",children:t}))]})}function ee({run:e,index:t}){let s=J[e.status],r=s.icon,a=0===t||"running"===e.status;return(0,n.jsxs)("li",{className:"rounded-lg border border-border/40 bg-card p-3 text-card-foreground",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,n.jsx)(r,{className:(0,k.cn)("size-4 shrink-0",s.tone,s.spin&&"animate-spin")}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 truncate text-base font-medium",children:[e.subagentType||"子代理",e.description?(0,n.jsxs)("span",{className:"ml-1 font-normal text-muted-foreground",children:["\xb7 ",e.description]}):null]}),(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 text-xs font-medium",s.tone),children:s.label})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(Z,{label:"Prompt",text:e.prompt,defaultOpen:a}),"running"!==e.status&&null!=e.result&&(0,n.jsx)(Z,{label:"結果",text:e.result,markdown:!0})]})]})}function et({open:e,taskId:t,taskTitle:s,runs:r,onClose:a}){return(0,n.jsx)(l.N,{children:e&&(0,n.jsx)(q,{title:"子代理",description:s,onClose:a,showHeader:!0,motionVariant:"drawer",className:"justify-end p-0",contentClassName:"flex h-full max-h-none max-w-md flex-col rounded-none border-l",bodyClassName:"p-4",children:0===r.length?(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-center text-base text-muted-foreground",children:"這個任務尚未衍生任何子代理"}):(0,n.jsx)("ul",{className:"space-y-3",children:r.map((e,t)=>(0,n.jsx)(ee,{run:e,index:t},e.id))})},`sub-agent-drawer-${t}`)})}var es=s(54903),en=s(19897),er=s(72752),ea=s(55985),ei=s(98201),el=s(55713),eo=s(41336),ec=s(50405),ed=s(6510),eu=s(1445),em=s(37763),ex=s(15344);let ef=(0,s(24779).F)("inline-flex items-center justify-center gap-2 whitespace-nowrap text-base font-medium transition-colors active:scale-95 motion-reduce:transform-none disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",{variants:{variant:{default:"rounded-full bg-primary text-primary-foreground hover:bg-primary/90",destructive:"rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"rounded-lg border bg-background hover:bg-accent hover:text-accent-foreground",secondary:"rounded-lg bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"rounded-lg hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),eh=r.forwardRef(({className:e,variant:t,size:s,...r},a)=>(0,n.jsx)("button",{ref:a,className:(0,k.cn)(ef({variant:t,size:s,className:e})),...r}));function ep(e){return new Promise((t,s)=>{let n=new FileReader;n.onload=()=>{if("string"!=typeof n.result)return void s(Error(`無法讀取附件:${e.name}`));let r=n.result.indexOf(",");r<0?s(Error(`無法解析附件:${e.name}`)):t({name:e.name,mime:e.type||"application/octet-stream",dataBase64:n.result.slice(r+1)})},n.onerror=()=>s(n.error??Error(`無法讀取附件:${e.name}`)),n.readAsDataURL(e)})}function eg(e){return Promise.all(Array.from(e).map(ep))}function eb(){return window.vibeflow??null}async function ej(){let e=eb();return e?e.getState():null}async function ev(e){let t=eb();t&&await t.setBoard(e)}async function eN(e){let t=eb();return t?t.setSettings(e):null}async function ey(){let e=eb();return e?e.getGithubAuthStatus():null}async function ek(){let e=eb();e&&await e.startGithubAuthLogin()}async function ew(){let e=eb();e&&await e.cancelGithubAuthLogin()}async function eC(){let e=eb();return e?e.logoutGithubAuth():null}function eS(e){return window.prompt(e)?.trim()||null}async function eA(){return eb()?eS("輸入專案資料夾的絕對路徑"):null}async function ez(e){let t=eb();return t?t.getGitInfo(e):null}async function eE(){let e=eb();return e?e.listRecentProjects():[]}async function eI(e){let t=eb();return t?t.initRepository(e):null}async function eP(){let e=eb();return e?e.detectAgents():[]}async function eT(e,t=!1){let s=eb();return s?s.listAgentModels(e,t):null}async function e$(e){let t=eb();return t?t.createTask(e):null}async function eR(e){let t=eb();return t?t.updateTask(e):null}async function eB(e){let t=eb();return t?t.resetTaskRun(e):null}async function e_(e){let t=eb();return t?t.getDiff(e):[]}async function eD(e,t){let s=eb();return s?s.getDiffEntries(e,t):[]}async function eL(e,t){let s=eb();return s?s.getDiffFile(e,t):null}async function eM(e){let t=eb();return t?t.listArtifacts(e):[]}async function eF(e,t){let s=eb();return s?s.readArtifact(e,t):null}async function eG(e){let t=eb();return t?t.openArtifactsDir(e):"bridge unavailable"}async function eO(e){let t=eb();return t?t.getSpecs(e):[]}async function eH(e){return eb()?eS("skill"===e?"輸入 skill 目錄的絕對路徑(需含 SKILL.md)":`輸入 ${e} 檔案的絕對路徑`):null}async function eV(){let e=eb();return e?e.listLibrary():[]}async function eY(e,t){let s=eb();return s?s.importLibraryEntry({kind:e,sourcePath:t}):null}async function eK(e,t,s,n){let r=eb();return r?r.createLibraryEntry({kind:e,name:t,content:s,description:n}):null}async function eW(e,t){let s=eb();return s?s.readLibraryEntry({kind:e,name:t}):null}async function eU(e,t,s){let n=eb();return n?n.updateLibraryEntry({kind:e,name:t,content:s}):null}async function eX(e,t,s){let n=eb();return!!n&&n.setLibraryEntryEnabled({kind:e,name:t,enabled:s})}async function eq(e,t){let s=eb();return!!s&&s.deleteLibraryEntry({kind:e,name:t})}async function eJ(e){let t=eb();return t?t.restoreBuiltinSkill({name:e}):null}async function eQ(){let e=eb();return e?e.listRemovedBuiltinSkills():[]}async function eZ(e){let t=eb();t&&await t.openExternal(e)}async function e0(e){let t=eb();return t?t.cleanupTask(e):null}async function e1(e){let t=eb();return t?t.deleteTask(e):null}async function e5(e){let t=eb();return t?t.attachments.write(e):[]}async function e2(e){let t=eb();return t?t.term.start(e):null}function e3(e,t){eb()?.term.input(e,t)}async function e4(e){await eb()?.term.scrollToBottom(e)}async function e6(e){let t=eb();return!!t&&t.term.sessionExists(e)}eh.displayName="Button";var e8=s(9036),e7=s(7640),e9=s(62607);function te(e,t){t&&e.writeln(`⏳ ${t}`)}function tt(e,t){let s=t instanceof Error?t.message:String(t);e.writeln(`\r
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9845],{2908:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>s$});var n=s(26514),r=s(75834),a=s(24322),i=s.n(a),l=s(18690),o=s(80527),c=s(67297),d=s(5026),u=s(29334),m=s(71520),x=s(44416),f=s(58629),h=s(17329),p=s(70170),g=s(87854),b=s(78999),j=s(85781),v=s(38031),N=s(74567);let y="text-xs font-semibold uppercase tracking-wider text-muted-foreground";var k=s(4416);let w={default:"text-muted-foreground hover:bg-accent hover:text-foreground",primary:"text-muted-foreground hover:bg-accent hover:text-primary",danger:"text-muted-foreground hover:bg-destructive/15 hover:text-destructive"},C=r.forwardRef(({className:e,children:t,tone:s="default",type:r="button",...a},i)=>(0,n.jsx)("button",{ref:i,type:r,className:(0,k.cn)("inline-flex shrink-0 items-center justify-center rounded-full p-1.5 transition-colors outline-none active:scale-95 motion-reduce:transform-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100 [&_svg]:pointer-events-none",w[s],e),...a,children:t}));C.displayName="IconButton";let S=["backlog","in_progress","done"],A={backlog:"Backlog",in_progress:"In Progress",done:"Done"},z={backlog:"bg-muted-foreground/60",in_progress:"bg-warning animate-pulse",done:"bg-success"};function E(e){if(e.projectName)return e.projectName;let t=(e.projectPath??"").split(/[/\\]/).filter(Boolean);return t[t.length-1]??"未指定專案"}function I(e,t){let s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!e)return;let n=e=>{s.current?.contains(e.target)||t()},r=e=>{"Escape"===e.key&&t()};return window.addEventListener("mousedown",n),window.addEventListener("keydown",r),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("keydown",r)}},[e,t]),s}let P="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors motion-reduce:transition-none";function T({task:e,anchor:t,onEdit:s,onDelete:a,onClose:i}){let[l,o]=(0,r.useState)(!1),c=I(!0,i),d=Math.max(8,Math.min(t.right-208,window.innerWidth-208-8)),u=Math.max(8,Math.min(t.top,window.innerHeight-224));return(0,n.jsxs)("div",{ref:c,role:"menu",style:{top:u,left:d},onClick:e=>e.stopPropagation(),className:"fixed z-50 w-52 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg",children:[s&&(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{s(),i()},className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"hover:bg-accent hover:text-accent-foreground"),children:[(0,n.jsx)(m.A,{className:"size-3.5 shrink-0"}),"編輯任務"]}),l?(0,n.jsxs)("div",{className:"flex items-center gap-1 rounded-sm bg-destructive/10 p-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>o(!1),className:"rounded-sm px-2 py-1 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50",children:"取消"}),(0,n.jsx)("button",{type:"button",onClick:()=>{a(),i()},className:"ml-auto rounded-sm px-2 py-1 text-sm font-medium text-destructive outline-none transition-colors motion-reduce:transition-none hover:bg-destructive/15 focus-visible:ring-[3px] focus-visible:ring-ring/50",children:"確認刪除"})]}):(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>o(!0),className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"text-destructive hover:bg-destructive/15"),title:`刪除任務「${e.title}」(清理 worktree)`,children:[(0,n.jsx)(x.A,{className:"size-3.5 shrink-0"}),"刪除任務"]})]})}function $({task:e,column:t,subAgentCount:s,selected:a,onSelect:i,onEdit:l,onDelete:o}){let c=(0,r.useRef)(null),[d,u]=(0,r.useState)(null),m=null!==d,x="done"===t;return(0,n.jsxs)("div",{ref:c,role:"button",tabIndex:0,"aria-label":`開啟任務:${e.title}`,onClick:i,onKeyDown:e=>{e.target!==e.currentTarget||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),i())},className:(0,k.cn)("relative cursor-pointer rounded-md border bg-card p-3 outline-none transition-colors motion-reduce:transition-none focus-visible:ring-[3px] focus-visible:ring-ring/50",x&&"bg-card/60",a?"border-primary shadow-[0_0_0_2px] shadow-primary/20":"border-border hover:border-input"),children:[(0,n.jsxs)("div",{className:"group/head flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(f.A,{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:E(e)}),x?(0,n.jsxs)("span",{className:"flex shrink-0 items-center gap-1 rounded-xs bg-primary/15 px-1.5 py-0.5 font-medium text-primary",children:[(0,n.jsx)(h.A,{className:"size-2.5"}),"complete"]}):(0,n.jsxs)(n.Fragment,{children:[e.effort&&(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-xs bg-secondary px-1.5 py-0.5 font-medium",m?"hidden":"group-hover/head:hidden"),children:e.effort}),(0,n.jsx)(C,{"aria-label":`任務選項:${e.title}`,title:"移動、編輯或刪除",onClick:e=>{if(e.stopPropagation(),m)return void u(null);let t=c.current?.getBoundingClientRect();t&&u({top:t.top+32,right:t.right-4})},className:(0,k.cn)("size-5 p-0.5",m?"flex":"hidden group-hover/head:flex"),children:(0,n.jsx)(p.A,{className:"size-3.5"})})]})]}),(0,n.jsx)("div",{className:"mt-2",title:e.title,children:(0,n.jsx)("span",{className:(0,k.cn)("line-clamp-2 text-[15px] font-medium leading-[1.4]",x?"text-muted-foreground":"text-foreground"),children:e.title})}),(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,n.jsx)(g.A,{className:"size-3 shrink-0"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 truncate",title:"backlog"!==t||e.worktreePath?void 0:"分支會在開始執行時建立",children:[e.branch,"backlog"===t&&!e.worktreePath&&(0,n.jsx)("span",{className:"text-muted-foreground/70",children:"(開始時建立)"})]}),"in_progress"===t&&s>0&&(0,n.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,n.jsx)(b.A,{className:"size-3"}),s]})]}),"backlog"===t&&e.launchError&&(0,n.jsxs)("p",{className:"mt-1.5 truncate text-xs text-destructive",title:e.launchError,children:["開始失敗:",e.launchError]}),d&&(0,n.jsx)(T,{task:e,anchor:d,onEdit:l,onDelete:o,onClose:()=>u(null)})]})}function R({projects:e,value:t,onChange:s}){let[a,i]=(0,r.useState)(!1),l=I(a,()=>i(!1));return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":a,onClick:()=>i(e=>!e),className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(f.A,{className:"size-3.5 shrink-0 text-muted-foreground"}),t??"所有專案",(0,n.jsx)(j.A,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),a&&(0,n.jsx)("div",{ref:l,role:"menu",className:"absolute left-0 top-8 z-20 w-56 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg",children:[null,...e].map(e=>(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{s(e),i(!1)},className:(0,k.cn)("focus-visible:ring-[3px] focus-visible:ring-ring/50",P,"hover:bg-accent hover:text-accent-foreground"),children:[(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e??"所有專案"}),e===t&&(0,n.jsx)(v.A,{className:"size-3 shrink-0"})]},e??"__all__"))})]})}function B({board:e,subAgents:t,selectedTaskId:s,onSelectTask:a,onEditTask:i,onDeleteTask:l,onNewTask:o}){let[c,d]=(0,r.useState)(null),u=[...e.backlog,...e.in_progress,...e.done],m=Array.from(new Set(u.map(E))).sort((e,t)=>e.localeCompare(t)),x=c&&m.includes(c)?c:null,f=u.length;return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[(0,n.jsxs)("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-5",children:[(0,n.jsx)(R,{projects:m,value:x,onChange:d}),(0,n.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[f," 個任務 \xb7 ",m.length," 個專案"]})]}),(0,n.jsx)("div",{className:"grid min-h-0 flex-1 grid-cols-3 gap-4 overflow-hidden px-5 pb-4 pt-3",children:S.map(r=>{let c=x?e[r].filter(e=>E(e)===x):e[r];return(0,n.jsxs)("section",{className:"flex min-h-0 flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2 px-1",children:[(0,n.jsx)("span",{className:(0,k.cn)("size-1.5 shrink-0 rounded-full",z[r])}),(0,n.jsx)("h2",{className:(0,k.cn)(y,"in_progress"===r&&"text-warning"),children:A[r]}),(0,n.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground/80",children:c.length})]}),(0,n.jsxs)("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto rounded-md p-1",children:[c.map(e=>(0,n.jsx)($,{task:e,column:r,subAgentCount:(t[e.id]??[]).length,selected:e.id===s,onSelect:()=>a(e.id),onEdit:"backlog"===r?()=>i(e.id):void 0,onDelete:()=>l(e.id)},e.id)),"backlog"===r&&(0,n.jsxs)("button",{type:"button",onClick:o,className:"flex w-full items-center justify-center gap-1.5 rounded-md px-3 py-2.5 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(N.A,{className:"size-3.5"}),"新增任務"]}),0===c.length&&"backlog"!==r&&(0,n.jsx)("p",{className:"px-2 py-1 text-sm text-muted-foreground/60",children:"尚無任務"})]})]},r)})})]})}var _=s(78141),D=s(26392),L=s(85320),M=s(37055);let F=(0,r.lazy)(()=>Promise.all([s.e(7045),s.e(7915)]).then(s.bind(s,37915)));function G({source:e,compact:t=!1,className:s}){return(0,n.jsx)("div",{className:(0,k.cn)("prose max-w-none break-words rounded-md bg-muted/30 p-3 text-muted-foreground",t?"prose-xs":"prose-sm",s),children:(0,n.jsx)(r.Suspense,{fallback:null,children:(0,n.jsx)(F,{source:e,compact:t})})})}var O=s(72975),H=s(41487);let V=0,Y={micro:.12,standard:.16,spatial:.18},K={enter:[.2,0,0,1],exit:[.4,0,1,1]};function W(e,t,s,n=Y[e]){return{duration:t?.01:n,ease:K[s]}}function U({timing:e,enterDuration:t,initialOpacity:s=0,transform:n,reducedMotion:r}){return{hidden:{opacity:s,...r?{}:n??{}},visible:{opacity:1,...r?{}:{...n?.x===void 0?{}:{x:0},...n?.y===void 0?{}:{y:0},...n?.scale===void 0?{}:{scale:1}},transition:W(e,r,"enter",t)}}}function X({timing:e,enterDuration:t,initialOpacity:s,exitTiming:n="micro",exitDuration:r,transform:a,exitTransform:i=a,reducedMotion:l}){return{...U({timing:e,enterDuration:t,initialOpacity:s,transform:a,reducedMotion:l}),exit:{opacity:0,...l?{}:i??{},transition:W(n,l,"exit",r)}}}function q({title:e,children:t,description:s,footer:a,showHeader:i=!1,className:l,contentClassName:o,bodyClassName:u,saving:m=!1,motionVariant:x="dialog",onClose:f}){let h=(0,r.useId)(),p=(0,r.useId)(),g=(0,r.useRef)(null),b=(0,r.useRef)("u">typeof document&&document.activeElement instanceof HTMLElement?document.activeElement:null),j=(0,r.useRef)(f),v=(0,r.useRef)(m),N=(0,H.tF)(),y=(0,c.I)()??!1,w=i||void 0!==s||void 0!==a||void 0!==u,S="drawer"===x,A=X({timing:"micro",enterDuration:.14,reducedMotion:y}),z=X({timing:S?"spatial":"standard",exitTiming:"micro",exitDuration:S?.14:void 0,transform:S?{x:16}:{scale:.98},reducedMotion:y});return(0,r.useEffect)(()=>{j.current=f,v.current=m},[f,m]),(0,r.useEffect)(()=>{let e;return V+=1,e=!1,()=>{e||(e=!0,V-=1)}},[]),(0,r.useEffect)(()=>{if(!N)return;g.current?.focus();let e=e=>{if("Escape"!==e.key||v.current)return;let t=document.querySelectorAll('[role="dialog"][aria-modal="true"]');t[t.length-1]===g.current&&j.current()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),b.current?.focus()}},[N]),(0,n.jsxs)(d.PY1.div,{initial:"hidden",animate:"visible",exit:"exit",inert:!N,"aria-hidden":!N||void 0,"data-dialog-state":N?"present":"exiting",className:(0,k.cn)("fixed inset-0 z-50 flex items-center justify-center p-4",!N&&"pointer-events-none",l),children:[(0,n.jsx)(d.PY1.div,{variants:A,className:"absolute inset-0 bg-background/80",onClick:m||!N?void 0:f}),(0,n.jsx)(d.PY1.div,{variants:z,ref:g,role:N?"dialog":void 0,"aria-modal":N?"true":void 0,"aria-labelledby":N?h:void 0,"aria-describedby":N&&s?p:void 0,tabIndex:-1,className:(0,k.cn)("relative z-10 w-full rounded-lg border bg-card text-card-foreground shadow-lg outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",w&&"flex max-h-[min(90vh,760px)] flex-col overflow-hidden",o),children:w?(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsxs)("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-border/70 px-5 py-4",children:[(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsx)("h2",{id:h,className:"truncate text-lg font-semibold tracking-tight",children:e}),s&&(0,n.jsx)("div",{id:p,className:"text-sm leading-5 text-muted-foreground",children:s})]}),(0,n.jsx)(C,{"aria-label":`關閉${e}`,onClick:f,disabled:m,className:"mt-0.5 shrink-0 p-1",children:(0,n.jsx)(O.A,{className:"size-4"})})]}),!i&&(0,n.jsx)("h2",{id:h,className:"sr-only",children:e}),(0,n.jsx)("div",{className:(0,k.cn)("min-h-0 flex-1 overflow-y-auto px-5 py-4",u),children:t}),a&&(0,n.jsx)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/70 bg-muted/20 px-5 py-3",children:a})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{id:h,className:"sr-only",children:e}),t]})})]})}let J={running:{label:"執行中",icon:_.A,tone:"text-warning",spin:!0},completed:{label:"已完成",icon:D.A,tone:"text-primary"},error:{label:"失敗",icon:u.A,tone:"text-destructive"}};function Q({text:e}){let[t,s]=(0,r.useState)(!1);return(0,n.jsxs)("button",{type:"button",onClick:()=>{"u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{s(!0),window.setTimeout(()=>s(!1),1500)})},title:"複製",className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)(L.A,{className:"size-3"}),t?"已複製":"複製"]})}function Z({label:e,text:t,defaultOpen:s,markdown:a=!1}){let[i,l]=(0,r.useState)(!!s),o=(0,r.useId)();return(0,n.jsxs)("div",{className:"rounded-md border border-border/40 bg-muted/30",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-1",children:[(0,n.jsxs)("button",{type:"button","aria-expanded":i,"aria-controls":o,onClick:()=>l(e=>!e),className:"inline-flex items-center gap-1 rounded-sm text-xs font-medium text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[i?(0,n.jsx)(j.A,{className:"size-3"}):(0,n.jsx)(M.A,{className:"size-3"}),e]}),i&&(0,n.jsx)(Q,{text:t})]}),i&&(a?(0,n.jsx)("div",{id:o,className:"border-t border-border/40",children:(0,n.jsx)(G,{source:t,compact:!0,className:"max-h-60 overflow-auto bg-transparent px-2.5 py-2 text-foreground/90"})}):(0,n.jsx)("pre",{id:o,className:"max-h-60 overflow-auto whitespace-pre-wrap break-words border-t border-border/40 px-2.5 py-2 text-xs leading-relaxed text-foreground/90",children:t}))]})}function ee({run:e,index:t}){let s=J[e.status],r=s.icon,a=0===t||"running"===e.status;return(0,n.jsxs)("li",{className:"rounded-lg border border-border/40 bg-card p-3 text-card-foreground",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,n.jsx)(r,{className:(0,k.cn)("size-4 shrink-0",s.tone,s.spin&&"animate-spin")}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 truncate text-base font-medium",children:[e.subagentType||"子代理",e.description?(0,n.jsxs)("span",{className:"ml-1 font-normal text-muted-foreground",children:["\xb7 ",e.description]}):null]}),(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 text-xs font-medium",s.tone),children:s.label})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(Z,{label:"Prompt",text:e.prompt,defaultOpen:a}),"running"!==e.status&&null!=e.result&&(0,n.jsx)(Z,{label:"結果",text:e.result,markdown:!0})]})]})}function et({open:e,taskId:t,taskTitle:s,runs:r,onClose:a}){return(0,n.jsx)(l.N,{children:e&&(0,n.jsx)(q,{title:"子代理",description:s,onClose:a,showHeader:!0,motionVariant:"drawer",className:"justify-end p-0",contentClassName:"flex h-full max-h-none max-w-md flex-col rounded-none border-l",bodyClassName:"p-4",children:0===r.length?(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-center text-base text-muted-foreground",children:"這個任務尚未衍生任何子代理"}):(0,n.jsx)("ul",{className:"space-y-3",children:r.map((e,t)=>(0,n.jsx)(ee,{run:e,index:t},e.id))})},`sub-agent-drawer-${t}`)})}var es=s(54903),en=s(19897),er=s(72752),ea=s(55985),ei=s(98201),el=s(55713),eo=s(41336),ec=s(50405),ed=s(6510),eu=s(1445),em=s(37763),ex=s(15344);let ef=(0,s(24779).F)("inline-flex items-center justify-center gap-2 whitespace-nowrap text-base font-medium transition-colors active:scale-95 motion-reduce:transform-none disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",{variants:{variant:{default:"rounded-full bg-primary text-primary-foreground hover:bg-primary/90",destructive:"rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"rounded-lg border bg-background hover:bg-accent hover:text-accent-foreground",secondary:"rounded-lg bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"rounded-lg hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),eh=r.forwardRef(({className:e,variant:t,size:s,...r},a)=>(0,n.jsx)("button",{ref:a,className:(0,k.cn)(ef({variant:t,size:s,className:e})),...r}));function ep(e){return new Promise((t,s)=>{let n=new FileReader;n.onload=()=>{if("string"!=typeof n.result)return void s(Error(`無法讀取附件:${e.name}`));let r=n.result.indexOf(",");r<0?s(Error(`無法解析附件:${e.name}`)):t({name:e.name,mime:e.type||"application/octet-stream",dataBase64:n.result.slice(r+1)})},n.onerror=()=>s(n.error??Error(`無法讀取附件:${e.name}`)),n.readAsDataURL(e)})}function eg(e){return Promise.all(Array.from(e).map(ep))}function eb(){return window.vibeflow??null}async function ej(){let e=eb();return e?e.getState():null}async function ev(e){let t=eb();t&&await t.setBoard(e)}async function eN(e){let t=eb();return t?t.setSettings(e):null}async function ey(){let e=eb();return e?e.getGithubAuthStatus():null}async function ek(){let e=eb();e&&await e.startGithubAuthLogin()}async function ew(){let e=eb();e&&await e.cancelGithubAuthLogin()}async function eC(){let e=eb();return e?e.logoutGithubAuth():null}function eS(e){return window.prompt(e)?.trim()||null}async function eA(e="選擇資料夾"){let t=eb();if(!t)return null;try{let s=await t.pickFolder({title:e});if("path"in s)return s.path;if("canceled"in s)return null}catch{}return eS("輸入資料夾的絕對路徑")}async function ez(e){let t=eb();return t?t.getGitInfo(e):null}async function eE(){let e=eb();return e?e.listRecentProjects():[]}async function eI(e){let t=eb();return t?t.initRepository(e):null}async function eP(){let e=eb();return e?e.detectAgents():[]}async function eT(e,t=!1){let s=eb();return s?s.listAgentModels(e,t):null}async function e$(e){let t=eb();return t?t.createTask(e):null}async function eR(e){let t=eb();return t?t.updateTask(e):null}async function eB(e){let t=eb();return t?t.resetTaskRun(e):null}async function e_(e){let t=eb();return t?t.getDiff(e):[]}async function eD(e,t){let s=eb();return s?s.getDiffEntries(e,t):[]}async function eL(e,t){let s=eb();return s?s.getDiffFile(e,t):null}async function eM(e){let t=eb();return t?t.listArtifacts(e):[]}async function eF(e,t){let s=eb();return s?s.readArtifact(e,t):null}async function eG(e){let t=eb();return t?t.openArtifactsDir(e):"bridge unavailable"}async function eO(e){let t=eb();return t?t.getSpecs(e):[]}async function eH(e){return eb()?eS("skill"===e?"輸入 skill 目錄的絕對路徑(需含 SKILL.md)":`輸入 ${e} 檔案的絕對路徑`):null}async function eV(){let e=eb();return e?e.listLibrary():[]}async function eY(e,t){let s=eb();return s?s.importLibraryEntry({kind:e,sourcePath:t}):null}async function eK(e,t,s,n){let r=eb();return r?r.createLibraryEntry({kind:e,name:t,content:s,description:n}):null}async function eW(e,t){let s=eb();return s?s.readLibraryEntry({kind:e,name:t}):null}async function eU(e,t,s){let n=eb();return n?n.updateLibraryEntry({kind:e,name:t,content:s}):null}async function eX(e,t,s){let n=eb();return!!n&&n.setLibraryEntryEnabled({kind:e,name:t,enabled:s})}async function eq(e,t){let s=eb();return!!s&&s.deleteLibraryEntry({kind:e,name:t})}async function eJ(e){let t=eb();return t?t.restoreBuiltinSkill({name:e}):null}async function eQ(){let e=eb();return e?e.listRemovedBuiltinSkills():[]}async function eZ(e){let t=eb();t&&await t.openExternal(e)}async function e0(e){let t=eb();return t?t.cleanupTask(e):null}async function e1(e){let t=eb();return t?t.deleteTask(e):null}async function e5(e){let t=eb();return t?t.attachments.write(e):[]}async function e2(e){let t=eb();return t?t.term.start(e):null}function e3(e,t){eb()?.term.input(e,t)}async function e4(e){await eb()?.term.scrollToBottom(e)}async function e6(e){let t=eb();return!!t&&t.term.sessionExists(e)}eh.displayName="Button";var e8=s(9036),e7=s(7640),e9=s(62607);function te(e,t){t&&e.writeln(`⏳ ${t}`)}function tt(e,t){let s=t instanceof Error?t.message:String(t);e.writeln(`\r
2
2
  ⚠️ 無法開始執行:${s}`)}function ts({taskId:e,sessionKey:t,cwd:a,launchCommand:i,launchNonce:l=0,provisionNotice:o=null,readOnly:c=!1,onReturnToBacklog:d,onLaunchAgent:u,onInteract:m}){let x=t??e,f=(0,r.useRef)(null),h=(0,r.useRef)(null),p=(0,r.useRef)(0),[g,b]=(0,r.useState)(!1),[j,v]=(0,r.useState)(!1),[N,y]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(!1),[z,E]=(0,r.useState)(!1),I=(0,r.useRef)(!1),P=(0,r.useRef)(-1),T=(0,r.useRef)(!1),$=(0,r.useRef)(i),R=(0,r.useRef)(l);$.current=i,R.current=l;let B=(0,r.useRef)(a);B.current=a;let _=(0,r.useRef)(c),D=(0,r.useRef)(o);D.current=o;let L=(0,r.useRef)(m);L.current=m;let M=(0,r.useCallback)(t=>{let s=B.current,n=h.current;s&&(I.current=!1,T.current=!0,n&&te(n,D.current),e2({taskId:e,sessionKey:x,launch:t,cols:n?.cols,rows:n?.rows}).then(()=>{I.current=!0,h.current?.focus()}).catch(e=>{T.current=!1,h.current&&tt(h.current,e)}))},[e,x]),F=(0,r.useCallback)(()=>{let t=B.current,s=h.current;t&&s&&null!==eb()&&!_.current&&(I.current=!1,T.current=!1,e2({taskId:e,sessionKey:x,cols:s.cols,rows:s.rows}).then(()=>{I.current=!0,s.focus()}))},[e,x]),G=(0,r.useCallback)(async()=>{let e=h.current;if(e&&d&&!_.current){L.current?.(),y(!0);try{if(!await d())return;e.reset(),e.clear(),F(),e.focus()}catch(s){let t=s instanceof Error?s.message:String(s);e.writeln(`\r
3
3
  ⚠️ 退回 Backlog 失敗:${t}`)}finally{y(!1)}}},[d,F]),O=(0,r.useCallback)(async()=>{let e=h.current;if(e&&u&&!_.current){L.current?.(),C(!0),e.reset(),e.clear();try{await u(),e.focus()}catch(s){let t=s instanceof Error?s.message:String(s);e.writeln(`\r
4
4
  ⚠️ 啟動 Agent 失敗:${t}`)}finally{C(!1)}}},[u]),H=(0,r.useCallback)(()=>{if(!I.current||_.current)return;let e=$.current;if(!e)return;let t=R.current;P.current!==t&&(P.current=t,M(e))},[M]);(0,r.useEffect)(()=>{_.current=c,h.current&&(h.current.options.disableStdin=c)},[c]),(0,r.useEffect)(()=>{let t,n,r,a,i,l,o=!1;return I.current=!1,(async()=>{let c,{Terminal:d}=await s.e(3779).then(s.bind(s,15167)),{FitAddon:u}=await s.e(5695).then(s.bind(s,95695));if(o||!f.current)return;let m=new d({fontSize:12,fontFamily:'Menlo, Monaco, "Courier New", monospace',cursorBlink:!0,disableStdin:_.current,theme:{background:"#191919",foreground:"#e6e6e6",cursor:"#4c9bf5",cursorAccent:"#191919",selectionBackground:"rgba(76, 155, 245, 0.30)",selectionForeground:"#ededed",black:"#3b3b3b",red:"#f0716a",green:"#4ec98a",yellow:"#e2b341",blue:"#4c9bf5",magenta:"#c58af9",cyan:"#4dd0e1",white:"#c8c8c8",brightBlack:"#6e6e6e",brightRed:"#ff8b84",brightGreen:"#6bdfa3",brightYellow:"#f2c862",brightBlue:"#7db8ff",brightMagenta:"#d7a6ff",brightCyan:"#72e0ee",brightWhite:"#ffffff"}}),p=new u;m.loadAddon(p),m.open(f.current);let g=()=>{p.fit();let e=m.element?.querySelector(".xterm-screen"),t=m.element?.querySelector(".xterm-viewport");if(!e||!t)return;let s=function(e,t,s){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(s)||e<=2||t<=0||s<=0||t<=s)return e;let n=Math.ceil((t-s)/(t/e));return Math.max(2,e-n)}(m.cols,e.getBoundingClientRect().width,t.clientWidth);s!==m.cols&&m.resize(s,m.rows)};if(h.current=m,await document.fonts.ready,await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),o||h.current!==m)return;g();let b=window.vibeflow;if(!b)return m.writeln("⚠️ 未連線到 VibeFlow core,無法開啟終端。");if(_.current)return m.writeln("ℹ️ 任務已完成 — 終端為唯讀,僅供查閱訊息。");if(!B.current)return m.writeln("⚠️ 尚未設定工作目錄,請先選擇專案或建立任務。");let j=_.current?null:$.current;j&&(P.current=R.current),T.current=!!j,j&&te(m,D.current);try{c=await b.term.start({taskId:e,sessionKey:x,launch:j??void 0,cols:m.cols,rows:m.rows})}catch(e){T.current=!1,tt(m,e);return}let{scrollback:v}=c;v&&m.write(v),t=b.term.onData(({sessionKey:e,data:t})=>{e===x&&m.write(t)}),n=b.term.onExit(({sessionKey:e,exitCode:t,intentional:s})=>{if(e!==x||s)return;let n=T.current;if(T.current=!1,!n){I.current=!1,m.writeln(`\r
@@ -9,4 +9,4 @@ name: ${t}
9
9
  description:
10
10
  ---
11
11
 
12
- `}function sa({onEditingChange:e}){let[t,s]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[l,o]=(0,r.useState)(null),[c,d]=(0,r.useState)(null),[u,m]=(0,r.useState)(null),[f,h]=(0,r.useState)(null),[p,g]=(0,r.useState)([]),[b,j]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{let[e,t]=await Promise.all([eV(),eQ()]);s(e),g(t),i(!1)},[]);(0,r.useEffect)(()=>{v()},[v]),(0,r.useEffect)(()=>{e?.(null!==f)},[f,e]);let w=async(e,t)=>{o(e),d(null);try{await t(),await v()}catch(e){d(e instanceof Error?e.message:String(e))}finally{o(null)}};return f?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:f.entry.name}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"skill"===f.entry.kind?"編輯 SKILL.md。frontmatter 的 name 與 description 兩個 CLI 都會讀。":"編輯檔案內容。"})]}),(0,n.jsx)("textarea",{value:f.content,onChange:e=>h({...f,content:e.target.value}),rows:18,spellCheck:!1,className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),c&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:c}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>h(null),children:"取消"}),(0,n.jsx)(eh,{size:"sm",onClick:()=>void(()=>{if(!f)return;let{entry:e,content:t}=f;return w(`save:${e.key}`,async()=>{await eU(e.kind,e.name,t),h(null)})})(),disabled:null!==l,children:"儲存"})]})]}):(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"啟用的項目會在每次啟動任務時自動投遞:Claude 以 session-only plugin 載入,Codex 以 VibeFlow 組出的 CODEX_HOME 載入。本機與專案自己的 skill 仍會照常載入,這裡的項目是額外加上去的。"}),c&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:c}),ss.map(({id:e,label:s,hint:r})=>{let i=t.filter(t=>t.kind===e),o=sn[e];return(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:(0,k.cn)(y,"flex items-center gap-2"),children:[(0,n.jsx)(o,{className:"size-3.5"}),s,(0,n.jsx)("span",{className:"tabular-nums text-muted-foreground/70",children:i.length})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`import:${e}`,async()=>{let t=await eH(e);t&&await eY(e,t)})},disabled:null!==l,children:[l===`import:${e}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(se.A,{className:"size-3.5"}),"Import"]}),(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>m({kind:e,name:"",content:sr(e,""),description:""}),disabled:null!==l,children:[(0,n.jsx)(N.A,{className:"size-3.5"}),"新建"]})]})]}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:r}),u?.kind===e&&(0,n.jsxs)("div",{className:"space-y-2 rounded-md border border-border/60 p-3",children:[(0,n.jsx)("input",{autoFocus:!0,value:u.name,onChange:t=>{let s=t.target.value;m({...u,name:s,content:u.content===sr(e,u.name)?sr(e,s):u.content})},placeholder:"skill"===e?"skill 名稱(目錄名)":"檔名,如 house-rules.md",className:(0,k.cn)(tD,"font-mono text-sm")}),"skill"!==e&&(0,n.jsx)("input",{value:u.description,onChange:e=>m({...u,description:e.target.value}),placeholder:"用途說明(scripts 會寫進 prompt 給 agent 判斷)",className:(0,k.cn)(tD,"text-sm")}),(0,n.jsx)("textarea",{value:u.content,onChange:e=>m({...u,content:e.target.value}),rows:8,spellCheck:!1,placeholder:"skill"===e?"":"內容",className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>m(null),children:"取消"}),(0,n.jsx)(eh,{size:"sm",onClick:()=>void(()=>{if(!u)return;let{kind:e,name:t,content:s,description:n}=u;return w("create",async()=>{await eK(e,t,s,n.trim()||void 0),m(null)})})(),disabled:null!==l||0===u.name.trim().length,children:"建立"})]})]}),a?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"讀取中…"}):0===i.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"尚無項目。"}):(0,n.jsx)("div",{className:"grid gap-2",children:i.map(e=>(0,n.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[(0,n.jsx)("input",{type:"checkbox",checked:e.enabled,onChange:t=>void w(`toggle:${e.key}`,()=>eX(e.kind,e.name,t.target.checked)),"aria-label":`啟用 ${e.name}`,className:"mt-1 size-4 shrink-0 rounded-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 font-mono text-sm",children:[(0,n.jsx)("span",{className:"truncate",children:e.name}),e.builtin&&(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 font-sans text-xs text-muted-foreground",children:"內建"}),e.builtin?.updateAvailable?(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-primary/15 px-1.5 font-sans text-xs text-primary",children:"有新版"}):e.builtin?.modified?(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 font-sans text-xs text-muted-foreground",children:"已修改"}):null]}),e.description&&(0,n.jsx)("p",{className:"line-clamp-2 text-sm text-muted-foreground",title:e.description,children:e.description}),e.sourcePath&&(0,n.jsxs)("p",{className:"truncate text-xs text-muted-foreground/70",children:["來源:",e.sourcePath]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`open:${e.key}`,async()=>{h({entry:e,content:await eW(e.kind,e.name)??""})})},disabled:null!==l,children:"編輯"}),e.builtin?.modified&&(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>{var t;b!==(t=e.name)?j(t):(j(null),w(`restore:${t}`,()=>eJ(t)))},onBlur:()=>j(null),disabled:null!==l,title:"以 VibeFlow 出貨的版本覆蓋(會丟掉你的修改)",children:[l===`restore:${e.name}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(st.A,{className:"size-3.5"}),b===e.name?"確定覆蓋?":"還原預設"]}),e.sourcePath&&(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`reimport:${e.key}`,async()=>{e.sourcePath&&await eY(e.kind,e.sourcePath)})},disabled:null!==l,title:"從來源重新複製一份快照",children:l===`reimport:${e.key}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(em.A,{className:"size-3.5"})}),(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>void w(`delete:${e.key}`,()=>eq(e.kind,e.name)),disabled:null!==l,title:"從 library 刪除",children:(0,n.jsx)(x.A,{className:"size-3.5 text-destructive"})})]})]},e.key))})]},e)}),p.length>0&&(0,n.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:["已移除的內建 skill:",p.map(e=>(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>void w(`restore:${e}`,()=>eJ(e)),disabled:null!==l,title:"放回 VibeFlow 出貨的版本",children:[(0,n.jsx)(st.A,{className:"size-3.5"}),e]},e))]})]})}let si=[{id:"claude",name:"Claude Code"},{id:"codex",name:"Codex CLI"}],sl={builtin:"內建清單","codex-cache":"Codex 本機快取","codex-cli":"Codex CLI"};function so({open:e,systemPrompt:t,workstationPath:s,autoMode:a,saving:i,error:o,onSave:c,onPickFolder:d,onClose:m}){let[x,f]=(0,r.useState)(""),[h,p]=(0,r.useState)(""),[g,b]=(0,r.useState)(!0),[j,v]=(0,r.useState)({}),[N,y]=(0,r.useState)(null),[w,C]=(0,r.useState)(void 0),[S,A]=(0,r.useState)(!1),[z,E]=(0,r.useState)(null),[I,P]=(0,r.useState)("idle"),[T,$]=(0,r.useState)(""),[R,B]=(0,r.useState)("https://github.com/login/device"),[L,M]=(0,r.useState)(null),[F,G]=(0,r.useState)(!1),[O,H]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(f(t),p(s),b(a),A(!1),P("idle"),$(""),M(null),H(!1),ey().then(E))},[e,t,s,a]),(0,r.useEffect)(()=>{if(!e)return;let t=!1;for(let e of(v({}),C(void 0),eP().then(e=>e.map(e=>e.id)).catch(()=>null).then(e=>{t||C(e)}),si))eT(e.id).catch(()=>null).then(s=>{t||v(t=>({...t,[e.id]:s}))});return()=>{t=!0}},[e]);let V=async e=>{y(e);try{let t=await eT(e,!0).catch(()=>null);v(s=>({...s,[e]:t}))}finally{y(null)}};(0,r.useEffect)(()=>{if(e){var t;let e;return t=e=>{if("starting"===e.type){P("starting"),M(null);return}if("code"===e.type){P("waiting"),$(e.code),B(e.url),H(!1),G(!1);return}if("success"===e.type){E(e.status),P("success"),G(!1);return}if("cancelled"===e.type){P("idle"),G(!1);return}P("error"),M(e.error),G(!1)},(e=eb())?e.onGithubAuthEvent(t):()=>{}}},[e]);let[Y,K]=(0,r.useState)(!1),[W,U]=(0,r.useState)(!1),X=x.trim(),J=""===X,Q=!i&&!S,Z=async()=>{let e=await d();e&&p(e)},ee=async()=>{A(!0),P("starting"),$(""),M(null),H(!1),G(!0);try{await ek()}catch(e){P("error"),M(e instanceof Error?e.message:String(e)),G(!1)}},et=async()=>{("starting"===I||"waiting"===I)&&await ew(),A(!1),P("idle"),G(!1),$(""),M(null),H(!1),E(await ey())},es=async()=>{G(!0),M(null);try{let e=await eC();E(e)}catch(e){M(e instanceof Error?e.message:String(e))}finally{G(!1)}},er=()=>{S&&("starting"===I||"waiting"===I)&&ew(),m()},ea=async()=>{T&&(await navigator.clipboard.writeText(T),H(!0),window.setTimeout(()=>H(!1),1500))};return(0,n.jsx)(l.N,{children:e&&(0,n.jsx)(q,{title:S?"登入 GitHub CLI":Y?"Library":"設定",description:S?"使用 GitHub CLI 的網頁授權流程登入 github.com。":Y?"VibeFlow 自有的 skill / prompt / script,啟動任務時投遞給 Claude 與 Codex。":"調整 system prompt 與 agent 帳號連線。",saving:i||F,onClose:er,showHeader:!0,contentClassName:"max-w-2xl",footer:S?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>void et(),disabled:F&&"success"!==I,children:"success"===I?"完成":"返回"}),"error"===I&&(0,n.jsx)(eh,{size:"sm",onClick:()=>void ee(),children:"重新登入"})]}):Y?W?null:(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>K(!1),children:[(0,n.jsx)(t3.A,{className:"size-3.5"}),"返回設定"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:er,disabled:i,children:"取消"}),(0,n.jsxs)(eh,{size:"sm",onClick:()=>{Q&&c(X,h.trim(),g)},disabled:!Q,className:(0,k.cn)(i&&"opacity-80"),children:[i&&(0,n.jsx)(_.A,{className:"animate-spin"}),i?"儲存中…":"儲存設定"]})]}),children:S?(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void et(),disabled:F&&"success"!==I,className:"inline-flex items-center gap-1.5 rounded-sm text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50",children:[(0,n.jsx)(t3.A,{className:"size-4"}),"返回設定"]}),(0,n.jsx)("div",{className:"rounded-md border border-border/60 p-3",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:["success"===I?(0,n.jsx)(D.A,{className:"mt-0.5 size-5 shrink-0 text-success"}):"error"===I?(0,n.jsx)(u.A,{className:"mt-0.5 size-5 shrink-0 text-destructive"}):(0,n.jsx)(_.A,{className:"mt-0.5 size-5 shrink-0 animate-spin text-muted-foreground"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:"success"===I?"GitHub CLI 已完成授權":"error"===I?"GitHub CLI 授權失敗":"waiting"===I?"等待 GitHub 授權完成":"正在啟動 GitHub CLI 登入"}),(0,n.jsx)("p",{className:"text-sm leading-5 text-muted-foreground",children:"success"===I?`目前登入帳號:${z?.login??"GitHub"}`:"error"===I?L:"waiting"===I?"請複製授權碼並開啟 GitHub 授權頁,完成後 VibeFlow 會自動更新狀態。":"VibeFlow 正在背景準備 gh auth login。"})]})]})}),("waiting"===I||T)&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("label",{className:"block space-y-1.5",children:[(0,n.jsx)("span",{className:"text-base font-medium",children:"授權碼"}),(0,n.jsxs)("div",{className:"flex rounded-md border bg-background focus-within:ring-[3px] focus-within:ring-ring/50",children:[(0,n.jsx)("input",{readOnly:!0,value:T,className:"min-w-0 flex-1 bg-transparent px-3 py-2 font-mono text-base tracking-wider outline-none"}),(0,n.jsxs)("button",{type:"button",onClick:()=>void ea(),className:"flex h-9 items-center gap-1.5 rounded-r-md px-3 text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset disabled:opacity-50",disabled:!T,children:[(0,n.jsx)(t4.A,{className:"size-4"}),O?"已複製":"複製"]})]})]}),(0,n.jsxs)("label",{className:"block space-y-1.5",children:[(0,n.jsx)("span",{className:"text-base font-medium",children:"登入網址"}),(0,n.jsxs)("div",{className:"flex rounded-md border bg-background focus-within:ring-[3px] focus-within:ring-ring/50",children:[(0,n.jsx)("input",{readOnly:!0,value:R,className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-base outline-none"}),(0,n.jsxs)("button",{type:"button",onClick:()=>void eZ(R),className:"flex h-9 items-center gap-1.5 rounded-r-md px-3 text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,n.jsx)(en.A,{className:"size-4"}),"開啟"]})]})]})]})]}):Y?(0,n.jsx)(sa,{onEditingChange:U}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)(tH,{value:g,onChange:b}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"新卡片的預設值;每張卡片可在建立或編輯時各自調整。"})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)("span",{className:"text-base font-medium",children:["工作站資料夾",(0,n.jsx)("span",{className:(0,k.cn)("ml-2 rounded-xs px-1.5 py-0.5 text-xs font-medium",""===h.trim()?"bg-secondary text-secondary-foreground":"bg-primary/15 text-primary"),children:""===h.trim()?"預設(~/Desktop)":"已自訂"})]})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("input",{name:"workstation-path",autoComplete:"off",spellCheck:!1,value:h,placeholder:"~/Desktop",onChange:e=>p(e.target.value),className:(0,k.cn)(tD,"font-mono text-sm")}),(0,n.jsx)(eh,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>void Z(),children:"選擇資料夾"})]}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["每個任務的 worktree 與執行期檔案會建立在 ","<工作站>/<專案名>/"," 底下;留空則預設為 ~/Desktop。"]})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)("span",{className:"text-base font-medium",children:["System Prompt",(0,n.jsx)("span",{className:(0,k.cn)("ml-2 rounded-xs px-1.5 py-0.5 text-xs font-medium",J?"bg-secondary text-secondary-foreground":"bg-primary/15 text-primary"),children:J?"未設定":"已自訂"})]})}),(0,n.jsx)("textarea",{name:"system-prompt",autoComplete:"off",value:x,onChange:e=>f(e.target.value),rows:10,spellCheck:!1,className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"啟動 Agent 時會以此 prompt 作為 system prompt;留空則只帶入任務專屬的 Artifact 設定。"})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:"Library"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"VibeFlow 自有的 skill / prompt / script。啟用的項目會在啟動任務時自動投遞給 Claude 與 Codex,不必依賴本機的 ~/.claude 或 ~/.codex 佈局。"})]}),(0,n.jsxs)(eh,{variant:"secondary",size:"sm",onClick:()=>K(!0),children:[(0,n.jsx)(t6.A,{className:"size-3.5"}),"管理 Library"]})]}),(0,n.jsxs)("section",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:"CLI 與帳號設定"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Model 清單直接取自已登入的 Agent CLI,不需要 API key;設定 GitHub CLI 以支援本機 GitHub 操作。"})]}),(0,n.jsxs)("div",{className:"grid gap-2",children:[si.map(e=>{let t=j[e.id],s=Array.isArray(w)&&!w.includes(e.id),r=void 0===w||!s&&(void 0===t||N===e.id);return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[r?(0,n.jsx)(_.A,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):s?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-muted-foreground"}):t?.error||!t?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-destructive"}):(0,n.jsx)(D.A,{className:"size-4 shrink-0 text-success"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:e.name}),(0,n.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:void 0===w?"偵測 CLI…":s?`未安裝・PATH 中找不到 ${e.id} 指令`:void 0===t?"讀取 model 清單…":t?`${t.models.length} 個 models 可用・來源:${sl[t.source]}`:"無法取得 model 清單"}),!s&&t?.error&&(0,n.jsx)("p",{className:"truncate text-sm text-destructive",title:t.error,children:t.error})]}),"codex"===e.id&&!s&&void 0!==w&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 w-8 p-0",disabled:N===e.id,"aria-label":"向 Codex CLI 重新取得 model 清單",title:"向 Codex CLI 重新取得 model 清單",onClick:()=>void V(e.id),children:(0,n.jsx)(em.A,{className:(0,k.cn)("size-4",N===e.id&&"animate-spin")})})]},e.id)}),(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[z?.authenticated?(0,n.jsx)(D.A,{className:"size-4 shrink-0 text-success"}):z?.error?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-destructive"}):(0,n.jsx)("span",{className:"size-4 shrink-0 rounded-full border border-muted-foreground/50"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:"GitHub CLI"}),(0,n.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:z?.authenticated?`${z.login??"GitHub"} 已授權(${z.gitProtocol??"https"})`:z?.installed===!1?"找不到 GitHub CLI(gh)":z?.error?z.error:"尚未授權"})]}),z?.authenticated&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2",disabled:F,onClick:()=>void ee(),children:"切換使用者"}),z?.authenticated&&(0,n.jsxs)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2",disabled:F,onClick:()=>void es(),children:[F?(0,n.jsx)(_.A,{className:"size-4 animate-spin"}):(0,n.jsx)(t8.A,{className:"size-4"}),"登出"]}),!z?.authenticated&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"outline",disabled:z?.installed===!1||F,onClick:()=>void ee(),children:F?"啟動中…":"登入"})]})]}),L&&!S&&(0,n.jsx)("p",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-2 text-base",children:L})]}),o&&(0,n.jsx)("p",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-2 text-base",children:o})]})},"settings-dialog")})}var sc=s(93202),sd=s(51256),su=s(27955),sm=s(26814),sx=s(6684),sf=s(76750),sh=s(80136);function sp(e){return e.projectName||function(e){if(!e)return"";let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}(e.projectPath)||"Unassigned"}let sg={in_progress:0,backlog:1,done:2};function sb(e){return e.hasSelected||e.tasks.some(e=>"done"!==e.column)}let sj={backlog:"Backlog",in_progress:"In Progress",done:"Done"};function sv({entry:e,selected:t,onSelectTask:s}){let r=(0,c.I)()??!1,a="done"===e.column?null:"in_progress"===e.column?{className:"text-warning",pillClassName:"bg-warning/10 text-warning",icon:(0,n.jsx)("span",{className:"flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)("span",{className:"size-1.5 rounded-full bg-warning animate-pulse"})})}:{className:"text-muted-foreground",pillClassName:"bg-muted-foreground/10 text-muted-foreground",icon:(0,n.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})};return(0,n.jsxs)(d.PY1.button,{"data-selected-task":t||void 0,type:"button",onClick:()=>s(e.task.id),whileTap:r?void 0:{scale:.99,opacity:.9},transition:{duration:r?0:Y.micro,ease:K.enter},className:(0,k.cn)("flex w-full min-w-0 items-center gap-1.5 rounded-md px-2 py-1 text-left text-sm transition-colors motion-reduce:transition-none outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",t?"bg-primary/15 font-medium text-primary":"done"===e.column?"text-muted-foreground/60 hover:bg-accent/50 hover:text-muted-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:e.task.title,children:[(0,n.jsx)("span",{className:(0,k.cn)("flex size-3 shrink-0 items-center justify-center",a?.className),children:a?.icon}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.task.title}),a?(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full px-1.5 py-0.5 text-xs font-medium",a.pillClassName),children:sj[e.column]}):null]})}function sN({id:e,project:t,selectedTaskId:s,onSelectTask:r}){let a=(0,H.tF)(),i=(0,c.I)()??!1;return(0,n.jsx)(d.PY1.div,{id:e,initial:"hidden",animate:"visible",exit:"exit",variants:X({timing:"standard",exitTiming:"micro",transform:{y:-4},reducedMotion:i}),inert:!a,"aria-hidden":!a||void 0,className:(0,k.cn)("ml-3 space-y-0.5",!a&&"pointer-events-none"),children:0===t.tasks.length?(0,n.jsx)("p",{className:"px-2 py-0.5 text-sm text-muted-foreground/60",children:"尚無任務"}):t.tasks.map(e=>(0,n.jsx)(sv,{entry:e,selected:e.task.id===s,onSelectTask:r},e.task.id))})}function sy({project:e,expanded:t,selectedTaskId:s,onToggle:a,onSelectTask:i,onNewTaskForProject:o,onDeleteProject:c}){let d=(0,r.useId)();return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:(0,k.cn)("group flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-muted-foreground transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground",e.hasSelected&&"text-foreground"),children:[(0,n.jsxs)("button",{type:"button","aria-expanded":t,"aria-controls":d,onClick:a,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",title:e.path??e.name,children:[t?(0,n.jsx)(j.A,{className:"size-3 shrink-0"}):(0,n.jsx)(M.A,{className:"size-3 shrink-0"}),(0,n.jsx)(ed.A,{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.name})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground group-hover:hidden",children:e.tasks.length}),(0,n.jsxs)("div",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[(0,n.jsx)(C,{"aria-label":`在 ${e.name} 新增任務`,title:"在此專案新增任務",onClick:()=>o(e.path),className:"p-0.5",children:(0,n.jsx)(N.A,{className:"size-3"})}),(0,n.jsx)(C,{"aria-label":`刪除專案 ${e.name}`,title:"刪除整個專案(含所有任務)",tone:"danger",onClick:()=>c(e.name,e.tasks.map(e=>e.task.id)),className:"p-0.5",children:(0,n.jsx)(x.A,{className:"size-3"})})]})]}),(0,n.jsx)(l.N,{initial:!1,children:t&&(0,n.jsx)(sN,{id:d,project:e,selectedTaskId:s,onSelectTask:i},e.key)})]})}function sk({mode:e,className:t,children:s}){let r=(0,c.I)()??!1;return(0,n.jsx)(d.PY1.div,{initial:"hidden",animate:"visible",variants:U({timing:"micro",reducedMotion:r}),className:t,children:s},e)}function sw({collapsed:e,onRemoteShare:t,remoteActive:s,onOpenSettings:r}){return e?(0,n.jsxs)(sk,{mode:"collapsed",className:"flex flex-col items-center gap-1 border-t border-border p-2",children:[t&&(0,n.jsx)(C,{"aria-label":"遠端控制",onClick:t,title:"遠端控制",className:(0,k.cn)("size-8",s&&"text-primary hover:text-primary"),children:(0,n.jsx)(sc.A,{className:"size-4"})}),(0,n.jsx)(C,{"aria-label":"設定 System Prompt",onClick:r,title:"設定(System Prompt)",className:"size-8",children:(0,n.jsx)(sd.A,{className:"size-4"})})]}):(0,n.jsx)(sk,{mode:"expanded",className:"border-t border-border p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1 px-1",children:[t&&(0,n.jsx)(C,{"aria-label":"遠端控制",onClick:t,title:"遠端控制",className:(0,k.cn)(s?"text-primary hover:text-primary":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(sc.A,{className:"size-4"})}),(0,n.jsx)(C,{"aria-label":"設定 System Prompt",onClick:r,title:"設定(System Prompt)",children:(0,n.jsx)(sd.A,{className:"size-4"})})]})})}function sC({value:e,onChange:t}){return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(su.A,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,n.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:s=>{"Escape"===s.key&&e&&(s.preventDefault(),t(""))},placeholder:"搜尋任務","aria-label":"搜尋任務",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-7 text-sm text-foreground outline-none transition-colors motion-reduce:transition-none placeholder:text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50"}),e?(0,n.jsx)("button",{type:"button","aria-label":"清除搜尋",title:"清除搜尋",onClick:()=>t(""),className:"absolute right-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:(0,n.jsx)(O.A,{className:"size-3.5"})}):null]})}function sS({collapsed:e,onToggleCollapse:t,board:s,selectedTaskId:a,onSelectTask:i,onNewTask:l,onNewTaskForProject:o,onDeleteProject:u,onRemoteShare:m,remoteActive:x,onOpenSettings:f}){let[h,p]=(0,r.useState)({}),[g,b]=(0,r.useState)(""),j=(0,c.I)()??!1,v=U({timing:"micro",reducedMotion:j}),w=g.trim().toLowerCase(),S=!e&&w.length>0,A=function(e,t){var s;let n=new Map;for(let r of[...e.in_progress.map(e=>({task:e,column:"in_progress"})),...e.backlog.map(e=>({task:e,column:"backlog"})),...e.done.map(e=>({task:e,column:"done"}))]){let e=(s=r.task).projectPath||`name:${sp(s)}`,a=n.get(e)??{key:e,name:sp(r.task),path:r.task.projectPath??null,tasks:[],total:0,hasSelected:!1};a.tasks.push(r),a.total+=1,a.hasSelected||=r.task.id===t,n.set(e,a)}for(let e of n.values())e.tasks=[...e.tasks].sort((e,t)=>{var s,n;let r=sg[e.column]-sg[t.column];return 0!==r?r:(s=e.task,n=t.task,s.createdAt===n.createdAt?0:void 0===s.createdAt?1:void 0===n.createdAt?-1:n.createdAt-s.createdAt)});return Array.from(n.values()).sort((e,t)=>e.name.localeCompare(t.name))}(s,a),z=S?A.map(e=>({...e,tasks:e.tasks.filter(e=>e.task.title.toLowerCase().includes(w))})).filter(e=>e.tasks.length>0):A,E=A.map(e=>e.key).join(" ");(0,r.useEffect)(()=>{p(e=>{let t=!1,s={...e};for(let e of A)e.key in s||(s[e.key]=sb(e),t=!0);return t?s:e})},[E]);let I=e=>S||(h[e.key]??sb(e)),P=z.length>0&&z.every(e=>I(e));return(0,r.useEffect)(()=>{let e=document.querySelector("aside [data-selected-task]");e?.scrollIntoView({block:"nearest"})},[a]),(0,n.jsxs)(d.PY1.aside,{initial:!1,animate:{width:e?48:320},transition:{duration:j?0:Y.spatial,ease:K.enter},className:"flex flex-shrink-0 flex-col overflow-x-clip border-r border-border bg-card text-card-foreground",children:[(0,n.jsxs)("div",{className:(0,k.cn)("flex h-12 shrink-0 items-center border-b border-border px-3",e?"justify-center":"justify-between"),children:[!e&&(0,n.jsxs)(d.PY1.span,{initial:"hidden",animate:"visible",variants:v,className:"flex items-center gap-2 text-[15px] font-semibold tracking-tight text-foreground",children:[(0,n.jsx)("img",{src:"/logo.svg",alt:"",className:"size-5"}),"VibeFlow"]}),(0,n.jsx)(C,{"aria-label":e?"展開選單":"收合選單",onClick:t,title:e?"展開選單":"收合選單",className:"group p-1",children:e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("img",{src:"/logo.svg",alt:"",className:"size-5 group-hover:hidden group-focus-visible:hidden"}),(0,n.jsx)(sm.A,{className:"hidden size-4 group-hover:block group-focus-visible:block"})]}):(0,n.jsx)(sx.A,{className:"size-4"})})]}),(0,n.jsx)(sk,{mode:e?"collapsed":"expanded",className:(0,k.cn)("shrink-0 px-2 pt-3",e?"flex justify-center":"w-full"),children:e?(0,n.jsx)(C,{"aria-label":"新增任務",onClick:l,title:"新增任務",className:"size-8 p-1.5",children:(0,n.jsx)(N.A,{className:"size-4"})}):(0,n.jsxs)(eh,{size:"sm",className:"w-full rounded-md active:scale-95",onClick:l,children:[(0,n.jsx)(N.A,{}),"新增任務"]})}),!e&&(0,n.jsx)(sk,{mode:"expanded",className:"shrink-0 px-2 pt-2",children:(0,n.jsx)(sC,{value:g,onChange:b})}),(0,n.jsx)("div",{className:(0,k.cn)("flex flex-1 flex-col py-3",e?"overflow-hidden":"overflow-y-auto"),children:(0,n.jsx)("div",{className:"px-2",children:e?null:(0,n.jsxs)(d.PY1.div,{initial:"hidden",animate:"visible",variants:v,children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-1 px-2",children:[(0,n.jsx)("span",{className:y,children:"Projects"}),!S&&z.length>0&&(0,n.jsx)(C,{"aria-label":P?"全部收合":"全部展開",title:P?"全部收合":"全部展開",onClick:()=>{let e=!P;p(t=>{let s={...t};for(let t of z)s[t.key]=e;return s})},className:"ml-auto p-0.5",children:P?(0,n.jsx)(sf.A,{className:"size-3.5"}):(0,n.jsx)(sh.A,{className:"size-3.5"})})]}),(0,n.jsx)("div",{className:"space-y-1",children:0===z.length?(0,n.jsx)("p",{className:"px-2 py-1 text-sm text-muted-foreground",children:S?"找不到符合的任務":"尚無任務"}):z.map(e=>{let t=I(e);return(0,n.jsx)(sy,{project:e,expanded:t,selectedTaskId:a,onToggle:()=>p(s=>({...s,[e.key]:!t})),onSelectTask:i,onNewTaskForProject:o,onDeleteProject:u},e.key)})})]},"expanded-projects")})}),(0,n.jsx)(sw,{collapsed:e,onRemoteShare:m,remoteActive:x,onOpenSettings:f})]})}function sA({entries:e,activeTaskId:t,onSelect:s,onPin:r,onClose:a}){return 0===e.length?null:(0,n.jsx)("div",{className:"flex h-9 shrink-0 items-stretch overflow-x-auto overflow-y-hidden border-b border-border bg-card/40",children:e.map(e=>{let i=e.taskId===t;return(0,n.jsxs)("div",{className:(0,k.cn)("group flex h-full min-w-0 max-w-52 shrink-0 items-center gap-1 border-r border-border/60 pl-3 pr-1.5 transition-colors motion-reduce:transition-none",i?"bg-background text-foreground":"text-muted-foreground hover:bg-accent/40 hover:text-foreground"),children:[(0,n.jsxs)("button",{type:"button","aria-current":i?"page":void 0,title:e.title,onClick:()=>s(e.taskId),onDoubleClick:()=>r(e.taskId),onAuxClick:t=>{1===t.button&&a(e.taskId)},className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-sm py-0.5 text-left text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)("span",{className:(0,k.cn)("size-1.5 shrink-0 rounded-full","in_progress"===e.column?"bg-warning animate-pulse":"bg-muted-foreground/50")}),(0,n.jsx)("span",{className:(0,k.cn)("min-w-0 truncate",e.preview&&"italic"),children:e.title})]}),(0,n.jsx)("button",{type:"button","aria-label":`關閉分頁 ${e.title}`,title:"關閉分頁(執行中的 agent 會繼續在背景執行)",onClick:()=>a(e.taskId),className:(0,k.cn)("flex size-5 shrink-0 items-center justify-center rounded-sm outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:opacity-100",i?"opacity-100":"opacity-0 group-hover:opacity-100"),children:(0,n.jsx)(O.A,{className:"size-3"})})]},e.taskId)})})}var sz=s(4504);function sE({roomCode:e,peerCount:t,onClose:a,onStop:i}){let l=`https://vibe-flow-remote.vercel.app/?room=${e}`,[o,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=!0;return s.e(167).then(s.t.bind(s,20167,19)).then(({default:t})=>{t.toDataURL(l,{width:240,margin:2}).then(t=>{e&&c(t)})}),()=>{e=!1}},[l]),(0,n.jsxs)(q,{title:"遠端控制",onClose:a,showHeader:!0,contentClassName:"max-w-xs",children:[(0,n.jsx)("div",{className:"mb-4 flex justify-center",children:o?(0,n.jsx)("img",{src:o,alt:"QR Code",width:200,height:200,className:"rounded-md"}):(0,n.jsx)("div",{className:"flex h-[200px] w-[200px] items-center justify-center rounded-md bg-muted",children:(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"生成中…"})})}),(0,n.jsxs)("div",{className:"mb-3 text-center",children:[(0,n.jsx)("p",{className:"mb-1 text-sm text-muted-foreground",children:"Room Code"}),(0,n.jsx)("p",{className:"font-mono text-3xl font-bold tracking-widest",children:e})]}),(0,n.jsxs)("div",{className:"mb-4 flex items-center justify-center gap-1.5 text-sm text-muted-foreground",children:[(0,n.jsx)(sz.A,{className:"size-3"}),(0,n.jsx)("span",{children:t>0?`${t} 台裝置已連線`:"等待裝置連線…"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(l),u(!0),setTimeout(()=>u(!1),2e3)},className:"flex flex-1 items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[d?(0,n.jsx)(v.A,{className:"size-3.5"}):(0,n.jsx)(L.A,{className:"size-3.5"}),d?"已複製":"複製連結"]}),(0,n.jsx)(eh,{size:"sm",variant:"destructive",onClick:i,children:"停止分享"})]})]})}function sI(e,t){return{capabilities:{createTask:!1},tasks:["backlog","in_progress","done"].flatMap(t=>e[t].map(e=>({id:e.id,title:e.title,description:e.description,projectName:e.projectName,column:t,launchedAt:e.launchedAt}))),workspaces:[],settings:{autoMode:t}}}let sP={backlog:[],in_progress:[],done:[]},sT=["in_progress","backlog","done"];function s$(){let[e,t]=(0,r.useState)(sP),[a,o]=(0,r.useState)({}),[c,d]=(0,r.useState)(!0),[m,x]=(0,r.useState)(""),[f,h]=(0,r.useState)(""),[p,g]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(null),[w,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(null),[z,E]=(0,r.useState)(null),[I,P]=(0,r.useState)(!1),[T,$]=(0,r.useState)(null),[R,B]=(0,r.useState)(!1),[D,L]=(0,r.useState)(!0),[M,F]=(0,r.useState)(null),[G,O]=(0,r.useState)([]),[H,V]=(0,r.useState)(null),[Y,K]=(0,r.useState)(0),[W,U]=(0,r.useState)(null),[X,J]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return ej().then(s=>{e&&(s&&(t(s.board),d(s.settings.autoMode),x(s.settings.systemPrompt??""),h(s.settings.workstationPath??"")),g(!0))}),()=>{e=!1}},[]),(0,r.useEffect)(()=>{var e;let t;return e=({taskId:e,subAgents:t})=>{o(s=>({...s,[e]:t}))},(t=eb())?t.onSubAgentsUpdate(e):()=>{}},[]),(0,r.useEffect)(()=>{var e;let s;return e=e=>{t(e.board),d(e.settings.autoMode),x(e.settings.systemPrompt??""),h(e.settings.workstationPath??"")},(s=eb())?s.onStateChanged(e):()=>{}},[]),(0,r.useEffect)(()=>{let t=new Set(Object.values(e).flat().map(e=>e.id));O(e=>e.every(e=>t.has(e.taskId))?e:e.filter(e=>t.has(e.taskId))),F(e=>e&&!t.has(e)?null:e)},[e]);let Q=(e,t)=>{O(s=>{let n=s.find(t=>t.taskId===e);if(n)return t?.pin&&n.preview?s.map(t=>t.taskId===e?{...t,preview:!1}:t):s;let r={taskId:e,preview:t?.pin!==!0},a=s.findIndex(e=>e.preview);if(r.preview&&-1!==a){let e=[...s];return e[a]=r,e}return[...s,r]}),F(e)},Z=e=>{O(t=>t.some(t=>t.taskId===e&&t.preview)?t.map(t=>t.taskId===e?{...t,preview:!1}:t):t)},ee=e=>{let t=new Set(e);if(M&&t.has(M)){let e=G.findIndex(e=>e.taskId===M),s=G.slice(e+1).find(e=>!t.has(e.taskId)),n=G.slice(0,Math.max(e,0)).reverse().find(e=>!t.has(e.taskId));F(s?.taskId??n?.taskId??null)}O(e=>e.filter(e=>!t.has(e.taskId)))},et=()=>{A(null),V(null),K(e=>e+1),F(null)},es=async(e,t,s)=>{N(!0),k(null);try{await eN({systemPrompt:e,workstationPath:t||void 0,autoMode:s}),x(e),h(t),d(s),j(!1)}catch(e){k(e instanceof Error?e.message:String(e))}finally{N(!1)}},en=async(e,s,n,r,a,i,l,o,c,d)=>{C(!0),A(null);try{let u=await e$({title:e,description:s,projectPath:n,baseBranch:r,branch:a||void 0,agentCli:i,model:l||void 0,effort:o,autoMode:c,attachments:d});u&&(t(u.state.board),Q(u.task.id,{pin:!0}))}catch(e){A(e instanceof Error?e.message:String(e))}finally{C(!1)}},er=async e=>{if(z){P(!0),$(null);try{let s=await eR({taskId:z.id,title:e.title,description:e.description,agentCli:e.agentCli,model:e.model||void 0,effort:e.effort,autoMode:e.autoMode,projectPath:e.projectPath,baseBranch:e.baseBranch,branch:e.branch});s&&t(s.board),E(null)}catch(e){$(e instanceof Error?e.message:String(e))}finally{P(!1)}}},ea=async e=>{let s=await e0(e);s&&t(s.board)},ei=async e=>{let s=await e1(e);s&&(t(s.board),ee([e]))},el=async()=>{if(W){J(!0);try{let e=null;for(let t of W.taskIds){let s=await e1(t);s&&(e=s.board)}e&&t(e),ee(W.taskIds),U(null)}finally{J(!1)}}},eo=G.flatMap(t=>{for(let s of sT){let n=e[s].find(e=>e.id===t.taskId);if(n)return[{...t,title:n.title,column:s}]}return[]}),ec=function({board:e,autoMode:t,onStateChange:n}){let[a,i]=(0,r.useState)(null),[l,o]=(0,r.useState)(0),c=(0,r.useRef)(new Set),d=(0,r.useRef)(new Map),u=(0,r.useRef)(e),m=(0,r.useRef)(t),x=(0,r.useRef)(n);async function f(e,t){if(!e||"object"!=typeof e)return;let{type:s,payload:n}=e;switch(s){case"client:get-state":try{t.send({type:"vf:state",payload:sI(u.current,m.current)})}catch{}break;case"client:send-command":{let{taskId:e,text:t}=n??{};if(!e||!t)break;e3(e,String(t).slice(0,1e3));break}case"client:subscribe-terminal":{let{taskId:e}=n??{};if(!e)break;let s=d.current.get(e);s||(s=new Set,d.current.set(e,s)),s.add(t);break}case"client:unsubscribe-terminal":{let{taskId:e}=n??{};e&&d.current.get(e)?.delete(t);break}case"client:move-task":{let{taskId:e,targetColumn:t}=n??{};if(!e||!t)break;let s=function(e,t,s){let n,r={...e};for(let e of["backlog","in_progress","done"]){let s=r[e].findIndex(e=>e.id===t);if(-1!==s){n=r[e][s],r[e]=r[e].filter(e=>e.id!==t);break}}return n?(r[s]=[n,...r[s]],r):e}(u.current,e,t);x.current(s),await ev(s)}}}return(0,r.useEffect)(()=>{u.current=e},[e]),(0,r.useEffect)(()=>{m.current=t},[t]),(0,r.useEffect)(()=>{x.current=n},[n]),(0,r.useEffect)(()=>{if(!c.current.size)return;let s=sI(e,t);for(let e of c.current)try{e.send({type:"vf:state",payload:s})}catch{}},[e,t]),(0,r.useEffect)(()=>{let e;if(!a)return;let t=!1;return async function(){let{Peer:n}=await s.e(1886).then(s.bind(s,11886));t||((e=new n(`vibeflow-${a}`)).on("connection",e=>{c.current.add(e),o(e=>e+1),e.on("open",()=>{(async()=>{try{e.send({type:"vf:hello",payload:{version:"1.0"}}),e.send({type:"vf:state",payload:sI(u.current,m.current)})}catch{}})()}),e.on("data",t=>{f(t,e)}),e.on("close",()=>{for(let[,t]of(c.current.delete(e),o(e=>e-1),d.current))t.delete(e)})}),e.on("error",e=>{console.error("[VibeFlow Remote] PeerJS error:",e)}))}(),()=>{for(let e of(t=!0,c.current))try{e.close()}catch{}c.current.clear(),d.current.clear(),o(0),e?.destroy()}},[a]),(0,r.useEffect)(()=>{if(a){var e;let t;return e=({sessionKey:e,data:t})=>{let s=e.split(":")[0],n=d.current.get(s);if(!n?.size)return;let r={type:"vf:terminal-chunk",payload:{taskId:s,data:t}};for(let e of n)try{e.send(r)}catch{}},(t=eb())?t.term.onData(e):()=>{}}},[a]),{roomCode:a,peerCount:l,startSharing:()=>{i(String(Math.floor(1e5+9e5*Math.random())))},stopSharing:()=>i(null)}}({board:e,autoMode:c,onStateChange:e=>{t(e),ev(e)}});return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(i(),{children:(0,n.jsx)("title",{children:"VibeFlow"})}),(0,n.jsx)("div",{className:"bg-background text-foreground",children:p?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,n.jsx)(sS,{collapsed:D,onToggleCollapse:()=>L(e=>!e),board:e,selectedTaskId:M,onSelectTask:Q,onNewTask:et,onNewTaskForProject:e=>{A(null),V(e),K(e=>e+1),F(null)},onDeleteProject:(e,t)=>{0!==t.length&&U({name:e,taskIds:t})},remoteActive:!!ec.roomCode,onOpenSettings:()=>{k(null),j(!0)}}),(0,n.jsx)("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:(0,n.jsx)("div",{className:"min-h-0 flex-1",children:(0,n.jsx)(t5,{tabBar:(0,n.jsx)(sA,{entries:eo,activeTaskId:M,onSelect:Q,onPin:Z,onClose:e=>ee([e])}),onSelectTask:Q,onNewTask:et,board:e,onBoardChange:e=>{t(e),ev(e)},onEditTask:t=>{$(null),e.backlog.some(e=>e.id===t)&&E(function(e,t){for(let s of Object.values(e)){let e=s.find(e=>e.id===t);if(e)return e}return null}(e,t))},onTaskDone:ea,onDeleteTask:ei,autoMode:c,workstationPath:f,subAgents:a,selectedTaskId:M,onTaskInteract:Z,openTabIds:G.map(e=>e.taskId),initialProjectPath:H,newTaskNonce:Y,creating:w,createError:S,pickFolder:eA,loadRecentProjects:eE,loadGitInfo:ez,initRepository:eI,detectAgents:eP,onCreateTask:en})})})]}),(0,n.jsx)(t2,{task:z,defaultAutoMode:c,detectAgents:eP,pickFolder:eA,loadRecentProjects:eE,loadGitInfo:ez,saving:I,error:T,onSubmit:er,onClose:()=>E(null)}),(0,n.jsx)(so,{open:b,systemPrompt:m,workstationPath:f,autoMode:c,saving:v,error:y,onSave:es,onPickFolder:eA,onClose:()=>j(!1)}),(0,n.jsx)(l.N,{children:w&&(0,n.jsx)(q,{title:"建立任務中",saving:!0,onClose:()=>{},contentClassName:"max-w-sm rounded-lg p-5",children:(0,n.jsx)("div",{className:"space-y-4",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("span",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary",children:(0,n.jsx)(_.A,{className:"size-5 animate-spin"})}),(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"正在建立 workspace"}),(0,n.jsx)("p",{className:"text-base leading-6 text-muted-foreground",children:"正在建立 git worktree、分支與任務資料。完成前請先不要切換或操作其他任務。"})]})]})})},"creating-task-dialog")}),(0,n.jsx)(l.N,{children:W&&(0,n.jsx)(q,{title:"刪除專案",saving:X,onClose:()=>{X||U(null)},contentClassName:"max-w-md rounded-lg p-5",children:(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("span",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:(0,n.jsx)(u.A,{className:"size-5"})}),(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsxs)("h2",{className:"text-lg font-semibold tracking-tight",children:["刪除專案「",W.name,"」?"]}),(0,n.jsxs)("p",{className:"text-base leading-6 text-muted-foreground",children:["這會刪除此專案底下的 ",W.taskIds.length," ","個任務,包含它們的 worktree、branch 與對話紀錄。此操作無法復原。"]})]})]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",className:"rounded-full",disabled:X,onClick:()=>U(null),children:"取消"}),(0,n.jsx)(eh,{variant:"destructive",size:"sm",className:"rounded-full active:scale-95 motion-reduce:transform-none",disabled:X,onClick:el,children:X?"刪除中…":"刪除專案"})]})]})},"delete-project-dialog")}),(0,n.jsx)(l.N,{children:R&&ec.roomCode&&(0,n.jsx)(sE,{roomCode:ec.roomCode,peerCount:ec.peerCount,onClose:()=>B(!1),onStop:()=>{ec.stopSharing(),B(!1)}},"remote-share-dialog")})]}):(0,n.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-background text-base text-muted-foreground",children:"載入中…"})})]})}},24464:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/home",function(){return s(2908)}])}},e=>{e.O(0,[2524,636,6593,8792],()=>e(e.s=24464)),_N_E=e.O()}]);
12
+ `}function sa({onEditingChange:e}){let[t,s]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[l,o]=(0,r.useState)(null),[c,d]=(0,r.useState)(null),[u,m]=(0,r.useState)(null),[f,h]=(0,r.useState)(null),[p,g]=(0,r.useState)([]),[b,j]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{let[e,t]=await Promise.all([eV(),eQ()]);s(e),g(t),i(!1)},[]);(0,r.useEffect)(()=>{v()},[v]),(0,r.useEffect)(()=>{e?.(null!==f)},[f,e]);let w=async(e,t)=>{o(e),d(null);try{await t(),await v()}catch(e){d(e instanceof Error?e.message:String(e))}finally{o(null)}};return f?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:f.entry.name}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"skill"===f.entry.kind?"編輯 SKILL.md。frontmatter 的 name 與 description 兩個 CLI 都會讀。":"編輯檔案內容。"})]}),(0,n.jsx)("textarea",{value:f.content,onChange:e=>h({...f,content:e.target.value}),rows:18,spellCheck:!1,className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),c&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:c}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>h(null),children:"取消"}),(0,n.jsx)(eh,{size:"sm",onClick:()=>void(()=>{if(!f)return;let{entry:e,content:t}=f;return w(`save:${e.key}`,async()=>{await eU(e.kind,e.name,t),h(null)})})(),disabled:null!==l,children:"儲存"})]})]}):(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"啟用的項目會在每次啟動任務時自動投遞:Claude 以 session-only plugin 載入,Codex 以 VibeFlow 組出的 CODEX_HOME 載入。本機與專案自己的 skill 仍會照常載入,這裡的項目是額外加上去的。"}),c&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:c}),ss.map(({id:e,label:s,hint:r})=>{let i=t.filter(t=>t.kind===e),o=sn[e];return(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:(0,k.cn)(y,"flex items-center gap-2"),children:[(0,n.jsx)(o,{className:"size-3.5"}),s,(0,n.jsx)("span",{className:"tabular-nums text-muted-foreground/70",children:i.length})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`import:${e}`,async()=>{let t=await eH(e);t&&await eY(e,t)})},disabled:null!==l,children:[l===`import:${e}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(se.A,{className:"size-3.5"}),"Import"]}),(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>m({kind:e,name:"",content:sr(e,""),description:""}),disabled:null!==l,children:[(0,n.jsx)(N.A,{className:"size-3.5"}),"新建"]})]})]}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:r}),u?.kind===e&&(0,n.jsxs)("div",{className:"space-y-2 rounded-md border border-border/60 p-3",children:[(0,n.jsx)("input",{autoFocus:!0,value:u.name,onChange:t=>{let s=t.target.value;m({...u,name:s,content:u.content===sr(e,u.name)?sr(e,s):u.content})},placeholder:"skill"===e?"skill 名稱(目錄名)":"檔名,如 house-rules.md",className:(0,k.cn)(tD,"font-mono text-sm")}),"skill"!==e&&(0,n.jsx)("input",{value:u.description,onChange:e=>m({...u,description:e.target.value}),placeholder:"用途說明(scripts 會寫進 prompt 給 agent 判斷)",className:(0,k.cn)(tD,"text-sm")}),(0,n.jsx)("textarea",{value:u.content,onChange:e=>m({...u,content:e.target.value}),rows:8,spellCheck:!1,placeholder:"skill"===e?"":"內容",className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>m(null),children:"取消"}),(0,n.jsx)(eh,{size:"sm",onClick:()=>void(()=>{if(!u)return;let{kind:e,name:t,content:s,description:n}=u;return w("create",async()=>{await eK(e,t,s,n.trim()||void 0),m(null)})})(),disabled:null!==l||0===u.name.trim().length,children:"建立"})]})]}),a?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"讀取中…"}):0===i.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"尚無項目。"}):(0,n.jsx)("div",{className:"grid gap-2",children:i.map(e=>(0,n.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[(0,n.jsx)("input",{type:"checkbox",checked:e.enabled,onChange:t=>void w(`toggle:${e.key}`,()=>eX(e.kind,e.name,t.target.checked)),"aria-label":`啟用 ${e.name}`,className:"mt-1 size-4 shrink-0 rounded-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 font-mono text-sm",children:[(0,n.jsx)("span",{className:"truncate",children:e.name}),e.builtin&&(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 font-sans text-xs text-muted-foreground",children:"內建"}),e.builtin?.updateAvailable?(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-primary/15 px-1.5 font-sans text-xs text-primary",children:"有新版"}):e.builtin?.modified?(0,n.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 font-sans text-xs text-muted-foreground",children:"已修改"}):null]}),e.description&&(0,n.jsx)("p",{className:"line-clamp-2 text-sm text-muted-foreground",title:e.description,children:e.description}),e.sourcePath&&(0,n.jsxs)("p",{className:"truncate text-xs text-muted-foreground/70",children:["來源:",e.sourcePath]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`open:${e.key}`,async()=>{h({entry:e,content:await eW(e.kind,e.name)??""})})},disabled:null!==l,children:"編輯"}),e.builtin?.modified&&(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>{var t;b!==(t=e.name)?j(t):(j(null),w(`restore:${t}`,()=>eJ(t)))},onBlur:()=>j(null),disabled:null!==l,title:"以 VibeFlow 出貨的版本覆蓋(會丟掉你的修改)",children:[l===`restore:${e.name}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(st.A,{className:"size-3.5"}),b===e.name?"確定覆蓋?":"還原預設"]}),e.sourcePath&&(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>{w(`reimport:${e.key}`,async()=>{e.sourcePath&&await eY(e.kind,e.sourcePath)})},disabled:null!==l,title:"從來源重新複製一份快照",children:l===`reimport:${e.key}`?(0,n.jsx)(_.A,{className:"size-3.5 animate-spin"}):(0,n.jsx)(em.A,{className:"size-3.5"})}),(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>void w(`delete:${e.key}`,()=>eq(e.kind,e.name)),disabled:null!==l,title:"從 library 刪除",children:(0,n.jsx)(x.A,{className:"size-3.5 text-destructive"})})]})]},e.key))})]},e)}),p.length>0&&(0,n.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:["已移除的內建 skill:",p.map(e=>(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>void w(`restore:${e}`,()=>eJ(e)),disabled:null!==l,title:"放回 VibeFlow 出貨的版本",children:[(0,n.jsx)(st.A,{className:"size-3.5"}),e]},e))]})]})}let si=[{id:"claude",name:"Claude Code"},{id:"codex",name:"Codex CLI"}],sl={builtin:"內建清單","codex-cache":"Codex 本機快取","codex-cli":"Codex CLI"};function so({open:e,systemPrompt:t,workstationPath:s,autoMode:a,saving:i,error:o,onSave:c,onPickFolder:d,onClose:m}){let[x,f]=(0,r.useState)(""),[h,p]=(0,r.useState)(""),[g,b]=(0,r.useState)(!0),[j,v]=(0,r.useState)({}),[N,y]=(0,r.useState)(null),[w,C]=(0,r.useState)(void 0),[S,A]=(0,r.useState)(!1),[z,E]=(0,r.useState)(null),[I,P]=(0,r.useState)("idle"),[T,$]=(0,r.useState)(""),[R,B]=(0,r.useState)("https://github.com/login/device"),[L,M]=(0,r.useState)(null),[F,G]=(0,r.useState)(!1),[O,H]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(f(t),p(s),b(a),A(!1),P("idle"),$(""),M(null),H(!1),ey().then(E))},[e,t,s,a]),(0,r.useEffect)(()=>{if(!e)return;let t=!1;for(let e of(v({}),C(void 0),eP().then(e=>e.map(e=>e.id)).catch(()=>null).then(e=>{t||C(e)}),si))eT(e.id).catch(()=>null).then(s=>{t||v(t=>({...t,[e.id]:s}))});return()=>{t=!0}},[e]);let V=async e=>{y(e);try{let t=await eT(e,!0).catch(()=>null);v(s=>({...s,[e]:t}))}finally{y(null)}};(0,r.useEffect)(()=>{if(e){var t;let e;return t=e=>{if("starting"===e.type){P("starting"),M(null);return}if("code"===e.type){P("waiting"),$(e.code),B(e.url),H(!1),G(!1);return}if("success"===e.type){E(e.status),P("success"),G(!1);return}if("cancelled"===e.type){P("idle"),G(!1);return}P("error"),M(e.error),G(!1)},(e=eb())?e.onGithubAuthEvent(t):()=>{}}},[e]);let[Y,K]=(0,r.useState)(!1),[W,U]=(0,r.useState)(!1),X=x.trim(),J=""===X,Q=!i&&!S,Z=async()=>{let e=await d();e&&p(e)},ee=async()=>{A(!0),P("starting"),$(""),M(null),H(!1),G(!0);try{await ek()}catch(e){P("error"),M(e instanceof Error?e.message:String(e)),G(!1)}},et=async()=>{("starting"===I||"waiting"===I)&&await ew(),A(!1),P("idle"),G(!1),$(""),M(null),H(!1),E(await ey())},es=async()=>{G(!0),M(null);try{let e=await eC();E(e)}catch(e){M(e instanceof Error?e.message:String(e))}finally{G(!1)}},er=()=>{S&&("starting"===I||"waiting"===I)&&ew(),m()},ea=async()=>{T&&(await navigator.clipboard.writeText(T),H(!0),window.setTimeout(()=>H(!1),1500))};return(0,n.jsx)(l.N,{children:e&&(0,n.jsx)(q,{title:S?"登入 GitHub CLI":Y?"Library":"設定",description:S?"使用 GitHub CLI 的網頁授權流程登入 github.com。":Y?"VibeFlow 自有的 skill / prompt / script,啟動任務時投遞給 Claude 與 Codex。":"調整 system prompt 與 agent 帳號連線。",saving:i||F,onClose:er,showHeader:!0,contentClassName:"max-w-2xl",footer:S?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:()=>void et(),disabled:F&&"success"!==I,children:"success"===I?"完成":"返回"}),"error"===I&&(0,n.jsx)(eh,{size:"sm",onClick:()=>void ee(),children:"重新登入"})]}):Y?W?null:(0,n.jsxs)(eh,{variant:"ghost",size:"sm",onClick:()=>K(!1),children:[(0,n.jsx)(t3.A,{className:"size-3.5"}),"返回設定"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",onClick:er,disabled:i,children:"取消"}),(0,n.jsxs)(eh,{size:"sm",onClick:()=>{Q&&c(X,h.trim(),g)},disabled:!Q,className:(0,k.cn)(i&&"opacity-80"),children:[i&&(0,n.jsx)(_.A,{className:"animate-spin"}),i?"儲存中…":"儲存設定"]})]}),children:S?(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void et(),disabled:F&&"success"!==I,className:"inline-flex items-center gap-1.5 rounded-sm text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50",children:[(0,n.jsx)(t3.A,{className:"size-4"}),"返回設定"]}),(0,n.jsx)("div",{className:"rounded-md border border-border/60 p-3",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:["success"===I?(0,n.jsx)(D.A,{className:"mt-0.5 size-5 shrink-0 text-success"}):"error"===I?(0,n.jsx)(u.A,{className:"mt-0.5 size-5 shrink-0 text-destructive"}):(0,n.jsx)(_.A,{className:"mt-0.5 size-5 shrink-0 animate-spin text-muted-foreground"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:"success"===I?"GitHub CLI 已完成授權":"error"===I?"GitHub CLI 授權失敗":"waiting"===I?"等待 GitHub 授權完成":"正在啟動 GitHub CLI 登入"}),(0,n.jsx)("p",{className:"text-sm leading-5 text-muted-foreground",children:"success"===I?`目前登入帳號:${z?.login??"GitHub"}`:"error"===I?L:"waiting"===I?"請複製授權碼並開啟 GitHub 授權頁,完成後 VibeFlow 會自動更新狀態。":"VibeFlow 正在背景準備 gh auth login。"})]})]})}),("waiting"===I||T)&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("label",{className:"block space-y-1.5",children:[(0,n.jsx)("span",{className:"text-base font-medium",children:"授權碼"}),(0,n.jsxs)("div",{className:"flex rounded-md border bg-background focus-within:ring-[3px] focus-within:ring-ring/50",children:[(0,n.jsx)("input",{readOnly:!0,value:T,className:"min-w-0 flex-1 bg-transparent px-3 py-2 font-mono text-base tracking-wider outline-none"}),(0,n.jsxs)("button",{type:"button",onClick:()=>void ea(),className:"flex h-9 items-center gap-1.5 rounded-r-md px-3 text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset disabled:opacity-50",disabled:!T,children:[(0,n.jsx)(t4.A,{className:"size-4"}),O?"已複製":"複製"]})]})]}),(0,n.jsxs)("label",{className:"block space-y-1.5",children:[(0,n.jsx)("span",{className:"text-base font-medium",children:"登入網址"}),(0,n.jsxs)("div",{className:"flex rounded-md border bg-background focus-within:ring-[3px] focus-within:ring-ring/50",children:[(0,n.jsx)("input",{readOnly:!0,value:R,className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-base outline-none"}),(0,n.jsxs)("button",{type:"button",onClick:()=>void eZ(R),className:"flex h-9 items-center gap-1.5 rounded-r-md px-3 text-base text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,n.jsx)(en.A,{className:"size-4"}),"開啟"]})]})]})]})]}):Y?(0,n.jsx)(sa,{onEditingChange:U}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)(tH,{value:g,onChange:b}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"新卡片的預設值;每張卡片可在建立或編輯時各自調整。"})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)("span",{className:"text-base font-medium",children:["工作站資料夾",(0,n.jsx)("span",{className:(0,k.cn)("ml-2 rounded-xs px-1.5 py-0.5 text-xs font-medium",""===h.trim()?"bg-secondary text-secondary-foreground":"bg-primary/15 text-primary"),children:""===h.trim()?"預設(~/Desktop)":"已自訂"})]})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("input",{name:"workstation-path",autoComplete:"off",spellCheck:!1,value:h,placeholder:"~/Desktop",onChange:e=>p(e.target.value),className:(0,k.cn)(tD,"font-mono text-sm")}),(0,n.jsx)(eh,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>void Z(),children:"選擇資料夾"})]}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["每個任務的 worktree 與執行期檔案會建立在 ","<工作站>/<專案名>/"," 底下;留空則預設為 ~/Desktop。"]})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)("span",{className:"text-base font-medium",children:["System Prompt",(0,n.jsx)("span",{className:(0,k.cn)("ml-2 rounded-xs px-1.5 py-0.5 text-xs font-medium",J?"bg-secondary text-secondary-foreground":"bg-primary/15 text-primary"),children:J?"未設定":"已自訂"})]})}),(0,n.jsx)("textarea",{name:"system-prompt",autoComplete:"off",value:x,onChange:e=>f(e.target.value),rows:10,spellCheck:!1,className:(0,k.cn)(tD,"resize-y font-mono text-sm leading-5")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"啟動 Agent 時會以此 prompt 作為 system prompt;留空則只帶入任務專屬的 Artifact 設定。"})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:"Library"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"VibeFlow 自有的 skill / prompt / script。啟用的項目會在啟動任務時自動投遞給 Claude 與 Codex,不必依賴本機的 ~/.claude 或 ~/.codex 佈局。"})]}),(0,n.jsxs)(eh,{variant:"secondary",size:"sm",onClick:()=>K(!0),children:[(0,n.jsx)(t6.A,{className:"size-3.5"}),"管理 Library"]})]}),(0,n.jsxs)("section",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-medium",children:"CLI 與帳號設定"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Model 清單直接取自已登入的 Agent CLI,不需要 API key;設定 GitHub CLI 以支援本機 GitHub 操作。"})]}),(0,n.jsxs)("div",{className:"grid gap-2",children:[si.map(e=>{let t=j[e.id],s=Array.isArray(w)&&!w.includes(e.id),r=void 0===w||!s&&(void 0===t||N===e.id);return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[r?(0,n.jsx)(_.A,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):s?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-muted-foreground"}):t?.error||!t?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-destructive"}):(0,n.jsx)(D.A,{className:"size-4 shrink-0 text-success"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:e.name}),(0,n.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:void 0===w?"偵測 CLI…":s?`未安裝・PATH 中找不到 ${e.id} 指令`:void 0===t?"讀取 model 清單…":t?`${t.models.length} 個 models 可用・來源:${sl[t.source]}`:"無法取得 model 清單"}),!s&&t?.error&&(0,n.jsx)("p",{className:"truncate text-sm text-destructive",title:t.error,children:t.error})]}),"codex"===e.id&&!s&&void 0!==w&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 w-8 p-0",disabled:N===e.id,"aria-label":"向 Codex CLI 重新取得 model 清單",title:"向 Codex CLI 重新取得 model 清單",onClick:()=>void V(e.id),children:(0,n.jsx)(em.A,{className:(0,k.cn)("size-4",N===e.id&&"animate-spin")})})]},e.id)}),(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-2.5",children:[z?.authenticated?(0,n.jsx)(D.A,{className:"size-4 shrink-0 text-success"}):z?.error?(0,n.jsx)(u.A,{className:"size-4 shrink-0 text-destructive"}):(0,n.jsx)("span",{className:"size-4 shrink-0 rounded-full border border-muted-foreground/50"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-base font-medium",children:"GitHub CLI"}),(0,n.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:z?.authenticated?`${z.login??"GitHub"} 已授權(${z.gitProtocol??"https"})`:z?.installed===!1?"找不到 GitHub CLI(gh)":z?.error?z.error:"尚未授權"})]}),z?.authenticated&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2",disabled:F,onClick:()=>void ee(),children:"切換使用者"}),z?.authenticated&&(0,n.jsxs)(eh,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2",disabled:F,onClick:()=>void es(),children:[F?(0,n.jsx)(_.A,{className:"size-4 animate-spin"}):(0,n.jsx)(t8.A,{className:"size-4"}),"登出"]}),!z?.authenticated&&(0,n.jsx)(eh,{type:"button",size:"sm",variant:"outline",disabled:z?.installed===!1||F,onClick:()=>void ee(),children:F?"啟動中…":"登入"})]})]}),L&&!S&&(0,n.jsx)("p",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-2 text-base",children:L})]}),o&&(0,n.jsx)("p",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-2 text-base",children:o})]})},"settings-dialog")})}var sc=s(93202),sd=s(51256),su=s(27955),sm=s(26814),sx=s(6684),sf=s(76750),sh=s(80136);function sp(e){return e.projectName||function(e){if(!e)return"";let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}(e.projectPath)||"Unassigned"}let sg={in_progress:0,backlog:1,done:2};function sb(e){return e.hasSelected||e.tasks.some(e=>"done"!==e.column)}let sj={backlog:"Backlog",in_progress:"In Progress",done:"Done"};function sv({entry:e,selected:t,onSelectTask:s}){let r=(0,c.I)()??!1,a="done"===e.column?null:"in_progress"===e.column?{className:"text-warning",pillClassName:"bg-warning/10 text-warning",icon:(0,n.jsx)("span",{className:"flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)("span",{className:"size-1.5 rounded-full bg-warning animate-pulse"})})}:{className:"text-muted-foreground",pillClassName:"bg-muted-foreground/10 text-muted-foreground",icon:(0,n.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})};return(0,n.jsxs)(d.PY1.button,{"data-selected-task":t||void 0,type:"button",onClick:()=>s(e.task.id),whileTap:r?void 0:{scale:.99,opacity:.9},transition:{duration:r?0:Y.micro,ease:K.enter},className:(0,k.cn)("flex w-full min-w-0 items-center gap-1.5 rounded-md px-2 py-1 text-left text-sm transition-colors motion-reduce:transition-none outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",t?"bg-primary/15 font-medium text-primary":"done"===e.column?"text-muted-foreground/60 hover:bg-accent/50 hover:text-muted-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:e.task.title,children:[(0,n.jsx)("span",{className:(0,k.cn)("flex size-3 shrink-0 items-center justify-center",a?.className),children:a?.icon}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.task.title}),a?(0,n.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full px-1.5 py-0.5 text-xs font-medium",a.pillClassName),children:sj[e.column]}):null]})}function sN({id:e,project:t,selectedTaskId:s,onSelectTask:r}){let a=(0,H.tF)(),i=(0,c.I)()??!1;return(0,n.jsx)(d.PY1.div,{id:e,initial:"hidden",animate:"visible",exit:"exit",variants:X({timing:"standard",exitTiming:"micro",transform:{y:-4},reducedMotion:i}),inert:!a,"aria-hidden":!a||void 0,className:(0,k.cn)("ml-3 space-y-0.5",!a&&"pointer-events-none"),children:0===t.tasks.length?(0,n.jsx)("p",{className:"px-2 py-0.5 text-sm text-muted-foreground/60",children:"尚無任務"}):t.tasks.map(e=>(0,n.jsx)(sv,{entry:e,selected:e.task.id===s,onSelectTask:r},e.task.id))})}function sy({project:e,expanded:t,selectedTaskId:s,onToggle:a,onSelectTask:i,onNewTaskForProject:o,onDeleteProject:c}){let d=(0,r.useId)();return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:(0,k.cn)("group flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-muted-foreground transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground",e.hasSelected&&"text-foreground"),children:[(0,n.jsxs)("button",{type:"button","aria-expanded":t,"aria-controls":d,onClick:a,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",title:e.path??e.name,children:[t?(0,n.jsx)(j.A,{className:"size-3 shrink-0"}):(0,n.jsx)(M.A,{className:"size-3 shrink-0"}),(0,n.jsx)(ed.A,{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.name})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground group-hover:hidden",children:e.tasks.length}),(0,n.jsxs)("div",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[(0,n.jsx)(C,{"aria-label":`在 ${e.name} 新增任務`,title:"在此專案新增任務",onClick:()=>o(e.path),className:"p-0.5",children:(0,n.jsx)(N.A,{className:"size-3"})}),(0,n.jsx)(C,{"aria-label":`刪除專案 ${e.name}`,title:"刪除整個專案(含所有任務)",tone:"danger",onClick:()=>c(e.name,e.tasks.map(e=>e.task.id)),className:"p-0.5",children:(0,n.jsx)(x.A,{className:"size-3"})})]})]}),(0,n.jsx)(l.N,{initial:!1,children:t&&(0,n.jsx)(sN,{id:d,project:e,selectedTaskId:s,onSelectTask:i},e.key)})]})}function sk({mode:e,className:t,children:s}){let r=(0,c.I)()??!1;return(0,n.jsx)(d.PY1.div,{initial:"hidden",animate:"visible",variants:U({timing:"micro",reducedMotion:r}),className:t,children:s},e)}function sw({collapsed:e,onRemoteShare:t,remoteActive:s,onOpenSettings:r}){return e?(0,n.jsxs)(sk,{mode:"collapsed",className:"flex flex-col items-center gap-1 border-t border-border p-2",children:[t&&(0,n.jsx)(C,{"aria-label":"遠端控制",onClick:t,title:"遠端控制",className:(0,k.cn)("size-8",s&&"text-primary hover:text-primary"),children:(0,n.jsx)(sc.A,{className:"size-4"})}),(0,n.jsx)(C,{"aria-label":"設定 System Prompt",onClick:r,title:"設定(System Prompt)",className:"size-8",children:(0,n.jsx)(sd.A,{className:"size-4"})})]}):(0,n.jsx)(sk,{mode:"expanded",className:"border-t border-border p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1 px-1",children:[t&&(0,n.jsx)(C,{"aria-label":"遠端控制",onClick:t,title:"遠端控制",className:(0,k.cn)(s?"text-primary hover:text-primary":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(sc.A,{className:"size-4"})}),(0,n.jsx)(C,{"aria-label":"設定 System Prompt",onClick:r,title:"設定(System Prompt)",children:(0,n.jsx)(sd.A,{className:"size-4"})})]})})}function sC({value:e,onChange:t}){return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(su.A,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,n.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:s=>{"Escape"===s.key&&e&&(s.preventDefault(),t(""))},placeholder:"搜尋任務","aria-label":"搜尋任務",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-7 text-sm text-foreground outline-none transition-colors motion-reduce:transition-none placeholder:text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50"}),e?(0,n.jsx)("button",{type:"button","aria-label":"清除搜尋",title:"清除搜尋",onClick:()=>t(""),className:"absolute right-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:(0,n.jsx)(O.A,{className:"size-3.5"})}):null]})}function sS({collapsed:e,onToggleCollapse:t,board:s,selectedTaskId:a,onSelectTask:i,onNewTask:l,onNewTaskForProject:o,onDeleteProject:u,onRemoteShare:m,remoteActive:x,onOpenSettings:f}){let[h,p]=(0,r.useState)({}),[g,b]=(0,r.useState)(""),j=(0,c.I)()??!1,v=U({timing:"micro",reducedMotion:j}),w=g.trim().toLowerCase(),S=!e&&w.length>0,A=function(e,t){var s;let n=new Map;for(let r of[...e.in_progress.map(e=>({task:e,column:"in_progress"})),...e.backlog.map(e=>({task:e,column:"backlog"})),...e.done.map(e=>({task:e,column:"done"}))]){let e=(s=r.task).projectPath||`name:${sp(s)}`,a=n.get(e)??{key:e,name:sp(r.task),path:r.task.projectPath??null,tasks:[],total:0,hasSelected:!1};a.tasks.push(r),a.total+=1,a.hasSelected||=r.task.id===t,n.set(e,a)}for(let e of n.values())e.tasks=[...e.tasks].sort((e,t)=>{var s,n;let r=sg[e.column]-sg[t.column];return 0!==r?r:(s=e.task,n=t.task,s.createdAt===n.createdAt?0:void 0===s.createdAt?1:void 0===n.createdAt?-1:n.createdAt-s.createdAt)});return Array.from(n.values()).sort((e,t)=>e.name.localeCompare(t.name))}(s,a),z=S?A.map(e=>({...e,tasks:e.tasks.filter(e=>e.task.title.toLowerCase().includes(w))})).filter(e=>e.tasks.length>0):A,E=A.map(e=>e.key).join(" ");(0,r.useEffect)(()=>{p(e=>{let t=!1,s={...e};for(let e of A)e.key in s||(s[e.key]=sb(e),t=!0);return t?s:e})},[E]);let I=e=>S||(h[e.key]??sb(e)),P=z.length>0&&z.every(e=>I(e));return(0,r.useEffect)(()=>{let e=document.querySelector("aside [data-selected-task]");e?.scrollIntoView({block:"nearest"})},[a]),(0,n.jsxs)(d.PY1.aside,{initial:!1,animate:{width:e?48:320},transition:{duration:j?0:Y.spatial,ease:K.enter},className:"flex flex-shrink-0 flex-col overflow-x-clip border-r border-border bg-card text-card-foreground",children:[(0,n.jsxs)("div",{className:(0,k.cn)("flex h-12 shrink-0 items-center border-b border-border px-3",e?"justify-center":"justify-between"),children:[!e&&(0,n.jsxs)(d.PY1.span,{initial:"hidden",animate:"visible",variants:v,className:"flex items-center gap-2 text-[15px] font-semibold tracking-tight text-foreground",children:[(0,n.jsx)("img",{src:"/logo.svg",alt:"",className:"size-5"}),"VibeFlow"]}),(0,n.jsx)(C,{"aria-label":e?"展開選單":"收合選單",onClick:t,title:e?"展開選單":"收合選單",className:"group p-1",children:e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("img",{src:"/logo.svg",alt:"",className:"size-5 group-hover:hidden group-focus-visible:hidden"}),(0,n.jsx)(sm.A,{className:"hidden size-4 group-hover:block group-focus-visible:block"})]}):(0,n.jsx)(sx.A,{className:"size-4"})})]}),(0,n.jsx)(sk,{mode:e?"collapsed":"expanded",className:(0,k.cn)("shrink-0 px-2 pt-3",e?"flex justify-center":"w-full"),children:e?(0,n.jsx)(C,{"aria-label":"新增任務",onClick:l,title:"新增任務",className:"size-8 p-1.5",children:(0,n.jsx)(N.A,{className:"size-4"})}):(0,n.jsxs)(eh,{size:"sm",className:"w-full rounded-md active:scale-95",onClick:l,children:[(0,n.jsx)(N.A,{}),"新增任務"]})}),!e&&(0,n.jsx)(sk,{mode:"expanded",className:"shrink-0 px-2 pt-2",children:(0,n.jsx)(sC,{value:g,onChange:b})}),(0,n.jsx)("div",{className:(0,k.cn)("flex flex-1 flex-col py-3",e?"overflow-hidden":"overflow-y-auto"),children:(0,n.jsx)("div",{className:"px-2",children:e?null:(0,n.jsxs)(d.PY1.div,{initial:"hidden",animate:"visible",variants:v,children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-1 px-2",children:[(0,n.jsx)("span",{className:y,children:"Projects"}),!S&&z.length>0&&(0,n.jsx)(C,{"aria-label":P?"全部收合":"全部展開",title:P?"全部收合":"全部展開",onClick:()=>{let e=!P;p(t=>{let s={...t};for(let t of z)s[t.key]=e;return s})},className:"ml-auto p-0.5",children:P?(0,n.jsx)(sf.A,{className:"size-3.5"}):(0,n.jsx)(sh.A,{className:"size-3.5"})})]}),(0,n.jsx)("div",{className:"space-y-1",children:0===z.length?(0,n.jsx)("p",{className:"px-2 py-1 text-sm text-muted-foreground",children:S?"找不到符合的任務":"尚無任務"}):z.map(e=>{let t=I(e);return(0,n.jsx)(sy,{project:e,expanded:t,selectedTaskId:a,onToggle:()=>p(s=>({...s,[e.key]:!t})),onSelectTask:i,onNewTaskForProject:o,onDeleteProject:u},e.key)})})]},"expanded-projects")})}),(0,n.jsx)(sw,{collapsed:e,onRemoteShare:m,remoteActive:x,onOpenSettings:f})]})}function sA({entries:e,activeTaskId:t,onSelect:s,onPin:r,onClose:a}){return 0===e.length?null:(0,n.jsx)("div",{className:"flex h-9 shrink-0 items-stretch overflow-x-auto overflow-y-hidden border-b border-border bg-card/40",children:e.map(e=>{let i=e.taskId===t;return(0,n.jsxs)("div",{className:(0,k.cn)("group flex h-full min-w-0 max-w-52 shrink-0 items-center gap-1 border-r border-border/60 pl-3 pr-1.5 transition-colors motion-reduce:transition-none",i?"bg-background text-foreground":"text-muted-foreground hover:bg-accent/40 hover:text-foreground"),children:[(0,n.jsxs)("button",{type:"button","aria-current":i?"page":void 0,title:e.title,onClick:()=>s(e.taskId),onDoubleClick:()=>r(e.taskId),onAuxClick:t=>{1===t.button&&a(e.taskId)},className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-sm py-0.5 text-left text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,n.jsx)("span",{className:(0,k.cn)("size-1.5 shrink-0 rounded-full","in_progress"===e.column?"bg-warning animate-pulse":"bg-muted-foreground/50")}),(0,n.jsx)("span",{className:(0,k.cn)("min-w-0 truncate",e.preview&&"italic"),children:e.title})]}),(0,n.jsx)("button",{type:"button","aria-label":`關閉分頁 ${e.title}`,title:"關閉分頁(執行中的 agent 會繼續在背景執行)",onClick:()=>a(e.taskId),className:(0,k.cn)("flex size-5 shrink-0 items-center justify-center rounded-sm outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:opacity-100",i?"opacity-100":"opacity-0 group-hover:opacity-100"),children:(0,n.jsx)(O.A,{className:"size-3"})})]},e.taskId)})})}var sz=s(4504);function sE({roomCode:e,peerCount:t,onClose:a,onStop:i}){let l=`https://vibe-flow-remote.vercel.app/?room=${e}`,[o,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=!0;return s.e(167).then(s.t.bind(s,20167,19)).then(({default:t})=>{t.toDataURL(l,{width:240,margin:2}).then(t=>{e&&c(t)})}),()=>{e=!1}},[l]),(0,n.jsxs)(q,{title:"遠端控制",onClose:a,showHeader:!0,contentClassName:"max-w-xs",children:[(0,n.jsx)("div",{className:"mb-4 flex justify-center",children:o?(0,n.jsx)("img",{src:o,alt:"QR Code",width:200,height:200,className:"rounded-md"}):(0,n.jsx)("div",{className:"flex h-[200px] w-[200px] items-center justify-center rounded-md bg-muted",children:(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"生成中…"})})}),(0,n.jsxs)("div",{className:"mb-3 text-center",children:[(0,n.jsx)("p",{className:"mb-1 text-sm text-muted-foreground",children:"Room Code"}),(0,n.jsx)("p",{className:"font-mono text-3xl font-bold tracking-widest",children:e})]}),(0,n.jsxs)("div",{className:"mb-4 flex items-center justify-center gap-1.5 text-sm text-muted-foreground",children:[(0,n.jsx)(sz.A,{className:"size-3"}),(0,n.jsx)("span",{children:t>0?`${t} 台裝置已連線`:"等待裝置連線…"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(l),u(!0),setTimeout(()=>u(!1),2e3)},className:"flex flex-1 items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[d?(0,n.jsx)(v.A,{className:"size-3.5"}):(0,n.jsx)(L.A,{className:"size-3.5"}),d?"已複製":"複製連結"]}),(0,n.jsx)(eh,{size:"sm",variant:"destructive",onClick:i,children:"停止分享"})]})]})}function sI(e,t){return{capabilities:{createTask:!1},tasks:["backlog","in_progress","done"].flatMap(t=>e[t].map(e=>({id:e.id,title:e.title,description:e.description,projectName:e.projectName,column:t,launchedAt:e.launchedAt}))),workspaces:[],settings:{autoMode:t}}}let sP={backlog:[],in_progress:[],done:[]},sT=["in_progress","backlog","done"];function s$(){let[e,t]=(0,r.useState)(sP),[a,o]=(0,r.useState)({}),[c,d]=(0,r.useState)(!0),[m,x]=(0,r.useState)(""),[f,h]=(0,r.useState)(""),[p,g]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(null),[w,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(null),[z,E]=(0,r.useState)(null),[I,P]=(0,r.useState)(!1),[T,$]=(0,r.useState)(null),[R,B]=(0,r.useState)(!1),[D,L]=(0,r.useState)(!0),[M,F]=(0,r.useState)(null),[G,O]=(0,r.useState)([]),[H,V]=(0,r.useState)(null),[Y,K]=(0,r.useState)(0),[W,U]=(0,r.useState)(null),[X,J]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return ej().then(s=>{e&&(s&&(t(s.board),d(s.settings.autoMode),x(s.settings.systemPrompt??""),h(s.settings.workstationPath??"")),g(!0))}),()=>{e=!1}},[]),(0,r.useEffect)(()=>{var e;let t;return e=({taskId:e,subAgents:t})=>{o(s=>({...s,[e]:t}))},(t=eb())?t.onSubAgentsUpdate(e):()=>{}},[]),(0,r.useEffect)(()=>{var e;let s;return e=e=>{t(e.board),d(e.settings.autoMode),x(e.settings.systemPrompt??""),h(e.settings.workstationPath??"")},(s=eb())?s.onStateChanged(e):()=>{}},[]),(0,r.useEffect)(()=>{let t=new Set(Object.values(e).flat().map(e=>e.id));O(e=>e.every(e=>t.has(e.taskId))?e:e.filter(e=>t.has(e.taskId))),F(e=>e&&!t.has(e)?null:e)},[e]);let Q=()=>eA("選擇專案資料夾"),Z=(e,t)=>{O(s=>{let n=s.find(t=>t.taskId===e);if(n)return t?.pin&&n.preview?s.map(t=>t.taskId===e?{...t,preview:!1}:t):s;let r={taskId:e,preview:t?.pin!==!0},a=s.findIndex(e=>e.preview);if(r.preview&&-1!==a){let e=[...s];return e[a]=r,e}return[...s,r]}),F(e)},ee=e=>{O(t=>t.some(t=>t.taskId===e&&t.preview)?t.map(t=>t.taskId===e?{...t,preview:!1}:t):t)},et=e=>{let t=new Set(e);if(M&&t.has(M)){let e=G.findIndex(e=>e.taskId===M),s=G.slice(e+1).find(e=>!t.has(e.taskId)),n=G.slice(0,Math.max(e,0)).reverse().find(e=>!t.has(e.taskId));F(s?.taskId??n?.taskId??null)}O(e=>e.filter(e=>!t.has(e.taskId)))},es=()=>{A(null),V(null),K(e=>e+1),F(null)},en=async(e,t,s)=>{N(!0),k(null);try{await eN({systemPrompt:e,workstationPath:t||void 0,autoMode:s}),x(e),h(t),d(s),j(!1)}catch(e){k(e instanceof Error?e.message:String(e))}finally{N(!1)}},er=async(e,s,n,r,a,i,l,o,c,d)=>{C(!0),A(null);try{let u=await e$({title:e,description:s,projectPath:n,baseBranch:r,branch:a||void 0,agentCli:i,model:l||void 0,effort:o,autoMode:c,attachments:d});u&&(t(u.state.board),Z(u.task.id,{pin:!0}))}catch(e){A(e instanceof Error?e.message:String(e))}finally{C(!1)}},ea=async e=>{if(z){P(!0),$(null);try{let s=await eR({taskId:z.id,title:e.title,description:e.description,agentCli:e.agentCli,model:e.model||void 0,effort:e.effort,autoMode:e.autoMode,projectPath:e.projectPath,baseBranch:e.baseBranch,branch:e.branch});s&&t(s.board),E(null)}catch(e){$(e instanceof Error?e.message:String(e))}finally{P(!1)}}},ei=async e=>{let s=await e0(e);s&&t(s.board)},el=async e=>{let s=await e1(e);s&&(t(s.board),et([e]))},eo=async()=>{if(W){J(!0);try{let e=null;for(let t of W.taskIds){let s=await e1(t);s&&(e=s.board)}e&&t(e),et(W.taskIds),U(null)}finally{J(!1)}}},ec=G.flatMap(t=>{for(let s of sT){let n=e[s].find(e=>e.id===t.taskId);if(n)return[{...t,title:n.title,column:s}]}return[]}),ed=function({board:e,autoMode:t,onStateChange:n}){let[a,i]=(0,r.useState)(null),[l,o]=(0,r.useState)(0),c=(0,r.useRef)(new Set),d=(0,r.useRef)(new Map),u=(0,r.useRef)(e),m=(0,r.useRef)(t),x=(0,r.useRef)(n);async function f(e,t){if(!e||"object"!=typeof e)return;let{type:s,payload:n}=e;switch(s){case"client:get-state":try{t.send({type:"vf:state",payload:sI(u.current,m.current)})}catch{}break;case"client:send-command":{let{taskId:e,text:t}=n??{};if(!e||!t)break;e3(e,String(t).slice(0,1e3));break}case"client:subscribe-terminal":{let{taskId:e}=n??{};if(!e)break;let s=d.current.get(e);s||(s=new Set,d.current.set(e,s)),s.add(t);break}case"client:unsubscribe-terminal":{let{taskId:e}=n??{};e&&d.current.get(e)?.delete(t);break}case"client:move-task":{let{taskId:e,targetColumn:t}=n??{};if(!e||!t)break;let s=function(e,t,s){let n,r={...e};for(let e of["backlog","in_progress","done"]){let s=r[e].findIndex(e=>e.id===t);if(-1!==s){n=r[e][s],r[e]=r[e].filter(e=>e.id!==t);break}}return n?(r[s]=[n,...r[s]],r):e}(u.current,e,t);x.current(s),await ev(s)}}}return(0,r.useEffect)(()=>{u.current=e},[e]),(0,r.useEffect)(()=>{m.current=t},[t]),(0,r.useEffect)(()=>{x.current=n},[n]),(0,r.useEffect)(()=>{if(!c.current.size)return;let s=sI(e,t);for(let e of c.current)try{e.send({type:"vf:state",payload:s})}catch{}},[e,t]),(0,r.useEffect)(()=>{let e;if(!a)return;let t=!1;return async function(){let{Peer:n}=await s.e(1886).then(s.bind(s,11886));t||((e=new n(`vibeflow-${a}`)).on("connection",e=>{c.current.add(e),o(e=>e+1),e.on("open",()=>{(async()=>{try{e.send({type:"vf:hello",payload:{version:"1.0"}}),e.send({type:"vf:state",payload:sI(u.current,m.current)})}catch{}})()}),e.on("data",t=>{f(t,e)}),e.on("close",()=>{for(let[,t]of(c.current.delete(e),o(e=>e-1),d.current))t.delete(e)})}),e.on("error",e=>{console.error("[VibeFlow Remote] PeerJS error:",e)}))}(),()=>{for(let e of(t=!0,c.current))try{e.close()}catch{}c.current.clear(),d.current.clear(),o(0),e?.destroy()}},[a]),(0,r.useEffect)(()=>{if(a){var e;let t;return e=({sessionKey:e,data:t})=>{let s=e.split(":")[0],n=d.current.get(s);if(!n?.size)return;let r={type:"vf:terminal-chunk",payload:{taskId:s,data:t}};for(let e of n)try{e.send(r)}catch{}},(t=eb())?t.term.onData(e):()=>{}}},[a]),{roomCode:a,peerCount:l,startSharing:()=>{i(String(Math.floor(1e5+9e5*Math.random())))},stopSharing:()=>i(null)}}({board:e,autoMode:c,onStateChange:e=>{t(e),ev(e)}});return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(i(),{children:(0,n.jsx)("title",{children:"VibeFlow"})}),(0,n.jsx)("div",{className:"bg-background text-foreground",children:p?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,n.jsx)(sS,{collapsed:D,onToggleCollapse:()=>L(e=>!e),board:e,selectedTaskId:M,onSelectTask:Z,onNewTask:es,onNewTaskForProject:e=>{A(null),V(e),K(e=>e+1),F(null)},onDeleteProject:(e,t)=>{0!==t.length&&U({name:e,taskIds:t})},remoteActive:!!ed.roomCode,onOpenSettings:()=>{k(null),j(!0)}}),(0,n.jsx)("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:(0,n.jsx)("div",{className:"min-h-0 flex-1",children:(0,n.jsx)(t5,{tabBar:(0,n.jsx)(sA,{entries:ec,activeTaskId:M,onSelect:Z,onPin:ee,onClose:e=>et([e])}),onSelectTask:Z,onNewTask:es,board:e,onBoardChange:e=>{t(e),ev(e)},onEditTask:t=>{$(null),e.backlog.some(e=>e.id===t)&&E(function(e,t){for(let s of Object.values(e)){let e=s.find(e=>e.id===t);if(e)return e}return null}(e,t))},onTaskDone:ei,onDeleteTask:el,autoMode:c,workstationPath:f,subAgents:a,selectedTaskId:M,onTaskInteract:ee,openTabIds:G.map(e=>e.taskId),initialProjectPath:H,newTaskNonce:Y,creating:w,createError:S,pickFolder:Q,loadRecentProjects:eE,loadGitInfo:ez,initRepository:eI,detectAgents:eP,onCreateTask:er})})})]}),(0,n.jsx)(t2,{task:z,defaultAutoMode:c,detectAgents:eP,pickFolder:Q,loadRecentProjects:eE,loadGitInfo:ez,saving:I,error:T,onSubmit:ea,onClose:()=>E(null)}),(0,n.jsx)(so,{open:b,systemPrompt:m,workstationPath:f,autoMode:c,saving:v,error:y,onSave:en,onPickFolder:()=>eA("選擇工作區資料夾"),onClose:()=>j(!1)}),(0,n.jsx)(l.N,{children:w&&(0,n.jsx)(q,{title:"建立任務中",saving:!0,onClose:()=>{},contentClassName:"max-w-sm rounded-lg p-5",children:(0,n.jsx)("div",{className:"space-y-4",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("span",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary",children:(0,n.jsx)(_.A,{className:"size-5 animate-spin"})}),(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"正在建立 workspace"}),(0,n.jsx)("p",{className:"text-base leading-6 text-muted-foreground",children:"正在建立 git worktree、分支與任務資料。完成前請先不要切換或操作其他任務。"})]})]})})},"creating-task-dialog")}),(0,n.jsx)(l.N,{children:W&&(0,n.jsx)(q,{title:"刪除專案",saving:X,onClose:()=>{X||U(null)},contentClassName:"max-w-md rounded-lg p-5",children:(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("span",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:(0,n.jsx)(u.A,{className:"size-5"})}),(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsxs)("h2",{className:"text-lg font-semibold tracking-tight",children:["刪除專案「",W.name,"」?"]}),(0,n.jsxs)("p",{className:"text-base leading-6 text-muted-foreground",children:["這會刪除此專案底下的 ",W.taskIds.length," ","個任務,包含它們的 worktree、branch 與對話紀錄。此操作無法復原。"]})]})]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(eh,{variant:"ghost",size:"sm",className:"rounded-full",disabled:X,onClick:()=>U(null),children:"取消"}),(0,n.jsx)(eh,{variant:"destructive",size:"sm",className:"rounded-full active:scale-95 motion-reduce:transform-none",disabled:X,onClick:eo,children:X?"刪除中…":"刪除專案"})]})]})},"delete-project-dialog")}),(0,n.jsx)(l.N,{children:R&&ed.roomCode&&(0,n.jsx)(sE,{roomCode:ed.roomCode,peerCount:ed.peerCount,onClose:()=>B(!1),onStop:()=>{ed.stopSharing(),B(!1)}},"remote-share-dialog")})]}):(0,n.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-background text-base text-muted-foreground",children:"載入中…"})})]})}},24464:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/home",function(){return s(2908)}])}},e=>{e.O(0,[2524,636,6593,8792],()=>e(e.s=24464)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">VibeFlow</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-014e95fe86cd1d39.js" defer=""></script><script src="/_next/static/chunks/2524-abaf3a55023f6066.js" defer=""></script><script src="/_next/static/chunks/pages/home-1fb1d1a49d28f6dd.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_buildManifest.js" defer=""></script><script src="/_next/static/_pjqayPqD9pDyPeTbc6L2/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="bg-background text-foreground"><div class="flex min-h-screen items-center justify-center bg-background text-base text-muted-foreground">載入中…</div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/home","query":{},"buildId":"_pjqayPqD9pDyPeTbc6L2","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><title data-next-head="">VibeFlow</title><link rel="preload" href="/_next/static/css/24b804d01aa3af3c.css" as="style"/><link rel="stylesheet" href="/_next/static/css/24b804d01aa3af3c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8aa5df0425f6b7b.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-2a4ae532bdcab6f2.js" defer=""></script><script src="/_next/static/chunks/2524-abaf3a55023f6066.js" defer=""></script><script src="/_next/static/chunks/pages/home-3c2a73bbb48cf9a2.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_buildManifest.js" defer=""></script><script src="/_next/static/WryXzkD7rqukLA95d06Zt/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="bg-background text-foreground"><div class="flex min-h-screen items-center justify-center bg-background text-base text-muted-foreground">載入中…</div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/home","query":{},"buildId":"WryXzkD7rqukLA95d06Zt","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kw-yeh/vibeflow",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "Intent-driven local kanban for coding agents: git worktree per card, Web UI and TUI.",
5
5
  "license": "MIT",
6
6
  "author": "KW-Yeh",