@tom2012/cc-web 2026.4.20-d → 2026.4.21-a

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.
Files changed (29) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/index.d.ts.map +1 -1
  3. package/backend/dist/index.js +41 -0
  4. package/backend/dist/index.js.map +1 -1
  5. package/backend/dist/routes/sync.d.ts.map +1 -1
  6. package/backend/dist/routes/sync.js +61 -11
  7. package/backend/dist/routes/sync.js.map +1 -1
  8. package/backend/dist/sync-service.d.ts +44 -0
  9. package/backend/dist/sync-service.d.ts.map +1 -1
  10. package/backend/dist/sync-service.js +188 -21
  11. package/backend/dist/sync-service.js.map +1 -1
  12. package/frontend/dist/assets/{AssistantMessageContent-BhfKqZ7C.js → AssistantMessageContent-Dm3z0RIO.js} +1 -1
  13. package/frontend/dist/assets/{GraphPreview-BzH3Wak5.js → GraphPreview-DC6o5F0m.js} +1 -1
  14. package/frontend/dist/assets/{MobilePage-BQRuj2Cs.js → MobilePage-BPKPsPbS.js} +4 -4
  15. package/frontend/dist/assets/{OfficePreview-B-VYapp6.js → OfficePreview-C215GkvD.js} +2 -2
  16. package/frontend/dist/assets/{ProjectPage-CsiEfciU.js → ProjectPage-lrAM-2d9.js} +5 -5
  17. package/frontend/dist/assets/SettingsPage-CYfAxyoC.js +13 -0
  18. package/frontend/dist/assets/{SkillHubPage-Bl50eKHR.js → SkillHubPage-lb0WJ97m.js} +3 -3
  19. package/frontend/dist/assets/{chevron-down-WeK3LuVf.js → chevron-down-CbFkp9NB.js} +1 -1
  20. package/frontend/dist/assets/{chevron-up-CJDXUdmI.js → chevron-up-PypucKf2.js} +1 -1
  21. package/frontend/dist/assets/{index-BrqN6Jet.js → index-BBvmgEUM.js} +4 -4
  22. package/frontend/dist/assets/{index-vHzDarwZ.css → index-CjKxGpPA.css} +1 -1
  23. package/frontend/dist/assets/{index-Bu3s8sE1.js → index-Hqp72os9.js} +1 -1
  24. package/frontend/dist/assets/{index-c0ovO67g.js → index-LBFGRSfF.js} +1 -1
  25. package/frontend/dist/assets/{jszip.min-BwsPvdp_.js → jszip.min-C4dvRM2c.js} +1 -1
  26. package/frontend/dist/assets/{search-0gpkXlAu.js → search-6DMKwY12.js} +1 -1
  27. package/frontend/dist/index.html +2 -2
  28. package/package.json +1 -1
  29. package/frontend/dist/assets/SettingsPage-oMXzGZc9.js +0 -13
@@ -33,11 +33,17 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.syncEvents = void 0;
36
37
  exports.syncProject = syncProject;
38
+ exports.cancelSync = cancelSync;
39
+ exports.cancelAllForUser = cancelAllForUser;
40
+ exports.isBulkCancelled = isBulkCancelled;
41
+ exports.clearBulkCancel = clearBulkCancel;
37
42
  exports.isSyncing = isSyncing;
38
43
  exports.listInFlight = listInFlight;
39
44
  exports.testConnection = testConnection;
40
45
  const child_process_1 = require("child_process");
46
+ const events_1 = require("events");
41
47
  const fs = __importStar(require("fs"));
42
48
  const path = __importStar(require("path"));
43
49
  const os = __importStar(require("os"));
@@ -48,9 +54,23 @@ const LOGS_DIR = path.join(config_1.DATA_DIR, 'sync-logs');
48
54
  const WRAP_DIR = path.join(config_1.DATA_DIR, 'sync-ssh');
49
55
  const LOG_MAX_BYTES = 2 * 1024 * 1024; // 2 MB per project
50
56
  const inFlight = new Map();
57
+ // Cancellable child handles keyed the same way as inFlight. Populated for the
58
+ // duration of each rsync invocation inside runOne; used by cancelSync to kill
59
+ // the live process with SIGTERM. A bidirectional sync may reuse the slot
60
+ // across push/pull legs.
61
+ const activeChildren = new Map();
62
+ // Per-(user, projectId) cancellation flag: once set, the in-flight promise
63
+ // resolves with reason:'cancelled' and the bidirectional path skips the pull
64
+ // leg. Cleared by syncProject on finally.
65
+ const cancelled = new Set();
66
+ // Per-user bulk-cancel flag, set by cancelAllForUser to break the syncAll
67
+ // for-loop between projects. Cleared by syncAll on entry and exit.
68
+ const bulkCancel = new Set();
51
69
  function inFlightKey(username, projectId) {
52
70
  return `${username}::${projectId}`;
53
71
  }
72
+ exports.syncEvents = new events_1.EventEmitter();
73
+ exports.syncEvents.setMaxListeners(50);
54
74
  function userSlug(username) {
55
75
  return crypto.createHash('sha1').update(`ccweb-sync-user:${username}`).digest('hex');
56
76
  }
@@ -263,29 +283,108 @@ async function runOne(cfg, projectId, folderName, localPath, direction, bidirect
263
283
  const startStamp = new Date().toISOString();
264
284
  const header = `\n===== ${startStamp} ${direction.toUpperCase()}${bidirectionalLeg ? '(bidi)' : ''} ${folderName} (${bin.versionLine}) =====\n`;
265
285
  const started = Date.now();
286
+ const key = inFlightKey(cfg.username, projectId);
287
+ const leg = !bidirectionalLeg
288
+ ? 'single'
289
+ : direction === 'push' ? 'bidi-push' : 'bidi-pull';
290
+ const startEvt = { kind: 'start', username: cfg.username, projectId, direction, leg };
291
+ exports.syncEvents.emit('event', startEvt);
266
292
  return await new Promise((resolve) => {
267
293
  let combined = '';
294
+ // Line-buffered parser so we can emit a progress event per itemized file
295
+ // line while rsync is still running. rsync writes unbuffered when its
296
+ // stdout is a pipe, so lines arrive promptly. The leftover (no-newline)
297
+ // tail is carried across chunks.
298
+ let lineBuf = '';
299
+ let fileCount = 0;
300
+ const ITEMIZE_LINE = /^[<>ch][fdLDS]\S*\s+(.+?)\s*$/;
301
+ const handleLine = (line) => {
302
+ const m = line.match(ITEMIZE_LINE);
303
+ if (!m)
304
+ return;
305
+ // Count file-typed transfers only; dir/symlink lines come through too
306
+ // but "files transferred" in the final result is file-only, so stay
307
+ // consistent with parseRsyncOutput.
308
+ if (!/^[<>ch]f/.test(line))
309
+ return;
310
+ fileCount += 1;
311
+ const evt = {
312
+ kind: 'progress',
313
+ username: cfg.username,
314
+ projectId,
315
+ currentFile: m[1],
316
+ filesTransferred: fileCount,
317
+ };
318
+ exports.syncEvents.emit('event', evt);
319
+ };
268
320
  const logStream = fs.createWriteStream(logFile, { flags: 'a', mode: 0o600 });
269
321
  logStream.write(header);
270
- const child = (0, child_process_1.spawn)(bin.path, args, { env, cwd: os.homedir(), stdio: ['ignore', 'pipe', 'pipe'] });
322
+ // Guard against double-teardown: child.on('error') and child.on('close')
323
+ // can both fire for the same invocation (error commonly precedes close),
324
+ // and WriteStream.end() logs a noisy warning on double-end. `finished`
325
+ // also covers the synchronous-spawn-throw path below.
326
+ let finished = false;
327
+ const finish = (result) => {
328
+ if (finished)
329
+ return;
330
+ finished = true;
331
+ activeChildren.delete(key);
332
+ try {
333
+ logStream.end();
334
+ }
335
+ catch { /* already closed */ }
336
+ resolve(result);
337
+ };
338
+ // spawn can throw synchronously (ENOENT on rsync binary path, argv too
339
+ // long, etc). Without this guard the Promise executor throws and the
340
+ // outer `await` never resolves — inFlight leaks and the log fd leaks.
341
+ let child;
342
+ try {
343
+ child = (0, child_process_1.spawn)(bin.path, args, { env, cwd: os.homedir(), stdio: ['ignore', 'pipe', 'pipe'] });
344
+ }
345
+ catch (err) {
346
+ const msg = err instanceof Error ? err.message : String(err);
347
+ logStream.write(`spawn threw: ${msg}\n`);
348
+ finish({ ok: false, exitCode: null, durationMs: Date.now() - started, bytes: 0, filesTransferred: 0, logTail: msg, reason: 'spawn-failed' });
349
+ return;
350
+ }
351
+ activeChildren.set(key, child);
271
352
  const onData = (buf) => {
272
353
  const s = buf.toString();
273
354
  combined += s;
274
355
  logStream.write(s);
356
+ lineBuf += s;
357
+ let nl;
358
+ while ((nl = lineBuf.indexOf('\n')) >= 0) {
359
+ const line = lineBuf.slice(0, nl);
360
+ lineBuf = lineBuf.slice(nl + 1);
361
+ handleLine(line);
362
+ }
275
363
  };
276
- child.stdout.on('data', onData);
277
- child.stderr.on('data', onData);
364
+ child.stdout?.on('data', onData);
365
+ child.stderr?.on('data', onData);
278
366
  child.on('error', (err) => {
279
367
  logStream.write(`spawn error: ${err.message}\n`);
280
- logStream.end();
281
- resolve({ ok: false, exitCode: null, durationMs: Date.now() - started, bytes: 0, filesTransferred: 0, logTail: err.message, reason: 'spawn-failed' });
368
+ finish({ ok: false, exitCode: null, durationMs: Date.now() - started, bytes: 0, filesTransferred: 0, logTail: err.message, reason: 'spawn-failed' });
282
369
  });
283
- child.on('close', (code) => {
284
- logStream.end();
285
- const ok = code === 0;
370
+ child.on('close', (code, signal) => {
371
+ // Flush any trailing partial line so a file name without a trailing \n
372
+ // still counts.
373
+ if (lineBuf) {
374
+ handleLine(lineBuf);
375
+ lineBuf = '';
376
+ }
377
+ const wasCancelled = cancelled.has(key);
378
+ // rsync exits non-zero (commonly 20) when killed by SIGTERM/SIGINT.
379
+ // Normalise that to `ok:false, reason:'cancelled'` so the HTTP caller
380
+ // can distinguish user cancel from real rsync errors.
381
+ const ok = code === 0 && !wasCancelled;
286
382
  const { bytes, files } = parseRsyncOutput(combined, direction);
287
383
  const logTail = combined.split('\n').slice(-30).join('\n');
288
- resolve({ ok, exitCode: code, durationMs: Date.now() - started, bytes, filesTransferred: files, logTail });
384
+ const reason = wasCancelled
385
+ ? 'cancelled'
386
+ : (signal ? `killed-${signal}` : undefined);
387
+ finish({ ok, exitCode: code, durationMs: Date.now() - started, bytes, filesTransferred: files, logTail, reason });
289
388
  });
290
389
  });
291
390
  }
@@ -328,21 +427,43 @@ async function syncProject(username, projectId, projectName, localPath, override
328
427
  const folderName = (0, sync_config_1.sanitizeFolderName)(rawName) ?? projectId;
329
428
  const direction = overrideDirection ?? cfg.direction;
330
429
  const job = (async () => {
430
+ let result;
331
431
  if (direction === 'bidirectional') {
332
432
  const push = await runOne(cfg, projectId, folderName, localPath, 'push', true);
333
- if (!push.ok)
334
- return push;
335
- const pull = await runOne(cfg, projectId, folderName, localPath, 'pull', true);
336
- return {
337
- ok: pull.ok,
338
- exitCode: pull.exitCode,
339
- durationMs: push.durationMs + pull.durationMs,
340
- bytes: push.bytes + pull.bytes,
341
- filesTransferred: push.filesTransferred + pull.filesTransferred,
342
- logTail: `[PUSH]\n${push.logTail}\n[PULL]\n${pull.logTail}`,
343
- };
433
+ // Skip the pull leg entirely if push failed OR user cancelled mid-push
434
+ // (a cancelled push produces ok:false, so the early-return already
435
+ // handles that this comment just makes the intent explicit).
436
+ if (!push.ok) {
437
+ result = push;
438
+ }
439
+ else {
440
+ const pull = await runOne(cfg, projectId, folderName, localPath, 'pull', true);
441
+ result = {
442
+ ok: pull.ok,
443
+ exitCode: pull.exitCode,
444
+ durationMs: push.durationMs + pull.durationMs,
445
+ bytes: push.bytes + pull.bytes,
446
+ filesTransferred: push.filesTransferred + pull.filesTransferred,
447
+ logTail: `[PUSH]\n${push.logTail}\n[PULL]\n${pull.logTail}`,
448
+ reason: pull.reason,
449
+ };
450
+ }
344
451
  }
345
- return runOne(cfg, projectId, folderName, localPath, direction, false);
452
+ else {
453
+ result = await runOne(cfg, projectId, folderName, localPath, direction, false);
454
+ }
455
+ const doneEvt = {
456
+ kind: 'done',
457
+ username: cfg.username,
458
+ projectId,
459
+ ok: result.ok,
460
+ filesTransferred: result.filesTransferred,
461
+ bytes: result.bytes,
462
+ durationMs: result.durationMs,
463
+ reason: result.reason,
464
+ };
465
+ exports.syncEvents.emit('event', doneEvt);
466
+ return result;
346
467
  })();
347
468
  inFlight.set(key, job);
348
469
  try {
@@ -350,8 +471,54 @@ async function syncProject(username, projectId, projectName, localPath, override
350
471
  }
351
472
  finally {
352
473
  inFlight.delete(key);
474
+ cancelled.delete(key);
353
475
  }
354
476
  }
477
+ /**
478
+ * Cancel a running sync for (username, projectId) by sending SIGTERM to the
479
+ * live rsync child process. Returns true if a process was signalled.
480
+ *
481
+ * Safe to call when nothing is in flight — returns false without side effects.
482
+ * The cancelled flag is set first so runOne's close handler can distinguish
483
+ * user cancel from spontaneous rsync failure even if SIGTERM races with a
484
+ * natural exit.
485
+ */
486
+ function cancelSync(username, projectId) {
487
+ const key = inFlightKey(username, projectId);
488
+ const child = activeChildren.get(key);
489
+ if (!child)
490
+ return false;
491
+ cancelled.add(key);
492
+ try {
493
+ child.kill('SIGTERM');
494
+ return true;
495
+ }
496
+ catch {
497
+ return false;
498
+ }
499
+ }
500
+ /**
501
+ * Cancel every in-flight sync for a user AND set the bulk-cancel flag so a
502
+ * running `syncAll` loop breaks between projects. Returns the list of
503
+ * projectIds that had a process cancelled.
504
+ */
505
+ function cancelAllForUser(username) {
506
+ bulkCancel.add(username);
507
+ const cancelledIds = [];
508
+ for (const pid of listInFlight(username)) {
509
+ if (cancelSync(username, pid))
510
+ cancelledIds.push(pid);
511
+ }
512
+ return cancelledIds;
513
+ }
514
+ /** True when the bulk-cancel flag has been set for this user. */
515
+ function isBulkCancelled(username) {
516
+ return bulkCancel.has(username);
517
+ }
518
+ /** Clear the bulk-cancel flag. syncAll calls this on entry and exit. */
519
+ function clearBulkCancel(username) {
520
+ bulkCancel.delete(username);
521
+ }
355
522
  function isSyncing(username, projectId) {
356
523
  return inFlight.has(inFlightKey(username, projectId));
357
524
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sync-service.js","sourceRoot":"","sources":["../src/sync-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0VA,kCAmEC;AAED,8BAEC;AAED,oCAOC;AAOD,wCAwCC;AAzdD,iDAAgD;AAChD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,+CAAiC;AACjC,qCAAoC;AACpC,+CAGuB;AAwCvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAQ,EAAE,WAAW,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAQ,EAAE,UAAU,CAAC,CAAC;AACjD,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAE1D,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;AAExD,SAAS,WAAW,CAAC,QAAgB,EAAE,SAAiB;IACtD,OAAO,GAAG,QAAQ,KAAK,SAAS,EAAE,CAAC;AACrC,CAAC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AE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;;gBAClD,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import{br as e,bs as t,r as n,bt as r,c as a,bu as i,bv as o,j as s,R as l,aC as c,d as u,bw as d,t as p,A as m,p as g,aU as h,a as f}from"./index-BrqN6Jet.js";import{C as b}from"./chevron-down-WeK3LuVf.js";import{C as y,a as E}from"./chevron-up-CJDXUdmI.js";function S(){!e.current&&t();const[a]=n.useState(r.current);return a}
1
+ import{bu as e,bv as t,r as n,bw as r,c as a,bx as i,by as o,j as s,R as l,aD as c,d as u,bz as d,t as p,A as m,p as g,aW as h,a as f}from"./index-BBvmgEUM.js";import{C as b}from"./chevron-down-CbFkp9NB.js";import{C as y,a as E}from"./chevron-up-PypucKf2.js";function S(){!e.current&&t();const[a]=n.useState(r.current);return a}
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as e,r as t,b as n,j as i,aC as r,B as o,l as a}from"./index-BrqN6Jet.js";import{Z as s,a as l}from"./ProjectPage-CsiEfciU.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-BhfKqZ7C.js";import"./chevron-down-WeK3LuVf.js";import"./chevron-up-CJDXUdmI.js";import"./index-Bu3s8sE1.js";import"./search-0gpkXlAu.js";
1
+ import{c as e,r as t,b as n,j as i,aD as r,B as o,l as a}from"./index-BBvmgEUM.js";import{Z as s,a as l}from"./ProjectPage-lrAM-2d9.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-Dm3z0RIO.js";import"./chevron-down-CbFkp9NB.js";import"./chevron-up-PypucKf2.js";import"./index-Hqp72os9.js";import"./search-6DMKwY12.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,14 +1,14 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-B-VYapp6.js","assets/index-BrqN6Jet.js","assets/index-vHzDarwZ.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
- import{c as e,ax as t,aT as s,r as a,bj as n,bk as r,j as l,bl as o,l as c,d as i,bm as d,bn as x,aJ as u,aK as m,a5 as h,a4 as p,bo as f,ay as g,aR as j,a as b,b as v,g as y,D as N,aC as w,f as k,R as C,_ as S,k as I,X as M,o as z,bp as P,bq as U,C as T,A as $,p as A}from"./index-BrqN6Jet.js";import{A as D,d as E,G as R,M as L,r as H,a as O,b as q,h as _,o as F,c as B,I as W,F as K}from"./AssistantMessageContent-BhfKqZ7C.js";import{C as V}from"./chevron-up-CJDXUdmI.js";import{C as J}from"./chevron-down-WeK3LuVf.js";
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-C215GkvD.js","assets/index-BBvmgEUM.js","assets/index-CjKxGpPA.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,ax as t,aV as s,r as a,bm as n,bn as r,j as l,bo as o,l as c,d as i,bp as d,bq as x,aL as u,aM as m,a5 as h,a4 as p,br as f,az as g,aT as j,a as b,b as v,g as y,D as N,aD as w,f as k,R as C,_ as S,k as I,X as M,o as z,bs as P,bt as U,C as T,A as D,p as $}from"./index-BBvmgEUM.js";import{A,d as E,G as L,M as R,r as H,a as O,b as q,h as _,o as B,c as F,I as W,F as V}from"./AssistantMessageContent-Dm3z0RIO.js";import{C as K}from"./chevron-up-PypucKf2.js";import{C as G}from"./chevron-down-CbFkp9NB.js";
3
3
  /**
4
4
  * @license lucide-react v0.309.0 - ISC
5
5
  *
6
6
  * This source code is licensed under the ISC license.
7
7
  * See the LICENSE file in the root directory of this source tree.
8
- */const G=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),Q=e("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),X=e("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),Y=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Z=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
8
+ */const J=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),Q=e("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),X=e("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),Y=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Z=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
9
9
  /**
10
10
  * @license lucide-react v0.309.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
- */function ee({onSelectProject:e}){const x=t(),{projects:u,fetchProjects:m,hasFetched:h,loading:p}=s(),[f,g]=a.useState(new Map),[j,b]=a.useState(new Set),[v,y]=a.useState(!1);a.useEffect(()=>{m()},[m]);const N=a.useCallback(e=>{e.status&&g(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&b(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);n({onActivityUpdate:N});const{applyOrder:w}=r(),k=w(u.filter(e=>!e.archived));return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[l.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),l.jsx(o,{}),l.jsx("button",{onClick:()=>{(async()=>{y(!0);try{await m()}finally{y(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:v,children:l.jsx(c,{className:i("h-4 w-4",v&&"animate-spin")})}),!Z&&l.jsx("button",{onClick:()=>x("/"),className:"text-muted-foreground active:text-foreground",title:"桌面模式",children:l.jsx(d,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[p&&!h&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),h&&0===k.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{var s;const a="running"===(s=t,f.get(s.id)??s.status??"stopped"),n=j.has(t.id),r=l.jsxs("button",{onClick:()=>e(t.id),className:i("w-full text-left rounded-lg border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),l.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),l.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return l.jsx("div",{className:n?"card-active-glow rounded-lg":void 0,children:r},t.id)})})]})]})}function te({project:e,onBack:t,onOpenPanel:s,onContextUpdate:n}){const[r,o]=a.useState(""),c=a.useRef(null),d=a.useRef(null),[b,v]=a.useState([]),y=a.useCallback(e=>{v(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),N=a.useRef(null),w=a.useCallback(e=>{var t;"stopped"===e&&(null==(t=N.current)||t.call(N,"stopped"))},[]),[k,C]=a.useState([]),S=a.useRef(new Set),I=a.useCallback(e=>{S.current.has(e.toolUseId)||C(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),M=a.useCallback(e=>{S.current.add(e.toolUseId),C(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),z=a.useCallback(e=>{S.current.add(e),C(t=>t.filter(t=>t.toolUseId!==e))},[]),{sendInput:P,connected:U}=x({projectId:e.id,enabled:!0,onChatMessage:y,onStatusChange:w,onContextUpdate:n,onApprovalRequest:I,onApprovalResolved:M});a.useEffect(()=>{if(!U)return;if("claude"!==e.cliTool)return;let t=!1;return u(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!S.current.has(e.toolUseId));C(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||S.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,U]);const{state:T,setState:$,messages:A,hasMoreHistory:L,loadMoreHistory:H,sendMessage:O,isWaking:q}=m({project:e,liveMessages:b,ws:{send:P,connected:U},historyLimit:20});N.current=$;const _=a.useRef(U);a.useEffect(()=>{!_.current&&U&&v([]),_.current=U},[U]);const F=(()=>{for(let e=A.length-1;e>=0;e--)if("assistant"===A[e].role)return e;return-1})(),[B,W]=a.useState([]),[K,Q]=a.useState([]),[X,Z]=a.useState(null);a.useEffect(()=>{h().then(W).catch(()=>{}),p(e.id).then(Q).catch(()=>{})},[e.id]);const ee=a.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await H(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[H]),te=a.useRef(0);a.useEffect(()=>{const e=c.current;if(!e)return;const t=A.length>te.current,s=0===te.current&&A.length>0;te.current=A.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[A,k.length]);const se=a.useCallback(()=>{const e=r.trim();e&&(o(""),d.current&&(d.current.style.height="auto"),O(e))},[r,O]),ae=f(se,"shift"),ne=a.useCallback(e=>{Z(null),O(e)},[O]),re="live"===T;return l.jsxs("div",{className:"flex flex-col h-full bg-background",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[l.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",re?"bg-green-500":q?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),l.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(Y,{className:"h-5 w-5"})})]}),l.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[L&&l.jsx("div",{className:"flex justify-center pb-1",children:l.jsxs("button",{onClick:()=>{ee()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[l.jsx(V,{className:"h-3 w-3"}),"加载更早消息"]})}),A.map((e,t)=>{const s="user"===e.role;return l.jsx("div",{className:i("flex",s?"justify-end":"justify-start"),children:l.jsx("div",{className:i("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:l.jsx(D,{content:e.content,blocks:e.blocks,isLatest:t===F})})},e.id)}),k.map(e=>l.jsx(E,{approval:e,onResolved:z},e.toolUseId)),0===A.length&&0===k.length&&"stopped"===T&&l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),q&&l.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),X&&l.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:l.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===X?B:K).map(e=>l.jsxs("button",{onClick:()=>ne(e.command),disabled:q,className:i("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",q&&"opacity-50 cursor-not-allowed"),children:[l.jsx("div",{className:"font-medium text-xs",children:e.label}),l.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===X?B:K).length&&l.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}),(B.length>0||K.length>0)&&l.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[l.jsxs("button",{onClick:()=>Z(e=>"global"===e?null:"global"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(R,{className:"h-3 w-3"}),"全局","global"===X&&l.jsx(J,{className:"h-3 w-3"})]}),l.jsxs("button",{onClick:()=>Z(e=>"project"===e?null:"project"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(G,{className:"h-3 w-3"}),"项目","project"===X&&l.jsx(J,{className:"h-3 w-3"})]})]}),l.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsx("textarea",{ref:d,value:r,onChange:e=>o(e.target.value),onKeyDown:ae,disabled:q,placeholder:q?"启动中...":"stopped"===T?"输入消息(自动启动)...":"输入消息...",rows:1,className:i("flex-1 resize-none rounded-lg border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",q&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),l.jsx("button",{onClick:se,disabled:q||!r.trim(),className:i("shrink-0 p-2 rounded-lg transition-colors",r.trim()?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:l.jsx(j,{className:"h-5 w-5"})})]})})]})}const se=C.lazy(()=>S(()=>import("./OfficePreview-B-VYapp6.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),ae=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ne=new Set(["docx","xlsx","xls","pptx"]),re={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function le(e){return e.split("/").pop()??e}function oe({filePath:e,onBack:t}){const[s,n]=a.useState(null),[r,o]=a.useState(!0),[c,i]=a.useState(null),{resolved:d}=b(),x=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),u=ae.has(x),m=ne.has(x),h=re[x],p="dark"===d;a.useEffect(()=>{u||m?o(!1):(o(!0),i(null),v(e).then(n).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>o(!1)))},[e,u,m]);const f=k(e),j=a.useMemo(()=>{const e=y();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),C=a.useMemo(()=>u?`${j}&t=${Date.now()}`:"",[j,u]);return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:le(e)}),l.jsx("a",{href:j,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:l.jsx(N,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&l.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),u&&l.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:l.jsx("img",{src:C,alt:le(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&l.jsx(a.Suspense,{fallback:l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:l.jsx(se,{filePath:e,ext:x,zoom:100})}),s&&(s.binary||s.tooLarge)&&l.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[l.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${S=s.size,S<1024?`${S} B`:S<1048576?`${(S/1024).toFixed(1)} KB`:`${(S/1048576).toFixed(1)} MB`})`]}),l.jsxs("a",{href:j,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[l.jsx(N,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&l.jsxs(l.Fragment,{children:["md"===x&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:l.jsx(L,{remarkPlugins:[O,q],rehypePlugins:[H],children:s.content})}),"md"!==x&&h&&l.jsx(_,{language:h,style:p?F:B,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==x&&!h&&l.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var S}const ce=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ie=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),de=new Set(["json","yaml","yml","toml","csv","tsv"]);function xe({entry:e}){if("dir"===e.type)return l.jsx(z,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ce.has(t)?l.jsx(W,{className:"h-8 w-8 text-emerald-400"}):ie.has(t)?l.jsx(Q,{className:"h-8 w-8 text-orange-400"}):de.has(t)?l.jsx(X,{className:"h-8 w-8 text-yellow-400"}):"md"===t?l.jsx(K,{className:"h-8 w-8 text-sky-400"}):l.jsx(P,{className:"h-8 w-8 text-muted-foreground"})}function ue({rootPath:e,onClose:t}){const[s,n]=a.useState(e),[r,o]=a.useState([]),[c,i]=a.useState(!0),[d,x]=a.useState(null),u=a.useCallback(async e=>{i(!0);try{const t=[...(await I(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));o(t),n(e)}catch{o([])}finally{i(!1)}},[]);a.useEffect(()=>{u(e)},[e,u]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?l.jsx(oe,{filePath:d,onBack:()=>x(null)}):l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&l.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&u(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:l.jsx(g,{className:"h-4 w-4"})}),l.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&l.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>l.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?u(e.path):x(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-lg active:bg-accent transition-colors",children:[l.jsx(xe,{entry:e}),l.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function me(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function he(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function pe({projectName:e,cliTool:t,folderPath:s,contextData:n,onClose:r}){const[o,d]=a.useState(new Set(["context","usage","files"])),[x,u]=a.useState(null),[m,h]=a.useState(!1),p=e=>{d(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};a.useEffect(()=>{h(!0),U(t).then(u).catch(()=>u(null)).finally(()=>h(!1))},[t]);const f=n?Math.round(n.usedPercentage):null;return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[o.has("context")?l.jsx(J,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&l.jsxs("span",{className:i("text-xs font-mono ml-auto",me(f)),children:[f,"%"]})]}),o.has("context")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&n?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full transition-all",he(f)),style:{width:`${Math.min(f,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-10 text-right",me(f)),children:[f,"%"]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:"窗口大小"}),l.jsx("span",{className:"text-right font-mono",children:n.contextWindowSize>=1e6?`${(n.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(n.contextWindowSize/1e3)}K`}),l.jsx("span",{children:"输入 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.inputTokens.toLocaleString()}),l.jsx("span",{children:"输出 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.outputTokens.toLocaleString()})]})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),l.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[o.has("usage")?l.jsx(J,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"用量"}),l.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await S(async()=>{const{refreshUsage:e}=await import("./index-BrqN6Jet.js").then(e=>e.by);return{refreshUsage:e}},__vite__mapDeps([1,2]));u(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:l.jsx(c,{className:i("h-3 w-3",m&&"animate-spin")})})]}),o.has("usage")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:x?l.jsxs("div",{className:"space-y-2",children:[x.planName&&l.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",l.jsx("span",{className:"font-medium text-foreground",children:x.planName})]}),l.jsx(fe,{label:"5h",bucket:x.fiveHour}),l.jsx(fe,{label:"7d",bucket:x.sevenDay}),x.sevenDaySonnet&&l.jsx(fe,{label:"7d Sonnet",bucket:x.sevenDaySonnet}),x.sevenDayOpus&&l.jsx(fe,{label:"7d Opus",bucket:x.sevenDayOpus}),!x.fiveHour&&!x.sevenDay&&l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),l.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[o.has("files")?l.jsx(J,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),o.has("files")&&l.jsx("div",{className:"h-[60vh]",children:l.jsx(ue,{rootPath:s,onClose:()=>p("files")})})]})]})}function fe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),l.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full",he(s)),style:{width:`${Math.min(s,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-8 text-right",me(s)),children:[s,"%"]}),a&&l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function ge(){a.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=a.useState({screen:"list"}),[n,r]=a.useState(null),o=s(e=>e.projects),c=a.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=a.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=a.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),x="list"!==e.screen?o.find(t=>t.id===e.projectId):void 0;return l.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[l.jsxs($,{mode:"wait",children:["list"===e.screen&&l.jsx(A.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(ee,{onSelectProject:c})},"list"),"chat"===e.screen&&x&&l.jsx(A.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(te,{project:x,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),l.jsx($,{children:"panel"===e.screen&&x&&l.jsx(A.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(pe,{projectName:x.name,cliTool:x.cliTool??"claude",folderPath:x.folderPath,contextData:n,onClose:d})},"panel")})]})}export{ge as MobilePage};
14
+ */function ee({onSelectProject:e}){const x=t(),{projects:u,fetchProjects:m,hasFetched:h,loading:p}=s(),[f,g]=a.useState(new Map),[j,b]=a.useState(new Set),[v,y]=a.useState(!1);a.useEffect(()=>{m()},[m]);const N=a.useCallback(e=>{e.status&&g(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&b(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);n({onActivityUpdate:N});const{applyOrder:w}=r(),k=w(u.filter(e=>!e.archived));return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[l.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),l.jsx(o,{}),l.jsx("button",{onClick:()=>{(async()=>{y(!0);try{await m()}finally{y(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:v,children:l.jsx(c,{className:i("h-4 w-4",v&&"animate-spin")})}),!Z&&l.jsx("button",{onClick:()=>x("/"),className:"text-muted-foreground active:text-foreground",title:"桌面模式",children:l.jsx(d,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[p&&!h&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),h&&0===k.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{var s;const a="running"===(s=t,f.get(s.id)??s.status??"stopped"),n=j.has(t.id),r=l.jsxs("button",{onClick:()=>e(t.id),className:i("w-full text-left rounded-lg border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),l.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),l.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return l.jsx("div",{className:n?"card-active-glow rounded-lg":void 0,children:r},t.id)})})]})]})}function te({project:e,onBack:t,onOpenPanel:s,onContextUpdate:n}){const[r,o]=a.useState(""),c=a.useRef(null),d=a.useRef(null),[b,v]=a.useState([]),y=a.useCallback(e=>{v(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),N=a.useRef(null),w=a.useCallback(e=>{var t;"stopped"===e&&(null==(t=N.current)||t.call(N,"stopped"))},[]),[k,C]=a.useState([]),S=a.useRef(new Set),I=a.useCallback(e=>{S.current.has(e.toolUseId)||C(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),M=a.useCallback(e=>{S.current.add(e.toolUseId),C(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),z=a.useCallback(e=>{S.current.add(e),C(t=>t.filter(t=>t.toolUseId!==e))},[]),{sendInput:P,connected:U}=x({projectId:e.id,enabled:!0,onChatMessage:y,onStatusChange:w,onContextUpdate:n,onApprovalRequest:I,onApprovalResolved:M});a.useEffect(()=>{if(!U)return;if("claude"!==e.cliTool)return;let t=!1;return u(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!S.current.has(e.toolUseId));C(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||S.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,U]);const{state:T,setState:D,messages:$,hasMoreHistory:R,loadMoreHistory:H,sendMessage:O,isWaking:q}=m({project:e,liveMessages:b,ws:{send:P,connected:U},historyLimit:20});N.current=D;const _=a.useRef(U);a.useEffect(()=>{!_.current&&U&&v([]),_.current=U},[U]);const B=(()=>{for(let e=$.length-1;e>=0;e--)if("assistant"===$[e].role)return e;return-1})(),[F,W]=a.useState([]),[V,Q]=a.useState([]),[X,Z]=a.useState(null);a.useEffect(()=>{h().then(W).catch(()=>{}),p(e.id).then(Q).catch(()=>{})},[e.id]);const ee=a.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await H(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[H]),te=a.useRef(0);a.useEffect(()=>{const e=c.current;if(!e)return;const t=$.length>te.current,s=0===te.current&&$.length>0;te.current=$.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[$,k.length]);const se=a.useCallback(()=>{const e=r.trim();e&&(o(""),d.current&&(d.current.style.height="auto"),O(e))},[r,O]),ae=f(se,"shift"),ne=a.useCallback(e=>{Z(null),O(e)},[O]),re="live"===T;return l.jsxs("div",{className:"flex flex-col h-full bg-background",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[l.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",re?"bg-green-500":q?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),l.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(Y,{className:"h-5 w-5"})})]}),l.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[R&&l.jsx("div",{className:"flex justify-center pb-1",children:l.jsxs("button",{onClick:()=>{ee()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[l.jsx(K,{className:"h-3 w-3"}),"加载更早消息"]})}),$.map((e,t)=>{const s="user"===e.role;return l.jsx("div",{className:i("flex",s?"justify-end":"justify-start"),children:l.jsx("div",{className:i("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:l.jsx(A,{content:e.content,blocks:e.blocks,isLatest:t===B})})},e.id)}),k.map(e=>l.jsx(E,{approval:e,onResolved:z},e.toolUseId)),0===$.length&&0===k.length&&"stopped"===T&&l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),q&&l.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),X&&l.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:l.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===X?F:V).map(e=>l.jsxs("button",{onClick:()=>ne(e.command),disabled:q,className:i("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",q&&"opacity-50 cursor-not-allowed"),children:[l.jsx("div",{className:"font-medium text-xs",children:e.label}),l.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===X?F:V).length&&l.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}),(F.length>0||V.length>0)&&l.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[l.jsxs("button",{onClick:()=>Z(e=>"global"===e?null:"global"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(L,{className:"h-3 w-3"}),"全局","global"===X&&l.jsx(G,{className:"h-3 w-3"})]}),l.jsxs("button",{onClick:()=>Z(e=>"project"===e?null:"project"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(J,{className:"h-3 w-3"}),"项目","project"===X&&l.jsx(G,{className:"h-3 w-3"})]})]}),l.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsx("textarea",{ref:d,value:r,onChange:e=>o(e.target.value),onKeyDown:ae,disabled:q,placeholder:q?"启动中...":"stopped"===T?"输入消息(自动启动)...":"输入消息...",rows:1,className:i("flex-1 resize-none rounded-lg border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",q&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),l.jsx("button",{onClick:se,disabled:q||!r.trim(),className:i("shrink-0 p-2 rounded-lg transition-colors",r.trim()?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:l.jsx(j,{className:"h-5 w-5"})})]})})]})}const se=C.lazy(()=>S(()=>import("./OfficePreview-C215GkvD.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),ae=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ne=new Set(["docx","xlsx","xls","pptx"]),re={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function le(e){return e.split("/").pop()??e}function oe({filePath:e,onBack:t}){const[s,n]=a.useState(null),[r,o]=a.useState(!0),[c,i]=a.useState(null),{resolved:d}=b(),x=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),u=ae.has(x),m=ne.has(x),h=re[x],p="dark"===d;a.useEffect(()=>{u||m?o(!1):(o(!0),i(null),v(e).then(n).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>o(!1)))},[e,u,m]);const f=k(e),j=a.useMemo(()=>{const e=y();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),C=a.useMemo(()=>u?`${j}&t=${Date.now()}`:"",[j,u]);return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:le(e)}),l.jsx("a",{href:j,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:l.jsx(N,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&l.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),u&&l.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:l.jsx("img",{src:C,alt:le(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&l.jsx(a.Suspense,{fallback:l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:l.jsx(se,{filePath:e,ext:x,zoom:100})}),s&&(s.binary||s.tooLarge)&&l.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[l.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${S=s.size,S<1024?`${S} B`:S<1048576?`${(S/1024).toFixed(1)} KB`:`${(S/1048576).toFixed(1)} MB`})`]}),l.jsxs("a",{href:j,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[l.jsx(N,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&l.jsxs(l.Fragment,{children:["md"===x&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:l.jsx(R,{remarkPlugins:[O,q],rehypePlugins:[H],children:s.content})}),"md"!==x&&h&&l.jsx(_,{language:h,style:p?B:F,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==x&&!h&&l.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var S}const ce=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ie=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),de=new Set(["json","yaml","yml","toml","csv","tsv"]);function xe({entry:e}){if("dir"===e.type)return l.jsx(z,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ce.has(t)?l.jsx(W,{className:"h-8 w-8 text-emerald-400"}):ie.has(t)?l.jsx(Q,{className:"h-8 w-8 text-orange-400"}):de.has(t)?l.jsx(X,{className:"h-8 w-8 text-yellow-400"}):"md"===t?l.jsx(V,{className:"h-8 w-8 text-sky-400"}):l.jsx(P,{className:"h-8 w-8 text-muted-foreground"})}function ue({rootPath:e,onClose:t}){const[s,n]=a.useState(e),[r,o]=a.useState([]),[c,i]=a.useState(!0),[d,x]=a.useState(null),u=a.useCallback(async e=>{i(!0);try{const t=[...(await I(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));o(t),n(e)}catch{o([])}finally{i(!1)}},[]);a.useEffect(()=>{u(e)},[e,u]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?l.jsx(oe,{filePath:d,onBack:()=>x(null)}):l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&l.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&u(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:l.jsx(g,{className:"h-4 w-4"})}),l.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&l.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>l.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?u(e.path):x(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-lg active:bg-accent transition-colors",children:[l.jsx(xe,{entry:e}),l.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function me(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function he(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function pe({projectName:e,cliTool:t,folderPath:s,contextData:n,onClose:r}){const[o,d]=a.useState(new Set(["context","usage","files"])),[x,u]=a.useState(null),[m,h]=a.useState(!1),p=e=>{d(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};a.useEffect(()=>{h(!0),U(t).then(u).catch(()=>u(null)).finally(()=>h(!1))},[t]);const f=n?Math.round(n.usedPercentage):null;return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[o.has("context")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&l.jsxs("span",{className:i("text-xs font-mono ml-auto",me(f)),children:[f,"%"]})]}),o.has("context")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&n?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full transition-all",he(f)),style:{width:`${Math.min(f,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-10 text-right",me(f)),children:[f,"%"]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:"窗口大小"}),l.jsx("span",{className:"text-right font-mono",children:n.contextWindowSize>=1e6?`${(n.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(n.contextWindowSize/1e3)}K`}),l.jsx("span",{children:"输入 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.inputTokens.toLocaleString()}),l.jsx("span",{children:"输出 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.outputTokens.toLocaleString()})]})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),l.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[o.has("usage")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"用量"}),l.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await S(async()=>{const{refreshUsage:e}=await import("./index-BBvmgEUM.js").then(e=>e.bB);return{refreshUsage:e}},__vite__mapDeps([1,2]));u(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:l.jsx(c,{className:i("h-3 w-3",m&&"animate-spin")})})]}),o.has("usage")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:x?l.jsxs("div",{className:"space-y-2",children:[x.planName&&l.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",l.jsx("span",{className:"font-medium text-foreground",children:x.planName})]}),l.jsx(fe,{label:"5h",bucket:x.fiveHour}),l.jsx(fe,{label:"7d",bucket:x.sevenDay}),x.sevenDaySonnet&&l.jsx(fe,{label:"7d Sonnet",bucket:x.sevenDaySonnet}),x.sevenDayOpus&&l.jsx(fe,{label:"7d Opus",bucket:x.sevenDayOpus}),!x.fiveHour&&!x.sevenDay&&l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),l.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[o.has("files")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),o.has("files")&&l.jsx("div",{className:"h-[60vh]",children:l.jsx(ue,{rootPath:s,onClose:()=>p("files")})})]})]})}function fe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),l.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full",he(s)),style:{width:`${Math.min(s,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-8 text-right",me(s)),children:[s,"%"]}),a&&l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function ge(){a.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=a.useState({screen:"list"}),[n,r]=a.useState(null),o=s(e=>e.projects),c=a.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=a.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=a.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),x="list"!==e.screen?o.find(t=>t.id===e.projectId):void 0;return l.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[l.jsxs(D,{mode:"wait",children:["list"===e.screen&&l.jsx($.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(ee,{onSelectProject:c})},"list"),"chat"===e.screen&&x&&l.jsx($.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(te,{project:x,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),l.jsx(D,{children:"panel"===e.screen&&x&&l.jsx($.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:l.jsx(pe,{projectName:x.name,cliTool:x.cliTool??"claude",folderPath:x.folderPath,contextData:n,onClose:d})},"panel")})]})}export{ge as MobilePage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-c0ovO67g.js","assets/index-BrqN6Jet.js","assets/index-vHzDarwZ.css","assets/jszip.min-BwsPvdp_.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as t,_ as s,g as r,f as a}from"./index-BrqN6Jet.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-c0ovO67g.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-BwsPvdp_.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-LBFGRSfF.js","assets/index-BBvmgEUM.js","assets/index-CjKxGpPA.css","assets/jszip.min-C4dvRM2c.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as s,g as r,f as a}from"./index-BBvmgEUM.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-LBFGRSfF.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-C4dvRM2c.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};