lantern-harness 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/builtin/session/lh-nav-groups.mjs +52 -17
  3. package/cli/server.mjs +2 -0
  4. package/dist/500.html +3 -3
  5. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.kD0Cbs0F.js → Base.astro_astro_type_script_index_0_lang.DSWudA4D.js} +1 -1
  6. package/dist/_astro/{ReqAnalysisBoard.Bd69wB2p.js → ReqAnalysisBoard.BIIUqGVh.js} +1 -1
  7. package/dist/_astro/{SettingsDialog.DbjLDMDJ.js → SettingsDialog.DILea5eO.js} +1 -1
  8. package/dist/_astro/{UiAutoBoard.Bo0dpRuf.js → UiAutoBoard.BNLRrunE.js} +1 -1
  9. package/dist/_astro/{update.BkHtINbZ.js → update.BSnBvaFF.js} +1 -1
  10. package/dist/case-exec/index.html +3 -3
  11. package/dist/cases/generate/index.html +3 -3
  12. package/dist/cases/library/index.html +3 -3
  13. package/dist/dashboard/index.html +3 -3
  14. package/dist/docs/changelog/index.html +12 -4
  15. package/dist/docs/install/index.html +3 -3
  16. package/dist/docs/manual/index.html +5 -5
  17. package/dist/knowledge/index.html +3 -3
  18. package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +3 -3
  19. package/dist/plugins/index.html +3 -3
  20. package/dist/pm/bugs/index.html +3 -3
  21. package/dist/pm/iterations/index.html +3 -3
  22. package/dist/pm/projects/detail/index.html +3 -3
  23. package/dist/pm/projects/index.html +3 -3
  24. package/dist/pm/requirements/index.html +3 -3
  25. package/dist/prompts/index.html +3 -3
  26. package/dist/reports/index.html +3 -3
  27. package/dist/requirement-analysis/index.html +4 -4
  28. package/dist/requirements/index.html +3 -3
  29. package/dist/tasks/index.html +3 -3
  30. package/dist/templates/index.html +3 -3
  31. package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  32. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  33. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  34. package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  35. package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  36. package/dist/test-automation/index.html +4 -4
  37. package/dist/test-stats/index.html +3 -3
  38. package/dist/todos/index.html +3 -3
  39. package/dist/workbench/index.html +3 -3
  40. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +2 -2
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # 版本日志
2
2
 
3
+ ## [0.1.13] - 2026-10-21
4
+
5
+ 修 0.1.12 的两个问题:npm 安装版的一体服务漏注册了「需求分析」中间件,页面一直提示未就绪;分组与内容根同名时侧栏菜单会带上「(分组)」后缀。顺带把「未挂载提示词」从强制弹窗改成内容区提示。
6
+
7
+ ### 修复
8
+
9
+ - **npm / 本地一体服务下「需求分析」不可用**:`cli/server.mjs` 自己维护了一份插件清单,0.1.12 加需求分析时只注册到了 `astro.config.mjs` 的 Vite 插件里,`lantern web` 启动的服务没有 `/__tb_reqanalysis`,页面因此一直停在「需求分析需要本地服务,当前未就绪」。现在两条入口都会注册;提示文案也改成可操作的(升级后重启服务),不再暗示只有 `npm run dev` 能用
10
+ - **分组菜单名带上「(分组)」后缀**:分组与内容根同名(例如分组也叫「用例管理」「需求管理」)时,文件夹必须避让成 `用例管理 (分组)`,而侧栏此前直接拿文件夹名当菜单名。现在 `.group.json` 里额外记 `name`(用户取的名字),界面与文件夹名解耦;老分组没有该字段,扫描时会把 ` (分组)` / ` (2)` 后缀还原掉,不用重新建组
11
+ - 自动化测试「未挂载提示词」不再自动弹窗:进页面 / 切项目时只把顶栏提示词框标黄,内容区按当前 Tab 给一句对应说明(运行要跑 / 生成要出码 / 历史需重跑)+ 「挂载提示词」按钮,点按钮才打开弹窗;取消后保持未挂载,不会再次弹出
12
+
3
13
  ## [0.1.12] - 2026-10-21
4
14
 
5
15
  新增「需求分析」插件:把需求文档拆成按 INVEST 写法的用户故事并做体检,拆好的故事可以直接带进工作台的用例生成;顺带把生成用例抽屉重排成两列、下拉框改成「只读值 + 菜单内搜索」。
@@ -136,10 +136,13 @@ function readManifest(dir) {
136
136
  const raw = readJson(fp, null);
137
137
  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
138
138
  const id = typeof raw.id === 'string' ? raw.id.trim() : '';
139
+ // 展示名与文件夹名分开存:分组叫「用例管理」时文件夹必须避让同名内容根(改叫
140
+ // 「用例管理 (分组)」),但侧栏仍应显示用户取的名字
141
+ const name = typeof raw.name === 'string' ? raw.name.trim() : '';
139
142
  const items = Array.isArray(raw.items)
140
143
  ? raw.items.filter((x) => typeof x === 'string' && x.trim())
141
144
  : [];
142
- return { id, items };
145
+ return { id, name, items };
143
146
  }
144
147
 
145
148
  function onlyManifest(dir) {
@@ -222,40 +225,47 @@ export function scanNavGroups(spaceDir) {
222
225
  };
223
226
 
224
227
  const top = [];
225
- for (const name of safeReaddir(root)) {
226
- if (name.startsWith('.') || SKIP_DIR_NAMES.has(name)) continue;
227
- const abs = path.join(root, name);
228
+ for (const dirName of safeReaddir(root)) {
229
+ if (dirName.startsWith('.') || SKIP_DIR_NAMES.has(dirName)) continue;
230
+ const abs = path.join(root, dirName);
228
231
  if (!isDir(abs)) continue;
229
232
  const manifest = readManifest(abs);
230
233
  if (!manifest) continue;
231
234
  const g = {
232
- id: takeId(manifest.id, `dir:${name}`),
233
- name,
235
+ id: takeId(manifest.id, `dir:${dirName}`),
236
+ // 展示名优先用清单里记的;老数据没有就从文件夹名还原(去掉为避让内容根加的「 (分组)」)
237
+ name: manifest.name || labelFromDir(dirName),
234
238
  items: takeItems([...manifest.items, ...nestedContentItems(abs)]),
239
+ /** 磁盘上的文件夹名:扫描时定位子分组用,不对外展示 */
240
+ dirName,
235
241
  };
236
242
  top.push(g);
237
243
  groups.push(g);
238
244
  }
239
245
 
240
246
  for (const parent of top) {
241
- const parentAbs = path.join(root, parent.name);
242
- for (const name of safeReaddir(parentAbs)) {
243
- if (name.startsWith('.') || SKIP_DIR_NAMES.has(name)) continue;
244
- const abs = path.join(parentAbs, name);
247
+ const parentAbs = path.join(root, parent.dirName);
248
+ for (const dirName of safeReaddir(parentAbs)) {
249
+ if (dirName.startsWith('.') || SKIP_DIR_NAMES.has(dirName)) continue;
250
+ const abs = path.join(parentAbs, dirName);
245
251
  if (!isDir(abs)) continue;
246
252
  const manifest = readManifest(abs);
247
253
  if (!manifest) continue;
248
254
  groups.push({
249
- id: takeId(manifest.id, `dir:${parent.name}/${name}`),
250
- name,
255
+ id: takeId(manifest.id, `dir:${parent.dirName}/${dirName}`),
256
+ name: manifest.name || labelFromDir(dirName),
251
257
  items: takeItems([...manifest.items, ...nestedContentItems(abs)]),
252
258
  parentId: parent.id,
259
+ dirName,
253
260
  });
254
261
  }
255
262
  }
256
263
 
257
264
  const childOf = new Set(groups.map((g) => g.parentId).filter(Boolean));
258
- const kept = groups.filter((g) => g.items.length > 0 || childOf.has(g.id));
265
+ // dirName 只在扫描过程中定位子分组用,对外只给 id / name / items / parentId
266
+ const kept = groups
267
+ .filter((g) => g.items.length > 0 || childOf.has(g.id))
268
+ .map(({ dirName: _dirName, ...g }) => g);
259
269
  // 只有真正能还原出分组时才算「磁盘已有分组」;否则按尚未文件夹化处理,避免清空配置
260
270
  return { groups: kept, found: kept.length > 0 };
261
271
  }
@@ -414,19 +424,38 @@ export function markNavRootsDetected(spaceDir, rootIds) {
414
424
  return ids;
415
425
  }
416
426
 
417
- /** 文件夹名清洗:去掉路径分隔符与首尾点,避开内容根 / 保留目录名 */
418
- function safeName(raw) {
419
- let name = String(raw ?? '')
427
+ /** 用户取的名字:只清掉路径分隔符与首尾点 */
428
+ function cleanLabel(raw) {
429
+ return String(raw ?? '')
420
430
  .replace(/[\\/:*?"<>|]/g, '-')
421
431
  .replace(/^\.+/, '')
422
432
  .trim();
433
+ }
434
+
435
+ /** 文件夹名清洗:在用户名字基础上避开内容根 / 保留目录名 */
436
+ function safeName(raw) {
437
+ const name = cleanLabel(raw);
423
438
  if (!name) return '';
424
439
  if (SKIP_DIR_NAMES.has(name) || name === GROUP_MANIFEST_FILE) {
425
- name = `${name} (分组)`;
440
+ return `${name} (分组)`;
426
441
  }
427
442
  return name;
428
443
  }
429
444
 
445
+ /**
446
+ * 文件夹名 → 侧栏展示名(兼容没有在清单里存 name 的旧分组)。
447
+ * 旧数据里为了让开同名内容根,文件夹被改成了「用例管理 (分组)」,甚至再撞车时
448
+ * 「用例管理 (分组) (2)」;这些都应显示回用户取的名字。
449
+ */
450
+ function labelFromDir(name) {
451
+ let base = name;
452
+ const dup = /^(.*) \(\d+\)$/.exec(base);
453
+ if (dup) base = dup[1];
454
+ const reserved = /^(.*) \(分组\)$/.exec(base);
455
+ if (reserved && SKIP_DIR_NAMES.has(reserved[1])) return reserved[1];
456
+ return name;
457
+ }
458
+
430
459
  /** 在父目录里占一个不冲突的文件夹名;重名时依次加 (2)、(3) */
431
460
  function claimName(parentAbs, desired) {
432
461
  let name = desired;
@@ -591,10 +620,13 @@ export function syncNavGroups(spaceDir, groups) {
591
620
  for (const raw of Array.isArray(groups) ? groups : []) {
592
621
  if (!raw || typeof raw !== 'object') continue;
593
622
  const id = typeof raw.id === 'string' ? raw.id.trim() : '';
623
+ // label = 用户取的名字(清单里存这个);name = 文件夹名(与同名内容根避让)
624
+ const label = cleanLabel(raw.name);
594
625
  const name = safeName(raw.name);
595
626
  if (!id || !name || byId.has(id)) continue;
596
627
  const g = {
597
628
  id,
629
+ label,
598
630
  name,
599
631
  items: Array.isArray(raw.items) ? raw.items : [],
600
632
  parentId: typeof raw.parentId === 'string' ? raw.parentId.trim() : '',
@@ -680,6 +712,9 @@ export function syncNavGroups(spaceDir, groups) {
680
712
  id: g.id,
681
713
  items: [...new Set(g.items.filter((x) => typeof x === 'string'))],
682
714
  };
715
+ // 文件夹名被改过(叫「用例管理」这类与内容根同名的分组会存成「用例管理 (分组)」)时
716
+ // 把用户取的名字一并记下,侧栏才不会跟着显示改名后的文件夹名
717
+ if (g.label && g.label !== rel.split('/').pop()) manifest.name = g.label;
683
718
  const fp = path.join(root, rel, GROUP_MANIFEST_FILE);
684
719
  const body = `${JSON.stringify(manifest, null, 2)}\n`;
685
720
  try {
package/cli/server.mjs CHANGED
@@ -22,6 +22,7 @@ import { lhPmPlugin } from '../lh-plugins/lh-pm.mjs';
22
22
  import { lhReportsPlugin } from '../lh-plugins/lh-reports.mjs';
23
23
  import { lhStatsPlugin } from '../lh-plugins/lh-stats.mjs';
24
24
  import { lhUiautoPlugin } from '../lh-plugins/lh-uiauto.mjs';
25
+ import { lhReqAnalysisPlugin } from '../lh-plugins/lh-req-analysis.mjs';
25
26
  import { lhUpdatePlugin } from '../lh-plugins/lh-update.mjs';
26
27
  import { lhWebPlugin } from '../builtin/session/lh-web.mjs';
27
28
  import { tbSessionRunsPlugin } from '../builtin/session/session-runs.mjs';
@@ -61,6 +62,7 @@ function attachPlugins(app, dataRoot) {
61
62
  lhReportsPlugin(),
62
63
  lhStatsPlugin(),
63
64
  lhUiautoPlugin(),
65
+ lhReqAnalysisPlugin(),
64
66
  lhUpdatePlugin(),
65
67
  lhNavGroupsPlugin(),
66
68
  lhConfigPlugin(),
package/dist/500.html CHANGED
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if ('scrollRestoration' in history) history.scrollRestoration = 'manual';
5
5
  } catch (e) {}
6
- </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.kD0Cbs0F.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
6
+ </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.DSWudA4D.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
7
7
  (function () {
8
8
  try {
9
9
  // 配置按空间分键(`tw.app.config.v1::<spaceId>`),主题必须从同一个键读,
@@ -135,7 +135,7 @@
135
135
  animation-duration: 180ms;
136
136
  animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
137
137
  animation-fill-mode: both;
138
- animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.12">v0.1.12<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.BeCumAuj.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.CVdolwYy.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
138
+ animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.13">v0.1.13<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.BeCumAuj.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.CVdolwYy.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
139
139
  const cacheKey = "tw.hydrate.nav";
140
140
  const fixActive = true;
141
141
  const capture = false;
@@ -365,7 +365,7 @@ const syncNavGroups = true;
365
365
  // 缓存坏了就当没有
366
366
  }
367
367
  })();
368
- })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.DbjLDMDJ.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
368
+ })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.DILea5eO.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
369
369
  (function () {
370
370
  try {
371
371
  var raw = localStorage.getItem('tw.app.model.v1');
@@ -1 +1 @@
1
- import{i as e}from"./app-config.Cq_F8I0l.js";import{i as t,o as n}from"./plugins.CKkgnq4r.js";import{t as r}from"./settings.HM3DiNh0.js";import{n as i,r as a,t as o}from"./update.BkHtINbZ.js";var ee=100,te=420,s=14,ne=150,c=6,re=3200,l=null,u=null,d=null,f=null,p=null,m=!1,h=0,g=0,_=0,v=0,y=!1,b=!1,x=null,S=!1;function C(e){if(!e.isConnected||e.closest(`[data-closed]`)||e.checkVisibility&&!e.checkVisibility())return!0;let t=e.getBoundingClientRect();return t.width===0&&t.height===0}function w(e){let t=e.getBoundingClientRect();return t.bottom<=0||t.top>=window.innerHeight||t.right<=0||t.left>=window.innerWidth}function ie(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function T(){v&&=(cancelAnimationFrame(v),0)}function ae(){T();let e=()=>{v=0;let t=f;t&&(C(t)||w(t)||b&&x&&!ie(t.getBoundingClientRect(),x.x,x.y)||!b&&!t.contains(document.activeElement)?M():v=requestAnimationFrame(e))};v=requestAnimationFrame(e)}function oe(){l&&l.isConnected||(l=document.createElement(`div`),l.setAttribute(`role`,`tooltip`),l.className=`tw-tooltip tw-tooltip-anim pointer-events-none fixed rounded-md px-2 py-1 text-[12px] leading-5 break-all text-stone-700 shadow-lg`,l.style.zIndex=String(ee),l.dataset.closed=``,u=document.createElement(`span`),u.setAttribute(`aria-hidden`,`true`),u.className=`tw-tooltip-arrow absolute h-2 w-2`,u.style.transform=`translateX(-50%) rotate(45deg)`,d=document.createTextNode(``),l.append(u,d),document.body.appendChild(l))}function E(){if(!f)return;let e=f.getBoundingClientRect(),t=Math.min(Math.max(e.width,160),te),n=e.bottom+72>window.innerHeight-8,r=n?e.top-c:e.bottom+c,i=Math.max(8,Math.min(e.left,Math.max(8,window.innerWidth-t-8)));p={top:r,left:i,maxWidth:t,openUp:n,arrowLeft:Math.max(s,Math.min(e.left+e.width/2-i,t-s))}}function D(){l&&u&&p&&(l.style.top=`${p.top}px`,l.style.left=`${p.left}px`,l.style.maxWidth=`${p.maxWidth}px`,l.classList.toggle(`is-up`,p.openUp),l.classList.toggle(`is-down`,!p.openUp),u.classList.toggle(`is-up`,p.openUp),u.classList.toggle(`is-down`,!p.openUp),u.style.left=`${p.arrowLeft}px`,u.style.top=p.openUp?``:`-5px`,u.style.bottom=p.openUp?`-5px`:``)}function se(e){let t=e.innerText||``;return e.querySelectorAll(`[class*="sr-only"]`).forEach(e=>{let n=e.innerText;n&&(t=t.replace(n,``))}),t.replace(/\s+/g,` `).trim()}function O(e){return e.scrollWidth>e.clientWidth+1}function k(e){return e.dataset.hintAlways!==void 0||e.dataset.hintFit===void 0&&!se(e)||O(e)}function A(e){return!!e.dataset.hint&&k(e)}function j(e,t){let n=e.dataset.hint??``;n&&k(e)&&(f=e,b=t,g&&=(window.clearTimeout(g),0),oe(),l&&d&&(d.data=n,E(),D(),l.style.display=``,cancelAnimationFrame(h),h=requestAnimationFrame(()=>{h=requestAnimationFrame(()=>{l&&(m=!0,delete l.dataset.closed)})}),ae(),_&&window.clearTimeout(_),_=window.setTimeout(()=>{_=0,f===e&&M()},re)))}function M(){T(),f=null,b=!1,_&&=(window.clearTimeout(_),0),l&&(m=!1,l.dataset.closed=``,g&&window.clearTimeout(g),g=window.setTimeout(()=>{g=0,!m&&l&&(l.style.display=`none`)},ne))}function N(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-hint]`);return t instanceof HTMLElement?t:null}function ce(e){S=!0;let t=N(e.target);t!==f&&(!t||!A(t)?f&&M():j(t,!0))}function le(e){let t=N(e.target);if(!t||t!==f)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||M()}function ue(e){if(S)return;let t=N(e.target);t!==f&&(!t||!A(t)?f&&M():j(t,!1))}function de(e){let t=N(e.target);if(!t||t!==f)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||M()}function fe(){f&&M()}function P(){f&&(C(f)||w(f)?M():(E(),D()))}function pe(e){x={x:e.clientX,y:e.clientY},S=!0}function F(){S=!0,f&&M()}function I(e){S=!1,e.key===`Escape`&&f&&M()}function L(){typeof document>`u`||y||(y=!0,document.addEventListener(`mouseover`,ce,!0),document.addEventListener(`mouseout`,le,!0),document.addEventListener(`pointermove`,pe,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,F,!0),document.addEventListener(`focusin`,ue,!0),document.addEventListener(`focusout`,de,!0),document.addEventListener(`click`,fe,!0),document.addEventListener(`keydown`,I,!0),window.addEventListener(`scroll`,P,!0),window.addEventListener(`resize`,P),window.addEventListener(`blur`,()=>{f&&M()}),document.addEventListener(`visibilitychange`,()=>{document.hidden&&f&&M()}),document.documentElement.addEventListener(`mouseleave`,()=>{f&&M()}),document.addEventListener(`astro:after-swap`,()=>{T(),_&&=(window.clearTimeout(_),0),f=null,l?.isConnected&&l.remove(),l=null,u=null,d=null}))}var R=[`dashboard`,`tasks`,`todos`,`projects`,`iterations`,`pmRequirements`,`bugs`,`reports`,`testStats`,`caseExec`,`cases`,`prompts`,`knowledgeLib`,`requirements`,`templates`];function z(e){return`pluginOff${e.charAt(0).toUpperCase()}${e.slice(1)}`}function B(){let e=document.documentElement;for(let n of R){let r=z(n);t(n)?delete e.dataset[r]:e.dataset[r]=`1`}}function me(){B(),n(()=>B()),e().then(()=>B()),document.addEventListener(`astro:page-load`,B)}var he=`tw-update-dot`,ge=3e5,V=`tw.update.badge.checked-at.v1`,_e=15e3,ve=4,H=0,U=null,W=!1,G=`tw.update.silent.lock.v1`,K=`tw.update.stale.reload.v1`,ye=18e5,be=2500,xe=36e4,q=!1,J=!1;function Se(e){return new Promise(t=>window.setTimeout(t,e))}function Ce(){try{let e=JSON.parse(localStorage.getItem(G)||`null`);return!e||typeof e.version!=`string`?null:{version:e.version,at:Number(e.at)||0}}catch{return null}}function Y(e){try{localStorage.setItem(G,JSON.stringify({version:e,at:Date.now()}))}catch{}}function we(){try{localStorage.removeItem(G)}catch{}}function X(e){let t=e.status?.phase;return t===`installing`||t===`restarting`}async function Te(e){let t=Date.now()+xe;for(;Date.now()<t;){await Se(be);let t=await o(!0);if(t){if(t.status?.phase===`failed`)return!1;if(e&&t.current&&t.current===e&&!t.hasUpdate||t.status?.phase===`done`){if(t.hasUpdate&&t.status?.phase===`done`)continue;return!0}}}return!1}function Ee(e){if(e.mode!==`dev`&&!(q||X(e))&&e.current&&e.current!==a){try{let e=Number(localStorage.getItem(K))||0;if(Date.now()-e<6e4)return;localStorage.setItem(K,String(Date.now()))}catch{}window.location.reload()}}async function De(e,t){if(J||q)return;if(e.mode===`dev`){J=!0;return}let n=X(e);if(!n){if(!e.hasUpdate||!e.latest)return;let t=Ce();if(t?.version===e.latest&&Date.now()-t.at<ye||typeof navigator<`u`&&navigator.onLine===!1)return;Y(e.latest)}q=!0,t.hidden=!1,t.closest(`.tw-nav-brand-ver`)?.classList.add(`has-update`),t.setAttribute(`aria-label`,`正在后台更新到 v${e.latest||``}`);try{if(!n&&!(await i(e.latest)).ok){J=!0;return}if(await Te(e.latest)){we(),window.location.reload();return}Y(e.latest||e.current)}finally{q=!1}}function Z(){try{return Number(localStorage.getItem(V))||0}catch{return 0}}function Oe(){try{localStorage.setItem(V,String(Date.now()))}catch{}}function ke(e,t,n){e.hidden=!n,e.closest(`.tw-nav-brand-ver`)?.classList.toggle(`has-update`,n),n&&e.setAttribute(`aria-label`,t?`有新版本可用 v${t}`:`有新版本可更新`)}function Ae(e,t){H>=ve||(H+=1,U!==null&&window.clearTimeout(U),U=window.setTimeout(()=>{U=null,Q(e,t)},_e))}async function Q(e,t){if(!W){W=!0;try{let n=await o(t);if(!n){Ae(e,t);return}H=0,Oe();let r=!!n.current&&n.current!==a;ke(e,n.latest,!!n.hasUpdate||r),De(n,e),n.hasUpdate||Ee(n)}finally{W=!1}}}function $(){let e=document.getElementById(he);if(!e)return;e.dataset.bound!==`1`&&(e.dataset.bound=`1`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(r,{detail:{tab:`general`}}))}));let t=Date.now()-Z()>ge;H=0,Q(e,t)}function je(){document.addEventListener(`astro:page-load`,$),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&$()}),document.readyState!==`loading`&&$()}L(),me(),je();
1
+ import{i as e}from"./app-config.Cq_F8I0l.js";import{i as t,o as n}from"./plugins.CKkgnq4r.js";import{t as r}from"./settings.HM3DiNh0.js";import{n as i,r as a,t as o}from"./update.BSnBvaFF.js";var ee=100,te=420,s=14,ne=150,c=6,re=3200,l=null,u=null,d=null,f=null,p=null,m=!1,h=0,g=0,_=0,v=0,y=!1,b=!1,x=null,S=!1;function C(e){if(!e.isConnected||e.closest(`[data-closed]`)||e.checkVisibility&&!e.checkVisibility())return!0;let t=e.getBoundingClientRect();return t.width===0&&t.height===0}function w(e){let t=e.getBoundingClientRect();return t.bottom<=0||t.top>=window.innerHeight||t.right<=0||t.left>=window.innerWidth}function ie(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function T(){v&&=(cancelAnimationFrame(v),0)}function ae(){T();let e=()=>{v=0;let t=f;t&&(C(t)||w(t)||b&&x&&!ie(t.getBoundingClientRect(),x.x,x.y)||!b&&!t.contains(document.activeElement)?M():v=requestAnimationFrame(e))};v=requestAnimationFrame(e)}function oe(){l&&l.isConnected||(l=document.createElement(`div`),l.setAttribute(`role`,`tooltip`),l.className=`tw-tooltip tw-tooltip-anim pointer-events-none fixed rounded-md px-2 py-1 text-[12px] leading-5 break-all text-stone-700 shadow-lg`,l.style.zIndex=String(ee),l.dataset.closed=``,u=document.createElement(`span`),u.setAttribute(`aria-hidden`,`true`),u.className=`tw-tooltip-arrow absolute h-2 w-2`,u.style.transform=`translateX(-50%) rotate(45deg)`,d=document.createTextNode(``),l.append(u,d),document.body.appendChild(l))}function E(){if(!f)return;let e=f.getBoundingClientRect(),t=Math.min(Math.max(e.width,160),te),n=e.bottom+72>window.innerHeight-8,r=n?e.top-c:e.bottom+c,i=Math.max(8,Math.min(e.left,Math.max(8,window.innerWidth-t-8)));p={top:r,left:i,maxWidth:t,openUp:n,arrowLeft:Math.max(s,Math.min(e.left+e.width/2-i,t-s))}}function D(){l&&u&&p&&(l.style.top=`${p.top}px`,l.style.left=`${p.left}px`,l.style.maxWidth=`${p.maxWidth}px`,l.classList.toggle(`is-up`,p.openUp),l.classList.toggle(`is-down`,!p.openUp),u.classList.toggle(`is-up`,p.openUp),u.classList.toggle(`is-down`,!p.openUp),u.style.left=`${p.arrowLeft}px`,u.style.top=p.openUp?``:`-5px`,u.style.bottom=p.openUp?`-5px`:``)}function se(e){let t=e.innerText||``;return e.querySelectorAll(`[class*="sr-only"]`).forEach(e=>{let n=e.innerText;n&&(t=t.replace(n,``))}),t.replace(/\s+/g,` `).trim()}function O(e){return e.scrollWidth>e.clientWidth+1}function k(e){return e.dataset.hintAlways!==void 0||e.dataset.hintFit===void 0&&!se(e)||O(e)}function A(e){return!!e.dataset.hint&&k(e)}function j(e,t){let n=e.dataset.hint??``;n&&k(e)&&(f=e,b=t,g&&=(window.clearTimeout(g),0),oe(),l&&d&&(d.data=n,E(),D(),l.style.display=``,cancelAnimationFrame(h),h=requestAnimationFrame(()=>{h=requestAnimationFrame(()=>{l&&(m=!0,delete l.dataset.closed)})}),ae(),_&&window.clearTimeout(_),_=window.setTimeout(()=>{_=0,f===e&&M()},re)))}function M(){T(),f=null,b=!1,_&&=(window.clearTimeout(_),0),l&&(m=!1,l.dataset.closed=``,g&&window.clearTimeout(g),g=window.setTimeout(()=>{g=0,!m&&l&&(l.style.display=`none`)},ne))}function N(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-hint]`);return t instanceof HTMLElement?t:null}function ce(e){S=!0;let t=N(e.target);t!==f&&(!t||!A(t)?f&&M():j(t,!0))}function le(e){let t=N(e.target);if(!t||t!==f)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||M()}function ue(e){if(S)return;let t=N(e.target);t!==f&&(!t||!A(t)?f&&M():j(t,!1))}function de(e){let t=N(e.target);if(!t||t!==f)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||M()}function fe(){f&&M()}function P(){f&&(C(f)||w(f)?M():(E(),D()))}function pe(e){x={x:e.clientX,y:e.clientY},S=!0}function F(){S=!0,f&&M()}function I(e){S=!1,e.key===`Escape`&&f&&M()}function L(){typeof document>`u`||y||(y=!0,document.addEventListener(`mouseover`,ce,!0),document.addEventListener(`mouseout`,le,!0),document.addEventListener(`pointermove`,pe,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,F,!0),document.addEventListener(`focusin`,ue,!0),document.addEventListener(`focusout`,de,!0),document.addEventListener(`click`,fe,!0),document.addEventListener(`keydown`,I,!0),window.addEventListener(`scroll`,P,!0),window.addEventListener(`resize`,P),window.addEventListener(`blur`,()=>{f&&M()}),document.addEventListener(`visibilitychange`,()=>{document.hidden&&f&&M()}),document.documentElement.addEventListener(`mouseleave`,()=>{f&&M()}),document.addEventListener(`astro:after-swap`,()=>{T(),_&&=(window.clearTimeout(_),0),f=null,l?.isConnected&&l.remove(),l=null,u=null,d=null}))}var R=[`dashboard`,`tasks`,`todos`,`projects`,`iterations`,`pmRequirements`,`bugs`,`reports`,`testStats`,`caseExec`,`cases`,`prompts`,`knowledgeLib`,`requirements`,`templates`];function z(e){return`pluginOff${e.charAt(0).toUpperCase()}${e.slice(1)}`}function B(){let e=document.documentElement;for(let n of R){let r=z(n);t(n)?delete e.dataset[r]:e.dataset[r]=`1`}}function me(){B(),n(()=>B()),e().then(()=>B()),document.addEventListener(`astro:page-load`,B)}var he=`tw-update-dot`,ge=3e5,V=`tw.update.badge.checked-at.v1`,_e=15e3,ve=4,H=0,U=null,W=!1,G=`tw.update.silent.lock.v1`,K=`tw.update.stale.reload.v1`,ye=18e5,be=2500,xe=36e4,q=!1,J=!1;function Se(e){return new Promise(t=>window.setTimeout(t,e))}function Ce(){try{let e=JSON.parse(localStorage.getItem(G)||`null`);return!e||typeof e.version!=`string`?null:{version:e.version,at:Number(e.at)||0}}catch{return null}}function Y(e){try{localStorage.setItem(G,JSON.stringify({version:e,at:Date.now()}))}catch{}}function we(){try{localStorage.removeItem(G)}catch{}}function X(e){let t=e.status?.phase;return t===`installing`||t===`restarting`}async function Te(e){let t=Date.now()+xe;for(;Date.now()<t;){await Se(be);let t=await o(!0);if(t){if(t.status?.phase===`failed`)return!1;if(e&&t.current&&t.current===e&&!t.hasUpdate||t.status?.phase===`done`){if(t.hasUpdate&&t.status?.phase===`done`)continue;return!0}}}return!1}function Ee(e){if(e.mode!==`dev`&&!(q||X(e))&&e.current&&e.current!==a){try{let e=Number(localStorage.getItem(K))||0;if(Date.now()-e<6e4)return;localStorage.setItem(K,String(Date.now()))}catch{}window.location.reload()}}async function De(e,t){if(J||q)return;if(e.mode===`dev`){J=!0;return}let n=X(e);if(!n){if(!e.hasUpdate||!e.latest)return;let t=Ce();if(t?.version===e.latest&&Date.now()-t.at<ye||typeof navigator<`u`&&navigator.onLine===!1)return;Y(e.latest)}q=!0,t.hidden=!1,t.closest(`.tw-nav-brand-ver`)?.classList.add(`has-update`),t.setAttribute(`aria-label`,`正在后台更新到 v${e.latest||``}`);try{if(!n&&!(await i(e.latest)).ok){J=!0;return}if(await Te(e.latest)){we(),window.location.reload();return}Y(e.latest||e.current)}finally{q=!1}}function Z(){try{return Number(localStorage.getItem(V))||0}catch{return 0}}function Oe(){try{localStorage.setItem(V,String(Date.now()))}catch{}}function ke(e,t,n){e.hidden=!n,e.closest(`.tw-nav-brand-ver`)?.classList.toggle(`has-update`,n),n&&e.setAttribute(`aria-label`,t?`有新版本可用 v${t}`:`有新版本可更新`)}function Ae(e,t){H>=ve||(H+=1,U!==null&&window.clearTimeout(U),U=window.setTimeout(()=>{U=null,Q(e,t)},_e))}async function Q(e,t){if(!W){W=!0;try{let n=await o(t);if(!n){Ae(e,t);return}H=0,Oe();let r=!!n.current&&n.current!==a;ke(e,n.latest,!!n.hasUpdate||r),De(n,e),n.hasUpdate||Ee(n)}finally{W=!1}}}function $(){let e=document.getElementById(he);if(!e)return;e.dataset.bound!==`1`&&(e.dataset.bound=`1`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(r,{detail:{tab:`general`}}))}));let t=Date.now()-Z()>ge;H=0,Q(e,t)}function je(){document.addEventListener(`astro:page-load`,$),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&$()}),document.readyState!==`loading`&&$()}L(),me(),je();
@@ -22,4 +22,4 @@ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Cq_F8I
22
22
  `);for await(let e of d(a,[{role:`system`,content:`${i}\n\n${we}`},{role:`user`,content:u}],t.signal,{tools:ke.filter(e=>e.function.name===`req_save_check`),maxToolRounds:8,runTool:(e,t)=>Ae(e,t,s)}))e.type===`content`?F(t=>t+e.delta):e.type===`tool`&&e.status===`running`&&K(`调用 ${e.name}`,`tool`);o||(K(`模型没有提交体检结果,当前只保留规则结果`,`error`),h(`模型没有提交体检结果,只保留了规则检查`,`error`)),z(`check`)}catch(e){let n=e instanceof Error?e.message:String(e);t.signal.aborted?K(`已中断:规则体检结果已保留`,`info`):(L(n),K(`体检失败:${n}`,`error`))}finally{j(null),W.current=null}},[Q,Z,G,K,Y,D]),Ot=(0,w.useCallback)(async()=>{let e=U.current,t=Tt();if(!e||!t)return;let n=(e.check?.gaps??[]).filter(e=>e.selected);if(!n.length){h(`先在缺口清单里勾选要补写的条目`,`info`);return}let r=Y?.fix.trim()??``;if(!r){h(`「需求分析提示词.md」缺少「## 补写」段落`,`error`);return}L(``),F(``),N([]),j(`fix`);let i=new AbortController;W.current=i;try{K(`按 ${n.length} 个勾选缺口补写`,`info`);let a=new Map(e.stories.map(e=>[e.id,e.title])),o=[`## 当前故事集(${e.stories.length} 条,没被点名的必须原样保留)`,"```json",JSON.stringify(e.stories,null,2),"```",``,`## 勾选待补写的缺口`,n.map(e=>{let t=e.storyId?`${e.storyId} ${a.get(e.storyId)??``}`:`全局问题`;return[`- [${e.severity}] ${t}|${e.title}`,e.detail?` 原因:${e.detail}`:``,e.suggestion?` 建议:${e.suggestion}`:``].filter(Boolean).join(`
23
23
  `)}).join(`
24
24
  `)].join(`
25
- `),s=Q(e,90),c=!1,l=s.saveStories;s.saveStories=async e=>(c=!0,l(e));for await(let e of d(t,[{role:`system`,content:`${r}\n\n${we}`},{role:`user`,content:o}],i.signal,{tools:ke.filter(e=>e.function.name===`req_set_stories`),maxToolRounds:10,runTool:(e,t)=>Ae(e,t,s)}))e.type===`content`?F(t=>t+e.delta):e.type===`tool`&&e.status===`running`&&K(`调用 ${e.name}`,`tool`);if(!c){K(`模型没有提交补写结果,故事集保持不变`,`error`),h(`模型没有提交补写结果`,`error`);return}let u=U.current;if(u){let e=re(u),t=await g(u.id,{check:e,status:`decomposed`});G(t)}K(`补写完成,已按规则重算覆盖率;建议再跑一次体检`,`done`),z(`check`),h(`补写完成,建议再跑一次体检`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?K(`已中断:已经写入的改动保留`,`info`):(L(t),K(`补写失败:${t}`,`error`))}finally{j(null),W.current=null}},[Q,G,K,Y,Tt]),$=(0,w.useCallback)(async e=>{let t=U.current;if(t)try{await X({stories:e},t)}catch(e){h(`保存失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[X]),kt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n)return;let r=n.stories.map((n,r)=>r===e?{...t,id:n.id}:n);$(r)},[$]),At=(0,w.useCallback)(e=>{let t=U.current;t&&$(t.stories.filter((t,n)=>n!==e))},[$]),jt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n)return;let r=e+t;if(r<0||r>=n.stories.length)return;let i=[...n.stories],a=i[e],o=i[r];a&&o&&(i[e]=o,i[r]=a,$(i))},[$]),Mt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n?.check)return;let r={...n,check:{...n.check,gaps:n.check.gaps.map(n=>n.id===e?{...n,selected:t}:n)}};G(r),Ct()},[G,Ct]),Nt=(0,w.useCallback)(e=>{let t=U.current;if(!t?.check)return;let n={...t,check:{...t.check,gaps:t.check.gaps.map(t=>({...t,selected:e}))}};G(n),Ct()},[G,Ct]),Pt=(0,w.useCallback)(e=>{let t=U.current,n=e.trim();t&&n&&n!==t.title&&X({title:n},t).catch(()=>void 0)},[X]),Ft=(0,w.useCallback)(async()=>{let e=U.current;if(e)try{await he(e.id);let t=v.filter(t=>t.id!==e.id);y(t),q(t[0]??null),qe(`list`),h(`已删除分析记录`,`success`)}catch(e){h(`删除失败:${e instanceof Error?e.message:String(e)}`,`error`)}finally{it(!1)}},[v,q]),It=(0,w.useCallback)(()=>{let e=U.current;if(!e)return;let t=new Blob([ee(e)],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=ie(e),document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),h(`已导出 Markdown`,`success`)},[]),Lt=(0,w.useCallback)(()=>{W.current?.abort()},[]);if(!e.ready)return(0,O.jsx)(Ce,{label:`正在读取插件开关`});if(!e.on)return(0,O.jsx)(Se,{children:r(`reqAnalysis`)});if(t===null)return(0,O.jsx)(Ce,{label:`正在连接需求分析服务`});if(!t)return(0,O.jsx)(Se,{children:`需求分析需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});let Rt=b?.outline.filter(e=>bt.has(e.id)).length??0,zt=b?.check?.gaps??[],Bt=b?.progress,Vt=(0,O.jsx)(u,{options:ut,value:T,onChange:e=>{E(e),e&&wt(e)},triggerTitle:T||`选择来源需求文档…`,ariaLabel:`选择来源需求文档`,searchable:!0,searchPlaceholder:`搜索文件名或路径…`,flat:!0}),Ht=(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,O.jsxs)(`section`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-[240px] flex-1`,children:[(0,O.jsx)(`p`,{className:B,children:`新建分析`}),(0,O.jsx)(`div`,{className:`mt-1.5 max-w-[440px]`,children:Vt})]}),(0,O.jsxs)(`span`,{className:`pb-1 text-[11px] text-stone-400`,children:[`共 `,v.length,` 份分析`]})]}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`选一份需求文档就新建分析(同一份来源再选一次会回到已有记录),随后进「用户故事」拆解。支持 Word(.docx)/ Excel(.xlsx / .xls)/ Markdown / txt / csv,读取时抽成文本,不改原文件。`}),De?(0,O.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-700`,children:[`读不到需求文档库:`,De,(0,O.jsx)(`br`,{}),`请先启用「需求文档库」插件,或确认 `,ce,` 之外的内容目录没有被移动。`]}):null]}),I?(0,O.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,O.jsx)(`span`,{className:`break-all`,children:I}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,(0,O.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,O.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,O.jsxs)(`div`,{className:`inline-flex rounded-lg border border-stone-200 bg-stone-50 p-0.5`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>vt(`doc`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${Je===`doc`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按需求说明书`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>vt(`story`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${Je===`story`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按用户故事`})]}),Je===`story`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`relative block`,children:[(0,O.jsx)(S,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,O.jsx)(`input`,{value:V,onChange:e=>Xe(e.target.value),placeholder:`搜索编号 / 标题 / 角色…`,className:`h-8 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-xs text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,O.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[pt,` 个故事`,H?` · 已选 ${H.ids.length}`:``]}),(0,O.jsx)(`button`,{type:`button`,disabled:!H,onClick:()=>{if(!H)return;let e=new URLSearchParams({plugin:`caseGen`,reqDoc:H.docId,stories:H.ids.join(`,`)});window.location.href=`/workbench/?${e.toString()}`},className:`${ze} ml-auto h-8 text-xs`,children:`用选中故事生成用例`})]}):(0,O.jsxs)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:[v.length,` 份分析 · `,pt,` 个故事`]})]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:Je===`doc`?v.length?(0,O.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:v.map(e=>{let t=pe[e.status];return(0,O.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3 transition-colors hover:bg-stone-50`,children:[(0,O.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center text-left`,onClick:()=>J(e,`stories`),children:(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:e.title}),(0,O.jsx)(x,{tone:t.tone,children:t.label})]}),(0,O.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-stone-400`,children:[(0,O.jsx)(`span`,{className:`truncate`,children:e.sourcePath||`(未指定来源)`}),(0,O.jsxs)(`span`,{children:[`用户故事 `,e.stories.length]}),(0,O.jsxs)(`span`,{children:[`需求条目 `,e.outline.length]}),(0,O.jsx)(`span`,{children:We(e.updatedAt)})]})]})}),(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-700 transition-colors hover:border-[#3370ff] hover:text-[#3370ff]`,onClick:()=>J(e,`stories`),children:[`用户故事`,(0,O.jsx)(S,{name:`chevronRight`,size:13})]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-red-50 hover:text-red-600`,onClick:()=>{q(e),it(!0)},children:(0,O.jsx)(S,{name:`trash`,size:14})})]},e.id)})}):(0,O.jsx)(C,{icon:`file`,title:`还没有分析记录`,hint:`上面选一份需求文档,系统会新建一份分析并进入用户故事拆解。`}):mt.length?(0,O.jsx)(`div`,{className:`divide-y divide-stone-100`,children:mt.map(({doc:e,rows:t})=>{let n=Qe.includes(e.id),r=t.map(e=>e.story.id),i=H?.docId===e.id&&r.length>0&&r.every(e=>ht.has(e));return(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/70 px-3 py-1.5`,children:[(0,O.jsx)(`input`,{type:`checkbox`,"aria-label":`选中 ${e.title} 的全部故事`,checked:i,onChange:()=>_t(e.id,r)}),(0,O.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>$e(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,O.jsx)(S,{name:n?`chevronRight`:`chevronDown`,size:13,className:`shrink-0 text-stone-400`}),(0,O.jsx)(`span`,{className:`truncate text-xs font-medium text-stone-700`,children:e.title}),(0,O.jsxs)(`span`,{className:`shrink-0 text-[11px] text-stone-400`,children:[t.length,` 个故事 · `,We(e.updatedAt)]})]}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] text-[#3370ff] hover:underline`,onClick:()=>J(e,`stories`),children:`打开拆解`})]}),n?null:(0,O.jsx)(`ul`,{className:`divide-y divide-stone-50`,children:t.map(({story:t})=>(0,O.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2 transition-colors hover:bg-stone-50`,children:[(0,O.jsx)(`input`,{type:`checkbox`,className:`mt-1`,"aria-label":`选中 ${t.id}`,checked:ht.has(t.id)&&H?.docId===e.id,onChange:()=>gt(e.id,t.id)}),(0,O.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:()=>dt(e,t.id),children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-stone-400`,children:t.id}),(0,O.jsx)(`span`,{className:`truncate text-sm text-stone-800`,children:t.title})]}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-[11px] text-stone-400`,children:[t.role?(0,O.jsxs)(`span`,{children:[`角色:`,t.role]}):null,(0,O.jsxs)(`span`,{children:[`优先级 `,t.priority]}),(0,O.jsxs)(`span`,{children:[`验收 `,t.acceptance.length]}),(0,O.jsxs)(`span`,{children:[`异常 `,t.exceptions.length]}),(0,O.jsxs)(`span`,{children:[`维度 `,t.dimensions.length]})]})]})]},`${e.id}-${t.id}`))})]},e.id)})}):(0,O.jsx)(C,{icon:`file`,title:V?`没有匹配的用户故事`:`还没有用户故事`,hint:V?`换个编号、标题或角色再试。`:`先按「需求说明书」选中一份文档拆解,故事会自动出现在这里。`})})]})]});return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[Ke===`list`?Ht:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:border-stone-300 hover:text-stone-800`,onClick:()=>{E(``),L(``),qe(`list`)},children:[(0,O.jsx)(S,{name:`arrowLeft`,size:14}),`返回列表`]}),(0,O.jsx)(`span`,{className:`min-w-0 truncate text-xs text-stone-400`,children:b?.title?`用户故事 · ${b.title}`:`用户故事`})]}),(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,O.jsxs)(`aside`,{className:`flex w-[272px] shrink-0 flex-col gap-3 overflow-y-auto pb-1`,children:[(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`来源需求文档`}),(0,O.jsx)(`div`,{className:`mt-2`,children:Vt}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`支持 Word(.docx)/ Excel(.xlsx / .xls)/ Markdown / txt / csv,读取时抽成文本,不改原文件。`}),b?(0,O.jsxs)(`div`,{className:`mt-2 space-y-1 text-[11px] text-stone-400`,children:[(0,O.jsxs)(`p`,{className:`break-all`,children:[`当前:`,b.sourcePath||`(未指定)`]}),yt?(0,O.jsx)(`p`,{className:`rounded bg-amber-50 px-2 py-1 text-amber-700`,children:`源文档已更新,建议重新拆解`}):null]}):null]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`p`,{className:B,children:`分析记录`}),(0,O.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:v.length})]}),v.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:v.map(e=>{let t=e.id===ue,n=pe[e.status];return(0,O.jsx)(`li`,{children:(0,O.jsx)(`button`,{type:`button`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${t?`bg-[#eef3ff]`:`hover:bg-stone-50`}`,onClick:()=>q(e),children:(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate text-xs font-medium text-stone-700`,children:e.title}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-[11px] text-stone-400`,children:[(0,O.jsx)(x,{tone:n.tone,children:n.label}),(0,O.jsxs)(`span`,{children:[e.stories.length,` 个故事`]})]})]})})},e.id)})}):(0,O.jsx)(`p`,{className:`mt-2 text-xs text-stone-400`,children:`还没有分析记录,选一份来源文档开始。`})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`提示词`}),(0,O.jsx)(`p`,{className:`mt-1 break-all text-xs text-stone-500`,children:te}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] ${xt?`text-emerald-600`:`text-amber-700`}`,children:xt?`拆解 / 体检 / 补写三段已就绪`:`没有读到「## 拆解」段落:去「提示词管理」补上,或关闭再打开插件重新生成`}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] ${Z?`text-stone-400`:`text-amber-700`}`,children:Z?`模型:${D?.model}`:`还没配置模型`})]}),(0,O.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`动作`}),(0,O.jsx)(`button`,{type:`button`,className:`${ze} w-full`,disabled:!b||!!A||!b.sourcePath,onClick:()=>{b?.stories.length?ot(!0):Et()},children:A===`decompose`?`拆解中…`:b?.stories.length?`重新拆解`:`开始拆解`}),(0,O.jsx)(`button`,{type:`button`,className:`${Be} w-full`,disabled:!b||!!A||!b.stories.length,onClick:()=>void Dt(),children:A===`audit`?`体检中…`:`体检`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:`${Be} flex-1`,disabled:!b,onClick:It,children:`导出 Markdown`}),A?(0,O.jsx)(`button`,{type:`button`,className:`${Be} flex-1`,onClick:Lt,children:`中断`}):null]}),b?(0,O.jsx)(`button`,{type:`button`,className:`h-8 w-full rounded-md text-xs text-stone-400 transition-colors hover:bg-red-50 hover:text-red-500`,onClick:()=>it(!0),children:`删除这份分析`}):null]}),(0,O.jsxs)(`section`,{className:`min-h-[120px] rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`p`,{className:B,children:`活动日志`}),M.length?(0,O.jsx)(`button`,{type:`button`,className:`text-[11px] text-stone-400 hover:text-stone-600`,onClick:()=>N([]),children:`清空`}):null]}),(0,O.jsx)(`div`,{ref:ct,className:`mt-2 max-h-[240px] space-y-1 overflow-y-auto pr-1`,children:M.length?M.map(e=>(0,O.jsxs)(`p`,{className:`flex gap-1.5 text-[11px] leading-relaxed`,children:[(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.kind===`error`?`bg-red-500`:e.kind===`done`?`bg-emerald-500`:e.kind===`tool`?`bg-[#3370ff]`:`bg-stone-300`}`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:e.kind===`error`?`text-red-600`:`text-stone-500`,children:e.text})]},e.id)):(0,O.jsx)(`p`,{className:`text-[11px] text-stone-400`,children:`拆解 / 体检的过程会记在这里。`})})]})]}),(0,O.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[I?(0,O.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,O.jsx)(`span`,{className:`break-all`,children:I}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,b?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`header`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`input`,{className:`min-w-0 flex-1 rounded-md border border-transparent bg-transparent px-1 py-0.5 text-base font-semibold text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`,defaultValue:b.title,"aria-label":`分析标题`,onBlur:e=>Pt(e.target.value)},b.id),(0,O.jsx)(x,{tone:pe[b.status].tone,children:pe[b.status].label}),A?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-stone-500`,children:[(0,O.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`}),Bt?.message||(A===`decompose`?`拆解中`:A===`audit`?`体检中`:`补写中`)]}):null]}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-stone-400`,children:[(0,O.jsxs)(`span`,{children:[`故事`,` `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.stories.length})]}),(0,O.jsxs)(`span`,{children:[`需求条目`,` `,(0,O.jsxs)(`span`,{className:`font-medium text-stone-600`,children:[Rt,`/`,b.outline.length]}),` `,`覆盖`]}),(0,O.jsxs)(`span`,{children:[`缺口 `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:zt.length}),St?` · 已选 ${St}`:``]}),b.check?(0,O.jsxs)(`span`,{children:[`覆盖率`,` `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.check.coverage.total?`${Math.round(b.check.coverage.rate*100)}%`:`—`})]}):null,(0,O.jsxs)(`span`,{className:`truncate`,children:[`来源:`,b.sourcePath]})]}),(0,O.jsx)(`div`,{className:`mt-3 flex items-center gap-1 border-b border-stone-100`,children:[{id:`stories`,label:`用户故事 ${b.stories.length}`},{id:`check`,label:`体检结果 ${zt.length}`},{id:`outline`,label:`需求条目 ${b.outline.length}`}].map(e=>(0,O.jsx)(`button`,{type:`button`,className:`-mb-px border-b-2 px-3 py-1.5 text-xs transition-colors ${R===e.id?`border-[#3370ff] font-medium text-[#3370ff]`:`border-transparent text-stone-500 hover:text-stone-700`}`,onClick:()=>z(e.id),children:e.label},e.id))})]}),(0,O.jsxs)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto pr-1`,children:[R===`stories`?b.stories.length?(0,O.jsx)(`ul`,{className:`space-y-2`,children:b.stories.map((e,t)=>(0,O.jsx)(Fe,{story:e,index:t,total:b.stories.length,gaps:zt.filter(t=>t.storyId===e.id),busy:!!A,onSave:e=>kt(t,e),onDelete:()=>At(t),onMove:e=>jt(t,e),domId:e.id?`req-story-${e.id}`:void 0},`${e.id}-${t}`))}):(0,O.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有用户故事`,hint:`点左侧「开始拆解」,会先抽需求条目再拆故事。`})}):null,R===`check`?(0,O.jsx)(Ne,{check:b.check,stories:b.stories,busy:!!A,onToggleGap:Mt,onToggleAll:Nt,onFix:()=>void Ot(),onAudit:()=>void Dt()}):null,R===`outline`?b.outline.length?(0,O.jsx)(`ul`,{className:`space-y-2`,children:b.outline.map(e=>{let t=bt.has(e.id);return(0,O.jsx)(`li`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-2.5`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-emerald-500`:`bg-amber-400`}`,"aria-hidden":`true`}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-stone-800`,children:[(0,O.jsx)(`span`,{className:`mr-1.5 rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id}),e.title]}),e.quote?(0,O.jsx)(`p`,{className:`mt-1 border-l-2 border-stone-200 pl-2 text-xs leading-relaxed text-stone-400`,children:e.quote}):null]}),(0,O.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-amber-600`}`,children:t?`已覆盖`:`未覆盖`})]})},e.id)})}):(0,O.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有需求条目`,hint:`拆解时模型会先抽条目,覆盖率按条目统计。`})}):null]}),P?(0,O.jsxs)(`details`,{className:`mt-2 shrink-0 rounded-xl border border-stone-200 bg-white px-3 py-2`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-xs text-stone-500`,children:`模型说明(本轮)`}),(0,O.jsx)(`pre`,{className:`mt-1 max-h-[180px] overflow-y-auto whitespace-pre-wrap break-words text-[11px] leading-relaxed text-stone-600`,children:P})]}):null]}):(0,O.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有选来源`,hint:`左侧选一份「需求文档库」里的 Word / Excel / Markdown / txt,系统会新建一份分析。`})})]})]})]}),(0,O.jsx)(l,{open:rt,title:`删除分析记录`,message:`确认删除「${b?.title??``}」?故事、需求条目与体检报告都会一起删掉,来源需求文档不受影响。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>it(!1),onConfirm:()=>void Ft()}),(0,O.jsx)(l,{open:at,title:`重新拆解`,message:`重新拆解会用模型结果替换当前 ${b?.stories.length??0} 个用户故事,旧体检报告与需求条目也会一起清掉,编号从 US-001 重新开始。`,confirmLabel:`重新拆解`,onClose:()=>ot(!1),onConfirm:()=>void Et()})]})}export{Ke as default};
25
+ `),s=Q(e,90),c=!1,l=s.saveStories;s.saveStories=async e=>(c=!0,l(e));for await(let e of d(t,[{role:`system`,content:`${r}\n\n${we}`},{role:`user`,content:o}],i.signal,{tools:ke.filter(e=>e.function.name===`req_set_stories`),maxToolRounds:10,runTool:(e,t)=>Ae(e,t,s)}))e.type===`content`?F(t=>t+e.delta):e.type===`tool`&&e.status===`running`&&K(`调用 ${e.name}`,`tool`);if(!c){K(`模型没有提交补写结果,故事集保持不变`,`error`),h(`模型没有提交补写结果`,`error`);return}let u=U.current;if(u){let e=re(u),t=await g(u.id,{check:e,status:`decomposed`});G(t)}K(`补写完成,已按规则重算覆盖率;建议再跑一次体检`,`done`),z(`check`),h(`补写完成,建议再跑一次体检`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?K(`已中断:已经写入的改动保留`,`info`):(L(t),K(`补写失败:${t}`,`error`))}finally{j(null),W.current=null}},[Q,G,K,Y,Tt]),$=(0,w.useCallback)(async e=>{let t=U.current;if(t)try{await X({stories:e},t)}catch(e){h(`保存失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[X]),kt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n)return;let r=n.stories.map((n,r)=>r===e?{...t,id:n.id}:n);$(r)},[$]),At=(0,w.useCallback)(e=>{let t=U.current;t&&$(t.stories.filter((t,n)=>n!==e))},[$]),jt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n)return;let r=e+t;if(r<0||r>=n.stories.length)return;let i=[...n.stories],a=i[e],o=i[r];a&&o&&(i[e]=o,i[r]=a,$(i))},[$]),Mt=(0,w.useCallback)((e,t)=>{let n=U.current;if(!n?.check)return;let r={...n,check:{...n.check,gaps:n.check.gaps.map(n=>n.id===e?{...n,selected:t}:n)}};G(r),Ct()},[G,Ct]),Nt=(0,w.useCallback)(e=>{let t=U.current;if(!t?.check)return;let n={...t,check:{...t.check,gaps:t.check.gaps.map(t=>({...t,selected:e}))}};G(n),Ct()},[G,Ct]),Pt=(0,w.useCallback)(e=>{let t=U.current,n=e.trim();t&&n&&n!==t.title&&X({title:n},t).catch(()=>void 0)},[X]),Ft=(0,w.useCallback)(async()=>{let e=U.current;if(e)try{await he(e.id);let t=v.filter(t=>t.id!==e.id);y(t),q(t[0]??null),qe(`list`),h(`已删除分析记录`,`success`)}catch(e){h(`删除失败:${e instanceof Error?e.message:String(e)}`,`error`)}finally{it(!1)}},[v,q]),It=(0,w.useCallback)(()=>{let e=U.current;if(!e)return;let t=new Blob([ee(e)],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=ie(e),document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),h(`已导出 Markdown`,`success`)},[]),Lt=(0,w.useCallback)(()=>{W.current?.abort()},[]);if(!e.ready)return(0,O.jsx)(Ce,{label:`正在读取插件开关`});if(!e.on)return(0,O.jsx)(Se,{children:r(`reqAnalysis`)});if(t===null)return(0,O.jsx)(Ce,{label:`正在连接需求分析服务`});if(!t)return(0,O.jsx)(Se,{children:"需求分析需要本地服务,当前未就绪:确认服务已升级到最新版本并重启(`lantern` 一体服务或 `npm run dev`),静态部署的页面用不了。"});let Rt=b?.outline.filter(e=>bt.has(e.id)).length??0,zt=b?.check?.gaps??[],Bt=b?.progress,Vt=(0,O.jsx)(u,{options:ut,value:T,onChange:e=>{E(e),e&&wt(e)},triggerTitle:T||`选择来源需求文档…`,ariaLabel:`选择来源需求文档`,searchable:!0,searchPlaceholder:`搜索文件名或路径…`,flat:!0}),Ht=(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,O.jsxs)(`section`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-[240px] flex-1`,children:[(0,O.jsx)(`p`,{className:B,children:`新建分析`}),(0,O.jsx)(`div`,{className:`mt-1.5 max-w-[440px]`,children:Vt})]}),(0,O.jsxs)(`span`,{className:`pb-1 text-[11px] text-stone-400`,children:[`共 `,v.length,` 份分析`]})]}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`选一份需求文档就新建分析(同一份来源再选一次会回到已有记录),随后进「用户故事」拆解。支持 Word(.docx)/ Excel(.xlsx / .xls)/ Markdown / txt / csv,读取时抽成文本,不改原文件。`}),De?(0,O.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-700`,children:[`读不到需求文档库:`,De,(0,O.jsx)(`br`,{}),`请先启用「需求文档库」插件,或确认 `,ce,` 之外的内容目录没有被移动。`]}):null]}),I?(0,O.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,O.jsx)(`span`,{className:`break-all`,children:I}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,(0,O.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,O.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,O.jsxs)(`div`,{className:`inline-flex rounded-lg border border-stone-200 bg-stone-50 p-0.5`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>vt(`doc`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${Je===`doc`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按需求说明书`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>vt(`story`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${Je===`story`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按用户故事`})]}),Je===`story`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`relative block`,children:[(0,O.jsx)(S,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,O.jsx)(`input`,{value:V,onChange:e=>Xe(e.target.value),placeholder:`搜索编号 / 标题 / 角色…`,className:`h-8 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-xs text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,O.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[pt,` 个故事`,H?` · 已选 ${H.ids.length}`:``]}),(0,O.jsx)(`button`,{type:`button`,disabled:!H,onClick:()=>{if(!H)return;let e=new URLSearchParams({plugin:`caseGen`,reqDoc:H.docId,stories:H.ids.join(`,`)});window.location.href=`/workbench/?${e.toString()}`},className:`${ze} ml-auto h-8 text-xs`,children:`用选中故事生成用例`})]}):(0,O.jsxs)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:[v.length,` 份分析 · `,pt,` 个故事`]})]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:Je===`doc`?v.length?(0,O.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:v.map(e=>{let t=pe[e.status];return(0,O.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3 transition-colors hover:bg-stone-50`,children:[(0,O.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center text-left`,onClick:()=>J(e,`stories`),children:(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:e.title}),(0,O.jsx)(x,{tone:t.tone,children:t.label})]}),(0,O.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-stone-400`,children:[(0,O.jsx)(`span`,{className:`truncate`,children:e.sourcePath||`(未指定来源)`}),(0,O.jsxs)(`span`,{children:[`用户故事 `,e.stories.length]}),(0,O.jsxs)(`span`,{children:[`需求条目 `,e.outline.length]}),(0,O.jsx)(`span`,{children:We(e.updatedAt)})]})]})}),(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-700 transition-colors hover:border-[#3370ff] hover:text-[#3370ff]`,onClick:()=>J(e,`stories`),children:[`用户故事`,(0,O.jsx)(S,{name:`chevronRight`,size:13})]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-red-50 hover:text-red-600`,onClick:()=>{q(e),it(!0)},children:(0,O.jsx)(S,{name:`trash`,size:14})})]},e.id)})}):(0,O.jsx)(C,{icon:`file`,title:`还没有分析记录`,hint:`上面选一份需求文档,系统会新建一份分析并进入用户故事拆解。`}):mt.length?(0,O.jsx)(`div`,{className:`divide-y divide-stone-100`,children:mt.map(({doc:e,rows:t})=>{let n=Qe.includes(e.id),r=t.map(e=>e.story.id),i=H?.docId===e.id&&r.length>0&&r.every(e=>ht.has(e));return(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/70 px-3 py-1.5`,children:[(0,O.jsx)(`input`,{type:`checkbox`,"aria-label":`选中 ${e.title} 的全部故事`,checked:i,onChange:()=>_t(e.id,r)}),(0,O.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>$e(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,O.jsx)(S,{name:n?`chevronRight`:`chevronDown`,size:13,className:`shrink-0 text-stone-400`}),(0,O.jsx)(`span`,{className:`truncate text-xs font-medium text-stone-700`,children:e.title}),(0,O.jsxs)(`span`,{className:`shrink-0 text-[11px] text-stone-400`,children:[t.length,` 个故事 · `,We(e.updatedAt)]})]}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] text-[#3370ff] hover:underline`,onClick:()=>J(e,`stories`),children:`打开拆解`})]}),n?null:(0,O.jsx)(`ul`,{className:`divide-y divide-stone-50`,children:t.map(({story:t})=>(0,O.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2 transition-colors hover:bg-stone-50`,children:[(0,O.jsx)(`input`,{type:`checkbox`,className:`mt-1`,"aria-label":`选中 ${t.id}`,checked:ht.has(t.id)&&H?.docId===e.id,onChange:()=>gt(e.id,t.id)}),(0,O.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:()=>dt(e,t.id),children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-stone-400`,children:t.id}),(0,O.jsx)(`span`,{className:`truncate text-sm text-stone-800`,children:t.title})]}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-[11px] text-stone-400`,children:[t.role?(0,O.jsxs)(`span`,{children:[`角色:`,t.role]}):null,(0,O.jsxs)(`span`,{children:[`优先级 `,t.priority]}),(0,O.jsxs)(`span`,{children:[`验收 `,t.acceptance.length]}),(0,O.jsxs)(`span`,{children:[`异常 `,t.exceptions.length]}),(0,O.jsxs)(`span`,{children:[`维度 `,t.dimensions.length]})]})]})]},`${e.id}-${t.id}`))})]},e.id)})}):(0,O.jsx)(C,{icon:`file`,title:V?`没有匹配的用户故事`:`还没有用户故事`,hint:V?`换个编号、标题或角色再试。`:`先按「需求说明书」选中一份文档拆解,故事会自动出现在这里。`})})]})]});return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[Ke===`list`?Ht:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:border-stone-300 hover:text-stone-800`,onClick:()=>{E(``),L(``),qe(`list`)},children:[(0,O.jsx)(S,{name:`arrowLeft`,size:14}),`返回列表`]}),(0,O.jsx)(`span`,{className:`min-w-0 truncate text-xs text-stone-400`,children:b?.title?`用户故事 · ${b.title}`:`用户故事`})]}),(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,O.jsxs)(`aside`,{className:`flex w-[272px] shrink-0 flex-col gap-3 overflow-y-auto pb-1`,children:[(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`来源需求文档`}),(0,O.jsx)(`div`,{className:`mt-2`,children:Vt}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`支持 Word(.docx)/ Excel(.xlsx / .xls)/ Markdown / txt / csv,读取时抽成文本,不改原文件。`}),b?(0,O.jsxs)(`div`,{className:`mt-2 space-y-1 text-[11px] text-stone-400`,children:[(0,O.jsxs)(`p`,{className:`break-all`,children:[`当前:`,b.sourcePath||`(未指定)`]}),yt?(0,O.jsx)(`p`,{className:`rounded bg-amber-50 px-2 py-1 text-amber-700`,children:`源文档已更新,建议重新拆解`}):null]}):null]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`p`,{className:B,children:`分析记录`}),(0,O.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:v.length})]}),v.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:v.map(e=>{let t=e.id===ue,n=pe[e.status];return(0,O.jsx)(`li`,{children:(0,O.jsx)(`button`,{type:`button`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${t?`bg-[#eef3ff]`:`hover:bg-stone-50`}`,onClick:()=>q(e),children:(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate text-xs font-medium text-stone-700`,children:e.title}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-[11px] text-stone-400`,children:[(0,O.jsx)(x,{tone:n.tone,children:n.label}),(0,O.jsxs)(`span`,{children:[e.stories.length,` 个故事`]})]})]})})},e.id)})}):(0,O.jsx)(`p`,{className:`mt-2 text-xs text-stone-400`,children:`还没有分析记录,选一份来源文档开始。`})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`提示词`}),(0,O.jsx)(`p`,{className:`mt-1 break-all text-xs text-stone-500`,children:te}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] ${xt?`text-emerald-600`:`text-amber-700`}`,children:xt?`拆解 / 体检 / 补写三段已就绪`:`没有读到「## 拆解」段落:去「提示词管理」补上,或关闭再打开插件重新生成`}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] ${Z?`text-stone-400`:`text-amber-700`}`,children:Z?`模型:${D?.model}`:`还没配置模型`})]}),(0,O.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsx)(`p`,{className:B,children:`动作`}),(0,O.jsx)(`button`,{type:`button`,className:`${ze} w-full`,disabled:!b||!!A||!b.sourcePath,onClick:()=>{b?.stories.length?ot(!0):Et()},children:A===`decompose`?`拆解中…`:b?.stories.length?`重新拆解`:`开始拆解`}),(0,O.jsx)(`button`,{type:`button`,className:`${Be} w-full`,disabled:!b||!!A||!b.stories.length,onClick:()=>void Dt(),children:A===`audit`?`体检中…`:`体检`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,className:`${Be} flex-1`,disabled:!b,onClick:It,children:`导出 Markdown`}),A?(0,O.jsx)(`button`,{type:`button`,className:`${Be} flex-1`,onClick:Lt,children:`中断`}):null]}),b?(0,O.jsx)(`button`,{type:`button`,className:`h-8 w-full rounded-md text-xs text-stone-400 transition-colors hover:bg-red-50 hover:text-red-500`,onClick:()=>it(!0),children:`删除这份分析`}):null]}),(0,O.jsxs)(`section`,{className:`min-h-[120px] rounded-xl border border-stone-200 bg-white p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`p`,{className:B,children:`活动日志`}),M.length?(0,O.jsx)(`button`,{type:`button`,className:`text-[11px] text-stone-400 hover:text-stone-600`,onClick:()=>N([]),children:`清空`}):null]}),(0,O.jsx)(`div`,{ref:ct,className:`mt-2 max-h-[240px] space-y-1 overflow-y-auto pr-1`,children:M.length?M.map(e=>(0,O.jsxs)(`p`,{className:`flex gap-1.5 text-[11px] leading-relaxed`,children:[(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.kind===`error`?`bg-red-500`:e.kind===`done`?`bg-emerald-500`:e.kind===`tool`?`bg-[#3370ff]`:`bg-stone-300`}`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:e.kind===`error`?`text-red-600`:`text-stone-500`,children:e.text})]},e.id)):(0,O.jsx)(`p`,{className:`text-[11px] text-stone-400`,children:`拆解 / 体检的过程会记在这里。`})})]})]}),(0,O.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[I?(0,O.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,O.jsx)(`span`,{className:`break-all`,children:I}),(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>L(``),children:`✕`})]}):null,b?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`header`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`input`,{className:`min-w-0 flex-1 rounded-md border border-transparent bg-transparent px-1 py-0.5 text-base font-semibold text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`,defaultValue:b.title,"aria-label":`分析标题`,onBlur:e=>Pt(e.target.value)},b.id),(0,O.jsx)(x,{tone:pe[b.status].tone,children:pe[b.status].label}),A?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-stone-500`,children:[(0,O.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`}),Bt?.message||(A===`decompose`?`拆解中`:A===`audit`?`体检中`:`补写中`)]}):null]}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-stone-400`,children:[(0,O.jsxs)(`span`,{children:[`故事`,` `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.stories.length})]}),(0,O.jsxs)(`span`,{children:[`需求条目`,` `,(0,O.jsxs)(`span`,{className:`font-medium text-stone-600`,children:[Rt,`/`,b.outline.length]}),` `,`覆盖`]}),(0,O.jsxs)(`span`,{children:[`缺口 `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:zt.length}),St?` · 已选 ${St}`:``]}),b.check?(0,O.jsxs)(`span`,{children:[`覆盖率`,` `,(0,O.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.check.coverage.total?`${Math.round(b.check.coverage.rate*100)}%`:`—`})]}):null,(0,O.jsxs)(`span`,{className:`truncate`,children:[`来源:`,b.sourcePath]})]}),(0,O.jsx)(`div`,{className:`mt-3 flex items-center gap-1 border-b border-stone-100`,children:[{id:`stories`,label:`用户故事 ${b.stories.length}`},{id:`check`,label:`体检结果 ${zt.length}`},{id:`outline`,label:`需求条目 ${b.outline.length}`}].map(e=>(0,O.jsx)(`button`,{type:`button`,className:`-mb-px border-b-2 px-3 py-1.5 text-xs transition-colors ${R===e.id?`border-[#3370ff] font-medium text-[#3370ff]`:`border-transparent text-stone-500 hover:text-stone-700`}`,onClick:()=>z(e.id),children:e.label},e.id))})]}),(0,O.jsxs)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto pr-1`,children:[R===`stories`?b.stories.length?(0,O.jsx)(`ul`,{className:`space-y-2`,children:b.stories.map((e,t)=>(0,O.jsx)(Fe,{story:e,index:t,total:b.stories.length,gaps:zt.filter(t=>t.storyId===e.id),busy:!!A,onSave:e=>kt(t,e),onDelete:()=>At(t),onMove:e=>jt(t,e),domId:e.id?`req-story-${e.id}`:void 0},`${e.id}-${t}`))}):(0,O.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有用户故事`,hint:`点左侧「开始拆解」,会先抽需求条目再拆故事。`})}):null,R===`check`?(0,O.jsx)(Ne,{check:b.check,stories:b.stories,busy:!!A,onToggleGap:Mt,onToggleAll:Nt,onFix:()=>void Ot(),onAudit:()=>void Dt()}):null,R===`outline`?b.outline.length?(0,O.jsx)(`ul`,{className:`space-y-2`,children:b.outline.map(e=>{let t=bt.has(e.id);return(0,O.jsx)(`li`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-2.5`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-emerald-500`:`bg-amber-400`}`,"aria-hidden":`true`}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-stone-800`,children:[(0,O.jsx)(`span`,{className:`mr-1.5 rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id}),e.title]}),e.quote?(0,O.jsx)(`p`,{className:`mt-1 border-l-2 border-stone-200 pl-2 text-xs leading-relaxed text-stone-400`,children:e.quote}):null]}),(0,O.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-amber-600`}`,children:t?`已覆盖`:`未覆盖`})]})},e.id)})}):(0,O.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有需求条目`,hint:`拆解时模型会先抽条目,覆盖率按条目统计。`})}):null]}),P?(0,O.jsxs)(`details`,{className:`mt-2 shrink-0 rounded-xl border border-stone-200 bg-white px-3 py-2`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-xs text-stone-500`,children:`模型说明(本轮)`}),(0,O.jsx)(`pre`,{className:`mt-1 max-h-[180px] overflow-y-auto whitespace-pre-wrap break-words text-[11px] leading-relaxed text-stone-600`,children:P})]}):null]}):(0,O.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,O.jsx)(C,{icon:`file`,title:`还没有选来源`,hint:`左侧选一份「需求文档库」里的 Word / Excel / Markdown / txt,系统会新建一份分析。`})})]})]})]}),(0,O.jsx)(l,{open:rt,title:`删除分析记录`,message:`确认删除「${b?.title??``}」?故事、需求条目与体检报告都会一起删掉,来源需求文档不受影响。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>it(!1),onConfirm:()=>void Ft()}),(0,O.jsx)(l,{open:at,title:`重新拆解`,message:`重新拆解会用模型结果替换当前 ${b?.stories.length??0} 个用户故事,旧体检报告与需求条目也会一起清掉,编号从 US-001 重新开始。`,confirmLabel:`重新拆解`,onClose:()=>ot(!1),onConfirm:()=>void Et()})]})}export{Ke as default};
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as te}from"./app-config.Cq_F8I0l.js";import{i as ne,n as re,r as ie,t as ae}from"./listbox.DNxAJmEo.js";import{a as oe,o as se}from"./dialog.DZHZCe_T.js";import{t as a}from"./jsx-runtime.DUg_B_vD.js";import{t as ce}from"./ConfirmDialog.CsMwWevK.js";import{i as le}from"./llm.BZEzE0x2.js";import{_ as ue,a as de,c as fe,d as pe,g as me,h as he,i as ge,l as o,n as s,o as _e,r as ve,s as ye,t as be,u as xe,v as Se}from"./settings.HM3DiNh0.js";import{n as c}from"./i18n.DPw-aTIZ.js";import{n as Ce,r as we,t as l}from"./update.BkHtINbZ.js";var u=e(t(),1),d=a();function Te(e){try{return new URL(e).host}catch{return``}}var Ee=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],f=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,p=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function De({className:e=`w-3.5 h-3.5`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,d.jsx)(`path`,{d:`M6 8l4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Oe({className:e=`w-4 h-4`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,d.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function ke({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,d.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function Ae({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,d.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,d.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function je({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,d.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,d.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,d.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function m({title:e,description:t,control:n}){return(0,d.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,d.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,d.jsx)(`div`,{className:`shrink-0`,children:n})]})}function h({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,d.jsxs)(ie,{value:e,onChange:n,children:[(0,d.jsxs)(ne,{className:p,children:[(0,d.jsx)(`span`,{className:`flex-1 text-left truncate`,children:r}),(0,d.jsx)(De,{className:`w-3.5 h-3.5 text-stone-400 shrink-0`})]}),(0,d.jsx)(ae,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,d.jsxs)(re,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,d.jsx)(`span`,{children:e.label}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function g(){let[e,t]=(0,u.useState)(!1),[a,p]=(0,u.useState)(`general`),[g,Me]=(0,u.useState)(()=>ee().model.providers),[Ne,_]=(0,u.useState)(()=>ee().model.activeId),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(``),[Pe,Fe]=(0,u.useState)(`DeepSeek`),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(``),[O,Ie]=(0,u.useState)([]),[k,A]=(0,u.useState)(`idle`),[Le,j]=(0,u.useState)(!1),[Re,M]=(0,u.useState)(`readonly`),[ze,Be]=(0,u.useState)(!1),[Ve,N]=(0,u.useState)(!1),[He,P]=(0,u.useState)(null),[F,I]=(0,u.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[Ue,L]=(0,u.useState)(`14`),We=(0,u.useRef)(0),[R,Ge]=(0,u.useState)(null),[z,Ke]=(0,u.useState)(!1),[qe,Je]=(0,u.useState)(!1),[Ye,B]=(0,u.useState)(!1),[Xe,V]=(0,u.useState)(``),H=(0,u.useRef)(null),U=(0,u.useRef)(!1),W=v!==null,G=F.language,K=g.find(e=>e.id===Ne),q=(K?.name||``).trim(),J=R?.status??null,Ze=J?.phase===`done`&&!!J.to&&J.to===R?.current&&we!==R?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,Qe=J?.phase===`failed`?J.error:``,Y=Ye||J?.phase===`installing`||J?.phase===`restarting`,$e=(J?.to||R?.latest||``).replace(/^v/,``),X=Qe||Xe,et=R?.checkedAt&&!Y?new Date(R.checkedAt).toLocaleTimeString():``,tt=z?``:Y?J?.phase===`restarting`?c(`settings.updateRestarting`,void 0,G):c(`settings.updateInstalling`,{v:$e},G):X?`${c(`settings.updateFailed`,void 0,G)}:${X}`:Ze?c(`settings.updateDone`,{v:J?.to||``},G):R?.mode===`dev`&&R?.hasUpdate?c(`settings.updateDevMode`,void 0,G):R?.error?`${c(`settings.updateUnavailable`,void 0,G)}:${R.error}`:R?.hasUpdate?R.mode===`npx`?c(`settings.updateNpxHint`,void 0,G):``:R?`${c(`settings.updateLatest`,void 0,G)}${et?` · ${c(`settings.updateCheckedAt`,{time:et},G)}`:``}`:qe?c(`settings.updateUnavailable`,void 0,G):``,nt=q||(G===`en`?`No model`:`未配置`),rt=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function it(e=`general`){p(e),r().then(()=>{at(),t(!0)})}function at(){Be(n()),Me(fe()),_(de()),N(!!o()),I(ye()),ve(ye()),M(_e()),y(null)}function Z(){H.current!==null&&(window.clearInterval(H.current),H.current=null)}async function ot(e=!0){Ke(!0);try{let t=await l(e);t&&(Ge(t),V(``))}finally{Ke(!1),Je(!0)}}function st(e){Z();let t=Date.now()+18e4;H.current=window.setInterval(async()=>{if(!U.current){U.current=!0;try{let n=await l(!0);if(n){Ge(n);let t=n.status;if(t?.phase===`failed`){Z(),B(!1),V(t.error||c(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),B(!1);return}}Date.now()>t&&(Z(),B(!1),V(c(`settings.updateTimeout`,void 0,G)))}finally{U.current=!1}}},1500)}async function ct(){let e=R?.latest||``;V(``),B(!0);let t=R?.current||we,n=await Ce(e||void 0);n.ok?st(t):(B(!1),V(n.error||c(`settings.updateFailed`,void 0,G)))}function lt(e){if(!e){let e=te();y(e),x(`DeepSeek`),Fe(`DeepSeek`),C(`https://api.deepseek.com/v1`),T(``),D(``),Ie([]),A(`idle`),j(!1);return}y(e.id),x(e.name),C(e.baseURL);let t=e.apiKey?.trim()||(e.id===de()?i().trim():``)||``;T(t),D(e.model),Ie(e.availableModels??[]),A(e.availableModels?.length?`ok`:`idle`),Fe(s.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),j(!1)}(0,u.useEffect)(()=>{r().then(()=>at());let e=e=>{let n=e.detail;p(n?.tab===`model`?`model`:`general`),r().then(()=>{at(),t(!0)})};window.addEventListener(be,e);let n=pe(e=>I(e)),i=xe(e=>M(e));return()=>{window.removeEventListener(be,e),n(),i()}},[]),(0,u.useEffect)(()=>{if(e)return(async()=>{let e=await l(!1);if(Je(!0),!e)return;Ge(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(B(!0),st(t.from||e.current))})(),Z},[e]),(0,u.useEffect)(()=>{if(!e||a!==`model`||!W)return;let t=S.trim(),n=w.trim();if(!t||!n){A(e=>e===`ok`?`ok`:`idle`);return}A(`loading`);let r=++We.current,i=setTimeout(()=>{le(t,n).then(e=>{r===We.current&&(Ie(e),A(`ok`))}).catch(()=>{r===We.current&&A(`fail`)})},800);return()=>clearTimeout(i)},[e,a,W,S,w]);function ut(e){Fe(e);let t=s.find(t=>t.label===e);t&&(t.baseURL&&C(t.baseURL),(!b.trim()||s.some(e=>e.label===b))&&x(t.label)),D(``)}function Q(e){I(me(e))}(0,u.useEffect)(()=>{L(String(F.sessionFontSize))},[F.sessionFontSize]);function dt(){let e=Number(Ue);if(!Ue.trim()||!Number.isFinite(e)){L(String(F.sessionFontSize));return}let t=me({sessionFontSize:Math.round(e)});I(t),L(String(t.sessionFontSize))}let ft=!!(b.trim()&&S.trim()&&w.trim()&&E.trim()),$=O.length>0;function pt(){if(!ft||!v)return;let e=Se({id:v,name:b.trim(),baseURL:S.trim(),apiKey:w.trim(),model:E.trim(),availableModels:$?O:void 0},{activate:!0});Me(e),_(v),y(null),N(!!o())}function mt(e){P(e)}function ht(){let e=He;if(!e)return;P(null);let t=ge(e);Me(t),_(de()),v===e&&y(null),N(!!o())}function gt(e){ue(e),_(e),N(!!o())}let _t=[{value:`readonly`,label:c(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:c(`settings.access.readwrite`,void 0,G)},{value:`full`,label:c(`settings.access.full`,void 0,G)}],vt=[{value:`concise`,label:c(`settings.step.concise`,void 0,G)},{value:`standard`,label:c(`settings.step.standard`,void 0,G)},{value:`detailed`,label:c(`settings.step.detailed`,void 0,G)},{value:`full`,label:c(`settings.step.full`,void 0,G)}],yt=[{value:`queue`,label:c(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:c(`settings.busySend.interrupt`,void 0,G)}],bt=[{value:`light`,label:c(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:c(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:c(`settings.appear.system`,void 0,G),icon:`monitor`}],xt=[{id:`general`,label:c(`settings.general`,void 0,G),icon:(0,d.jsx)(ke,{})},{id:`model`,label:c(`settings.model`,void 0,G),icon:(0,d.jsx)(Ae,{})}],St=a===`general`?c(`settings.general`,void 0,G):W?g.some(e=>e.id===v)?c(`settings.editProvider`,void 0,G):c(`settings.addProviderTitle`,void 0,G):c(`settings.model`,void 0,G);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,d.jsxs)(`button`,{type:`button`,onClick:()=>it(`general`),className:`tw-nav-settings-btn`,"data-hint":Ve?`设置(已配置模型)`:`设置`,children:[(0,d.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,d.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),(0,d.jsx)(`span`,{"data-i18n":`nav.settings`,children:c(`nav.settings`,void 0,G)})]}),(0,d.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":rt,onClick:()=>it(`model`),children:[(0,d.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:`tw-nav-provider-name`,children:nt})]})]}),(0,d.jsx)(oe,{show:e,children:(0,d.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,d.jsx)(se,{children:(0,d.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,d.jsx)(se,{children:(0,d.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:St}),(0,d.jsx)(`button`,{type:`button`,"aria-label":c(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,d.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,d.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:xt.map(e=>{let t=a===e.id;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>{p(e.id),e.id===`model`&&y(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,d.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,d.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:a===`general`?(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,d.jsx)(m,{title:c(`settings.access`,void 0,G),description:c(`settings.accessDesc`,void 0,G),control:(0,d.jsx)(h,{value:Re,options:_t,onChange:e=>{M(e),he(e)}})}),(0,d.jsx)(m,{title:c(`settings.language`,void 0,G),control:(0,d.jsx)(h,{value:F.language,options:Ee,onChange:e=>Q({language:e})})}),(0,d.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:c(`settings.appearance`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:bt.map(e=>{let t=F.appearance===e.value;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,d.jsx)(je,{kind:e.icon}),(0,d.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,d.jsx)(m,{title:c(`settings.fontSize`,void 0,G),description:c(`settings.fontSizeDesc`,void 0,G),control:(0,d.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,d.jsx)(`input`,{type:`number`,min:12,max:22,value:Ue,onChange:e=>L(e.target.value),onBlur:dt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,d.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,d.jsx)(m,{title:c(`settings.toolSteps`,void 0,G),description:c(`settings.toolStepsDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.toolStepDetail,options:vt,onChange:e=>Q({toolStepDetail:e})})}),(0,d.jsx)(m,{title:c(`settings.busySend`,void 0,G),description:c(`settings.busySendDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.busySendBehavior,options:yt,onChange:e=>Q({busySendBehavior:e})})}),(0,d.jsx)(m,{title:c(`settings.subagentModel`,void 0,G),description:c(`settings.subagentModelDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.subagentModel?.trim()?F.subagentModel:`inherit`,options:[{value:`inherit`,label:c(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,d.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:c(`settings.platformVersion`,void 0,G)}),(0,d.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,we]}),R?.hasUpdate&&!Y&&!Ze?(0,d.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${c(`settings.updateAvailable`,void 0,G)} v${(R.latest||``).replace(/^v/,``)}`}):null]}),(0,d.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,d.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),c(`settings.updateWorking`,void 0,G)]}):Ze?(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:c(`settings.updateReload`,void 0,G)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,disabled:z,onClick:()=>void ot(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:z?(0,d.jsxs)(d.Fragment,{children:[c(`settings.updateChecking`,void 0,G),(0,d.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{})]})]}):c(`settings.updateCheck`,void 0,G)}),R?.hasUpdate?(0,d.jsx)(`button`,{type:`button`,disabled:R.mode===`dev`,onClick:()=>void ct(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:c(`settings.updateNow`,void 0,G)}):null]})})]}),tt?(0,d.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:tt}):null,X&&R?.logPath?(0,d.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:c(`settings.updateLog`,{path:R.logPath},G)}):null]})]}):W?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:c(`settings.back`,void 0,G)})}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.displayName`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`DeepSeek`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.preset`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:s.map(e=>{let t=Pe===e.label;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>ut(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,d.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,d.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?Te(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.baseUrl`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.apiKey`,void 0,G)}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`input`,{type:Le?`text`:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-...`,className:`${f} pr-14`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>j(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:Le?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),ze?(0,d.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:c(`settings.keyHint`,void 0,G)}):null]}),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,d.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:c(`settings.modelField`,void 0,G)}),k===`loading`&&(0,d.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:c(`settings.recognizing`,void 0,G)}),$&&k===`ok`&&(0,d.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:c(`settings.recognized`,{n:O.length},G)}),k===`fail`&&!$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeFail`,void 0,G)}),k===`fail`&&$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeKeep`,void 0,G)})]}),$?(0,d.jsxs)(ie,{value:E,onChange:D,children:[(0,d.jsxs)(ne,{className:`${f} flex items-center justify-between text-left hover:border-stone-400 cursor-pointer`,children:[(0,d.jsx)(`span`,{className:`truncate text-stone-800`,children:E||(G===`en`?`Select a model`:`请选择模型`)}),(0,d.jsx)(De,{className:`w-4 h-4 shrink-0 ml-2 text-stone-400`})]}),(0,d.jsx)(ae,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:O.map(e=>(0,d.jsxs)(re,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,d.jsx)(`span`,{className:`truncate`,children:e}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,d.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:c(`settings.modelPlaceholder`,void 0,G),className:f})]})]}),(0,d.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:c(`settings.cancel`,void 0,G)}),(0,d.jsx)(`button`,{type:`button`,onClick:pt,disabled:!ft,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`settings.save`,void 0,G)})]})]}):(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,d.jsx)(`p`,{className:`text-sm text-stone-500`,children:c(`settings.modelIntro`,void 0,G)}),(0,d.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[g.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===Ne;return(0,d.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,d.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>gt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:c(`settings.edit`,void 0,G)}),g.length>1?(0,d.jsx)(`button`,{type:`button`,onClick:()=>mt(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:c(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:c(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,d.jsx)(ce,{open:He!=null,title:c(`settings.delete`,void 0,G),message:c(`settings.deleteConfirm`,void 0,G),confirmLabel:c(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>P(null),onConfirm:ht})]})}export{g as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as te}from"./app-config.Cq_F8I0l.js";import{i as ne,n as re,r as ie,t as ae}from"./listbox.DNxAJmEo.js";import{a as oe,o as se}from"./dialog.DZHZCe_T.js";import{t as a}from"./jsx-runtime.DUg_B_vD.js";import{t as ce}from"./ConfirmDialog.CsMwWevK.js";import{i as le}from"./llm.BZEzE0x2.js";import{_ as ue,a as de,c as fe,d as pe,g as me,h as he,i as ge,l as o,n as s,o as _e,r as ve,s as ye,t as be,u as xe,v as Se}from"./settings.HM3DiNh0.js";import{n as c}from"./i18n.DPw-aTIZ.js";import{n as Ce,r as we,t as l}from"./update.BSnBvaFF.js";var u=e(t(),1),d=a();function Te(e){try{return new URL(e).host}catch{return``}}var Ee=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],f=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,p=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function De({className:e=`w-3.5 h-3.5`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,d.jsx)(`path`,{d:`M6 8l4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Oe({className:e=`w-4 h-4`}){return(0,d.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,d.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function ke({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,d.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function Ae({className:e=`w-4 h-4`}){return(0,d.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,d.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,d.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function je({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,d.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,d.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,d.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,d.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function m({title:e,description:t,control:n}){return(0,d.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,d.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,d.jsx)(`div`,{className:`shrink-0`,children:n})]})}function h({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,d.jsxs)(ie,{value:e,onChange:n,children:[(0,d.jsxs)(ne,{className:p,children:[(0,d.jsx)(`span`,{className:`flex-1 text-left truncate`,children:r}),(0,d.jsx)(De,{className:`w-3.5 h-3.5 text-stone-400 shrink-0`})]}),(0,d.jsx)(ae,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,d.jsxs)(re,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,d.jsx)(`span`,{children:e.label}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function g(){let[e,t]=(0,u.useState)(!1),[a,p]=(0,u.useState)(`general`),[g,Me]=(0,u.useState)(()=>ee().model.providers),[Ne,_]=(0,u.useState)(()=>ee().model.activeId),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(``),[Pe,Fe]=(0,u.useState)(`DeepSeek`),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(``),[O,Ie]=(0,u.useState)([]),[k,A]=(0,u.useState)(`idle`),[Le,j]=(0,u.useState)(!1),[Re,M]=(0,u.useState)(`readonly`),[ze,Be]=(0,u.useState)(!1),[Ve,N]=(0,u.useState)(!1),[He,P]=(0,u.useState)(null),[F,I]=(0,u.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[Ue,L]=(0,u.useState)(`14`),We=(0,u.useRef)(0),[R,Ge]=(0,u.useState)(null),[z,Ke]=(0,u.useState)(!1),[qe,Je]=(0,u.useState)(!1),[Ye,B]=(0,u.useState)(!1),[Xe,V]=(0,u.useState)(``),H=(0,u.useRef)(null),U=(0,u.useRef)(!1),W=v!==null,G=F.language,K=g.find(e=>e.id===Ne),q=(K?.name||``).trim(),J=R?.status??null,Ze=J?.phase===`done`&&!!J.to&&J.to===R?.current&&we!==R?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,Qe=J?.phase===`failed`?J.error:``,Y=Ye||J?.phase===`installing`||J?.phase===`restarting`,$e=(J?.to||R?.latest||``).replace(/^v/,``),X=Qe||Xe,et=R?.checkedAt&&!Y?new Date(R.checkedAt).toLocaleTimeString():``,tt=z?``:Y?J?.phase===`restarting`?c(`settings.updateRestarting`,void 0,G):c(`settings.updateInstalling`,{v:$e},G):X?`${c(`settings.updateFailed`,void 0,G)}:${X}`:Ze?c(`settings.updateDone`,{v:J?.to||``},G):R?.mode===`dev`&&R?.hasUpdate?c(`settings.updateDevMode`,void 0,G):R?.error?`${c(`settings.updateUnavailable`,void 0,G)}:${R.error}`:R?.hasUpdate?R.mode===`npx`?c(`settings.updateNpxHint`,void 0,G):``:R?`${c(`settings.updateLatest`,void 0,G)}${et?` · ${c(`settings.updateCheckedAt`,{time:et},G)}`:``}`:qe?c(`settings.updateUnavailable`,void 0,G):``,nt=q||(G===`en`?`No model`:`未配置`),rt=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function it(e=`general`){p(e),r().then(()=>{at(),t(!0)})}function at(){Be(n()),Me(fe()),_(de()),N(!!o()),I(ye()),ve(ye()),M(_e()),y(null)}function Z(){H.current!==null&&(window.clearInterval(H.current),H.current=null)}async function ot(e=!0){Ke(!0);try{let t=await l(e);t&&(Ge(t),V(``))}finally{Ke(!1),Je(!0)}}function st(e){Z();let t=Date.now()+18e4;H.current=window.setInterval(async()=>{if(!U.current){U.current=!0;try{let n=await l(!0);if(n){Ge(n);let t=n.status;if(t?.phase===`failed`){Z(),B(!1),V(t.error||c(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),B(!1);return}}Date.now()>t&&(Z(),B(!1),V(c(`settings.updateTimeout`,void 0,G)))}finally{U.current=!1}}},1500)}async function ct(){let e=R?.latest||``;V(``),B(!0);let t=R?.current||we,n=await Ce(e||void 0);n.ok?st(t):(B(!1),V(n.error||c(`settings.updateFailed`,void 0,G)))}function lt(e){if(!e){let e=te();y(e),x(`DeepSeek`),Fe(`DeepSeek`),C(`https://api.deepseek.com/v1`),T(``),D(``),Ie([]),A(`idle`),j(!1);return}y(e.id),x(e.name),C(e.baseURL);let t=e.apiKey?.trim()||(e.id===de()?i().trim():``)||``;T(t),D(e.model),Ie(e.availableModels??[]),A(e.availableModels?.length?`ok`:`idle`),Fe(s.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),j(!1)}(0,u.useEffect)(()=>{r().then(()=>at());let e=e=>{let n=e.detail;p(n?.tab===`model`?`model`:`general`),r().then(()=>{at(),t(!0)})};window.addEventListener(be,e);let n=pe(e=>I(e)),i=xe(e=>M(e));return()=>{window.removeEventListener(be,e),n(),i()}},[]),(0,u.useEffect)(()=>{if(e)return(async()=>{let e=await l(!1);if(Je(!0),!e)return;Ge(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(B(!0),st(t.from||e.current))})(),Z},[e]),(0,u.useEffect)(()=>{if(!e||a!==`model`||!W)return;let t=S.trim(),n=w.trim();if(!t||!n){A(e=>e===`ok`?`ok`:`idle`);return}A(`loading`);let r=++We.current,i=setTimeout(()=>{le(t,n).then(e=>{r===We.current&&(Ie(e),A(`ok`))}).catch(()=>{r===We.current&&A(`fail`)})},800);return()=>clearTimeout(i)},[e,a,W,S,w]);function ut(e){Fe(e);let t=s.find(t=>t.label===e);t&&(t.baseURL&&C(t.baseURL),(!b.trim()||s.some(e=>e.label===b))&&x(t.label)),D(``)}function Q(e){I(me(e))}(0,u.useEffect)(()=>{L(String(F.sessionFontSize))},[F.sessionFontSize]);function dt(){let e=Number(Ue);if(!Ue.trim()||!Number.isFinite(e)){L(String(F.sessionFontSize));return}let t=me({sessionFontSize:Math.round(e)});I(t),L(String(t.sessionFontSize))}let ft=!!(b.trim()&&S.trim()&&w.trim()&&E.trim()),$=O.length>0;function pt(){if(!ft||!v)return;let e=Se({id:v,name:b.trim(),baseURL:S.trim(),apiKey:w.trim(),model:E.trim(),availableModels:$?O:void 0},{activate:!0});Me(e),_(v),y(null),N(!!o())}function mt(e){P(e)}function ht(){let e=He;if(!e)return;P(null);let t=ge(e);Me(t),_(de()),v===e&&y(null),N(!!o())}function gt(e){ue(e),_(e),N(!!o())}let _t=[{value:`readonly`,label:c(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:c(`settings.access.readwrite`,void 0,G)},{value:`full`,label:c(`settings.access.full`,void 0,G)}],vt=[{value:`concise`,label:c(`settings.step.concise`,void 0,G)},{value:`standard`,label:c(`settings.step.standard`,void 0,G)},{value:`detailed`,label:c(`settings.step.detailed`,void 0,G)},{value:`full`,label:c(`settings.step.full`,void 0,G)}],yt=[{value:`queue`,label:c(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:c(`settings.busySend.interrupt`,void 0,G)}],bt=[{value:`light`,label:c(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:c(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:c(`settings.appear.system`,void 0,G),icon:`monitor`}],xt=[{id:`general`,label:c(`settings.general`,void 0,G),icon:(0,d.jsx)(ke,{})},{id:`model`,label:c(`settings.model`,void 0,G),icon:(0,d.jsx)(Ae,{})}],St=a===`general`?c(`settings.general`,void 0,G):W?g.some(e=>e.id===v)?c(`settings.editProvider`,void 0,G):c(`settings.addProviderTitle`,void 0,G):c(`settings.model`,void 0,G);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,d.jsxs)(`button`,{type:`button`,onClick:()=>it(`general`),className:`tw-nav-settings-btn`,"data-hint":Ve?`设置(已配置模型)`:`设置`,children:[(0,d.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,d.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),(0,d.jsx)(`span`,{"data-i18n":`nav.settings`,children:c(`nav.settings`,void 0,G)})]}),(0,d.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":rt,onClick:()=>it(`model`),children:[(0,d.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:`tw-nav-provider-name`,children:nt})]})]}),(0,d.jsx)(oe,{show:e,children:(0,d.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,d.jsx)(se,{children:(0,d.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,d.jsx)(se,{children:(0,d.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:St}),(0,d.jsx)(`button`,{type:`button`,"aria-label":c(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,d.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,d.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,d.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:xt.map(e=>{let t=a===e.id;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>{p(e.id),e.id===`model`&&y(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,d.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,d.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:a===`general`?(0,d.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,d.jsx)(m,{title:c(`settings.access`,void 0,G),description:c(`settings.accessDesc`,void 0,G),control:(0,d.jsx)(h,{value:Re,options:_t,onChange:e=>{M(e),he(e)}})}),(0,d.jsx)(m,{title:c(`settings.language`,void 0,G),control:(0,d.jsx)(h,{value:F.language,options:Ee,onChange:e=>Q({language:e})})}),(0,d.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,d.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:c(`settings.appearance`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:bt.map(e=>{let t=F.appearance===e.value;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,d.jsx)(je,{kind:e.icon}),(0,d.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,d.jsx)(m,{title:c(`settings.fontSize`,void 0,G),description:c(`settings.fontSizeDesc`,void 0,G),control:(0,d.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,d.jsx)(`input`,{type:`number`,min:12,max:22,value:Ue,onChange:e=>L(e.target.value),onBlur:dt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,d.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,d.jsx)(m,{title:c(`settings.toolSteps`,void 0,G),description:c(`settings.toolStepsDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.toolStepDetail,options:vt,onChange:e=>Q({toolStepDetail:e})})}),(0,d.jsx)(m,{title:c(`settings.busySend`,void 0,G),description:c(`settings.busySendDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.busySendBehavior,options:yt,onChange:e=>Q({busySendBehavior:e})})}),(0,d.jsx)(m,{title:c(`settings.subagentModel`,void 0,G),description:c(`settings.subagentModelDesc`,void 0,G),control:(0,d.jsx)(h,{value:F.subagentModel?.trim()?F.subagentModel:`inherit`,options:[{value:`inherit`,label:c(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,d.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:c(`settings.platformVersion`,void 0,G)}),(0,d.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,we]}),R?.hasUpdate&&!Y&&!Ze?(0,d.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${c(`settings.updateAvailable`,void 0,G)} v${(R.latest||``).replace(/^v/,``)}`}):null]}),(0,d.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,d.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),c(`settings.updateWorking`,void 0,G)]}):Ze?(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:c(`settings.updateReload`,void 0,G)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,disabled:z,onClick:()=>void ot(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:z?(0,d.jsxs)(d.Fragment,{children:[c(`settings.updateChecking`,void 0,G),(0,d.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{}),(0,d.jsx)(`i`,{})]})]}):c(`settings.updateCheck`,void 0,G)}),R?.hasUpdate?(0,d.jsx)(`button`,{type:`button`,disabled:R.mode===`dev`,onClick:()=>void ct(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:c(`settings.updateNow`,void 0,G)}):null]})})]}),tt?(0,d.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:tt}):null,X&&R?.logPath?(0,d.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:c(`settings.updateLog`,{path:R.logPath},G)}):null]})]}):W?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:c(`settings.back`,void 0,G)})}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.displayName`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`DeepSeek`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.preset`,void 0,G)}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:s.map(e=>{let t=Pe===e.label;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>ut(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,d.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,d.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?Te(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.baseUrl`,void 0,G)}),(0,d.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:f})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:c(`settings.apiKey`,void 0,G)}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`input`,{type:Le?`text`:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-...`,className:`${f} pr-14`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>j(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:Le?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),ze?(0,d.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:c(`settings.keyHint`,void 0,G)}):null]}),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,d.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:c(`settings.modelField`,void 0,G)}),k===`loading`&&(0,d.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:c(`settings.recognizing`,void 0,G)}),$&&k===`ok`&&(0,d.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:c(`settings.recognized`,{n:O.length},G)}),k===`fail`&&!$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeFail`,void 0,G)}),k===`fail`&&$&&(0,d.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:c(`settings.recognizeKeep`,void 0,G)})]}),$?(0,d.jsxs)(ie,{value:E,onChange:D,children:[(0,d.jsxs)(ne,{className:`${f} flex items-center justify-between text-left hover:border-stone-400 cursor-pointer`,children:[(0,d.jsx)(`span`,{className:`truncate text-stone-800`,children:E||(G===`en`?`Select a model`:`请选择模型`)}),(0,d.jsx)(De,{className:`w-4 h-4 shrink-0 ml-2 text-stone-400`})]}),(0,d.jsx)(ae,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:O.map(e=>(0,d.jsxs)(re,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,d.jsx)(`span`,{className:`truncate`,children:e}),(0,d.jsx)(Oe,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,d.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:c(`settings.modelPlaceholder`,void 0,G),className:f})]})]}),(0,d.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:c(`settings.cancel`,void 0,G)}),(0,d.jsx)(`button`,{type:`button`,onClick:pt,disabled:!ft,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`settings.save`,void 0,G)})]})]}):(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,d.jsx)(`p`,{className:`text-sm text-stone-500`,children:c(`settings.modelIntro`,void 0,G)}),(0,d.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[g.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===Ne;return(0,d.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,d.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>gt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:c(`settings.edit`,void 0,G)}),g.length>1?(0,d.jsx)(`button`,{type:`button`,onClick:()=>mt(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:c(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>lt(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:c(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,d.jsx)(ce,{open:He!=null,title:c(`settings.delete`,void 0,G),message:c(`settings.deleteConfirm`,void 0,G),confirmLabel:c(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>P(null),onConfirm:ht})]})}export{g as default};