claudekit-cli 4.4.0-dev.10 → 4.4.0-dev.12
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
package/dist/index.js
CHANGED
|
@@ -50107,6 +50107,18 @@ var init_ck_config_schema = __esm(() => {
|
|
|
50107
50107
|
description: "Separator color",
|
|
50108
50108
|
maxLength: 30,
|
|
50109
50109
|
pattern: "^[a-zA-Z]+$"
|
|
50110
|
+
},
|
|
50111
|
+
quotaLow: {
|
|
50112
|
+
type: "string",
|
|
50113
|
+
description: "Quota section color when all windows <85%",
|
|
50114
|
+
maxLength: 30,
|
|
50115
|
+
pattern: "^[a-zA-Z]+$"
|
|
50116
|
+
},
|
|
50117
|
+
quotaHigh: {
|
|
50118
|
+
type: "string",
|
|
50119
|
+
description: "Quota section color when any window >=85%",
|
|
50120
|
+
maxLength: 30,
|
|
50121
|
+
pattern: "^[a-zA-Z]+$"
|
|
50110
50122
|
}
|
|
50111
50123
|
},
|
|
50112
50124
|
additionalProperties: false
|
|
@@ -63942,7 +63954,7 @@ var package_default;
|
|
|
63942
63954
|
var init_package = __esm(() => {
|
|
63943
63955
|
package_default = {
|
|
63944
63956
|
name: "claudekit-cli",
|
|
63945
|
-
version: "4.4.0-dev.
|
|
63957
|
+
version: "4.4.0-dev.12",
|
|
63946
63958
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63947
63959
|
type: "module",
|
|
63948
63960
|
repository: {
|
|
@@ -77343,7 +77355,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
|
|
|
77343
77355
|
}
|
|
77344
77356
|
}
|
|
77345
77357
|
function spawnAndCollect(command, args, cwd2) {
|
|
77346
|
-
return new Promise((
|
|
77358
|
+
return new Promise((resolve57, reject) => {
|
|
77347
77359
|
const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
|
|
77348
77360
|
const chunks = [];
|
|
77349
77361
|
const stderrChunks = [];
|
|
@@ -77356,7 +77368,7 @@ function spawnAndCollect(command, args, cwd2) {
|
|
|
77356
77368
|
reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
|
|
77357
77369
|
return;
|
|
77358
77370
|
}
|
|
77359
|
-
|
|
77371
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
77360
77372
|
});
|
|
77361
77373
|
});
|
|
77362
77374
|
}
|
|
@@ -80203,8 +80215,8 @@ function shouldRunCleanup(lastAt) {
|
|
|
80203
80215
|
return Date.now() - new Date(lastAt).getTime() >= 86400000;
|
|
80204
80216
|
}
|
|
80205
80217
|
function sleep2(ms) {
|
|
80206
|
-
return new Promise((
|
|
80207
|
-
setTimeout(
|
|
80218
|
+
return new Promise((resolve57) => {
|
|
80219
|
+
setTimeout(resolve57, ms);
|
|
80208
80220
|
});
|
|
80209
80221
|
}
|
|
80210
80222
|
var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
|
|
@@ -82455,7 +82467,7 @@ function getPagerArgs(pagerCmd) {
|
|
|
82455
82467
|
return [];
|
|
82456
82468
|
}
|
|
82457
82469
|
async function trySystemPager(content) {
|
|
82458
|
-
return new Promise((
|
|
82470
|
+
return new Promise((resolve57) => {
|
|
82459
82471
|
const pagerCmd = process.env.PAGER || "less";
|
|
82460
82472
|
const pagerArgs = getPagerArgs(pagerCmd);
|
|
82461
82473
|
try {
|
|
@@ -82465,20 +82477,20 @@ async function trySystemPager(content) {
|
|
|
82465
82477
|
});
|
|
82466
82478
|
const timeout2 = setTimeout(() => {
|
|
82467
82479
|
pager.kill();
|
|
82468
|
-
|
|
82480
|
+
resolve57(false);
|
|
82469
82481
|
}, 30000);
|
|
82470
82482
|
pager.stdin.write(content);
|
|
82471
82483
|
pager.stdin.end();
|
|
82472
82484
|
pager.on("close", (code2) => {
|
|
82473
82485
|
clearTimeout(timeout2);
|
|
82474
|
-
|
|
82486
|
+
resolve57(code2 === 0);
|
|
82475
82487
|
});
|
|
82476
82488
|
pager.on("error", () => {
|
|
82477
82489
|
clearTimeout(timeout2);
|
|
82478
|
-
|
|
82490
|
+
resolve57(false);
|
|
82479
82491
|
});
|
|
82480
82492
|
} catch {
|
|
82481
|
-
|
|
82493
|
+
resolve57(false);
|
|
82482
82494
|
}
|
|
82483
82495
|
});
|
|
82484
82496
|
}
|
|
@@ -82505,16 +82517,16 @@ async function basicPager(content) {
|
|
|
82505
82517
|
break;
|
|
82506
82518
|
}
|
|
82507
82519
|
const remaining = lines.length - currentLine;
|
|
82508
|
-
await new Promise((
|
|
82520
|
+
await new Promise((resolve57) => {
|
|
82509
82521
|
rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
|
|
82510
82522
|
if (answer.toLowerCase() === "q") {
|
|
82511
82523
|
rl.close();
|
|
82512
82524
|
process.exitCode = 0;
|
|
82513
|
-
|
|
82525
|
+
resolve57();
|
|
82514
82526
|
return;
|
|
82515
82527
|
}
|
|
82516
82528
|
process.stdout.write("\x1B[1A\x1B[2K");
|
|
82517
|
-
|
|
82529
|
+
resolve57();
|
|
82518
82530
|
});
|
|
82519
82531
|
});
|
|
82520
82532
|
}
|
|
@@ -87316,7 +87328,7 @@ class CheckRunner {
|
|
|
87316
87328
|
});
|
|
87317
87329
|
}
|
|
87318
87330
|
async executeCheckersInParallel(checkers) {
|
|
87319
|
-
const
|
|
87331
|
+
const runChecker = async (checker) => {
|
|
87320
87332
|
logger.verbose(`Starting checker: ${checker.group}`);
|
|
87321
87333
|
const startTime = Date.now();
|
|
87322
87334
|
const results = await checker.run();
|
|
@@ -87330,8 +87342,19 @@ class CheckRunner {
|
|
|
87330
87342
|
duration: totalDuration
|
|
87331
87343
|
});
|
|
87332
87344
|
return results;
|
|
87333
|
-
}
|
|
87334
|
-
|
|
87345
|
+
};
|
|
87346
|
+
const indexedCheckers = checkers.map((checker, index) => ({ checker, index }));
|
|
87347
|
+
const networkCheckers = indexedCheckers.filter(({ checker }) => checker.group === "network");
|
|
87348
|
+
const otherCheckers = indexedCheckers.filter(({ checker }) => checker.group !== "network");
|
|
87349
|
+
const networkResults = networkCheckers.length ? await Promise.all(networkCheckers.map(async ({ checker, index }) => ({
|
|
87350
|
+
index,
|
|
87351
|
+
results: await runChecker(checker)
|
|
87352
|
+
}))) : [];
|
|
87353
|
+
const otherResults = await Promise.all(otherCheckers.map(async ({ checker, index }) => ({
|
|
87354
|
+
index,
|
|
87355
|
+
results: await runChecker(checker)
|
|
87356
|
+
})));
|
|
87357
|
+
return [...networkResults, ...otherResults].sort((a3, b3) => a3.index - b3.index).flatMap(({ results }) => results);
|
|
87335
87358
|
}
|
|
87336
87359
|
buildSummary(checks) {
|
|
87337
87360
|
let passed = 0;
|
|
@@ -90362,9 +90385,10 @@ function createDefaultDeps() {
|
|
|
90362
90385
|
};
|
|
90363
90386
|
}
|
|
90364
90387
|
function createDefaultDns() {
|
|
90388
|
+
const lookupFamily = (host, family) => dnsPromises.lookup(host, { family, all: true }).then((records) => records.map((record) => record.address));
|
|
90365
90389
|
return {
|
|
90366
|
-
resolve4: (host) =>
|
|
90367
|
-
resolve6: (host) =>
|
|
90390
|
+
resolve4: (host) => lookupFamily(host, 4),
|
|
90391
|
+
resolve6: (host) => lookupFamily(host, 6)
|
|
90368
90392
|
};
|
|
90369
90393
|
}
|
|
90370
90394
|
function createDefaultTcp() {
|
|
@@ -90545,11 +90569,25 @@ async function checkGitHubReachability(deps) {
|
|
|
90545
90569
|
}
|
|
90546
90570
|
function raceTimeout(promise, ms) {
|
|
90547
90571
|
return new Promise((resolve38, reject) => {
|
|
90548
|
-
|
|
90572
|
+
let settled = false;
|
|
90573
|
+
const timer = setTimeout(() => {
|
|
90574
|
+
setImmediate(() => {
|
|
90575
|
+
if (settled)
|
|
90576
|
+
return;
|
|
90577
|
+
settled = true;
|
|
90578
|
+
reject(new Error(`timeout after ${ms}ms`));
|
|
90579
|
+
});
|
|
90580
|
+
}, ms);
|
|
90549
90581
|
promise.then((v2) => {
|
|
90582
|
+
if (settled)
|
|
90583
|
+
return;
|
|
90584
|
+
settled = true;
|
|
90550
90585
|
clearTimeout(timer);
|
|
90551
90586
|
resolve38(v2);
|
|
90552
90587
|
}, (e2) => {
|
|
90588
|
+
if (settled)
|
|
90589
|
+
return;
|
|
90590
|
+
settled = true;
|
|
90553
90591
|
clearTimeout(timer);
|
|
90554
90592
|
reject(e2);
|
|
90555
90593
|
});
|
|
@@ -101977,7 +102015,7 @@ import { join as join121 } from "node:path";
|
|
|
101977
102015
|
|
|
101978
102016
|
// src/domains/installation/deletion-handler.ts
|
|
101979
102017
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
101980
|
-
import { dirname as dirname37, join as join106, relative as relative21, resolve as
|
|
102018
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as sep12 } from "node:path";
|
|
101981
102019
|
|
|
101982
102020
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
101983
102021
|
init_metadata_migration();
|
|
@@ -102202,8 +102240,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
102202
102240
|
}
|
|
102203
102241
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
102204
102242
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
102205
|
-
const normalizedClaudeDir =
|
|
102206
|
-
let currentDir =
|
|
102243
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102244
|
+
let currentDir = resolve42(dirname37(filePath));
|
|
102207
102245
|
let iterations = 0;
|
|
102208
102246
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
102209
102247
|
iterations++;
|
|
@@ -102212,7 +102250,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102212
102250
|
if (entries.length === 0) {
|
|
102213
102251
|
rmdirSync(currentDir);
|
|
102214
102252
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
102215
|
-
currentDir =
|
|
102253
|
+
currentDir = resolve42(dirname37(currentDir));
|
|
102216
102254
|
} else {
|
|
102217
102255
|
break;
|
|
102218
102256
|
}
|
|
@@ -102222,8 +102260,8 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102222
102260
|
}
|
|
102223
102261
|
}
|
|
102224
102262
|
function deletePath(fullPath, claudeDir3) {
|
|
102225
|
-
const normalizedPath =
|
|
102226
|
-
const normalizedClaudeDir =
|
|
102263
|
+
const normalizedPath = resolve42(fullPath);
|
|
102264
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102227
102265
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`) && normalizedPath !== normalizedClaudeDir) {
|
|
102228
102266
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
102229
102267
|
}
|
|
@@ -102296,8 +102334,8 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
102296
102334
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
102297
102335
|
for (const path16 of deletions) {
|
|
102298
102336
|
const fullPath = join106(claudeDir3, path16);
|
|
102299
|
-
const normalizedPath =
|
|
102300
|
-
const normalizedClaudeDir =
|
|
102337
|
+
const normalizedPath = resolve42(fullPath);
|
|
102338
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102301
102339
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
102302
102340
|
logger.warning(`Skipping invalid path: ${path16}`);
|
|
102303
102341
|
result.errors.push(path16);
|
|
@@ -105939,7 +105977,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
105939
105977
|
init_logger();
|
|
105940
105978
|
init_skip_directories();
|
|
105941
105979
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
105942
|
-
import { join as join116, relative as relative26, resolve as
|
|
105980
|
+
import { join as join116, relative as relative26, resolve as resolve43 } from "node:path";
|
|
105943
105981
|
|
|
105944
105982
|
class FileScanner2 {
|
|
105945
105983
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -106019,8 +106057,8 @@ class FileScanner2 {
|
|
|
106019
106057
|
return customFiles;
|
|
106020
106058
|
}
|
|
106021
106059
|
static isSafePath(basePath, targetPath) {
|
|
106022
|
-
const resolvedBase =
|
|
106023
|
-
const resolvedTarget =
|
|
106060
|
+
const resolvedBase = resolve43(basePath);
|
|
106061
|
+
const resolvedTarget = resolve43(targetPath);
|
|
106024
106062
|
return resolvedTarget.startsWith(resolvedBase);
|
|
106025
106063
|
}
|
|
106026
106064
|
static toPosixPath(path17) {
|
|
@@ -108167,7 +108205,7 @@ async function handlePostInstall(ctx) {
|
|
|
108167
108205
|
init_config_manager();
|
|
108168
108206
|
init_github_client();
|
|
108169
108207
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
108170
|
-
import { join as join135, resolve as
|
|
108208
|
+
import { join as join135, resolve as resolve46 } from "node:path";
|
|
108171
108209
|
|
|
108172
108210
|
// src/domains/github/kit-access-checker.ts
|
|
108173
108211
|
init_error2();
|
|
@@ -108337,7 +108375,7 @@ async function runPreflightChecks() {
|
|
|
108337
108375
|
// src/domains/installation/fresh-installer.ts
|
|
108338
108376
|
init_metadata_migration();
|
|
108339
108377
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
108340
|
-
import { basename as basename28, dirname as dirname42, join as join133, resolve as
|
|
108378
|
+
import { basename as basename28, dirname as dirname42, join as join133, resolve as resolve44 } from "node:path";
|
|
108341
108379
|
init_logger();
|
|
108342
108380
|
init_safe_spinner();
|
|
108343
108381
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -108389,15 +108427,15 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
108389
108427
|
};
|
|
108390
108428
|
}
|
|
108391
108429
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
108392
|
-
const normalizedClaudeDir =
|
|
108393
|
-
let currentDir =
|
|
108430
|
+
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
108431
|
+
let currentDir = resolve44(dirname42(filePath));
|
|
108394
108432
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
108395
108433
|
try {
|
|
108396
108434
|
const entries = readdirSync10(currentDir);
|
|
108397
108435
|
if (entries.length === 0) {
|
|
108398
108436
|
rmdirSync2(currentDir);
|
|
108399
108437
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
108400
|
-
currentDir =
|
|
108438
|
+
currentDir = resolve44(dirname42(currentDir));
|
|
108401
108439
|
} else {
|
|
108402
108440
|
break;
|
|
108403
108441
|
}
|
|
@@ -108587,7 +108625,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
108587
108625
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
108588
108626
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
108589
108627
|
import { homedir as homedir47 } from "node:os";
|
|
108590
|
-
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as
|
|
108628
|
+
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
108591
108629
|
var LEGACY_KIT_MARKERS = [
|
|
108592
108630
|
"metadata.json",
|
|
108593
108631
|
".ck.json",
|
|
@@ -108613,7 +108651,7 @@ function uniqueNormalizedPaths(paths) {
|
|
|
108613
108651
|
const seen = new Set;
|
|
108614
108652
|
const result = [];
|
|
108615
108653
|
for (const path17 of paths) {
|
|
108616
|
-
const normalized = normalize11(
|
|
108654
|
+
const normalized = normalize11(resolve45(path17));
|
|
108617
108655
|
if (seen.has(normalized))
|
|
108618
108656
|
continue;
|
|
108619
108657
|
seen.add(normalized);
|
|
@@ -108678,8 +108716,8 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
108678
108716
|
if (safeEnvPath(env2.CLAUDE_CONFIG_DIR)) {
|
|
108679
108717
|
return { status: "skipped", reason: "custom-global-dir", candidateDirs: [] };
|
|
108680
108718
|
}
|
|
108681
|
-
const targetDir = normalize11(
|
|
108682
|
-
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(
|
|
108719
|
+
const targetDir = normalize11(resolve45(options2.targetDir));
|
|
108720
|
+
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve45(candidate)) !== targetDir);
|
|
108683
108721
|
const legacyDirs = [];
|
|
108684
108722
|
for (const candidate of candidateDirs) {
|
|
108685
108723
|
if (await hasKitMarkers(candidate)) {
|
|
@@ -108902,7 +108940,7 @@ async function handleSelection(ctx) {
|
|
|
108902
108940
|
}
|
|
108903
108941
|
}
|
|
108904
108942
|
}
|
|
108905
|
-
const resolvedDir =
|
|
108943
|
+
const resolvedDir = resolve46(targetDir);
|
|
108906
108944
|
if (ctx.options.global) {
|
|
108907
108945
|
try {
|
|
108908
108946
|
const repairResult = await repairLegacyWindowsGlobalKitDir({ targetDir: resolvedDir });
|
|
@@ -109099,7 +109137,7 @@ async function handleSelection(ctx) {
|
|
|
109099
109137
|
}
|
|
109100
109138
|
// src/commands/init/phases/sync-handler.ts
|
|
109101
109139
|
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile59, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile33 } from "node:fs/promises";
|
|
109102
|
-
import { dirname as dirname44, join as join136, resolve as
|
|
109140
|
+
import { dirname as dirname44, join as join136, resolve as resolve47 } from "node:path";
|
|
109103
109141
|
init_logger();
|
|
109104
109142
|
init_path_resolver();
|
|
109105
109143
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -109108,7 +109146,7 @@ async function handleSync(ctx) {
|
|
|
109108
109146
|
if (!ctx.options.sync) {
|
|
109109
109147
|
return ctx;
|
|
109110
109148
|
}
|
|
109111
|
-
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() :
|
|
109149
|
+
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
109112
109150
|
const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
|
|
109113
109151
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
109114
109152
|
logger.error("Cannot sync: no .claude directory found");
|
|
@@ -109242,7 +109280,7 @@ async function acquireSyncLock(global3) {
|
|
|
109242
109280
|
}
|
|
109243
109281
|
logger.debug(`Lock stat failed: ${statError}`);
|
|
109244
109282
|
}
|
|
109245
|
-
await new Promise((
|
|
109283
|
+
await new Promise((resolve48) => setTimeout(resolve48, 100));
|
|
109246
109284
|
continue;
|
|
109247
109285
|
}
|
|
109248
109286
|
throw err;
|
|
@@ -110229,7 +110267,7 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
110229
110267
|
import { existsSync as existsSync68 } from "node:fs";
|
|
110230
110268
|
import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
110231
110269
|
import { homedir as homedir52 } from "node:os";
|
|
110232
|
-
import { basename as basename30, join as join144, resolve as
|
|
110270
|
+
import { basename as basename30, join as join144, resolve as resolve48 } from "node:path";
|
|
110233
110271
|
init_logger();
|
|
110234
110272
|
|
|
110235
110273
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -111613,7 +111651,7 @@ function shouldExecuteAction2(action) {
|
|
|
111613
111651
|
}
|
|
111614
111652
|
async function executeDeleteAction(action, options2) {
|
|
111615
111653
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
111616
|
-
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(
|
|
111654
|
+
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve48(action.targetPath));
|
|
111617
111655
|
try {
|
|
111618
111656
|
if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
|
|
111619
111657
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
@@ -111646,7 +111684,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
111646
111684
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111647
111685
|
if (!skillSourcePath)
|
|
111648
111686
|
return;
|
|
111649
|
-
const sourceMetadataPath = join144(
|
|
111687
|
+
const sourceMetadataPath = join144(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
111650
111688
|
if (!existsSync68(sourceMetadataPath))
|
|
111651
111689
|
return;
|
|
111652
111690
|
let sourceMetadata;
|
|
@@ -112067,7 +112105,7 @@ async function migrateCommand(options2) {
|
|
|
112067
112105
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
112068
112106
|
for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
|
|
112069
112107
|
if (result.path.length > 0) {
|
|
112070
|
-
writtenPaths.add(
|
|
112108
|
+
writtenPaths.add(resolve48(result.path));
|
|
112071
112109
|
}
|
|
112072
112110
|
if (task.type === "hooks") {
|
|
112073
112111
|
const existing = successfulHookFiles.get(task.provider) ?? {
|
|
@@ -112078,7 +112116,7 @@ async function migrateCommand(options2) {
|
|
|
112078
112116
|
successfulHookFiles.set(task.provider, existing);
|
|
112079
112117
|
if (result.path.length > 0) {
|
|
112080
112118
|
const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
|
|
112081
|
-
absExisting.push(
|
|
112119
|
+
absExisting.push(resolve48(result.path));
|
|
112082
112120
|
successfulHookAbsPaths.set(task.provider, absExisting);
|
|
112083
112121
|
}
|
|
112084
112122
|
}
|
|
@@ -112221,7 +112259,7 @@ async function migrateCommand(options2) {
|
|
|
112221
112259
|
}
|
|
112222
112260
|
}
|
|
112223
112261
|
try {
|
|
112224
|
-
const kitRoot = (agentSource ?
|
|
112262
|
+
const kitRoot = (agentSource ? resolve48(agentSource, "..") : null) ?? (commandSource ? resolve48(commandSource, "..") : null) ?? (skillSource ? resolve48(skillSource, "..") : null) ?? null;
|
|
112225
112263
|
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
112226
112264
|
if (manifest?.cliVersion) {
|
|
112227
112265
|
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
@@ -112418,7 +112456,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
|
112418
112456
|
|
|
112419
112457
|
// src/commands/new/phases/directory-setup.ts
|
|
112420
112458
|
init_config_manager();
|
|
112421
|
-
import { resolve as
|
|
112459
|
+
import { resolve as resolve49 } from "node:path";
|
|
112422
112460
|
init_logger();
|
|
112423
112461
|
init_path_resolver();
|
|
112424
112462
|
init_types3();
|
|
@@ -112503,7 +112541,7 @@ async function directorySetup(validOptions, prompts) {
|
|
|
112503
112541
|
targetDir = await prompts.getDirectory(targetDir);
|
|
112504
112542
|
}
|
|
112505
112543
|
}
|
|
112506
|
-
const resolvedDir =
|
|
112544
|
+
const resolvedDir = resolve49(targetDir);
|
|
112507
112545
|
logger.info(`Target directory: ${resolvedDir}`);
|
|
112508
112546
|
if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
|
|
112509
112547
|
logger.warning("You're creating a project at HOME directory.");
|
|
@@ -112837,7 +112875,7 @@ Please use only one download method.`);
|
|
|
112837
112875
|
// src/commands/plan/plan-command.ts
|
|
112838
112876
|
init_output_manager();
|
|
112839
112877
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
112840
|
-
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as
|
|
112878
|
+
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve53 } from "node:path";
|
|
112841
112879
|
|
|
112842
112880
|
// src/commands/plan/plan-read-handlers.ts
|
|
112843
112881
|
init_config();
|
|
@@ -112847,7 +112885,7 @@ init_logger();
|
|
|
112847
112885
|
init_output_manager();
|
|
112848
112886
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
112849
112887
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
112850
|
-
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as
|
|
112888
|
+
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as resolve51 } from "node:path";
|
|
112851
112889
|
|
|
112852
112890
|
// src/commands/plan/plan-dependencies.ts
|
|
112853
112891
|
init_config();
|
|
@@ -112905,14 +112943,14 @@ init_config();
|
|
|
112905
112943
|
init_plan_parser();
|
|
112906
112944
|
init_plan_scope();
|
|
112907
112945
|
init_plans_registry();
|
|
112908
|
-
import { isAbsolute as isAbsolute13, resolve as
|
|
112946
|
+
import { isAbsolute as isAbsolute13, resolve as resolve50 } from "node:path";
|
|
112909
112947
|
async function getGlobalPlansDirFromCwd() {
|
|
112910
112948
|
const projectRoot = findProjectRoot(process.cwd());
|
|
112911
112949
|
const { config } = await CkConfigManager.loadFull(projectRoot);
|
|
112912
112950
|
return resolveGlobalPlansDir(config);
|
|
112913
112951
|
}
|
|
112914
112952
|
function resolveTargetFromBase(target, baseDir) {
|
|
112915
|
-
const resolvedTarget = isAbsolute13(target) ?
|
|
112953
|
+
const resolvedTarget = isAbsolute13(target) ? resolve50(target) : resolve50(baseDir, target);
|
|
112916
112954
|
return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
|
|
112917
112955
|
}
|
|
112918
112956
|
|
|
@@ -113015,7 +113053,7 @@ async function handleStatus(target, options2) {
|
|
|
113015
113053
|
return;
|
|
113016
113054
|
}
|
|
113017
113055
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
113018
|
-
const t = effectiveTarget ?
|
|
113056
|
+
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
113019
113057
|
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join148(t, "plan.md")) ? t : null;
|
|
113020
113058
|
if (plansDir) {
|
|
113021
113059
|
const planFiles = scanPlanDir(plansDir);
|
|
@@ -113200,7 +113238,7 @@ init_plan_parser();
|
|
|
113200
113238
|
init_plans_registry();
|
|
113201
113239
|
init_output_manager();
|
|
113202
113240
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
113203
|
-
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as
|
|
113241
|
+
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as resolve52 } from "node:path";
|
|
113204
113242
|
function quoteReadTarget(filePath) {
|
|
113205
113243
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
113206
113244
|
}
|
|
@@ -113243,13 +113281,13 @@ async function handleCreate(target, options2) {
|
|
|
113243
113281
|
return;
|
|
113244
113282
|
}
|
|
113245
113283
|
const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
|
|
113246
|
-
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) :
|
|
113284
|
+
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve52(dir);
|
|
113247
113285
|
if (globalBaseDir && !resolvedDir) {
|
|
113248
113286
|
output.error("[X] Target directory must stay within the configured global plans root");
|
|
113249
113287
|
process.exitCode = 1;
|
|
113250
113288
|
return;
|
|
113251
113289
|
}
|
|
113252
|
-
const safeResolvedDir = resolvedDir ??
|
|
113290
|
+
const safeResolvedDir = resolvedDir ?? resolve52(dir);
|
|
113253
113291
|
const result = scaffoldPlan({
|
|
113254
113292
|
title: options2.title,
|
|
113255
113293
|
phases: phaseNames.map((name2) => ({ name: name2 })),
|
|
@@ -113428,19 +113466,19 @@ async function handleAddPhase(target, options2) {
|
|
|
113428
113466
|
// src/commands/plan/plan-command.ts
|
|
113429
113467
|
function resolveTargetPath(target, baseDir) {
|
|
113430
113468
|
if (!baseDir) {
|
|
113431
|
-
return
|
|
113469
|
+
return resolve53(target);
|
|
113432
113470
|
}
|
|
113433
113471
|
if (isAbsolute14(target)) {
|
|
113434
|
-
return
|
|
113472
|
+
return resolve53(target);
|
|
113435
113473
|
}
|
|
113436
|
-
const cwdCandidate =
|
|
113474
|
+
const cwdCandidate = resolve53(target);
|
|
113437
113475
|
if (existsSync71(cwdCandidate)) {
|
|
113438
113476
|
return cwdCandidate;
|
|
113439
113477
|
}
|
|
113440
|
-
return
|
|
113478
|
+
return resolve53(baseDir, target);
|
|
113441
113479
|
}
|
|
113442
113480
|
function resolvePlanFile(target, baseDir) {
|
|
113443
|
-
const t = target ? resolveTargetPath(target, baseDir) : baseDir ?
|
|
113481
|
+
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve53(baseDir) : process.cwd();
|
|
113444
113482
|
if (existsSync71(t)) {
|
|
113445
113483
|
const stat24 = statSync12(t);
|
|
113446
113484
|
if (stat24.isFile())
|
|
@@ -113504,7 +113542,7 @@ async function planCommand(action, target, options2) {
|
|
|
113504
113542
|
let resolvedTarget = target;
|
|
113505
113543
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
113506
113544
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
113507
|
-
const existsOnDisk = !looksLikePath && existsSync71(
|
|
113545
|
+
const existsOnDisk = !looksLikePath && existsSync71(resolve53(resolvedAction));
|
|
113508
113546
|
if (looksLikePath || existsOnDisk) {
|
|
113509
113547
|
resolvedTarget = resolvedAction;
|
|
113510
113548
|
resolvedAction = undefined;
|
|
@@ -113547,11 +113585,11 @@ init_logger();
|
|
|
113547
113585
|
init_safe_prompts();
|
|
113548
113586
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
113549
113587
|
import { existsSync as existsSync72 } from "node:fs";
|
|
113550
|
-
import { resolve as
|
|
113588
|
+
import { resolve as resolve54 } from "node:path";
|
|
113551
113589
|
async function handleAdd(projectPath, options2) {
|
|
113552
113590
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
113553
113591
|
intro("Add Project");
|
|
113554
|
-
const absolutePath =
|
|
113592
|
+
const absolutePath = resolve54(projectPath);
|
|
113555
113593
|
if (!existsSync72(absolutePath)) {
|
|
113556
113594
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
113557
113595
|
process.exitCode = 1;
|
|
@@ -113976,7 +114014,7 @@ import { readFile as readFile66 } from "node:fs/promises";
|
|
|
113976
114014
|
import { join as join151 } from "node:path";
|
|
113977
114015
|
|
|
113978
114016
|
// src/commands/skills/installed-skills-inventory.ts
|
|
113979
|
-
import { join as join150, resolve as
|
|
114017
|
+
import { join as join150, resolve as resolve55 } from "node:path";
|
|
113980
114018
|
init_path_resolver();
|
|
113981
114019
|
var SCOPE_SORT_ORDER = {
|
|
113982
114020
|
project: 0,
|
|
@@ -113984,8 +114022,8 @@ var SCOPE_SORT_ORDER = {
|
|
|
113984
114022
|
};
|
|
113985
114023
|
async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
113986
114024
|
const projectDir = options2.projectDir ?? process.cwd();
|
|
113987
|
-
const globalDir =
|
|
113988
|
-
const projectClaudeDir =
|
|
114025
|
+
const globalDir = resolve55(options2.globalDir ?? PathResolver.getGlobalKitDir());
|
|
114026
|
+
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
113989
114027
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
113990
114028
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
113991
114029
|
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join150(projectClaudeDir, "skills")),
|
|
@@ -114732,7 +114770,7 @@ async function detectInstallations() {
|
|
|
114732
114770
|
|
|
114733
114771
|
// src/commands/uninstall/removal-handler.ts
|
|
114734
114772
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114735
|
-
import { basename as basename33, join as join153, resolve as
|
|
114773
|
+
import { basename as basename33, join as join153, resolve as resolve56, sep as sep14 } from "node:path";
|
|
114736
114774
|
init_logger();
|
|
114737
114775
|
init_safe_prompts();
|
|
114738
114776
|
init_safe_spinner();
|
|
@@ -114916,8 +114954,8 @@ async function restoreUninstallBackup(backup) {
|
|
|
114916
114954
|
}
|
|
114917
114955
|
async function isPathSafeToRemove(filePath, baseDir) {
|
|
114918
114956
|
try {
|
|
114919
|
-
const resolvedPath =
|
|
114920
|
-
const resolvedBase =
|
|
114957
|
+
const resolvedPath = resolve56(filePath);
|
|
114958
|
+
const resolvedBase = resolve56(baseDir);
|
|
114921
114959
|
if (!resolvedPath.startsWith(resolvedBase + sep14) && resolvedPath !== resolvedBase) {
|
|
114922
114960
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
114923
114961
|
return false;
|
|
@@ -114925,7 +114963,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
114925
114963
|
const stats = await import_fs_extra43.lstat(filePath);
|
|
114926
114964
|
if (stats.isSymbolicLink()) {
|
|
114927
114965
|
const realPath = await import_fs_extra43.realpath(filePath);
|
|
114928
|
-
const resolvedReal =
|
|
114966
|
+
const resolvedReal = resolve56(realPath);
|
|
114929
114967
|
if (!resolvedReal.startsWith(resolvedBase + sep14) && resolvedReal !== resolvedBase) {
|
|
114930
114968
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
114931
114969
|
return false;
|
|
@@ -115463,7 +115501,7 @@ function getDisclaimerMarker() {
|
|
|
115463
115501
|
return AI_DISCLAIMER;
|
|
115464
115502
|
}
|
|
115465
115503
|
function spawnAndCollect2(command, args) {
|
|
115466
|
-
return new Promise((
|
|
115504
|
+
return new Promise((resolve57, reject) => {
|
|
115467
115505
|
const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115468
115506
|
const chunks = [];
|
|
115469
115507
|
const stderrChunks = [];
|
|
@@ -115476,7 +115514,7 @@ function spawnAndCollect2(command, args) {
|
|
|
115476
115514
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115477
115515
|
return;
|
|
115478
115516
|
}
|
|
115479
|
-
|
|
115517
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115480
115518
|
});
|
|
115481
115519
|
});
|
|
115482
115520
|
}
|
|
@@ -115584,7 +115622,7 @@ function formatResponse(content, showBranding) {
|
|
|
115584
115622
|
return disclaimer + formatted + branding;
|
|
115585
115623
|
}
|
|
115586
115624
|
async function postViaGh(owner, repo, issueNumber, body) {
|
|
115587
|
-
return new Promise((
|
|
115625
|
+
return new Promise((resolve57, reject) => {
|
|
115588
115626
|
const args = [
|
|
115589
115627
|
"issue",
|
|
115590
115628
|
"comment",
|
|
@@ -115606,7 +115644,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
|
|
|
115606
115644
|
reject(new Error(`gh exited with code ${code2}: ${stderr}`));
|
|
115607
115645
|
return;
|
|
115608
115646
|
}
|
|
115609
|
-
|
|
115647
|
+
resolve57();
|
|
115610
115648
|
});
|
|
115611
115649
|
});
|
|
115612
115650
|
}
|
|
@@ -115724,7 +115762,7 @@ After completing the implementation:
|
|
|
115724
115762
|
"--allowedTools",
|
|
115725
115763
|
tools
|
|
115726
115764
|
];
|
|
115727
|
-
await new Promise((
|
|
115765
|
+
await new Promise((resolve57, reject) => {
|
|
115728
115766
|
const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
|
|
115729
115767
|
child.stdin.write(prompt);
|
|
115730
115768
|
child.stdin.end();
|
|
@@ -115749,7 +115787,7 @@ After completing the implementation:
|
|
|
115749
115787
|
reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
|
|
115750
115788
|
return;
|
|
115751
115789
|
}
|
|
115752
|
-
|
|
115790
|
+
resolve57();
|
|
115753
115791
|
});
|
|
115754
115792
|
});
|
|
115755
115793
|
}
|
|
@@ -115893,7 +115931,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
|
|
|
115893
115931
|
return processedThisHour < maxPerHour;
|
|
115894
115932
|
}
|
|
115895
115933
|
function spawnAndCollect3(command, args) {
|
|
115896
|
-
return new Promise((
|
|
115934
|
+
return new Promise((resolve57, reject) => {
|
|
115897
115935
|
const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115898
115936
|
const chunks = [];
|
|
115899
115937
|
const stderrChunks = [];
|
|
@@ -115906,7 +115944,7 @@ function spawnAndCollect3(command, args) {
|
|
|
115906
115944
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115907
115945
|
return;
|
|
115908
115946
|
}
|
|
115909
|
-
|
|
115947
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115910
115948
|
});
|
|
115911
115949
|
});
|
|
115912
115950
|
}
|
|
@@ -115958,7 +115996,7 @@ async function invokeClaude(options2) {
|
|
|
115958
115996
|
return collectClaudeOutput(child, options2.timeoutSec, verbose);
|
|
115959
115997
|
}
|
|
115960
115998
|
function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
115961
|
-
return new Promise((
|
|
115999
|
+
return new Promise((resolve57, reject) => {
|
|
115962
116000
|
const chunks = [];
|
|
115963
116001
|
const stderrChunks = [];
|
|
115964
116002
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -115988,7 +116026,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
|
115988
116026
|
reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
|
|
115989
116027
|
return;
|
|
115990
116028
|
}
|
|
115991
|
-
|
|
116029
|
+
resolve57(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
|
|
115992
116030
|
});
|
|
115993
116031
|
});
|
|
115994
116032
|
}
|
|
@@ -117252,7 +117290,7 @@ function formatQueueInfo(state) {
|
|
|
117252
117290
|
return "idle";
|
|
117253
117291
|
}
|
|
117254
117292
|
function sleep(ms) {
|
|
117255
|
-
return new Promise((
|
|
117293
|
+
return new Promise((resolve57) => setTimeout(resolve57, ms));
|
|
117256
117294
|
}
|
|
117257
117295
|
// src/cli/command-registry.ts
|
|
117258
117296
|
init_logger();
|
|
@@ -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(`
|
package/dist/ui/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
background: var(--dash-text-muted);
|
|
72
72
|
}
|
|
73
73
|
</style>
|
|
74
|
-
<script type="module" crossorigin src="/assets/index-
|
|
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>
|