claudekit-cli 4.4.0-dev.11 → 4.4.0-dev.13

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/cli-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "4.4.0-dev.11",
3
- "generatedAt": "2026-06-11T01:27:49.348Z",
2
+ "version": "4.4.0-dev.13",
3
+ "generatedAt": "2026-06-15T16:33:44.921Z",
4
4
  "commands": {
5
5
  "agents": {
6
6
  "name": "agents",
@@ -1342,7 +1342,7 @@
1342
1342
  "sections": [
1343
1343
  {
1344
1344
  "title": "Gotchas",
1345
- "content": " --install and --reconcile are mutually exclusive — pass only one\n --reinstall-empty-dirs and --respect-deletions are mutually exclusive — pass only one\n Default mode is smart-detected: no/stale registry → install, valid registry → reconcile\n --respect-deletions disables the auto-reinstall heuristic for empty directories\n --force overrides skip decisions per item; --reinstall-empty-dirs is a per-directory heuristic\n Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills"
1345
+ "content": " --install and --reconcile are mutually exclusive — pass only one\n --reinstall-empty-dirs and --respect-deletions are mutually exclusive — pass only one\n Default mode is smart-detected: no/stale registry → install, valid registry → reconcile\n --respect-deletions disables the auto-reinstall heuristic for empty directories\n --force overrides skip decisions per item; --reinstall-empty-dirs is a per-directory heuristic\n Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills\n Kiro agents migrate as custom subagents; rules/config migrate as steering files; skills copy to .kiro/skills; commands/hooks are skipped"
1346
1346
  }
1347
1347
  ]
1348
1348
  },
@@ -1867,7 +1867,7 @@
1867
1867
  },
1868
1868
  {
1869
1869
  "flags": "-a, --agent <agent>",
1870
- "description": "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, roo, windsurf, cline, openhands"
1870
+ "description": "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, kiro, roo, windsurf, cline, openhands"
1871
1871
  },
1872
1872
  {
1873
1873
  "flags": "-g, --global",
@@ -1925,7 +1925,7 @@
1925
1925
  "sections": [
1926
1926
  {
1927
1927
  "title": "Supported Agents",
1928
- "content": " claude-code Claude Code CLI\n cursor Cursor IDE\n codex Codex CLI\n opencode OpenCode\n goose Goose AI\n gemini-cli Gemini CLI\n antigravity Antigravity Agent\n github-copilot GitHub Copilot\n amp Amp\n kilo Kilo Code\n roo Roo Code\n windsurf Windsurf IDE\n cline Cline\n openhands OpenHands"
1928
+ "content": " claude-code Claude Code CLI\n cursor Cursor IDE\n codex Codex CLI\n opencode OpenCode\n goose Goose AI\n gemini-cli Gemini CLI\n antigravity Antigravity Agent\n github-copilot GitHub Copilot\n amp Amp\n kilo Kilo Code\n kiro Kiro\n roo Roo Code\n windsurf Windsurf IDE\n cline Cline\n openhands OpenHands"
1929
1929
  },
1930
1930
  {
1931
1931
  "title": "Notes",
package/dist/index.js CHANGED
@@ -10774,6 +10774,9 @@ var init_hook_migration_compatibility = __esm(() => {
10774
10774
  // src/commands/portable/converters/direct-copy.ts
10775
10775
  import { readFileSync } from "node:fs";
10776
10776
  import { extname } from "node:path";
10777
+ function rewriteKiroPaths(content) {
10778
+ return content.replace(/\.claude\/skills\//g, ".kiro/skills/").replace(/\.claude\/agents\//g, ".kiro/agents/").replace(/\.claude\/rules\//g, ".kiro/steering/").replace(/\.claude\/commands\//g, "Claude Code commands/").replace(/\.claude\/hooks\//g, "Claude Code hooks/");
10779
+ }
10777
10780
  function convertDirectCopy(item, provider) {
10778
10781
  let content;
10779
10782
  try {
@@ -10786,9 +10789,13 @@ function convertDirectCopy(item, provider) {
10786
10789
  }
10787
10790
  }
10788
10791
  if (provider && provider !== "claude-code") {
10789
- const targetDir = PROVIDER_CONFIG_DIR[provider];
10790
- if (targetDir) {
10791
- content = content.replace(/\.claude\//g, targetDir);
10792
+ if (provider === "kiro") {
10793
+ content = rewriteKiroPaths(content);
10794
+ } else {
10795
+ const targetDir = PROVIDER_CONFIG_DIR[provider];
10796
+ if (targetDir) {
10797
+ content = content.replace(/\.claude\//g, targetDir);
10798
+ }
10792
10799
  }
10793
10800
  }
10794
10801
  if (provider === "codex" && item.type === "hooks") {
@@ -11380,44 +11387,48 @@ var init_provider_registry = __esm(() => {
11380
11387
  kiro: {
11381
11388
  name: "kiro",
11382
11389
  displayName: "Kiro IDE",
11383
- subagents: "none",
11390
+ subagents: "full",
11384
11391
  agents: {
11385
- projectPath: ".kiro/steering",
11386
- globalPath: null,
11387
- format: "md-to-kiro-steering",
11392
+ projectPath: ".kiro/agents",
11393
+ globalPath: join(home, ".kiro/agents"),
11394
+ format: "fm-to-fm",
11388
11395
  writeStrategy: "per-file",
11389
11396
  fileExtension: ".md"
11390
11397
  },
11391
11398
  commands: null,
11392
11399
  skills: {
11393
11400
  projectPath: ".kiro/skills",
11394
- globalPath: null,
11401
+ globalPath: join(home, ".kiro/skills"),
11395
11402
  format: "direct-copy",
11396
11403
  writeStrategy: "per-file",
11397
11404
  fileExtension: ".md"
11398
11405
  },
11399
11406
  config: {
11400
11407
  projectPath: ".kiro/steering/project.md",
11401
- globalPath: null,
11408
+ globalPath: join(home, ".kiro/steering/project.md"),
11402
11409
  format: "md-to-kiro-steering",
11403
11410
  writeStrategy: "single-file",
11404
11411
  fileExtension: ".md"
11405
11412
  },
11406
11413
  rules: {
11407
11414
  projectPath: ".kiro/steering",
11408
- globalPath: null,
11415
+ globalPath: join(home, ".kiro/steering"),
11409
11416
  format: "md-to-kiro-steering",
11410
11417
  writeStrategy: "per-file",
11411
11418
  fileExtension: ".md"
11412
11419
  },
11413
11420
  hooks: null,
11414
11421
  settingsJsonPath: null,
11415
- detect: async () => hasAnyInstallSignal([
11422
+ detect: async () => hasBinaryInPath("kiro") || hasAnyInstallSignal([
11416
11423
  join(cwd, ".kiro/steering"),
11417
11424
  join(cwd, ".kiro/skills"),
11418
11425
  join(cwd, ".kiro/hooks"),
11419
11426
  join(cwd, ".kiro/agents"),
11420
- join(cwd, ".kiro/settings/mcp.json")
11427
+ join(cwd, ".kiro/settings/mcp.json"),
11428
+ join(home, ".kiro/steering"),
11429
+ join(home, ".kiro/skills"),
11430
+ join(home, ".kiro/agents"),
11431
+ join(home, ".kiro/settings/mcp.json")
11421
11432
  ])
11422
11433
  },
11423
11434
  windsurf: {
@@ -12167,6 +12178,68 @@ ${item.body}
12167
12178
  warnings: []
12168
12179
  };
12169
12180
  }
12181
+ function mapKiroTools(toolsStr) {
12182
+ const warnings = [];
12183
+ if (!toolsStr || toolsStr.trim().length === 0) {
12184
+ return {
12185
+ tools: ["@builtin"],
12186
+ warnings: ["No Claude tools declared; granting Kiro built-in tools by default"]
12187
+ };
12188
+ }
12189
+ const tools = new Set;
12190
+ const unmapped = [];
12191
+ for (const rawTool of toolsStr.split(",")) {
12192
+ const tool = rawTool.trim();
12193
+ if (!tool)
12194
+ continue;
12195
+ const mapped = KIRO_TOOL_MAP[tool];
12196
+ if (mapped) {
12197
+ tools.add(mapped);
12198
+ continue;
12199
+ }
12200
+ const mcpMatch = /^mcp__(.+?)__(.+)$/.exec(tool);
12201
+ if (mcpMatch) {
12202
+ tools.add(`@${mcpMatch[1]}/${mcpMatch[2]}`);
12203
+ continue;
12204
+ }
12205
+ unmapped.push(tool);
12206
+ }
12207
+ if (unmapped.length > 0) {
12208
+ warnings.push(`Claude tools not mapped to Kiro custom subagent tools: ${unmapped.join(", ")}`);
12209
+ }
12210
+ if (tools.size === 0) {
12211
+ tools.add("@builtin");
12212
+ warnings.push("No mapped Kiro tools remained; granting Kiro built-in tools by default");
12213
+ }
12214
+ return { tools: Array.from(tools), warnings };
12215
+ }
12216
+ function pushYamlString(lines, key, value) {
12217
+ if (typeof value === "string" && value.trim().length > 0) {
12218
+ lines.push(`${key}: ${JSON.stringify(value.trim())}`);
12219
+ }
12220
+ }
12221
+ function convertKiroAgent(item) {
12222
+ const mappedTools = mapKiroTools(item.frontmatter.tools);
12223
+ const stripped = stripClaudeRefs(item.body, { provider: "kiro" });
12224
+ const warnings = [...mappedTools.warnings, ...stripped.warnings];
12225
+ const name = item.name;
12226
+ const description = item.description || `Custom subagent: ${name}`;
12227
+ const fmLines = ["---"];
12228
+ pushYamlString(fmLines, "name", name);
12229
+ pushYamlString(fmLines, "description", description);
12230
+ fmLines.push(`tools: ${JSON.stringify(mappedTools.tools)}`);
12231
+ pushYamlString(fmLines, "model", typeof item.frontmatter.model === "string" ? item.frontmatter.model : "");
12232
+ fmLines.push("---");
12233
+ return {
12234
+ content: `${fmLines.join(`
12235
+ `)}
12236
+
12237
+ ${stripped.content}
12238
+ `,
12239
+ filename: `${item.name}.md`,
12240
+ warnings
12241
+ };
12242
+ }
12170
12243
  function replaceClaudePathsForOpenCode(content) {
12171
12244
  return content.replace(/\.claude\//g, ".opencode/");
12172
12245
  }
@@ -12241,6 +12314,8 @@ function convertFmToFm(item, provider) {
12241
12314
  return convertForCopilot(item);
12242
12315
  case "cursor":
12243
12316
  return convertForCursor(item);
12317
+ case "kiro":
12318
+ return convertKiroAgent(item);
12244
12319
  case "opencode":
12245
12320
  if (item.type === "command")
12246
12321
  return convertOpenCodeCommand(item);
@@ -12253,8 +12328,9 @@ function convertFmToFm(item, provider) {
12253
12328
  };
12254
12329
  }
12255
12330
  }
12256
- var COPILOT_TOOL_MAP, OPENCODE_TOOL_MAP;
12331
+ var COPILOT_TOOL_MAP, KIRO_TOOL_MAP, OPENCODE_TOOL_MAP;
12257
12332
  var init_fm_to_fm = __esm(() => {
12333
+ init_md_strip();
12258
12334
  COPILOT_TOOL_MAP = {
12259
12335
  Read: "read",
12260
12336
  Glob: "search",
@@ -12266,6 +12342,19 @@ var init_fm_to_fm = __esm(() => {
12266
12342
  WebFetch: "fetch",
12267
12343
  WebSearch: "fetch"
12268
12344
  };
12345
+ KIRO_TOOL_MAP = {
12346
+ Read: "read",
12347
+ Glob: "read",
12348
+ Grep: "read",
12349
+ LS: "read",
12350
+ Edit: "write",
12351
+ Write: "write",
12352
+ MultiEdit: "write",
12353
+ NotebookEdit: "write",
12354
+ Bash: "shell",
12355
+ WebFetch: "web",
12356
+ WebSearch: "web"
12357
+ };
12269
12358
  OPENCODE_TOOL_MAP = {
12270
12359
  Read: "read",
12271
12360
  Glob: "glob",
@@ -12419,48 +12508,37 @@ function detectLanguageGlob(itemName) {
12419
12508
  function determineInclusionMode(item) {
12420
12509
  const languageGlob = detectLanguageGlob(item.name);
12421
12510
  if (languageGlob) {
12422
- return { mode: "fileMatch", fileMatch: languageGlob };
12511
+ return { mode: "fileMatch", fileMatchPattern: languageGlob };
12423
12512
  }
12424
12513
  const fmDescription = String(item.frontmatter.description || "").toLowerCase();
12425
12514
  const sortedLangs = Object.keys(LANGUAGE_GLOB_MAP).sort((a3, b3) => b3.length - a3.length);
12426
12515
  for (const lang of sortedLangs) {
12427
12516
  if (fmDescription.includes(` ${lang} `) || fmDescription.startsWith(`${lang} `) || fmDescription.endsWith(` ${lang}`)) {
12428
- return { mode: "fileMatch", fileMatch: LANGUAGE_GLOB_MAP[lang] };
12517
+ return { mode: "fileMatch", fileMatchPattern: LANGUAGE_GLOB_MAP[lang] };
12429
12518
  }
12430
12519
  }
12431
12520
  return { mode: "always" };
12432
12521
  }
12433
- function buildSteeringFrontmatter(mode, fileMatch) {
12522
+ function buildSteeringFrontmatter(mode, fileMatchPattern) {
12434
12523
  const lines = ["---"];
12435
12524
  lines.push(`inclusion: ${mode}`);
12436
- if (mode === "fileMatch" && fileMatch) {
12437
- lines.push(`fileMatch: "${fileMatch}"`);
12525
+ if (mode === "fileMatch" && fileMatchPattern) {
12526
+ lines.push(`fileMatchPattern: "${fileMatchPattern}"`);
12438
12527
  }
12439
12528
  lines.push("---");
12440
12529
  return lines.join(`
12441
12530
  `);
12442
12531
  }
12443
- function checkUnsupportedFields(item) {
12444
- const warnings = [];
12445
- const presentFields = UNSUPPORTED_AGENT_FIELDS.filter((field) => item.frontmatter[field] !== undefined);
12446
- if (presentFields.length > 0) {
12447
- warnings.push(`Agent metadata not supported by Kiro (dropped): ${presentFields.join(", ")}`);
12448
- }
12449
- return warnings;
12450
- }
12451
12532
  function bodyStartsWithHeading(body) {
12452
12533
  const trimmed = body.trimStart();
12453
12534
  return /^#{1,6}\s+/.test(trimmed);
12454
12535
  }
12455
12536
  function convertMdToKiroSteering(item, provider) {
12456
12537
  const warnings = [];
12457
- if (item.type === "agent") {
12458
- warnings.push(...checkUnsupportedFields(item));
12459
- }
12460
12538
  const stripped = stripClaudeRefs(item.body, { provider });
12461
12539
  warnings.push(...stripped.warnings);
12462
- const { mode, fileMatch } = determineInclusionMode(item);
12463
- const frontmatter = buildSteeringFrontmatter(mode, fileMatch);
12540
+ const { mode, fileMatchPattern } = determineInclusionMode(item);
12541
+ const frontmatter = buildSteeringFrontmatter(mode, fileMatchPattern);
12464
12542
  const heading = item.frontmatter.name || item.name;
12465
12543
  const hasExistingHeading = bodyStartsWithHeading(stripped.content);
12466
12544
  let content;
@@ -12477,8 +12555,8 @@ ${stripped.content}
12477
12555
  ${stripped.content}
12478
12556
  `;
12479
12557
  }
12480
- if (mode === "fileMatch" && fileMatch) {
12481
- warnings.push(`Using fileMatch mode with pattern: ${fileMatch}`);
12558
+ if (mode === "fileMatch" && fileMatchPattern) {
12559
+ warnings.push(`Using fileMatch mode with pattern: ${fileMatchPattern}`);
12482
12560
  }
12483
12561
  return {
12484
12562
  content,
@@ -12486,7 +12564,7 @@ ${stripped.content}
12486
12564
  warnings
12487
12565
  };
12488
12566
  }
12489
- var LANGUAGE_GLOB_MAP, UNSUPPORTED_AGENT_FIELDS;
12567
+ var LANGUAGE_GLOB_MAP;
12490
12568
  var init_md_to_kiro_steering = __esm(() => {
12491
12569
  init_md_strip();
12492
12570
  LANGUAGE_GLOB_MAP = {
@@ -12510,7 +12588,6 @@ var init_md_to_kiro_steering = __esm(() => {
12510
12588
  vue: "**/*.vue",
12511
12589
  svelte: "**/*.svelte"
12512
12590
  };
12513
- UNSUPPORTED_AGENT_FIELDS = ["model", "tools", "memory", "argumentHint"];
12514
12591
  });
12515
12592
 
12516
12593
  // src/commands/portable/converters/md-to-mdc.ts
@@ -50107,6 +50184,18 @@ var init_ck_config_schema = __esm(() => {
50107
50184
  description: "Separator color",
50108
50185
  maxLength: 30,
50109
50186
  pattern: "^[a-zA-Z]+$"
50187
+ },
50188
+ quotaLow: {
50189
+ type: "string",
50190
+ description: "Quota section color when all windows <85%",
50191
+ maxLength: 30,
50192
+ pattern: "^[a-zA-Z]+$"
50193
+ },
50194
+ quotaHigh: {
50195
+ type: "string",
50196
+ description: "Quota section color when any window >=85%",
50197
+ maxLength: 30,
50198
+ pattern: "^[a-zA-Z]+$"
50110
50199
  }
50111
50200
  },
50112
50201
  additionalProperties: false
@@ -62684,6 +62773,22 @@ var init_agents = __esm(() => {
62684
62773
  globalPath: join59(home3, ".kilocode/skills"),
62685
62774
  detect: async () => existsSync39(join59(home3, ".kilocode"))
62686
62775
  },
62776
+ kiro: {
62777
+ name: "kiro",
62778
+ displayName: "Kiro",
62779
+ projectPath: ".kiro/skills",
62780
+ globalPath: join59(home3, ".kiro/skills"),
62781
+ detect: async () => hasAnyInstallSignal2([
62782
+ join59(process.cwd(), ".kiro/skills"),
62783
+ join59(process.cwd(), ".kiro/steering"),
62784
+ join59(process.cwd(), ".kiro/agents"),
62785
+ join59(process.cwd(), ".kiro/settings/mcp.json"),
62786
+ join59(home3, ".kiro/skills"),
62787
+ join59(home3, ".kiro/steering"),
62788
+ join59(home3, ".kiro/agents"),
62789
+ join59(home3, ".kiro/settings/mcp.json")
62790
+ ])
62791
+ },
62687
62792
  roo: {
62688
62793
  name: "roo",
62689
62794
  displayName: "Roo Code",
@@ -63942,7 +64047,7 @@ var package_default;
63942
64047
  var init_package = __esm(() => {
63943
64048
  package_default = {
63944
64049
  name: "claudekit-cli",
63945
- version: "4.4.0-dev.11",
64050
+ version: "4.4.0-dev.13",
63946
64051
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
63947
64052
  type: "module",
63948
64053
  repository: {
@@ -81534,7 +81639,8 @@ var init_migrate_command_help = __esm(() => {
81534
81639
  " Default mode is smart-detected: no/stale registry → install, valid registry → reconcile",
81535
81640
  " --respect-deletions disables the auto-reinstall heuristic for empty directories",
81536
81641
  " --force overrides skip decisions per item; --reinstall-empty-dirs is a per-directory heuristic",
81537
- " Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills"
81642
+ " Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills",
81643
+ " Kiro agents migrate as custom subagents; rules/config migrate as steering files; skills copy to .kiro/skills; commands/hooks are skipped"
81538
81644
  ].join(`
81539
81645
  `)
81540
81646
  }
@@ -82007,7 +82113,7 @@ var init_skills_command_help = __esm(() => {
82007
82113
  },
82008
82114
  {
82009
82115
  flags: "-a, --agent <agent>",
82010
- description: "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, roo, windsurf, cline, openhands"
82116
+ description: "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, kiro, roo, windsurf, cline, openhands"
82011
82117
  },
82012
82118
  {
82013
82119
  flags: "-g, --global",
@@ -82075,6 +82181,7 @@ var init_skills_command_help = __esm(() => {
82075
82181
  github-copilot GitHub Copilot
82076
82182
  amp Amp
82077
82183
  kilo Kilo Code
82184
+ kiro Kiro
82078
82185
  roo Roo Code
82079
82186
  windsurf Windsurf IDE
82080
82187
  cline Cline
@@ -114054,6 +114161,7 @@ var AgentType = exports_external.enum([
114054
114161
  "github-copilot",
114055
114162
  "amp",
114056
114163
  "kilo",
114164
+ "kiro",
114057
114165
  "roo",
114058
114166
  "windsurf",
114059
114167
  "cline",
@@ -318,7 +318,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
318
318
  `),s=r!==-1?n.slice(0,r).trim():n.trim(),i=r!==-1?hS(n.slice(r+1)):"";return{name:s,content:i}})}function U_(t){const e=t.match(/^\[([a-z-]+)\]\n([\s\S]*)$/);return e?{tag:e[1],content:e[2]}:{tag:"",content:t}}const G_={"task-notification":"Task Notification","system-reminder":"System Context","local-command-stdout":"Command Output","local-command-caveat":"Command Note","antml:thinking":"Thinking"};function q_({text:t}){const{t:e}=ne(),{tag:n,content:r}=U_(t),s=K_(r);if(s.length>0)return c.jsx("div",{className:"flex flex-col gap-1.5",children:s.map(o=>c.jsx(ep,{name:o.name,text:o.content},o.name))});if(n==="local-command-stdout"){const o=r.match(/Launching skill:\s+(\S+)/);if(o)return c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-pink-500/70 dark:text-pink-400/60",children:[c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:c.jsx("path",{d:"M8.5 1.5L3 9h4.5l-1 5.5L13 7H8.5l1-5.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),c.jsxs("span",{children:["Launching skill: ",c.jsx("span",{className:"font-mono font-semibold",children:o[1]})]})]})}const i=G_[n]||e("sessionSystemContext");return c.jsxs("details",{className:"rounded-lg border border-dash-border/60 bg-dash-bg/30 overflow-hidden",children:[c.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-1.5 px-3 py-1.5 text-xs text-dash-text-muted hover:text-dash-text",children:[c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 opacity-50",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M8 7v4.5M8 5.5v.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),c.jsx("span",{children:i})]}),c.jsx("div",{className:"max-h-48 overflow-y-auto border-t border-dash-border/40 px-3 pb-2 pt-1",children:c.jsx("pre",{className:"text-[11px] text-dash-text-muted whitespace-pre-wrap break-words font-mono",children:r})})]})}const Y_=20;function X_({text:t}){const[e,n]=g.useState(!1),r=t.split(`
319
319
  `),s=r.slice(0,6).join(`
320
320
  `);return c.jsxs("div",{"data-search-content":!0,children:[c.jsx($s,{content:e?t:s}),!e&&c.jsxs("div",{className:"mt-1 text-[10px] text-dash-text-muted",children:["...",r.length-6," more lines"]}),c.jsx("button",{type:"button",onClick:()=>n(i=>!i),className:"mt-1 text-[11px] font-semibold text-dash-accent hover:text-dash-accent-hover transition-colors",children:e?"Collapse":"Expand all"})]})}const Q_=({block:t})=>{switch(t.type){case"text":{if(!t.text)return null;const e=F_(t.text);if(e.length>0){const[n,r]=z_(t.text);return n?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("p",{className:"text-sm text-dash-text leading-relaxed","data-search-content":!0,children:[e.map(s=>c.jsx(V_,{name:s},s)),c.jsx("span",{className:"whitespace-pre-wrap break-words",children:n})]}),r&&c.jsx(ep,{name:e[0],text:r})]}):r?c.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(s=>c.jsx(ep,{name:s,text:r},s))}):null}return t.text.split(`
321
- `).length>Y_?c.jsx(X_,{text:t.text}):c.jsx("div",{"data-search-content":!0,children:c.jsx($s,{content:t.text})})}case"thinking":return t.text?c.jsx(W_,{text:t.text}):null;case"tool_use":{const e=t.toolName==="Skill"?H_(t.toolInput):null;return c.jsx(__,{toolName:t.toolName??"Unknown",toolInput:t.toolInput,result:t.result,isError:t.isError,skillName:e??void 0})}case"system":return t.text?c.jsx(q_,{text:t.text}):null;case"tool_result":return null;default:return null}};function J_(t){const e=[];for(const n of t){const r=e[e.length-1];r&&r.role===n.role?r.messages.push(n):e.push({role:n.role,timestamp:n.timestamp??"",messages:[n]})}return e}function Z_({group:t}){const{t:e}=ne(),n=t.role==="user",r=t.messages.length;return c.jsxs("div",{className:`flex flex-col gap-2 rounded-lg border p-4 ${n?"bg-blue-50/50 dark:bg-blue-900/10 border-blue-200/60 dark:border-blue-800/40":"bg-dash-surface border-dash-border"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider ${n?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"bg-dash-accent-subtle text-dash-accent"}`,children:e(n?"sessionUser":"sessionAssistant")}),t.timestamp&&c.jsx("span",{className:"text-[10px] text-dash-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),r>1&&c.jsxs("span",{className:"text-[10px] text-dash-text-muted ml-auto",children:[r," ",e("sessionGroupMessages")]})]}),t.messages.map((s,i)=>c.jsx("div",{className:"flex flex-col gap-1.5",children:s.contentBlocks.map((o,a)=>c.jsx(Q_,{block:o,role:t.role},`${o.type}-${o.toolUseId??a}`))},s.timestamp??`msg-${i}`))]})}const eF=({messages:t})=>{const e=J_(t);return c.jsx("div",{className:"flex flex-col gap-3",children:e.map((n,r)=>c.jsx(Z_,{group:n},`group-${n.timestamp||r}`))})},Pm="data-search-mark",tp="bg-yellow-300/40 text-dash-text rounded-sm px-0.5",tF="ring-2 ring-dash-accent bg-yellow-300/60";function Lh(t){for(const e of t.querySelectorAll(`mark[${Pm}]`)){const n=e.parentNode;n&&(n.replaceChild(document.createTextNode(e.textContent??""),e),n.normalize())}}function nF(t,e){const n=e.toLowerCase(),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(a){const l=a.parentElement;return!l||l.tagName==="MARK"||!l.closest("[data-search-content]")?NodeFilter.FILTER_REJECT:a.textContent?.toLowerCase().includes(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),s=[];let i=r.nextNode();for(;i;)s.push(i),i=r.nextNode();let o=0;for(const a of s){const l=a.textContent??"",d=a.parentNode;if(!d)continue;const u=document.createDocumentFragment();let h=0,f=l.toLowerCase().indexOf(n,0);for(;f!==-1;){f>h&&u.appendChild(document.createTextNode(l.slice(h,f)));const p=document.createElement("mark");p.setAttribute(Pm,""),p.setAttribute("data-match-index",String(o)),p.className=tp,p.textContent=l.slice(f,f+e.length),u.appendChild(p),o++,h=f+e.length,f=l.toLowerCase().indexOf(n,h)}h<l.length&&u.appendChild(document.createTextNode(l.slice(h))),d.replaceChild(u,a)}return o}const rF=({containerRef:t,visible:e})=>{const{t:n}=ne(),[r,s]=g.useState(""),[i,o]=g.useState(""),[a,l]=g.useState(0),[d,u]=g.useState(0),h=g.useRef(null);g.useEffect(()=>{const p=setTimeout(()=>o(r),300);return()=>clearTimeout(p)},[r]),g.useEffect(()=>{e&&h.current?.focus()},[e]),g.useEffect(()=>{const p=t.current;if(!p)return;if(Lh(p),!i.trim()){l(0),u(0);return}const m=nF(p,i.trim());l(m),u(m>0?1:0)},[i,t]),g.useEffect(()=>{const p=t.current;if(!p||a===0)return;const m=p.querySelectorAll(`mark[${Pm}]`);m.forEach((x,b)=>{x.className=b===d-1?`${tp} ${tF}`:tp}),m[d-1]?.scrollIntoView({behavior:"smooth",block:"center"})},[d,a,t]),g.useEffect(()=>{!e&&t.current&&Lh(t.current)},[e,t]),g.useEffect(()=>()=>{t.current&&Lh(t.current)},[t]);const f=g.useCallback(p=>{a!==0&&u(m=>(m-1+p+a)%a+1)},[a]);return e?c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-dash-border bg-dash-surface",children:[c.jsxs("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("path",{d:"m21 21-4.35-4.35"})]}),c.jsx("input",{ref:h,type:"text",value:r,onChange:p=>s(p.target.value),placeholder:n("sessionSearchPlaceholder"),className:"flex-1 bg-dash-bg border border-dash-border rounded-lg px-3 py-1.5 text-sm text-dash-text outline-none focus:border-dash-accent min-w-0"}),c.jsx("span",{className:"text-xs text-dash-text-muted whitespace-nowrap shrink-0",children:a===0?n("sessionNoResults"):`${d}/${a} ${n("sessionSearchResults")}`}),c.jsx("button",{type:"button",onClick:()=>f(-1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"previous match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m18 15-6-6-6 6"})})}),c.jsx("button",{type:"button",onClick:()=>f(1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"next match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m6 9 6 6 6-6"})})})]}):null},us=50;function sF({messageCount:t,toolCallCount:e,duration:n}){const{t:r}=ne();return c.jsxs("div",{className:"flex items-center gap-4 px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:t})," ",r("sessionMessages")]}),c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:e})," ",r("sessionToolCalls")]}),n&&c.jsxs("span",{children:[r("sessionDuration"),": ",c.jsx("strong",{className:"text-dash-text",children:n})]})]})}function Hb({offset:t,limit:e,total:n,onPrev:r,onNext:s}){const i=t+1,o=Math.min(t+e,n);return n<=e?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[i,"–",o," / ",n]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:r,disabled:t<=0,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"←"}),c.jsx("button",{type:"button",onClick:s,disabled:o>=n,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"→"})]})]})}const iF=()=>{const{t}=ne(),e=Lt(),{projectId:n,sessionId:r}=nl(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(0),{data:d,loading:u,error:h}=C4(n,r,us,a),f=d?.summary.messageCount??0,p=!u&&!h&&d&&d.messages.length>0;return c.jsxs("div",{className:"flex flex-col h-full p-6 gap-4 max-w-4xl mx-auto w-full",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>e(`/project/${encodeURIComponent(n??"")}`),className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors shrink-0","aria-label":t("sessionBack"),children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold text-dash-text",children:t("sessionDetail")}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-mono truncate",children:r})]}),p&&c.jsx("button",{type:"button",onClick:()=>o(m=>!m),className:`w-8 h-8 rounded-lg flex items-center justify-center transition-colors shrink-0 ${i?"bg-dash-accent/10 text-dash-accent":"text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text"}`,"aria-label":"Search",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),u&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("sessionLoading")}),!u&&h&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[t("sessionError"),": ",h]}),!u&&!h&&d&&d.messages.length===0&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("noSessionsData")}),p&&c.jsxs(c.Fragment,{children:[c.jsx(sF,{messageCount:d.summary.messageCount,toolCallCount:d.summary.toolCallCount,duration:d.summary.duration}),c.jsx(rF,{containerRef:s,visible:i}),c.jsx(Hb,{offset:a,limit:us,total:f,onPrev:()=>l(m=>Math.max(0,m-us)),onNext:()=>l(m=>m+us)}),c.jsx("div",{ref:s,className:"overflow-y-auto flex-1",children:c.jsx(eF,{messages:d.messages})}),c.jsx(Hb,{offset:a,limit:us,total:f,onPrev:()=>l(m=>Math.max(0,m-us)),onNext:()=>l(m=>m+us)})]})]})},fS="/api";async function oF(){const t=await fetch(`${fS}/skills/browse`);if(!t.ok)throw new Error("Failed to fetch skills browser list");return(await t.json()).skills}async function aF(t){const e=await fetch(`${fS}/skills/browse/${encodeURIComponent(t)}`);if(!e.ok)throw e.status===404?new Error(`Skill "${t}" not found`):new Error("Failed to fetch skill detail");return e.json()}function pS(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{r(!0),i(null);try{const a=await oF();e(a)}catch(a){i(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:s,reload:o}}function lF(t){const[e,n]=g.useState(null),[r,s]=g.useState(!0),[i,o]=g.useState(null),a=g.useCallback(async()=>{s(!0),o(null);try{const l=await aF(t);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load skill detail")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function cF(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}const dF=Fe.forwardRef(({skill:t,selected:e,onClick:n},r)=>c.jsxs("button",{ref:r,type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(cF,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.source==="github"&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:"GitHub"})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})),uF=({name:t})=>{const{t:e}=ne(),{detail:n,loading:r,error:s}=lF(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loadingSkills")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/skills/",n.name,"/SKILL.md"]})}),n.triggers&&n.triggers.length>0&&c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("span",{className:"text-xs text-dash-text-muted",children:[e("skillTriggers"),":"]}),n.triggers.map(i=>c.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:i},i))]}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx($s,{content:n.content})})]}):null},hF=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t});function fF({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const pF=()=>{const{t}=ne(),[e]=sl(),{skills:n,loading:r,error:s}=pS(),[i,o]=g.useState(""),[a,l]=g.useState(null),d=g.useRef(new Map);g.useEffect(()=>{const x=e.get("name");if(x&&n.length>0){const b=x.toLowerCase(),y=`ck-${b}`,w=n.find(v=>v.name===x||v.name.toLowerCase()===b||v.name.toLowerCase()===y);w&&(l(w.name),requestAnimationFrame(()=>{const v=d.current.get(w.name);v&&v.scrollIntoView({behavior:"smooth",block:"center"})}))}},[e,n]);const{size:u,isDragging:h,startDrag:f}=$i({storageKey:"ck-skills-panel-width",defaultSize:380,minSize:260,maxSize:650}),p=g.useMemo(()=>{if(!i.trim())return n;const x=i.toLowerCase();return n.filter(b=>b.name.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x)||b.triggers?.some(y=>y.toLowerCase().includes(x)))},[n,i]),m=g.useMemo(()=>{const x=new Map;for(const b of p){const y=b.source==="github"?"GitHub":t("skillLocal"),w=x.get(y)??[];w.push(b),x.set(y,w)}return x},[p,t]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${u}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("skillsBrowser")}),!r&&!s&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("skillsCount").replace("{count}",String(n.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/skills/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:i,onChange:x=>o(x.target.value),placeholder:t("searchSkillsBrowserPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),i&&c.jsx("button",{type:"button",onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[r&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loadingSkills")}),!r&&s&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:s}),!r&&!s&&m.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noSkillsBrowserFound")}),!r&&!s&&m.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(m.entries()).map(([x,b])=>c.jsxs("div",{children:[m.size>1&&c.jsx(fF,{label:x,count:b.length}),c.jsx("div",{className:"space-y-0.5",children:b.map(y=>c.jsx(dF,{ref:w=>{w?d.current.set(y.name,w):d.current.delete(y.name)},skill:y,selected:a===y.name,onClick:()=>l(y.name)},y.name))})]},x))})]})]}),c.jsx(kn,{onMouseDown:f,isDragging:h,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a?c.jsx(uF,{name:a}):c.jsx(hF,{message:t("selectToView")})})]})},mS=["model","context","quota","directory","git","cost","changes","agents","todos"],wd={contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"cyan",muted:"dim",separator:"dim",quotaLow:"green",quotaHigh:"yellow"},mF=[["model","context","quota"],["directory","git","cost","changes"],["agents","todos"]],gS={model:{icon:"🤖"},quota:{icon:"⌛"},directory:{icon:"📁"},git:{icon:"🌿"},cost:{icon:"💰"},changes:{icon:"📝"},agents:{icon:"🔄"},todos:{icon:"✅"}},$r={baseMode:"full",lines:mF,sectionConfig:gS,theme:wd,responsiveBreakpoint:.85,maxAgentRows:4,todoTruncation:50},gF={model:"claude-sonnet-4-6",context:"▰▰▰▰▰▰▱▱▱▱▱▱ 52%",quota:"5h 31% wk 33%",directory:"~/projects/myapp",git:"main (2, +1, 3↑)",cost:"$0.042",changes:"+128 -34",agents:"○ planner ● researcher",todos:"▸ Implement auth (3 done, 4 pending)"},xS={green:"#4ade80",yellow:"#facc15",red:"#f87171",cyan:"#22d3ee",blue:"#60a5fa",magenta:"#e879f9",white:"#f1f5f9",dim:"#64748b",default:"#94a3b8",brightGreen:"#86efac",brightYellow:"#fde68a",brightRed:"#fca5a5",brightCyan:"#67e8f9",brightBlue:"#93c5fd",brightMagenta:"#f0abfc",brightWhite:"#ffffff"},Dm={model:"cyan",directory:"blue",git:"magenta",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"brightGreen"},Vb=[{name:"Default",labelKey:"statuslinePresetDefault",theme:wd,sectionColors:Dm},{name:"Monochrome",labelKey:"statuslinePresetMonochrome",theme:{contextLow:"white",contextMid:"white",contextHigh:"white",accent:"white",muted:"dim",separator:"dim",quotaLow:"white",quotaHigh:"white"},sectionColors:{model:"white",directory:"white",git:"white",cost:"dim",changes:"white",agents:"white",todos:"white"}},{name:"Nord",labelKey:"statuslinePresetNord",theme:{contextLow:"brightCyan",contextMid:"blue",contextHigh:"magenta",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightBlue"},sectionColors:{model:"brightCyan",directory:"brightBlue",git:"brightCyan",cost:"dim",changes:"brightYellow",agents:"blue",todos:"brightCyan"}},{name:"Dracula",labelKey:"statuslinePresetDracula",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"brightCyan",git:"brightGreen",cost:"dim",changes:"brightYellow",agents:"brightMagenta",todos:"brightGreen"}},{name:"Catppuccin",labelKey:"statuslinePresetCatppuccin",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"brightYellow",git:"brightMagenta",cost:"dim",changes:"brightGreen",agents:"brightBlue",todos:"brightCyan"}},{name:"Gruvbox",labelKey:"statuslinePresetGruvbox",theme:{contextLow:"brightGreen",contextMid:"yellow",contextHigh:"red",accent:"brightYellow",muted:"dim",separator:"dim",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"brightYellow",directory:"brightGreen",git:"red",cost:"dim",changes:"yellow",agents:"brightYellow",todos:"brightGreen"}},{name:"Tokyo Night",labelKey:"statuslinePresetTokyoNight",theme:{contextLow:"cyan",contextMid:"brightBlue",contextHigh:"brightMagenta",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"cyan",git:"brightMagenta",cost:"dim",changes:"brightCyan",agents:"brightBlue",todos:"brightGreen"}},{name:"Solarized",labelKey:"statuslinePresetSolarized",theme:{contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"blue",muted:"dim",separator:"dim",quotaLow:"cyan",quotaHigh:"yellow"},sectionColors:{model:"blue",directory:"cyan",git:"green",cost:"dim",changes:"yellow",agents:"blue",todos:"green"}},{name:"Rose Pine",labelKey:"statuslinePresetRosePine",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"magenta",muted:"dim",separator:"dim",quotaLow:"magenta",quotaHigh:"brightRed"},sectionColors:{model:"magenta",directory:"brightBlue",git:"brightMagenta",cost:"dim",changes:"brightYellow",agents:"magenta",todos:"brightGreen"}},{name:"One Dark",labelKey:"statuslinePresetOneDark",theme:{contextLow:"green",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightRed"},sectionColors:{model:"brightCyan",directory:"blue",git:"brightRed",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"green"}},{name:"Ayu",labelKey:"statuslinePresetAyu",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"yellow",muted:"dim",separator:"white",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"yellow",directory:"brightCyan",git:"brightYellow",cost:"dim",changes:"brightGreen",agents:"yellow",todos:"brightGreen"}},{name:"Kanagawa",labelKey:"statuslinePresetKanagawa",theme:{contextLow:"cyan",contextMid:"brightYellow",contextHigh:"red",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"cyan",git:"brightYellow",cost:"dim",changes:"brightBlue",agents:"brightMagenta",todos:"cyan"}},{name:"Stealth",labelKey:"statuslinePresetStealth",theme:{contextLow:"dim",contextMid:"dim",contextHigh:"brightRed",accent:"dim",muted:"dim",separator:"dim",quotaLow:"dim",quotaHigh:"brightRed"},sectionColors:{model:"dim",directory:"dim",git:"dim",cost:"dim",changes:"dim",agents:"dim",todos:"dim"}},{name:"Hacker",labelKey:"statuslinePresetHacker",theme:{contextLow:"green",contextMid:"brightGreen",contextHigh:"brightGreen",accent:"brightGreen",muted:"green",separator:"green",quotaLow:"green",quotaHigh:"brightGreen"},sectionColors:{model:"brightGreen",directory:"green",git:"brightGreen",cost:"green",changes:"brightGreen",agents:"green",todos:"brightGreen"}}],xF=({sectionId:t,label:e,config:n,onConfigChange:r,onRemove:s})=>{const{t:i}=ne(),[o,a]=g.useState(!1),{attributes:l,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:p}=xL({id:t}),m={transform:ts.Transform.toString(h),transition:f,opacity:p?.4:1,zIndex:p?50:void 0},x=k=>{r({...n,icon:k.target.value||void 0})},b=k=>{r({...n,label:k.target.value||void 0})},y=k=>{const C=Number.parseInt(k.target.value,10);r({...n,maxWidth:Number.isNaN(C)?void 0:Math.max(10,Math.min(200,C))})},w=n.icon??"",v=n.label??e;return c.jsxs("div",{ref:u,style:m,className:"relative",children:[c.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1 rounded-md border cursor-pointer select-none transition-all ${p?"border-dash-accent bg-dash-accent/20 shadow-lg":"border-dash-border bg-dash-surface hover:border-dash-accent/60 hover:bg-dash-surface-hover"}`,children:[c.jsx("span",{...l,...d,className:"text-dash-text-muted cursor-grab active:cursor-grabbing shrink-0 opacity-50 group-hover:opacity-100 transition-opacity","aria-label":"drag handle",children:"⠿"}),c.jsxs("button",{type:"button",onClick:()=>a(k=>!k),className:"flex items-center gap-1 text-xs text-dash-text min-w-0","aria-label":i(o?"statuslineCollapseSettings":"statuslineExpandSettings"),children:[w&&c.jsx("span",{className:"shrink-0",children:w}),c.jsx("span",{className:"truncate",children:v}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 text-dash-text-muted transition-transform ${o?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&c.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),s()},className:"text-dash-text-muted/40 hover:text-red-400 transition-colors shrink-0","aria-label":"remove section",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&c.jsxs("div",{className:"absolute top-full left-0 z-20 mt-1 w-56 p-3 rounded-lg border border-dash-border bg-dash-surface shadow-xl space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-icon-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineIconOverride")}),c.jsx("input",{id:`chip-icon-${t}`,type:"text",value:n.icon??"",onChange:x,placeholder:i("statuslineIconPlaceholder"),maxLength:20,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-label-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineLabelOverride")}),c.jsx("input",{id:`chip-label-${t}`,type:"text",value:n.label??"",onChange:b,placeholder:e,maxLength:50,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-maxwidth-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineMaxWidth")}),c.jsx("input",{id:`chip-maxwidth-${t}`,type:"number",min:10,max:200,value:n.maxWidth??"",onChange:y,placeholder:i("statuslineMaxWidthPlaceholder"),className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsx("button",{type:"button",onClick:()=>a(!1),className:"w-full text-[10px] py-0.5 text-dash-text-muted hover:text-dash-text transition-colors",children:i("closeModal")})]})]})},bF={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},Wb=({containerId:t,sectionIds:e,sectionConfig:n,onConfigChange:r,onRemoveSection:s,headerLabel:i,onRemove:o,isPool:a=!1})=>{const{t:l}=ne(),{setNodeRef:d,isOver:u}=Lk({id:t});return c.jsxs("div",{className:`rounded-lg border transition-colors ${a?"border-dash-border/50 bg-dash-bg/50":u?"border-dash-accent/60 bg-dash-accent/5":"border-dash-border bg-dash-surface"}`,children:[i&&c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dash-border/50",children:[c.jsx("span",{className:`text-xs font-medium uppercase tracking-wider ${a?"text-dash-text-muted/70":"text-dash-text-muted"}`,children:i}),o&&c.jsx("button",{type:"button",onClick:o,className:"text-xs text-dash-text-muted hover:text-red-400 transition-colors px-1","aria-label":l("statuslineRemoveLine"),children:l("statuslineRemoveLine")})]}),c.jsx("div",{ref:d,className:"p-2 min-h-[44px]",children:c.jsx(dL,{items:e,strategy:lL,children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?c.jsx("span",{className:"text-xs text-dash-text-muted/50 italic px-1 py-0.5",children:a?l("statuslineDragToLine"):"—"}):e.map(h=>c.jsx(xF,{sectionId:h,label:l(bF[h]??"statuslineSectionModelLabel"),config:n[h]??{},onConfigChange:f=>r(h,f),onRemove:!a&&s?()=>s(h):void 0},h))})})})]})};function Kb(t,e,n){for(let r=0;r<t.length;r++)if(t[r].includes(n))return`line-${r}`;return e.includes(n)?"pool":null}const yF=({lines:t,sectionConfig:e,onLinesChange:n,onSectionConfigChange:r})=>{const{t:s}=ne(),[i,o]=g.useState(null),a=H7(Ix(mm),Ix(fm,{coordinateGetter:vL})),l=new Set(t.flat()),d=mS.filter(b=>!l.has(b)),u=b=>{o(String(b.active.id))},h=b=>{o(null);const{active:y,over:w}=b;if(!w)return;const v=String(y.id),k=String(w.id),C=Kb(t,d,v);let N=Kb(t,d,k);if(N||(k.startsWith("line-")||k==="pool")&&(N=k),!C||!N||v===k)return;const S=t.map(M=>[...M]),D=M=>{if(M==="pool")return[...d];const P=Number.parseInt(M.replace("line-",""),10);return S[P]??[]},E=(M,P)=>{if(M==="pool")return;const A=Number.parseInt(M.replace("line-",""),10);S[A]=P};if(C===N){const M=D(C),P=M.indexOf(v),A=M.indexOf(k);P!==-1&&A!==-1&&E(C,xm(M,P,A))}else{const M=D(C),P=D(N),A=M.filter(T=>T!==v),R=P.indexOf(k),j=R===-1?P.length:R,O=[...P.slice(0,j),v,...P.slice(j)];C!=="pool"&&E(C,A),N!=="pool"&&E(N,O)}n(S)},f=()=>{n([...t,[]])},p=b=>{t[b];const y=t.filter((w,v)=>v!==b);n(y)},m=(b,y)=>{r({...e,[b]:y})},x=(b,y)=>{const w=t.map((v,k)=>k===b?v.filter(C=>C!==y):[...v]);n(w)};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-xs text-dash-text-muted px-1",children:s("statuslineDragHint")}),c.jsxs(F8,{sensors:a,collisionDetection:K7,onDragStart:u,onDragEnd:h,children:[c.jsx("div",{className:"space-y-2",children:t.map((b,y)=>c.jsx(Wb,{containerId:`line-${y}`,sectionIds:b,sectionConfig:e,onConfigChange:m,onRemoveSection:w=>x(y,w),headerLabel:`${s("statuslineLine")} ${y+1}`,onRemove:()=>p(y)},`line-zone-${y}`))}),c.jsxs("button",{type:"button",onClick:f,className:"w-full text-xs px-3 py-2 rounded-lg border border-dashed border-dash-border text-dash-text-muted hover:border-dash-accent/60 hover:text-dash-text transition-colors",children:["+ ",s("statuslineAddLine")]}),c.jsxs("div",{className:"pt-0.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider mb-1 px-1",children:s("statuslineHiddenSections")}),c.jsx(Wb,{containerId:"pool",sectionIds:d,sectionConfig:e,onConfigChange:m,isPool:!0})]}),c.jsx(sL,{children:i?c.jsx("div",{className:"px-2 py-1 rounded-md border border-dash-accent bg-dash-accent/20 text-xs text-dash-text shadow-xl opacity-90",children:i}):null})]})]})},tn=xS;function vF(t){return tn[t]??tn.default}const wF=({sectionId:t,config:e,theme:n})=>{const r=gF[t]??t,s=e.icon??"";let i=e.color??Dm[t]??n.accent;t==="context"&&!e.color&&(i=n.contextMid),t==="quota"&&!e.color&&(i=n.quotaLow);const o=vF(i),a=e.label?`${s} ${e.label}: ${r}`:s?`${s} ${r}`:r,l=e.maxWidth&&a.length>e.maxWidth?`${a.slice(0,e.maxWidth-1)}…`:a;return c.jsx("span",{className:"font-mono text-xs whitespace-nowrap",style:{color:o},children:l})},kF=c.jsx("span",{className:"font-mono text-xs",style:{color:tn.dim},children:" │ "}),SF=({sectionIds:t,sectionConfig:e,theme:n})=>{const{t:r}=ne();return c.jsx("div",{className:"flex items-center gap-0 py-0.5 px-2 rounded mb-0.5 last:mb-0 overflow-hidden",style:{backgroundColor:"#313244"},children:t.length===0?c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:tn.dim},children:r("statuslinePreviewEmptyLine")}):t.map((s,i)=>c.jsxs("span",{className:"flex items-center shrink-0",children:[c.jsx(wF,{sectionId:s,config:e[s]??{},theme:n}),i<t.length-1&&kF]},s))})},CF=({lines:t,sectionConfig:e,theme:n})=>{const{t:r}=ne(),s=t.reduce((i,o)=>i+o.length,0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:r("statuslinePreview")}),c.jsxs("span",{className:"text-xs text-dash-text-muted/60",children:[s," ",r("statuslineSectionsVisible")]})]}),c.jsxs("div",{className:"rounded-lg overflow-hidden border border-dash-border shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#1e1e2e] border-b border-[#313244]",children:[c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f38ba8]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f9e2af]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#a6e3a1]"})]}),c.jsx("span",{className:"text-xs text-[#6c7086] font-mono ml-2",children:r("statuslinePreviewTitle")})]}),c.jsxs("div",{className:"bg-[#1e1e2e] px-3 py-2 font-mono text-xs overflow-x-auto select-none",children:[c.jsxs("div",{className:"mb-1",children:[c.jsx("span",{style:{color:tn.green},children:"user@machine"}),c.jsx("span",{style:{color:tn.dim},children:":"}),c.jsx("span",{style:{color:tn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:tn.white},children:" $ "})]}),t.length===0?c.jsx("div",{className:"py-0.5 px-2 rounded mb-0.5",style:{backgroundColor:"#313244"},children:c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:tn.dim},children:r("statuslinePreviewNoLines")})}):t.map((i,o)=>c.jsx(SF,{sectionIds:i,sectionConfig:e,theme:n},o)),c.jsxs("div",{className:"mt-1 flex items-center",children:[c.jsx("span",{style:{color:tn.green},children:"user@machine"}),c.jsx("span",{style:{color:tn.dim},children:":"}),c.jsx("span",{style:{color:tn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:tn.white},children:" $ "}),c.jsx("span",{className:"inline-block w-2 h-4 bg-white/70 animate-pulse ml-0.5"})]})]})]})]})},jF={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},NF=["green","yellow","red","cyan","blue","magenta","white","dim","brightGreen","brightYellow","brightRed","brightCyan","brightBlue","brightMagenta","brightWhite"],kd=xS,gr=({field:t,label:e,value:n,onChange:r})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full shrink-0 border border-white/20",style:{backgroundColor:kd[n]??kd.default}}),c.jsx("label",{htmlFor:`color-${t}`,className:"text-xs text-dash-text-muted w-24 shrink-0",children:e}),c.jsx("select",{id:`color-${t}`,value:n,onChange:s=>r(s.target.value),className:"flex-1 text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text focus:outline-none focus:border-dash-accent",children:NF.map(s=>c.jsx("option",{value:s,children:s},s))})]}),PF=({theme:t,sectionConfig:e,onChange:n,onSectionConfigChange:r})=>{const{t:s}=ne(),i=(d,u)=>{n({...t,[d]:u})},o=(d,u)=>{r({...e,[d]:{...e[d],color:u}})},a=d=>{n({...d.theme});const u={...e};for(const[h,f]of Object.entries(d.sectionColors))u[h]={...u[h],color:f};r(u)},l=Vb.findIndex(d=>d.theme.contextLow===t.contextLow&&d.theme.contextMid===t.contextMid&&d.theme.contextHigh===t.contextHigh&&d.theme.accent===t.accent&&d.theme.muted===t.muted&&d.theme.separator===t.separator&&d.theme.quotaLow===t.quotaLow&&d.theme.quotaHigh===t.quotaHigh);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted mb-2 uppercase tracking-wider",children:s("statuslineTheme")}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:Vb.map((d,u)=>c.jsx("button",{type:"button",onClick:()=>a(d),className:`text-xs px-3 py-2 rounded border transition-colors text-left ${l===u?"border-dash-accent bg-dash-accent/10 text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:c.jsxs("span",{className:"flex items-center gap-1",children:[[d.sectionColors.model,d.theme.contextMid,d.sectionColors.git,d.sectionColors.changes].map((h,f)=>c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:kd[h]??kd.default}},f)),c.jsx("span",{className:"ml-0.5",children:s(d.labelKey)})]})},d.name))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["▰ ",s("statuslineColorContextGroup")]}),c.jsx(gr,{field:"contextLow",label:s("statuslineColorContextLow"),value:t.contextLow,onChange:d=>i("contextLow",d)}),c.jsx(gr,{field:"contextMid",label:s("statuslineColorContextMid"),value:t.contextMid,onChange:d=>i("contextMid",d)}),c.jsx(gr,{field:"contextHigh",label:s("statuslineColorContextHigh"),value:t.contextHigh,onChange:d=>i("contextHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["⌛ ",s("statuslineColorQuotaGroup")]}),c.jsx(gr,{field:"quotaLow",label:s("statuslineQuotaLow"),value:t.quotaLow,onChange:d=>i("quotaLow",d)}),c.jsx(gr,{field:"quotaHigh",label:s("statuslineQuotaHigh"),value:t.quotaHigh,onChange:d=>i("quotaHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorGeneralGroup")}),c.jsx(gr,{field:"accent",label:s("statuslineColorAccent"),value:t.accent,onChange:d=>i("accent",d)}),c.jsx(gr,{field:"muted",label:s("statuslineColorMuted"),value:t.muted,onChange:d=>i("muted",d)}),c.jsx(gr,{field:"separator",label:s("statuslineColorSeparator"),value:t.separator,onChange:d=>i("separator",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorSectionGroup")}),mS.filter(d=>d!=="context"&&d!=="quota").map(d=>{const u=e[d]?.icon??gS[d]?.icon??"",h=s(jF[d]??"statuslineSectionModelLabel");return c.jsx(gr,{field:`section-${d}`,label:u?`${u} ${h}`:h,value:e[d]?.color??Dm[d]??"default",onChange:f=>o(d,f)},d)})]})]})]})};function DF(t){return{baseMode:t.baseMode??$r.baseMode,lines:t.lines??$r.lines,sectionConfig:t.sectionConfig??$r.sectionConfig,theme:t.theme?{...wd,...t.theme}:wd,responsiveBreakpoint:t.responsiveBreakpoint??$r.responsiveBreakpoint,maxAgentRows:t.maxAgentRows??$r.maxAgentRows,todoTruncation:t.todoTruncation??$r.todoTruncation}}const EF=()=>{const{t}=ne(),[e,n]=g.useState($r),[r,s]=g.useState(!0),[i,o]=g.useState(!1),[a,l]=g.useState(null),[d,u]=g.useState(!1),[h,f]=g.useState(!1),{size:p,isDragging:m,startDrag:x}=$i({storageKey:"ck-statusline-preview-width",defaultSize:500,minSize:300,maxSize:900,direction:"horizontal",invert:!0});g.useEffect(()=>{let C=!1;return Gf("global").then(N=>{if(C)return;const S=N.config.statuslineLayout;S&&n(DF(S))}).catch(()=>{C||f(!0)}).finally(()=>{C||s(!1)}),()=>{C=!0}},[]);const b=g.useCallback(async()=>{o(!0),l(null),u(!1);try{await nT("statuslineLayout",e,"global"),u(!0),setTimeout(()=>u(!1),3e3)}catch(C){l(C instanceof Error?C.message:"Unknown error")}finally{o(!1)}},[e]),y=g.useCallback(()=>{n($r),u(!1),l(null)},[]),w=g.useCallback(C=>{n(N=>({...N,lines:C}))},[]),v=g.useCallback(C=>{n(N=>({...N,sectionConfig:C}))},[]),k=g.useCallback(C=>{n(N=>({...N,theme:C}))},[]);return r?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("div",{className:"text-dash-text-muted text-sm",children:t("loading")})}):c.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[c.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-dash-border bg-dash-surface",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-dash-text",children:t("statuslineBuilder")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-0.5",children:t("statuslineBuilderDescription")})]}),d&&c.jsx("div",{className:"text-xs text-green-400 bg-green-400/10 border border-green-400/20 rounded px-3 py-1.5",children:t("statuslineSaved")}),h&&c.jsx("div",{className:"bg-orange-50 dark:bg-orange-950 text-orange-700 dark:text-orange-300 px-4 py-2 rounded-md text-sm border border-orange-200 dark:border-orange-800",children:t("statuslineLoadErrorSaveDisabled")}),a&&c.jsxs("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-400/20 rounded px-3 py-1.5",children:[t("statuslineSaveError"),": ",a]})]})}),c.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-dash-border overflow-hidden",children:[c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.jsx(PF,{theme:e.theme,sectionConfig:e.sectionConfig,onChange:k,onSectionConfigChange:v})}),c.jsxs("div",{className:"shrink-0 px-4 py-3 border-t border-dash-border bg-dash-surface flex gap-2",children:[c.jsx("button",{type:"button",onClick:y,className:"text-xs px-3 py-1.5 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:t("statuslineResetDefaults")}),c.jsx("button",{type:"button",onClick:b,disabled:i||h,className:"flex-1 text-xs px-3 py-1.5 rounded border border-dash-accent bg-dash-accent/10 text-dash-accent hover:bg-dash-accent/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:i?`${t("saving")}…`:t("statuslineSave")})]})]}),c.jsx(kn,{direction:"horizontal",isDragging:m,onMouseDown:x}),c.jsxs("div",{className:"shrink-0 overflow-y-auto p-4 bg-dash-bg space-y-4",style:{width:p},children:[c.jsx(CF,{lines:e.lines,sectionConfig:e.sectionConfig,theme:e.theme}),c.jsx(yF,{lines:e.lines,sectionConfig:e.sectionConfig,onLinesChange:w,onSectionConfigChange:v})]})]})]})},OF=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:s,className:i})=>{const{t:o}=ne(),a=t.filter(u=>u.status==="update-available").length,l=t.length>0&&t.every(u=>u.status==="up-to-date"||u.status==="idle"),d=t.filter(u=>u.status==="up-to-date").length;return c.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${i??""}`,children:[c.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs",children:[c.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?c.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?c.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):c.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),d>0&&c.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:d})]}),c.jsx("button",{type:"button",onClick:r,disabled:e||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&c.jsx("button",{type:"button",onClick:s,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},MF=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=ne();return c.jsxs("fieldset",{className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 gap-1",role:"radiogroup","aria-label":"Update channel",children:[c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,className:"sr-only"}),r("channelStable")]}),c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},AF={idle:{color:"bg-dash-text-muted",pulse:!1},checking:{color:"bg-dash-text-muted",pulse:!0},"up-to-date":{color:"bg-emerald-500",pulse:!1},"update-available":{color:"bg-amber-500",pulse:!1}},bS=({status:t,ariaLabel:e,size:n="sm"})=>{const r=AF[t],s=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return c.jsx("span",{className:`
321
+ `).length>Y_?c.jsx(X_,{text:t.text}):c.jsx("div",{"data-search-content":!0,children:c.jsx($s,{content:t.text})})}case"thinking":return t.text?c.jsx(W_,{text:t.text}):null;case"tool_use":{const e=t.toolName==="Skill"?H_(t.toolInput):null;return c.jsx(__,{toolName:t.toolName??"Unknown",toolInput:t.toolInput,result:t.result,isError:t.isError,skillName:e??void 0})}case"system":return t.text?c.jsx(q_,{text:t.text}):null;case"tool_result":return null;default:return null}};function J_(t){const e=[];for(const n of t){const r=e[e.length-1];r&&r.role===n.role?r.messages.push(n):e.push({role:n.role,timestamp:n.timestamp??"",messages:[n]})}return e}function Z_({group:t}){const{t:e}=ne(),n=t.role==="user",r=t.messages.length;return c.jsxs("div",{className:`flex flex-col gap-2 rounded-lg border p-4 ${n?"bg-blue-50/50 dark:bg-blue-900/10 border-blue-200/60 dark:border-blue-800/40":"bg-dash-surface border-dash-border"}`,children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider ${n?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"bg-dash-accent-subtle text-dash-accent"}`,children:e(n?"sessionUser":"sessionAssistant")}),t.timestamp&&c.jsx("span",{className:"text-[10px] text-dash-text-muted",children:new Date(t.timestamp).toLocaleTimeString()}),r>1&&c.jsxs("span",{className:"text-[10px] text-dash-text-muted ml-auto",children:[r," ",e("sessionGroupMessages")]})]}),t.messages.map((s,i)=>c.jsx("div",{className:"flex flex-col gap-1.5",children:s.contentBlocks.map((o,a)=>c.jsx(Q_,{block:o,role:t.role},`${o.type}-${o.toolUseId??a}`))},s.timestamp??`msg-${i}`))]})}const eF=({messages:t})=>{const e=J_(t);return c.jsx("div",{className:"flex flex-col gap-3",children:e.map((n,r)=>c.jsx(Z_,{group:n},`group-${n.timestamp||r}`))})},Pm="data-search-mark",tp="bg-yellow-300/40 text-dash-text rounded-sm px-0.5",tF="ring-2 ring-dash-accent bg-yellow-300/60";function Lh(t){for(const e of t.querySelectorAll(`mark[${Pm}]`)){const n=e.parentNode;n&&(n.replaceChild(document.createTextNode(e.textContent??""),e),n.normalize())}}function nF(t,e){const n=e.toLowerCase(),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(a){const l=a.parentElement;return!l||l.tagName==="MARK"||!l.closest("[data-search-content]")?NodeFilter.FILTER_REJECT:a.textContent?.toLowerCase().includes(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),s=[];let i=r.nextNode();for(;i;)s.push(i),i=r.nextNode();let o=0;for(const a of s){const l=a.textContent??"",d=a.parentNode;if(!d)continue;const u=document.createDocumentFragment();let h=0,f=l.toLowerCase().indexOf(n,0);for(;f!==-1;){f>h&&u.appendChild(document.createTextNode(l.slice(h,f)));const p=document.createElement("mark");p.setAttribute(Pm,""),p.setAttribute("data-match-index",String(o)),p.className=tp,p.textContent=l.slice(f,f+e.length),u.appendChild(p),o++,h=f+e.length,f=l.toLowerCase().indexOf(n,h)}h<l.length&&u.appendChild(document.createTextNode(l.slice(h))),d.replaceChild(u,a)}return o}const rF=({containerRef:t,visible:e})=>{const{t:n}=ne(),[r,s]=g.useState(""),[i,o]=g.useState(""),[a,l]=g.useState(0),[d,u]=g.useState(0),h=g.useRef(null);g.useEffect(()=>{const p=setTimeout(()=>o(r),300);return()=>clearTimeout(p)},[r]),g.useEffect(()=>{e&&h.current?.focus()},[e]),g.useEffect(()=>{const p=t.current;if(!p)return;if(Lh(p),!i.trim()){l(0),u(0);return}const m=nF(p,i.trim());l(m),u(m>0?1:0)},[i,t]),g.useEffect(()=>{const p=t.current;if(!p||a===0)return;const m=p.querySelectorAll(`mark[${Pm}]`);m.forEach((x,b)=>{x.className=b===d-1?`${tp} ${tF}`:tp}),m[d-1]?.scrollIntoView({behavior:"smooth",block:"center"})},[d,a,t]),g.useEffect(()=>{!e&&t.current&&Lh(t.current)},[e,t]),g.useEffect(()=>()=>{t.current&&Lh(t.current)},[t]);const f=g.useCallback(p=>{a!==0&&u(m=>(m-1+p+a)%a+1)},[a]);return e?c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-dash-border bg-dash-surface",children:[c.jsxs("svg",{className:"w-4 h-4 text-dash-text-muted shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("path",{d:"m21 21-4.35-4.35"})]}),c.jsx("input",{ref:h,type:"text",value:r,onChange:p=>s(p.target.value),placeholder:n("sessionSearchPlaceholder"),className:"flex-1 bg-dash-bg border border-dash-border rounded-lg px-3 py-1.5 text-sm text-dash-text outline-none focus:border-dash-accent min-w-0"}),c.jsx("span",{className:"text-xs text-dash-text-muted whitespace-nowrap shrink-0",children:a===0?n("sessionNoResults"):`${d}/${a} ${n("sessionSearchResults")}`}),c.jsx("button",{type:"button",onClick:()=>f(-1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"previous match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m18 15-6-6-6 6"})})}),c.jsx("button",{type:"button",onClick:()=>f(1),disabled:a===0,className:"p-1 rounded hover:bg-dash-hover disabled:opacity-40","aria-label":"next match",children:c.jsx("svg",{className:"w-4 h-4 text-dash-text",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m6 9 6 6 6-6"})})})]}):null},us=50;function sF({messageCount:t,toolCallCount:e,duration:n}){const{t:r}=ne();return c.jsxs("div",{className:"flex items-center gap-4 px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:t})," ",r("sessionMessages")]}),c.jsxs("span",{children:[c.jsx("strong",{className:"text-dash-text",children:e})," ",r("sessionToolCalls")]}),n&&c.jsxs("span",{children:[r("sessionDuration"),": ",c.jsx("strong",{className:"text-dash-text",children:n})]})]})}function Hb({offset:t,limit:e,total:n,onPrev:r,onNext:s}){const i=t+1,o=Math.min(t+e,n);return n<=e?null:c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-dash-surface border border-dash-border text-xs text-dash-text-muted",children:[c.jsxs("span",{children:[i,"–",o," / ",n]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"button",onClick:r,disabled:t<=0,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"←"}),c.jsx("button",{type:"button",onClick:s,disabled:o>=n,className:"px-2 py-1 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"→"})]})]})}const iF=()=>{const{t}=ne(),e=Lt(),{projectId:n,sessionId:r}=nl(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(0),{data:d,loading:u,error:h}=C4(n,r,us,a),f=d?.summary.messageCount??0,p=!u&&!h&&d&&d.messages.length>0;return c.jsxs("div",{className:"flex flex-col h-full p-6 gap-4 max-w-4xl mx-auto w-full",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>e(`/project/${encodeURIComponent(n??"")}`),className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors shrink-0","aria-label":t("sessionBack"),children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold text-dash-text",children:t("sessionDetail")}),c.jsx("p",{className:"text-[10px] text-dash-text-muted font-mono truncate",children:r})]}),p&&c.jsx("button",{type:"button",onClick:()=>o(m=>!m),className:`w-8 h-8 rounded-lg flex items-center justify-center transition-colors shrink-0 ${i?"bg-dash-accent/10 text-dash-accent":"text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text"}`,"aria-label":"Search",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),u&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("sessionLoading")}),!u&&h&&c.jsxs("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:[t("sessionError"),": ",h]}),!u&&!h&&d&&d.messages.length===0&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm",children:t("noSessionsData")}),p&&c.jsxs(c.Fragment,{children:[c.jsx(sF,{messageCount:d.summary.messageCount,toolCallCount:d.summary.toolCallCount,duration:d.summary.duration}),c.jsx(rF,{containerRef:s,visible:i}),c.jsx(Hb,{offset:a,limit:us,total:f,onPrev:()=>l(m=>Math.max(0,m-us)),onNext:()=>l(m=>m+us)}),c.jsx("div",{ref:s,className:"overflow-y-auto flex-1",children:c.jsx(eF,{messages:d.messages})}),c.jsx(Hb,{offset:a,limit:us,total:f,onPrev:()=>l(m=>Math.max(0,m-us)),onNext:()=>l(m=>m+us)})]})]})},fS="/api";async function oF(){const t=await fetch(`${fS}/skills/browse`);if(!t.ok)throw new Error("Failed to fetch skills browser list");return(await t.json()).skills}async function aF(t){const e=await fetch(`${fS}/skills/browse/${encodeURIComponent(t)}`);if(!e.ok)throw e.status===404?new Error(`Skill "${t}" not found`):new Error("Failed to fetch skill detail");return e.json()}function pS(){const[t,e]=g.useState([]),[n,r]=g.useState(!0),[s,i]=g.useState(null),o=g.useCallback(async()=>{r(!0),i(null);try{const a=await oF();e(a)}catch(a){i(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return g.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:s,reload:o}}function lF(t){const[e,n]=g.useState(null),[r,s]=g.useState(!0),[i,o]=g.useState(null),a=g.useCallback(async()=>{s(!0),o(null);try{const l=await aF(t);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load skill detail")}finally{s(!1)}},[t]);return g.useEffect(()=>{a()},[a]),{detail:e,loading:r,error:i,reload:a}}function cF(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5 shrink-0 text-dash-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}const dF=Fe.forwardRef(({skill:t,selected:e,onClick:n},r)=>c.jsxs("button",{ref:r,type:"button",onClick:n,className:["w-full flex items-start gap-2 px-3 py-2 rounded-md transition-colors text-left group",e?"bg-dash-accent/10 border border-dash-accent/30":"hover:bg-dash-surface-hover border border-transparent"].join(" "),children:[c.jsx(cF,{}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-dash-accent font-mono",children:t.name}),t.source==="github"&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-medium shrink-0",children:"GitHub"})]}),t.description&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5 truncate",children:t.description})]})]})),uF=({name:t})=>{const{t:e}=ne(),{detail:n,loading:r,error:s}=lF(t);return r?c.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-dash-text-muted",children:e("loadingSkills")}):s?c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm",children:s}):n?c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h2",{className:"text-base font-semibold text-dash-text font-mono truncate flex-1",children:n.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:e("sessionReadOnly")})]}),n.description&&c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface px-4 py-3",children:c.jsx("p",{className:"text-sm text-dash-text-muted",children:n.description})}),c.jsx("div",{className:"flex items-center gap-2 text-xs text-dash-text-muted",children:c.jsxs("span",{className:"font-mono px-2 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:["~/.claude/skills/",n.name,"/SKILL.md"]})}),n.triggers&&n.triggers.length>0&&c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("span",{className:"text-xs text-dash-text-muted",children:[e("skillTriggers"),":"]}),n.triggers.map(i=>c.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-dash-surface border border-dash-border text-dash-accent",children:i},i))]}),c.jsx("div",{className:"rounded-lg border border-dash-border bg-dash-surface p-5 overflow-x-auto",children:c.jsx($s,{content:n.content})})]}):null},hF=({message:t})=>c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-dash-text-muted",children:t});function fF({label:t,count:e}){return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-bold text-dash-text-muted uppercase tracking-wider flex-1",children:t}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold",children:e})]})}const pF=()=>{const{t}=ne(),[e]=sl(),{skills:n,loading:r,error:s}=pS(),[i,o]=g.useState(""),[a,l]=g.useState(null),d=g.useRef(new Map);g.useEffect(()=>{const x=e.get("name");if(x&&n.length>0){const b=x.toLowerCase(),y=`ck-${b}`,w=n.find(v=>v.name===x||v.name.toLowerCase()===b||v.name.toLowerCase()===y);w&&(l(w.name),requestAnimationFrame(()=>{const v=d.current.get(w.name);v&&v.scrollIntoView({behavior:"smooth",block:"center"})}))}},[e,n]);const{size:u,isDragging:h,startDrag:f}=$i({storageKey:"ck-skills-panel-width",defaultSize:380,minSize:260,maxSize:650}),p=g.useMemo(()=>{if(!i.trim())return n;const x=i.toLowerCase();return n.filter(b=>b.name.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x)||b.triggers?.some(y=>y.toLowerCase().includes(x)))},[n,i]),m=g.useMemo(()=>{const x=new Map;for(const b of p){const y=b.source==="github"?"GitHub":t("skillLocal"),w=x.get(y)??[];w.push(b),x.set(y,w)}return x},[p,t]);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsxs("div",{style:{width:`${u}px`},className:"shrink-0 flex flex-col overflow-hidden border-r border-dash-border",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-3 border-b border-dash-border",children:[c.jsxs("div",{className:"flex items-start justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-base font-bold text-dash-text",children:t("skillsBrowser")}),!r&&!s&&c.jsx("p",{className:"text-xs text-dash-text-muted mt-0.5",children:t("skillsCount").replace("{count}",String(n.length))}),c.jsx("p",{className:"text-[11px] text-dash-text-muted font-mono mt-0.5",children:"~/.claude/skills/"})]}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-dash-accent-subtle text-dash-accent font-semibold shrink-0",children:t("sessionReadOnly")})]}),c.jsxs("div",{className:"relative",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-dash-text-muted pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),c.jsx("input",{type:"text",value:i,onChange:x=>o(x.target.value),placeholder:t("searchSkillsBrowserPlaceholder"),className:"w-full pl-9 pr-4 py-2 text-sm bg-dash-surface border border-dash-border rounded-lg text-dash-text placeholder:text-dash-text-muted focus:outline-none focus:border-dash-accent/50 transition-colors"}),i&&c.jsx("button",{type:"button",onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[r&&c.jsx("div",{className:"flex flex-1 items-center justify-center text-dash-text-muted text-sm p-8",children:t("loadingSkills")}),!r&&s&&c.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400 text-sm m-2",children:s}),!r&&!s&&m.size===0&&c.jsx("div",{className:"flex items-center justify-center p-8 text-dash-text-muted text-sm",children:t("noSkillsBrowserFound")}),!r&&!s&&m.size>0&&c.jsx("div",{className:"flex flex-col gap-2 pb-4",children:Array.from(m.entries()).map(([x,b])=>c.jsxs("div",{children:[m.size>1&&c.jsx(fF,{label:x,count:b.length}),c.jsx("div",{className:"space-y-0.5",children:b.map(y=>c.jsx(dF,{ref:w=>{w?d.current.set(y.name,w):d.current.delete(y.name)},skill:y,selected:a===y.name,onClick:()=>l(y.name)},y.name))})]},x))})]})]}),c.jsx(kn,{onMouseDown:f,isDragging:h,direction:"horizontal"}),c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a?c.jsx(uF,{name:a}):c.jsx(hF,{message:t("selectToView")})})]})},mS=["model","context","quota","directory","git","cost","changes","agents","todos"],wd={contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"cyan",muted:"dim",separator:"dim",quotaLow:"green",quotaHigh:"red"},mF=[["model","context","quota"],["directory","git","cost","changes"],["agents","todos"]],gS={model:{icon:"🤖"},quota:{icon:"⌛"},directory:{icon:"📁"},git:{icon:"🌿"},cost:{icon:"💰"},changes:{icon:"📝"},agents:{icon:"🔄"},todos:{icon:"✅"}},$r={baseMode:"full",lines:mF,sectionConfig:gS,theme:wd,responsiveBreakpoint:.85,maxAgentRows:4,todoTruncation:50},gF={model:"claude-sonnet-4-6",context:"▰▰▰▰▰▰▱▱▱▱▱▱ 52%",quota:"5h 31% wk 33%",directory:"~/projects/myapp",git:"main (2, +1, 3↑)",cost:"$0.042",changes:"+128 -34",agents:"○ planner ● researcher",todos:"▸ Implement auth (3 done, 4 pending)"},xS={green:"#4ade80",yellow:"#facc15",red:"#f87171",cyan:"#22d3ee",blue:"#60a5fa",magenta:"#e879f9",white:"#f1f5f9",dim:"#64748b",default:"#94a3b8",brightGreen:"#86efac",brightYellow:"#fde68a",brightRed:"#fca5a5",brightCyan:"#67e8f9",brightBlue:"#93c5fd",brightMagenta:"#f0abfc",brightWhite:"#ffffff"},Dm={model:"cyan",directory:"blue",git:"magenta",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"brightGreen"},Vb=[{name:"Default",labelKey:"statuslinePresetDefault",theme:wd,sectionColors:Dm},{name:"Monochrome",labelKey:"statuslinePresetMonochrome",theme:{contextLow:"white",contextMid:"white",contextHigh:"white",accent:"white",muted:"dim",separator:"dim",quotaLow:"white",quotaHigh:"white"},sectionColors:{model:"white",directory:"white",git:"white",cost:"dim",changes:"white",agents:"white",todos:"white"}},{name:"Nord",labelKey:"statuslinePresetNord",theme:{contextLow:"brightCyan",contextMid:"blue",contextHigh:"magenta",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightBlue"},sectionColors:{model:"brightCyan",directory:"brightBlue",git:"brightCyan",cost:"dim",changes:"brightYellow",agents:"blue",todos:"brightCyan"}},{name:"Dracula",labelKey:"statuslinePresetDracula",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"brightCyan",git:"brightGreen",cost:"dim",changes:"brightYellow",agents:"brightMagenta",todos:"brightGreen"}},{name:"Catppuccin",labelKey:"statuslinePresetCatppuccin",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"brightYellow",git:"brightMagenta",cost:"dim",changes:"brightGreen",agents:"brightBlue",todos:"brightCyan"}},{name:"Gruvbox",labelKey:"statuslinePresetGruvbox",theme:{contextLow:"brightGreen",contextMid:"yellow",contextHigh:"red",accent:"brightYellow",muted:"dim",separator:"dim",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"brightYellow",directory:"brightGreen",git:"red",cost:"dim",changes:"yellow",agents:"brightYellow",todos:"brightGreen"}},{name:"Tokyo Night",labelKey:"statuslinePresetTokyoNight",theme:{contextLow:"cyan",contextMid:"brightBlue",contextHigh:"brightMagenta",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"cyan",git:"brightMagenta",cost:"dim",changes:"brightCyan",agents:"brightBlue",todos:"brightGreen"}},{name:"Solarized",labelKey:"statuslinePresetSolarized",theme:{contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"blue",muted:"dim",separator:"dim",quotaLow:"cyan",quotaHigh:"yellow"},sectionColors:{model:"blue",directory:"cyan",git:"green",cost:"dim",changes:"yellow",agents:"blue",todos:"green"}},{name:"Rose Pine",labelKey:"statuslinePresetRosePine",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"magenta",muted:"dim",separator:"dim",quotaLow:"magenta",quotaHigh:"brightRed"},sectionColors:{model:"magenta",directory:"brightBlue",git:"brightMagenta",cost:"dim",changes:"brightYellow",agents:"magenta",todos:"brightGreen"}},{name:"One Dark",labelKey:"statuslinePresetOneDark",theme:{contextLow:"green",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightRed"},sectionColors:{model:"brightCyan",directory:"blue",git:"brightRed",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"green"}},{name:"Ayu",labelKey:"statuslinePresetAyu",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"yellow",muted:"dim",separator:"white",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"yellow",directory:"brightCyan",git:"brightYellow",cost:"dim",changes:"brightGreen",agents:"yellow",todos:"brightGreen"}},{name:"Kanagawa",labelKey:"statuslinePresetKanagawa",theme:{contextLow:"cyan",contextMid:"brightYellow",contextHigh:"red",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"cyan",git:"brightYellow",cost:"dim",changes:"brightBlue",agents:"brightMagenta",todos:"cyan"}},{name:"Stealth",labelKey:"statuslinePresetStealth",theme:{contextLow:"dim",contextMid:"dim",contextHigh:"brightRed",accent:"dim",muted:"dim",separator:"dim",quotaLow:"dim",quotaHigh:"brightRed"},sectionColors:{model:"dim",directory:"dim",git:"dim",cost:"dim",changes:"dim",agents:"dim",todos:"dim"}},{name:"Hacker",labelKey:"statuslinePresetHacker",theme:{contextLow:"green",contextMid:"brightGreen",contextHigh:"brightGreen",accent:"brightGreen",muted:"green",separator:"green",quotaLow:"green",quotaHigh:"brightGreen"},sectionColors:{model:"brightGreen",directory:"green",git:"brightGreen",cost:"green",changes:"brightGreen",agents:"green",todos:"brightGreen"}}],xF=({sectionId:t,label:e,config:n,onConfigChange:r,onRemove:s})=>{const{t:i}=ne(),[o,a]=g.useState(!1),{attributes:l,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:p}=xL({id:t}),m={transform:ts.Transform.toString(h),transition:f,opacity:p?.4:1,zIndex:p?50:void 0},x=k=>{r({...n,icon:k.target.value||void 0})},b=k=>{r({...n,label:k.target.value||void 0})},y=k=>{const C=Number.parseInt(k.target.value,10);r({...n,maxWidth:Number.isNaN(C)?void 0:Math.max(10,Math.min(200,C))})},w=n.icon??"",v=n.label??e;return c.jsxs("div",{ref:u,style:m,className:"relative",children:[c.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1 rounded-md border cursor-pointer select-none transition-all ${p?"border-dash-accent bg-dash-accent/20 shadow-lg":"border-dash-border bg-dash-surface hover:border-dash-accent/60 hover:bg-dash-surface-hover"}`,children:[c.jsx("span",{...l,...d,className:"text-dash-text-muted cursor-grab active:cursor-grabbing shrink-0 opacity-50 group-hover:opacity-100 transition-opacity","aria-label":"drag handle",children:"⠿"}),c.jsxs("button",{type:"button",onClick:()=>a(k=>!k),className:"flex items-center gap-1 text-xs text-dash-text min-w-0","aria-label":i(o?"statuslineCollapseSettings":"statuslineExpandSettings"),children:[w&&c.jsx("span",{className:"shrink-0",children:w}),c.jsx("span",{className:"truncate",children:v}),c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 text-dash-text-muted transition-transform ${o?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&c.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),s()},className:"text-dash-text-muted/40 hover:text-red-400 transition-colors shrink-0","aria-label":"remove section",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&c.jsxs("div",{className:"absolute top-full left-0 z-20 mt-1 w-56 p-3 rounded-lg border border-dash-border bg-dash-surface shadow-xl space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-icon-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineIconOverride")}),c.jsx("input",{id:`chip-icon-${t}`,type:"text",value:n.icon??"",onChange:x,placeholder:i("statuslineIconPlaceholder"),maxLength:20,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-label-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineLabelOverride")}),c.jsx("input",{id:`chip-label-${t}`,type:"text",value:n.label??"",onChange:b,placeholder:e,maxLength:50,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:`chip-maxwidth-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:i("statuslineMaxWidth")}),c.jsx("input",{id:`chip-maxwidth-${t}`,type:"number",min:10,max:200,value:n.maxWidth??"",onChange:y,placeholder:i("statuslineMaxWidthPlaceholder"),className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),c.jsx("button",{type:"button",onClick:()=>a(!1),className:"w-full text-[10px] py-0.5 text-dash-text-muted hover:text-dash-text transition-colors",children:i("closeModal")})]})]})},bF={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},Wb=({containerId:t,sectionIds:e,sectionConfig:n,onConfigChange:r,onRemoveSection:s,headerLabel:i,onRemove:o,isPool:a=!1})=>{const{t:l}=ne(),{setNodeRef:d,isOver:u}=Lk({id:t});return c.jsxs("div",{className:`rounded-lg border transition-colors ${a?"border-dash-border/50 bg-dash-bg/50":u?"border-dash-accent/60 bg-dash-accent/5":"border-dash-border bg-dash-surface"}`,children:[i&&c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dash-border/50",children:[c.jsx("span",{className:`text-xs font-medium uppercase tracking-wider ${a?"text-dash-text-muted/70":"text-dash-text-muted"}`,children:i}),o&&c.jsx("button",{type:"button",onClick:o,className:"text-xs text-dash-text-muted hover:text-red-400 transition-colors px-1","aria-label":l("statuslineRemoveLine"),children:l("statuslineRemoveLine")})]}),c.jsx("div",{ref:d,className:"p-2 min-h-[44px]",children:c.jsx(dL,{items:e,strategy:lL,children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?c.jsx("span",{className:"text-xs text-dash-text-muted/50 italic px-1 py-0.5",children:a?l("statuslineDragToLine"):"—"}):e.map(h=>c.jsx(xF,{sectionId:h,label:l(bF[h]??"statuslineSectionModelLabel"),config:n[h]??{},onConfigChange:f=>r(h,f),onRemove:!a&&s?()=>s(h):void 0},h))})})})]})};function Kb(t,e,n){for(let r=0;r<t.length;r++)if(t[r].includes(n))return`line-${r}`;return e.includes(n)?"pool":null}const yF=({lines:t,sectionConfig:e,onLinesChange:n,onSectionConfigChange:r})=>{const{t:s}=ne(),[i,o]=g.useState(null),a=H7(Ix(mm),Ix(fm,{coordinateGetter:vL})),l=new Set(t.flat()),d=mS.filter(b=>!l.has(b)),u=b=>{o(String(b.active.id))},h=b=>{o(null);const{active:y,over:w}=b;if(!w)return;const v=String(y.id),k=String(w.id),C=Kb(t,d,v);let N=Kb(t,d,k);if(N||(k.startsWith("line-")||k==="pool")&&(N=k),!C||!N||v===k)return;const S=t.map(M=>[...M]),D=M=>{if(M==="pool")return[...d];const P=Number.parseInt(M.replace("line-",""),10);return S[P]??[]},E=(M,P)=>{if(M==="pool")return;const A=Number.parseInt(M.replace("line-",""),10);S[A]=P};if(C===N){const M=D(C),P=M.indexOf(v),A=M.indexOf(k);P!==-1&&A!==-1&&E(C,xm(M,P,A))}else{const M=D(C),P=D(N),A=M.filter(T=>T!==v),R=P.indexOf(k),j=R===-1?P.length:R,O=[...P.slice(0,j),v,...P.slice(j)];C!=="pool"&&E(C,A),N!=="pool"&&E(N,O)}n(S)},f=()=>{n([...t,[]])},p=b=>{t[b];const y=t.filter((w,v)=>v!==b);n(y)},m=(b,y)=>{r({...e,[b]:y})},x=(b,y)=>{const w=t.map((v,k)=>k===b?v.filter(C=>C!==y):[...v]);n(w)};return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-xs text-dash-text-muted px-1",children:s("statuslineDragHint")}),c.jsxs(F8,{sensors:a,collisionDetection:K7,onDragStart:u,onDragEnd:h,children:[c.jsx("div",{className:"space-y-2",children:t.map((b,y)=>c.jsx(Wb,{containerId:`line-${y}`,sectionIds:b,sectionConfig:e,onConfigChange:m,onRemoveSection:w=>x(y,w),headerLabel:`${s("statuslineLine")} ${y+1}`,onRemove:()=>p(y)},`line-zone-${y}`))}),c.jsxs("button",{type:"button",onClick:f,className:"w-full text-xs px-3 py-2 rounded-lg border border-dashed border-dash-border text-dash-text-muted hover:border-dash-accent/60 hover:text-dash-text transition-colors",children:["+ ",s("statuslineAddLine")]}),c.jsxs("div",{className:"pt-0.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider mb-1 px-1",children:s("statuslineHiddenSections")}),c.jsx(Wb,{containerId:"pool",sectionIds:d,sectionConfig:e,onConfigChange:m,isPool:!0})]}),c.jsx(sL,{children:i?c.jsx("div",{className:"px-2 py-1 rounded-md border border-dash-accent bg-dash-accent/20 text-xs text-dash-text shadow-xl opacity-90",children:i}):null})]})]})},tn=xS;function vF(t){return tn[t]??tn.default}const wF=({sectionId:t,config:e,theme:n})=>{const r=gF[t]??t,s=e.icon??"";let i=e.color??Dm[t]??n.accent;t==="context"&&!e.color&&(i=n.contextMid),t==="quota"&&!e.color&&(i=n.quotaLow);const o=vF(i),a=e.label?`${s} ${e.label}: ${r}`:s?`${s} ${r}`:r,l=e.maxWidth&&a.length>e.maxWidth?`${a.slice(0,e.maxWidth-1)}…`:a;return c.jsx("span",{className:"font-mono text-xs whitespace-nowrap",style:{color:o},children:l})},kF=c.jsx("span",{className:"font-mono text-xs",style:{color:tn.dim},children:" │ "}),SF=({sectionIds:t,sectionConfig:e,theme:n})=>{const{t:r}=ne();return c.jsx("div",{className:"flex items-center gap-0 py-0.5 px-2 rounded mb-0.5 last:mb-0 overflow-hidden",style:{backgroundColor:"#313244"},children:t.length===0?c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:tn.dim},children:r("statuslinePreviewEmptyLine")}):t.map((s,i)=>c.jsxs("span",{className:"flex items-center shrink-0",children:[c.jsx(wF,{sectionId:s,config:e[s]??{},theme:n}),i<t.length-1&&kF]},s))})},CF=({lines:t,sectionConfig:e,theme:n})=>{const{t:r}=ne(),s=t.reduce((i,o)=>i+o.length,0);return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs text-dash-text-muted",children:r("statuslinePreview")}),c.jsxs("span",{className:"text-xs text-dash-text-muted/60",children:[s," ",r("statuslineSectionsVisible")]})]}),c.jsxs("div",{className:"rounded-lg overflow-hidden border border-dash-border shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#1e1e2e] border-b border-[#313244]",children:[c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f38ba8]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f9e2af]"}),c.jsx("span",{className:"w-3 h-3 rounded-full bg-[#a6e3a1]"})]}),c.jsx("span",{className:"text-xs text-[#6c7086] font-mono ml-2",children:r("statuslinePreviewTitle")})]}),c.jsxs("div",{className:"bg-[#1e1e2e] px-3 py-2 font-mono text-xs overflow-x-auto select-none",children:[c.jsxs("div",{className:"mb-1",children:[c.jsx("span",{style:{color:tn.green},children:"user@machine"}),c.jsx("span",{style:{color:tn.dim},children:":"}),c.jsx("span",{style:{color:tn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:tn.white},children:" $ "})]}),t.length===0?c.jsx("div",{className:"py-0.5 px-2 rounded mb-0.5",style:{backgroundColor:"#313244"},children:c.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:tn.dim},children:r("statuslinePreviewNoLines")})}):t.map((i,o)=>c.jsx(SF,{sectionIds:i,sectionConfig:e,theme:n},o)),c.jsxs("div",{className:"mt-1 flex items-center",children:[c.jsx("span",{style:{color:tn.green},children:"user@machine"}),c.jsx("span",{style:{color:tn.dim},children:":"}),c.jsx("span",{style:{color:tn.blue},children:"~/projects/myapp"}),c.jsx("span",{style:{color:tn.white},children:" $ "}),c.jsx("span",{className:"inline-block w-2 h-4 bg-white/70 animate-pulse ml-0.5"})]})]})]})]})},jF={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},NF=["green","yellow","red","cyan","blue","magenta","white","dim","brightGreen","brightYellow","brightRed","brightCyan","brightBlue","brightMagenta","brightWhite"],kd=xS,gr=({field:t,label:e,value:n,onChange:r})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full shrink-0 border border-white/20",style:{backgroundColor:kd[n]??kd.default}}),c.jsx("label",{htmlFor:`color-${t}`,className:"text-xs text-dash-text-muted w-24 shrink-0",children:e}),c.jsx("select",{id:`color-${t}`,value:n,onChange:s=>r(s.target.value),className:"flex-1 text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text focus:outline-none focus:border-dash-accent",children:NF.map(s=>c.jsx("option",{value:s,children:s},s))})]}),PF=({theme:t,sectionConfig:e,onChange:n,onSectionConfigChange:r})=>{const{t:s}=ne(),i=(d,u)=>{n({...t,[d]:u})},o=(d,u)=>{r({...e,[d]:{...e[d],color:u}})},a=d=>{n({...d.theme});const u={...e};for(const[h,f]of Object.entries(d.sectionColors))u[h]={...u[h],color:f};r(u)},l=Vb.findIndex(d=>d.theme.contextLow===t.contextLow&&d.theme.contextMid===t.contextMid&&d.theme.contextHigh===t.contextHigh&&d.theme.accent===t.accent&&d.theme.muted===t.muted&&d.theme.separator===t.separator&&d.theme.quotaLow===t.quotaLow&&d.theme.quotaHigh===t.quotaHigh);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted mb-2 uppercase tracking-wider",children:s("statuslineTheme")}),c.jsx("div",{className:"grid grid-cols-2 gap-2",children:Vb.map((d,u)=>c.jsx("button",{type:"button",onClick:()=>a(d),className:`text-xs px-3 py-2 rounded border transition-colors text-left ${l===u?"border-dash-accent bg-dash-accent/10 text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:c.jsxs("span",{className:"flex items-center gap-1",children:[[d.sectionColors.model,d.theme.contextMid,d.sectionColors.git,d.sectionColors.changes].map((h,f)=>c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:kd[h]??kd.default}},f)),c.jsx("span",{className:"ml-0.5",children:s(d.labelKey)})]})},d.name))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["▰ ",s("statuslineColorContextGroup")]}),c.jsx(gr,{field:"contextLow",label:s("statuslineColorContextLow"),value:t.contextLow,onChange:d=>i("contextLow",d)}),c.jsx(gr,{field:"contextMid",label:s("statuslineColorContextMid"),value:t.contextMid,onChange:d=>i("contextMid",d)}),c.jsx(gr,{field:"contextHigh",label:s("statuslineColorContextHigh"),value:t.contextHigh,onChange:d=>i("contextHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["⌛ ",s("statuslineColorQuotaGroup")]}),c.jsx(gr,{field:"quotaLow",label:s("statuslineQuotaLow"),value:t.quotaLow,onChange:d=>i("quotaLow",d)}),c.jsx(gr,{field:"quotaHigh",label:s("statuslineQuotaHigh"),value:t.quotaHigh,onChange:d=>i("quotaHigh",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorGeneralGroup")}),c.jsx(gr,{field:"accent",label:s("statuslineColorAccent"),value:t.accent,onChange:d=>i("accent",d)}),c.jsx(gr,{field:"muted",label:s("statuslineColorMuted"),value:t.muted,onChange:d=>i("muted",d)}),c.jsx(gr,{field:"separator",label:s("statuslineColorSeparator"),value:t.separator,onChange:d=>i("separator",d)})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:s("statuslineColorSectionGroup")}),mS.filter(d=>d!=="context"&&d!=="quota").map(d=>{const u=e[d]?.icon??gS[d]?.icon??"",h=s(jF[d]??"statuslineSectionModelLabel");return c.jsx(gr,{field:`section-${d}`,label:u?`${u} ${h}`:h,value:e[d]?.color??Dm[d]??"default",onChange:f=>o(d,f)},d)})]})]})]})};function DF(t){return{baseMode:t.baseMode??$r.baseMode,lines:t.lines??$r.lines,sectionConfig:t.sectionConfig??$r.sectionConfig,theme:t.theme?{...wd,...t.theme}:wd,responsiveBreakpoint:t.responsiveBreakpoint??$r.responsiveBreakpoint,maxAgentRows:t.maxAgentRows??$r.maxAgentRows,todoTruncation:t.todoTruncation??$r.todoTruncation}}const EF=()=>{const{t}=ne(),[e,n]=g.useState($r),[r,s]=g.useState(!0),[i,o]=g.useState(!1),[a,l]=g.useState(null),[d,u]=g.useState(!1),[h,f]=g.useState(!1),{size:p,isDragging:m,startDrag:x}=$i({storageKey:"ck-statusline-preview-width",defaultSize:500,minSize:300,maxSize:900,direction:"horizontal",invert:!0});g.useEffect(()=>{let C=!1;return Gf("global").then(N=>{if(C)return;const S=N.config.statuslineLayout;S&&n(DF(S))}).catch(()=>{C||f(!0)}).finally(()=>{C||s(!1)}),()=>{C=!0}},[]);const b=g.useCallback(async()=>{o(!0),l(null),u(!1);try{await nT("statuslineLayout",e,"global"),u(!0),setTimeout(()=>u(!1),3e3)}catch(C){l(C instanceof Error?C.message:"Unknown error")}finally{o(!1)}},[e]),y=g.useCallback(()=>{n($r),u(!1),l(null)},[]),w=g.useCallback(C=>{n(N=>({...N,lines:C}))},[]),v=g.useCallback(C=>{n(N=>({...N,sectionConfig:C}))},[]),k=g.useCallback(C=>{n(N=>({...N,theme:C}))},[]);return r?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("div",{className:"text-dash-text-muted text-sm",children:t("loading")})}):c.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[c.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-dash-border bg-dash-surface",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-bold text-dash-text",children:t("statuslineBuilder")}),c.jsx("p",{className:"text-sm text-dash-text-muted mt-0.5",children:t("statuslineBuilderDescription")})]}),d&&c.jsx("div",{className:"text-xs text-green-400 bg-green-400/10 border border-green-400/20 rounded px-3 py-1.5",children:t("statuslineSaved")}),h&&c.jsx("div",{className:"bg-orange-50 dark:bg-orange-950 text-orange-700 dark:text-orange-300 px-4 py-2 rounded-md text-sm border border-orange-200 dark:border-orange-800",children:t("statuslineLoadErrorSaveDisabled")}),a&&c.jsxs("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-400/20 rounded px-3 py-1.5",children:[t("statuslineSaveError"),": ",a]})]})}),c.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-dash-border overflow-hidden",children:[c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.jsx(PF,{theme:e.theme,sectionConfig:e.sectionConfig,onChange:k,onSectionConfigChange:v})}),c.jsxs("div",{className:"shrink-0 px-4 py-3 border-t border-dash-border bg-dash-surface flex gap-2",children:[c.jsx("button",{type:"button",onClick:y,className:"text-xs px-3 py-1.5 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:t("statuslineResetDefaults")}),c.jsx("button",{type:"button",onClick:b,disabled:i||h,className:"flex-1 text-xs px-3 py-1.5 rounded border border-dash-accent bg-dash-accent/10 text-dash-accent hover:bg-dash-accent/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:i?`${t("saving")}…`:t("statuslineSave")})]})]}),c.jsx(kn,{direction:"horizontal",isDragging:m,onMouseDown:x}),c.jsxs("div",{className:"shrink-0 overflow-y-auto p-4 bg-dash-bg space-y-4",style:{width:p},children:[c.jsx(CF,{lines:e.lines,sectionConfig:e.sectionConfig,theme:e.theme}),c.jsx(yF,{lines:e.lines,sectionConfig:e.sectionConfig,onLinesChange:w,onSectionConfigChange:v})]})]})]})},OF=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:s,className:i})=>{const{t:o}=ne(),a=t.filter(u=>u.status==="update-available").length,l=t.length>0&&t.every(u=>u.status==="up-to-date"||u.status==="idle"),d=t.filter(u=>u.status==="up-to-date").length;return c.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${i??""}`,children:[c.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs",children:[c.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?c.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?c.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):c.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),d>0&&c.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:d})]}),c.jsx("button",{type:"button",onClick:r,disabled:e||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&c.jsx("button",{type:"button",onClick:s,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},MF=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=ne();return c.jsxs("fieldset",{className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 gap-1",role:"radiogroup","aria-label":"Update channel",children:[c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,className:"sr-only"}),r("channelStable")]}),c.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[c.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},AF={idle:{color:"bg-dash-text-muted",pulse:!1},checking:{color:"bg-dash-text-muted",pulse:!0},"up-to-date":{color:"bg-emerald-500",pulse:!1},"update-available":{color:"bg-amber-500",pulse:!1}},bS=({status:t,ariaLabel:e,size:n="sm"})=>{const r=AF[t],s=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return c.jsx("span",{className:`
322
322
  inline-block rounded-full ${s} ${r.color}
323
323
  ${r.pulse?"animate-pulse motion-reduce:animate-none":""}
324
324
  `,role:"status","aria-label":e})},Em=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:s,onComplete:i,mode:o="single",components:a=[]})=>{const{t:l}=ne(),[d,u]=g.useState("running"),[h,f]=g.useState([]),[p,m]=g.useState([]),[x,b]=g.useState(!1),[y,w]=g.useState(0),v=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{x&&k.current&&k.current.scrollIntoView({behavior:"smooth"})},[x]);const C=g.useCallback(async()=>{if(a.length===0){u("success");return}for(let S=0;S<a.length;S++){w(S);const D=a[S];try{const E=D.id==="cli",M=new URLSearchParams({target:E?"cli":"kit"});E||M.set("kit",D.id);const P=new EventSource(`/api/system/update?${M}`);v.current=P,await new Promise((A,R)=>{P.onmessage=j=>{try{const O=JSON.parse(j.data);O.type==="phase"&&O.name&&f(T=>[...T,`[${D.name}] ${O.name}`]),O.type==="output"&&O.text&&m(T=>[...T,O.text]),O.type==="error"&&(u("error"),m(T=>[...T,`[ERROR ${D.name}] ${O.message||"Unknown error"}`]),P.close(),R()),O.type==="complete"&&(O.code===0?(P.close(),A()):(u("error"),P.close(),R()))}catch(O){console.error("Failed to parse SSE message:",O),P.close(),R(O)}},P.onerror=()=>{u("error"),m(j=>[...j,`[ERROR ${D.name}] Connection lost`]),P.close(),R()}})}catch(E){console.error(`Failed to update ${D.name}:`,E)}}u("success"),i()},[a,i]);g.useEffect(()=>{if(t)if(o==="batch")C();else{const S=new URLSearchParams({target:n});r&&S.set("kit",r),s&&S.set("version",s);const D=new EventSource(`/api/system/update?${S}`);return v.current=D,D.onmessage=E=>{try{const M=JSON.parse(E.data);M.type==="phase"&&M.name&&f(P=>[...P,M.name]),M.type==="output"&&M.text&&m(P=>[...P,M.text]),M.type==="error"&&(u("error"),m(P=>[...P,`[ERROR] ${M.message||"Unknown error"}`])),M.type==="complete"&&(u(M.code===0?"success":"error"),D.close(),M.code===0&&i())}catch(M){console.error("Failed to parse SSE message:",M)}},D.onerror=()=>{u("error"),m(E=>[...E,"[ERROR] Connection lost"]),D.close()},()=>{D.close()}}},[t,n,r,s,i,o,C]);const N=()=>{d!=="running"&&(u("running"),f([]),m([]),b(!1),w(0),e())};return t?c.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-lg w-full max-w-2xl max-h-[80vh] flex flex-col",children:[c.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:c.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(d==="running"?"updating":d==="success"?"updateSuccess":"updateFailed")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&c.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[d==="running"&&c.jsxs("span",{children:["Updating ",y+1," of ",a.length,":"," ",a[y]?.name]}),d==="success"&&c.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),h.length>0&&c.jsx("div",{className:"space-y-2",children:h.map((S,D)=>c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),c.jsx("span",{children:S})]},`${S}-${D}`))}),d==="running"&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[c.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),c.jsx("span",{children:l("updating")})]}),p.length>0&&c.jsxs("div",{children:[c.jsx("button",{type:"button",onClick:()=>b(!x),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(x?"hideDetails":"showDetails")}),x&&c.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[c.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
@@ -71,7 +71,7 @@
71
71
  background: var(--dash-text-muted);
72
72
  }
73
73
  </style>
74
- <script type="module" crossorigin src="/assets/index-D3Q_VrJU.js"></script>
74
+ <script type="module" crossorigin src="/assets/index-jFAdUzwZ.js"></script>
75
75
  <link rel="modulepreload" crossorigin href="/assets/vendor-BkC4CYzM.js">
76
76
  <link rel="stylesheet" crossorigin href="/assets/index-fz2_unLw.css">
77
77
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "4.4.0-dev.11",
3
+ "version": "4.4.0-dev.13",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {