lantern-harness 0.1.41 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/cli/server.mjs +2 -0
- package/dist/500.html +4 -4
- package/dist/_astro/Base.C-vZfmS4.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.C284v3Dm.js → Base.astro_astro_type_script_index_0_lang.BqOtiCPG.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.C-kyW6JJ.js → CaseGenerateApp.DW0HJj-e.js} +1 -1
- package/dist/_astro/{CasesLibrary.DQAWt_lF.js → CasesLibrary.BNgrULER.js} +1 -1
- package/dist/_astro/ChatApp.DzYFE67-.js +226 -0
- package/dist/_astro/PluginsPage.DayC2eOs.js +1 -0
- package/dist/_astro/{PluginsPage.DdpAYM08.js → PluginsPage.DwmK_UF-.js} +1 -1
- package/dist/_astro/{PromptsLibrary.BeFekutz.js → PromptsLibrary.DspwabiJ.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.CeR9Pz3f.js → ReqAnalysisBoard.LSxbIIWk.js} +1 -1
- package/dist/_astro/{SettingsDialog.B4YuUVo1.js → SettingsDialog.D21ojRGF.js} +1 -1
- package/dist/_astro/app-version.BEerieT3.js +1 -0
- package/dist/_astro/{case-gen-run.xJQWBg0s.js → case-gen-run.FzgC_1Ki.js} +1 -1
- package/dist/_astro/{req-analysis.DWdvPMmm.js → req-analysis.BqvytN69.js} +1 -1
- package/dist/_astro/{story-review.tv6ovtZz.js → story-review.D8FfhzAi.js} +1 -1
- package/dist/case-exec/index.html +4 -4
- package/dist/cases/generate/index.html +5 -5
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +4 -4
- package/dist/docs/changelog/index.html +54 -47
- package/dist/docs/install/index.html +4 -4
- package/dist/docs/manual/index.html +5 -5
- package/dist/knowledge/index.html +4 -4
- package/dist/life/kr-tasks/index.html +4 -4
- package/dist/life/kr-todos/index.html +4 -4
- package/dist/life/objectives/index.html +4 -4
- package/dist/life/reviews/index.html +4 -4
- package/dist/life/stages/index.html +4 -4
- package/dist/life/year-plans/index.html +4 -4
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +4 -4
- package/dist/pm/iterations/index.html +4 -4
- package/dist/pm/projects/detail/index.html +4 -4
- package/dist/pm/projects/index.html +4 -4
- package/dist/pm/requirements/index.html +4 -4
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +4 -4
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +4 -4
- package/dist/tasks/index.html +4 -4
- package/dist/templates/index.html +4 -4
- package/dist/test-automation/index.html +4 -4
- package/dist/test-stats/index.html +4 -4
- package/dist/todos/index.html +4 -4
- package/dist/workbench/index.html +5 -5
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +1 -1
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +1 -1
- package/lh-plugins/lh-attach.mjs +101 -0
- package/package.json +2 -1
- package/dist/_astro/Base.CIF3fwTz.css +0 -1
- package/dist/_astro/ChatApp.Dwz1v8AZ.js +0 -226
- package/dist/_astro/PluginsPage.AYWF5f3k.js +0 -1
- package/dist/_astro/app-version.BD8i00C-.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/lib.S37S0T6S.js","_astro/react.Blvh0GOs.js","_astro/jszip.min.Bh2Mgo40.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./SelectDropdown.Dmk5n225.js";import{showToast as a}from"./Toast.BO2NFckG.js";import{i as o,r as s}from"./case-types.CprZTsyX.js";import{d as c,f as l,m as u,p as d,r as f,u as ee}from"./case-gen-run.
|
|
2
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./SelectDropdown.Dmk5n225.js";import{showToast as a}from"./Toast.BO2NFckG.js";import{i as o,r as s}from"./case-types.CprZTsyX.js";import{d as c,f as l,m as u,p as d,r as f,u as ee}from"./case-gen-run.FzgC_1Ki.js";import{a as p}from"./case-fields.CmePqYfh.js";import{_ as m,c as h,f as g,l as _,p as v,r as y,u as b,v as x}from"./project-docs.DAw9bzgk.js";import{a as S,i as C,n as w,o as te,r as T,s as ne,t as re}from"./case-template.C-GBxgBC.js";import{b as E,m as ie,p as ae,u as oe}from"./settings.NTeTjmxg.js";import{o as se}from"./llm.DyweO-KK.js";import{n as D}from"./doc-roots.DAJP9Svr.js";import{r as ce}from"./prompts-meta.Dnmq-SnF.js";import{t as le}from"./ExcelFieldTags.CXif3Ilh.js";import{t as ue}from"./MultiSelectDropdown.y8JMbCxO.js";import{t as O}from"./SearchableSelect.DFZBUFIs.js";var k=e(t(),1),A=r(),de=[{value:`md`,label:`Markdown 表格`},{value:`xlsx`,label:`Excel`},{value:`csv`,label:`CSV`}];function fe(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1]??e.match(/\{[\s\S]*\}/)?.[0]??e.match(/\[[\s\S]*\]/)?.[0];if(!t)return null;try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return{docTitle:``,cases:e};if(e&&typeof e==`object`){let t=e,n=t.用例??t.cases??t.items;if(!Array.isArray(n)||n.length===0)return null;let r=t.需求名称??t.文档名称??t.docTitle??t.title;return{docTitle:typeof r==`string`?r.trim():``,cases:n}}}catch{return null}return null}function pe(e){return(e.split(`/`).pop()||e).replace(/\.[^.]+$/,``).trim()}function me(e){let t=e.match(/^#\s+(.+)$/m);if(t?.[1])return t[1].trim().slice(0,48);let n=e.match(/^标题[::]\s*(.+)$/m);return n?.[1]?n[1].trim().slice(0,48):``}function he(e,t){let n=[];if(!e.length)return n.push(`未生成任何用例`),n;for(let r of t){let t=e.filter(e=>!String(e[r]??``).trim()).length;t===e.length?n.push(`字段「${r}」全部为空`):t>Math.max(2,Math.floor(e.length*.3))&&n.push(`字段「${r}」有 ${t}/${e.length} 条为空`)}e.length<15&&n.push(`用例数量偏少(${e.length} 条),建议核对需求覆盖`);let r=e.map(e=>{for(let t of[`用例标题`,`标题`,`测试分项目`,`测试项目`])if(e[t]?.trim())return e[t].trim();return``}).filter(Boolean),i=new Set(r);return r.length>=4&&i.size<r.length*.6&&n.push(`用例标题/分项重复偏多,可能覆盖不足`),n}function ge(e){if(e==null||e<0)return`—`;if(e<1e3)return`${e} ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)} s`;let n=Math.floor(t/60);return`${n} 分 ${Math.round(t-n*60)} 秒`}function _e(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}async function ve(e){let t=s(e).templateFolder;try{let{entries:e}=await h(`templates`,t),n=e.filter(e=>e.type===`file`).sort((e,t)=>(t.mtime??0)-(e.mtime??0)),r=[];for(let e of n){let t=e.name.toLowerCase(),n=[...p],i=``;try{if(t.endsWith(`.xlsx`)||t.endsWith(`.xls`)){let t=await g(`templates`,e.path);if(t.encoding===`base64`&&t.contentBase64){let e=C(t.contentBase64);n=e.headers,i=e.body}}else if(t.endsWith(`.csv`)){let t=await v(`templates`,e.path),r=w(t.content);n=r.headers,i=r.body}else if(t.endsWith(`.md`)||t.endsWith(`.txt`)){let t=await v(`templates`,e.path),r=T(t.content);n=r.headers,i=r.body}}catch{i=``}r.push({id:e.path,title:e.name.replace(/\.[^.]+$/,``),body:i,headers:n})}return r}catch{return[]}}async function j(t){let n=t.toLowerCase();if(n.endsWith(`.md`)||n.endsWith(`.txt`)||n.endsWith(`.csv`))return(await v(`requirements`,t)).content;if(n.endsWith(`.docx`)){let n=await g(`requirements`,t);if(n.encoding!==`base64`||!n.contentBase64)throw Error(`无法读取 docx`);let r=atob(n.contentBase64),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return((await(await E(()=>import(`./lib.S37S0T6S.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1,2]))).extractRawText({arrayBuffer:i.buffer})).value??``).trim()}throw Error(`该需求文件类型暂不支持正文提取`)}function M(){let[e,t]=(0,k.useState)(null),[r,g]=(0,k.useState)(!1),[C,w]=(0,k.useState)([]),[T,E]=(0,k.useState)(``),[M,N]=(0,k.useState)(`functional`),[P,ye]=(0,k.useState)([]),[be,F]=(0,k.useState)(``),[xe,Se]=(0,k.useState)([]),[I,L]=(0,k.useState)(``),[Ce,R]=(0,k.useState)(``),[we,Te]=(0,k.useState)([]),[z,B]=(0,k.useState)([]),[V,H]=(0,k.useState)(`md`),[U,Ee]=(0,k.useState)(``),[W,G]=(0,k.useState)(null),[K,De]=(0,k.useState)(!1),[Oe,q]=(0,k.useState)(null),[J,Y]=(0,k.useState)(null),X=(0,k.useRef)(null),ke=(0,k.useRef)(null),Z=(0,k.useMemo)(()=>P.find(e=>e.id===be)??P[0],[P,be]),Q=M,Ae=s(Q).label;(0,k.useEffect)(()=>{n().then(()=>t(oe()));let e=ae(()=>t(oe()));return(async()=>{await c();let e=await y(`requirements`),t=await y(`cases`),n=await y(`templates`),r=await y(`prompts`),i=await y(`knowledge`);g(e&&t&&n&&r);async function a(e,t,n){let{entries:r}=await h(e,t);for(let t of r)t.type===`file`?n.push(t):await a(e,t.path,n)}if(e)try{let e=[];await a(`requirements`,`.`,e),w(e)}catch{}if(i)try{let e=[];await a(`knowledge`,`.`,e),e.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),Te(e)}catch{}if(r)try{let e=[];await a(`prompts`,`.`,e);let t=e.filter(e=>!ce(e.path));t.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),Se(t);let n=t.find(e=>e.path.includes(`功能测试用例提示词`))?.path??t[0]?.path??``;L(e=>e&&!ce(e)&&t.some(t=>t.path===e)?e:n)}catch{}let s=new URLSearchParams(window.location.search),d=s.get(`session`),f=s.get(`path`),p=l();if(d){let e=p.sessions.find(e=>e.id===d);e&&(G(e),N(e.caseType),H(e.outputFormat),E(e.reqPaths[0]??``),e.templateId&&F(e.templateId),e.promptPath&&L(e.promptPath),e.knowledgePaths?.length&&B([...e.knowledgePaths]),e.linkedCasePath&&Y({path:e.linkedCasePath,count:0}))}else if(f){let e=p.sessions.find(e=>e.linkedCasePath===f);if(e)G(e),N(e.caseType),H(e.outputFormat),E(e.reqPaths[0]??``),e.templateId&&F(e.templateId),e.promptPath&&L(e.promptPath),e.knowledgePaths?.length&&B([...e.knowledgePaths]),e.linkedCasePath&&Y({path:e.linkedCasePath,count:0});else{let e=f.split(`.`).pop()?.toLowerCase(),t=e===`csv`?`csv`:e===`xlsx`||e===`xls`?`xlsx`:`md`,n=f.split(`/`)[0]??``,r=o().find(e=>e.casesFolder===n)?.id??o()[0]?.id??`functional`,i=ee({title:f.split(`/`).pop()?.replace(/\.[^.]+$/,``)||`用例续改`,caseType:r,outputFormat:t,reqPaths:[]}),a=u(i.id,{linkedCasePath:f}).sessions.find(e=>e.id===i.id)??null;G(a),N(r),H(t),Y({path:f,count:0})}}})(),e},[]),(0,k.useEffect)(()=>{if(!r)return;let e=!1;return ve(M).then(t=>{e||(ye(t),F(e=>e&&t.some(t=>t.id===e)?e:W?.templateId&&t.some(e=>e.id===W.templateId)?W.templateId:t[0]?.id??``))}),()=>{e=!0}},[r,M,W?.templateId]),(0,k.useEffect)(()=>{I?v(`prompts`,I).then(e=>{let t=e.content??``;R(t),t.trim()||a(`「提示词管理/${I}」是空的,生成前请先补上提示词内容。`,`error`)}).catch(e=>{R(``);let t=e instanceof Error?e.message:String(e);a(`没有读到「提示词管理/${I}」:${t}`,`error`)}):R(``)},[I]),(0,k.useEffect)(()=>{ke.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[W?.messages,K]);function $(e){if(!W)return;let t=u(W.id,e);G(t.sessions.find(e=>e.id===W.id)??W)}async function je(){let e=``;if(T)try{let t=await j(T);e+=`\n### 需求文档:${T}\n${t}\n`}catch{e+=`\n### 需求文档:${T}\n(无法读取正文)\n`}Z?.body?e+=`\n### 用例模板:${Z.title}\n${Z.body}\n`:Z&&(e+=`\n### 用例模板:${Z.title}\n字段:${(Z.headers.length?Z.headers:p).join(`、`)}\n`);for(let t of z)try{let n=await v(`knowledge`,t);e+=`\n### 知识库:${t}\n${n.content}\n`}catch{e+=`\n### 知识库:${t}\n(无法读取)\n`}return e}async function Me(e,t,n,r){let i=s(t.caseType),a=n||t.title||i.label,o=f(a,t.caseType),c=i.casesFolder;try{await _(`cases`,`.`,c)}catch{}let l=`${c}/${o}${t.outputFormat===`md`?`.md`:t.outputFormat===`csv`?`.csv`:`.xlsx`}`,u=r.length?r:[...p];return t.outputFormat===`md`?await x(`cases`,l,te(e,a,u)):t.outputFormat===`csv`?await x(`cases`,l,S(e,u)):await m(`cases`,l,await ne(e,u,i.label)),l}async function Ne(){if(!T)return``;let e=pe(T);try{return me(await j(T))||e}catch{return e}}async function Pe(t,n){if(!e){ie(`model`);return}if(!r){q(`本地文档服务未就绪,无法读写用例 / 需求 / 模板库`);return}let i=await Ne(),o=n;o?(u(o.id,{caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}),o={...o,caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}):(o=ee({title:i||t.slice(0,24)||`用例生成`,caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}),G(o));let c=await je(),l=s(M).label,d=Z?.headers?.length?Z.headers:[...p],f=V===`md`?`最终结果将保存为 Markdown 表格文件`:V===`csv`?`最终结果将保存为 CSV 文件`:`最终结果将保存为 Excel 文件`,m=Ce.trim();if(!m){let e=I?`「提示词管理/${I}」没读到内容,请先在提示词管理里补上`:`请先选择提示词`;q(e),a(e,`error`);return}let h=`${m}
|
|
3
3
|
|
|
4
4
|
【运行时约束】
|
|
5
5
|
- 用例类型:${l}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/case-fields.CmePqYfh.js","_astro/react.Blvh0GOs.js","_astro/lib.S37S0T6S.js","_astro/jszip.min.Bh2Mgo40.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{i as r,o as i,s as a}from"./plugins.C0NrHGZv.js";import{n as o,o as s,r as c,s as l}from"./view-prefs.8MPl3A7e.js";import{i as u,n as d,r as f,t as p}from"./dialog.DZHZCe_T.js";import{t as m}from"./jsx-runtime.DUg_B_vD.js";import{t as h}from"./ConfirmDialog.D5qXeML0.js";import{n as g,t as _}from"./DocsPager.D0TMvJ67.js";import{t as v}from"./OverflowHint.pvo2Xc8R.js";import{t as y}from"./SelectDropdown.Dmk5n225.js";import{t as b}from"./SlideOverDrawer.C1IVOc_8.js";import{m as x}from"./PmShared.D6iq_Z9g.js";import{n as S,r as C,t as w}from"./TableFieldConfig.C_NeWm8L.js";import{showToast as T}from"./Toast.BO2NFckG.js";import{i as E,n as D,o as O}from"./case-gen-run.xJQWBg0s.js";import{a as ee,i as k,r as A,t as j}from"./case-fields.CmePqYfh.js";import{c as M,d as te,f as N,g as P,h as ne,n as re,o as F,p as I,r as ie,u as ae}from"./project-docs.DAw9bzgk.js";import{c as oe}from"./case-template.C-GBxgBC.js";import{b as se,p as ce,s as le,u as ue}from"./settings.NTeTjmxg.js";import{M as de,v as fe,z as pe}from"./req-analysis.DWdvPMmm.js";import{s as me}from"./llm.DyweO-KK.js";import{n as he}from"./doc-roots.DAJP9Svr.js";import{i as ge,n as _e,r as ve,t as ye}from"./DocsFileBrowser.DceJyP9V.js";import{d as L,f as be,h as R,l as xe,n as Se,o as Ce,p as z,t as we,v as B}from"./open-docs-in-session.5cTowYAC.js";import{A as Te,C as V,D as Ee,E as H,M as De,N as Oe,O as U,P as ke,S as Ae,T as je,_ as Me,a as W,b as Ne,c as G,d as Pe,f as Fe,g as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,n as He,o as Ue,p as K,s as q,t as J,u as We,v as Ge,w as Ke,x as qe,y as Je}from"./case-review.TdDs1WFM.js";import{a as Ye,c as Xe,d as Ze,i as Qe,l as $e,n as et,o as tt,t as Y}from"./ColumnResize.CkE59sGq.js";import{t as nt}from"./NamePromptDialog.Csfnh5eM.js";import{o as rt,r as it,s as at,t as ot}from"./composer-task.DJmluzPT.js";var X=e(t(),1),st=`备份列表`;function ct(e){return String(e??``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()===st}function lt(e){let t=String(e??``).split(/[/\\]/).pop();return t?/\.bak(?:$|[-_.])/i.test(t):!1}var Z=m(),ut=40,dt=20,ft=`tw.case-backup.page-size.v1`,pt=[{key:`select`,width:ut,min:36},{key:`name`,width:280,min:140},{key:`kind`,width:100,min:72},{key:`mtime`,width:148,min:120},{key:`size`,width:88,min:64},{key:`filler`,filler:!0},{key:`action`,width:72,min:64}];async function mt(e=`.`){let{entries:t}=await M(`cases`,e),n=[];for(let e of t)e.type===`file`?(lt(e.name)||lt(e.path))&&n.push(e):!ct(e.name)&&!ct(e.path)&&n.push(...await mt(e.path));return n}function ht(e){return e===`folder`?`备份列表`:e===`sidecar`?`旁路`:`历史`}function gt(e){if(!Number.isFinite(e))return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}function _t(e){return e==null||!Number.isFinite(e)?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function vt(){let e=[];try{if(await je()){let t=await V();for(let n of t){let t=n.kind===`legacy`?`legacy`:`folder`,r=n.casesPath||(t===`folder`?n.path:``);e.push({id:`${t}:${n.name}:${n.mtime}`,kind:t,name:n.name,path:r||n.path,reviewName:t===`legacy`?n.name:void 0,mtime:n.mtime,size:n.size})}}}catch{}try{let t=await mt(`.`);for(let n of t){let t=typeof n.mtime==`number`?n.mtime:0;e.push({id:`sidecar:${n.path}`,kind:`sidecar`,name:n.name,path:n.path,mtime:t,size:n.size})}}catch{}return e.sort((e,t)=>t.mtime-e.mtime),e}function yt({open:e,onClose:t,onChanged:n}){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)({}),[p,m]=(0,X.useState)(null),[y,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[E,D]=(0,X.useState)(1),[O,ee]=g(dt,ft),k=$e(`lh:case-backup:cols:v4`,pt),A=Ze(`case-backup`),j=(0,X.useCallback)(async()=>{o(!0),u(null);try{let e=await vt();i(e),f(t=>{let n={};for(let r of e)t[r.id]&&(n[r.id]=!0);return n})}catch(e){u(e instanceof Error?e.message:String(e))}finally{o(!1)}},[]);(0,X.useEffect)(()=>{e&&(D(1),j())},[e,j]);let M=Math.max(1,Math.ceil(r.length/O)),N=Math.min(E,M),P=(0,X.useMemo)(()=>r.slice((N-1)*O,N*O),[r,N,O]),F=(0,X.useMemo)(()=>Object.keys(d).filter(e=>d[e]),[d]),I=P.length>0&&P.every(e=>d[e.id]);async function ie(e){c(!0),u(null);try{let t=e.filter(e=>e.kind===`folder`||e.kind===`sidecar`),r=e.filter(e=>e.kind===`legacy`);for(let e of t)await re(`cases`,e.path);r.length&&await Je(r.map(e=>e.reviewName||e.name)),T(e.length===1?`已删除「${e[0].name}」`:`已删除 ${e.length} 个备份`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);u(t),T(`删除失败:${t}`,`error`)}finally{c(!1)}}async function oe(){let e=p;if(m(null),!e)return;if(e.kind===`one`){await ie([e.row]);return}let t=new Map(r.map(e=>[e.id,e])),n=e.ids.map(e=>t.get(e)).filter(Boolean);n.length&&await ie(n)}async function se(e){if(e.kind!==`legacy`)try{await ae(`cases`,e.path)}catch(e){u(e instanceof Error?e.message:String(e))}}function ce(e){e.kind!==`legacy`&&(w(``),S(e))}async function le(e){let t=y;if(!t||t.kind===`legacy`)return;let i=e.trim();if(!i||i===t.name){S(null),w(``);return}let a=te(t.path),o=(a===`.`?i:`${a}/${i}`).toLowerCase(),s=r.find(e=>e.id!==t.id&&e.kind!==`legacy`&&e.path.toLowerCase()===o);if(s)w(`已存在同名文件「${s.name}」,换个名字再试`);else{c(!0),u(null),w(``);try{await ne(`cases`,t.path,i),S(null),T(`已重命名为「${i}」`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);w(t),T(`重命名失败:${t}`,`error`)}finally{c(!1)}}}let ue=p?.kind===`one`?`删除备份「${p.row.name}」?此操作不可恢复。`:p?.kind===`batch`?`确认删除已选中的 ${p.ids.length} 个备份?此操作不可恢复。`:``;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(b,{open:e,onClose:t,title:`备份列表`,closeAriaLabel:`关闭备份列表`,widthClass:`max-w-5xl`,bodyClassName:`flex flex-col gap-3 overflow-hidden`,escDisabled:!!p||y!=null,footer:(0,Z.jsxs)(`footer`,{className:`shrink-0 p-4 border-t border-stone-100 flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:s||F.length===0,onClick:()=>m({kind:`batch`,ids:F}),className:`h-9 px-3 text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:[`删除所选`,F.length?`(${F.length})`:``]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsx)(`button`,{type:`button`,disabled:s||a,onClick:()=>void j(),className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40`,children:`刷新`}),(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50`,children:`关闭`})]}),children:[(0,Z.jsxs)(`p`,{className:`shrink-0 text-xs text-stone-500 leading-5`,children:[`新备份在「用例管理/`,st,`/」(首次备份时自动创建,主列表不展示该文件夹)。历史旁路 .bak* 仍可在此查看。备份不会自动过期,请手动删除。`]}),l?(0,Z.jsx)(`div`,{className:`shrink-0 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:l}):null,(0,Z.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 text-xs text-stone-500`,children:[(0,Z.jsxs)(`span`,{children:[`共 `,(0,Z.jsx)(`span`,{className:`font-medium text-stone-800`,children:r.length}),` 个`]}),a?(0,Z.jsx)(`span`,{children:`加载中…`}):null]}),r.length===0&&!a?(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-dashed border-stone-200 px-4 py-10 flex items-center justify-center text-sm text-stone-400`,children:`暂无备份文件`}):(0,Z.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-hidden rounded-xl border border-stone-200 flex flex-col`,children:[(0,Z.jsx)(`div`,{ref:A,className:`tw-scroll-x flex-1 min-h-0 overflow-auto`,children:(0,Z.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-left text-sm`,style:k.tableStyle,children:[(0,Z.jsx)(`colgroup`,{children:pt.map(e=>(0,Z.jsx)(`col`,{style:k.widthOf(e.key)?{width:k.widthOf(e.key)}:void 0},e.key))}),(0,Z.jsx)(`thead`,{className:`bg-stone-50 text-xs text-stone-500`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`${Ye} relative`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:I,disabled:s||P.length===0,onChange:e=>{let t=e.target.checked;f(e=>{let n={...e};for(let e of P)t?n[e.id]=!0:delete n[e.id];return n})},"aria-label":`全选本页备份`}),(0,Z.jsx)(Y,{...k.resizeProps(`select`)})]}),(0,Z.jsxs)(`th`,{className:tt,style:{"--tw-sticky-left":`${ut}px`},children:[`文件名`,(0,Z.jsx)(Y,{...k.resizeProps(`name`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`类型`,(0,Z.jsx)(Y,{...k.resizeProps(`kind`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`备份时间`,(0,Z.jsx)(Y,{...k.resizeProps(`mtime`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`大小`,(0,Z.jsx)(Y,{...k.resizeProps(`size`)})]}),(0,Z.jsx)(`th`,{"aria-hidden":`true`}),(0,Z.jsx)(`th`,{className:Xe,children:`操作`})]})}),(0,Z.jsx)(`tbody`,{children:P.map(e=>(0,Z.jsxs)(`tr`,{className:`group border-t border-stone-100 ${e.kind===`legacy`?``:`cursor-pointer`}`,onDoubleClick:()=>{e.kind===`legacy`||s||se(e)},children:[(0,Z.jsx)(`td`,{className:et,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!d[e.id],disabled:s,onChange:t=>f(n=>({...n,[e.id]:t.target.checked})),"aria-label":`选择 ${e.name}`})}),(0,Z.jsx)(`td`,{className:`${et} min-w-0 max-w-0`,style:{"--tw-sticky-left":`${ut}px`},children:(0,Z.jsxs)(`div`,{className:`inline-flex min-w-0 max-w-full items-center`,children:[(0,Z.jsx)(v,{text:e.name,className:`min-w-0 truncate font-medium text-stone-800`}),e.kind===`legacy`?null:(0,Z.jsx)(`span`,{className:`ml-0.5 mr-1 flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100`,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,"aria-label":`重命名 ${e.name}`,onClick:()=>ce(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,Z.jsx)(x,{name:`pencil`,size:12})})})]})}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:ht(e.kind)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:gt(e.mtime)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap tabular-nums`,children:_t(e.size)}),(0,Z.jsx)(`td`,{"aria-hidden":`true`}),(0,Z.jsx)(`td`,{className:Qe,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 whitespace-nowrap`,children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>m({kind:`one`,row:e}),className:`h-7 px-2 text-xs font-medium text-red-600 rounded-md hover:bg-red-50 disabled:opacity-40`,children:`删除`})})})]},e.id))})]})}),r.length>0?(0,Z.jsx)(_,{page:N,totalPages:M,pageSize:O,busy:s||a,className:`shrink-0 !px-4 !py-2`,onPage:D,onPageSize:e=>{ee(e),D(1)}}):null]})]}),(0,Z.jsx)(h,{open:!!p,title:p?.kind===`batch`?`批量删除备份`:`删除备份`,message:ue,confirmLabel:`删除`,danger:!0,onClose:()=>m(null),onConfirm:()=>void oe()}),(0,Z.jsx)(nt,{open:y!=null,title:`重命名备份`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:y?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:C,onClose:()=>{s||(S(null),w(``))},onConfirm:e=>void le(e)})]})}async function bt(e){let t=[...pe(e.outline??[]).entries()].sort((e,t)=>e[1]-t[1]).map(([e])=>e),n=new Map((e.stories??[]).map(e=>[e.id.toUpperCase(),e.sourceRefs??[]])),r=[];if(e.sourcePath)try{let t=await xt(e.sourcePath);r=fe(t)}catch{r=[]}return{outlineOrder:t,testPointIds:e.testPoints?.points?.map(e=>e.id)??void 0,idealOrder:r,storySourceRefs:n}}async function xt(t){let n=t.toLowerCase();if(n.endsWith(`.xlsx`)||n.endsWith(`.xls`)){let e=await N(`requirements`,t);if(e.encoding!==`base64`||!e.contentBase64)throw Error(`无法读取 Excel`);let n=await se(()=>import(`./case-fields.CmePqYfh.js`).then(e=>e.d),__vite__mapDeps([0,1])),r=n.read(e.contentBase64,{type:`base64`,cellDates:!0}),i=[];for(let e of r.SheetNames){let t=r.Sheets[e];if(!t)continue;let a=n.utils.sheet_to_csv(t,{blankrows:!1}).trim();a&&i.push(`## 工作表:${e}\n${a}`)}return i.join(`
|
|
2
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{i as r,o as i,s as a}from"./plugins.C0NrHGZv.js";import{n as o,o as s,r as c,s as l}from"./view-prefs.8MPl3A7e.js";import{i as u,n as d,r as f,t as p}from"./dialog.DZHZCe_T.js";import{t as m}from"./jsx-runtime.DUg_B_vD.js";import{t as h}from"./ConfirmDialog.D5qXeML0.js";import{n as g,t as _}from"./DocsPager.D0TMvJ67.js";import{t as v}from"./OverflowHint.pvo2Xc8R.js";import{t as y}from"./SelectDropdown.Dmk5n225.js";import{t as b}from"./SlideOverDrawer.C1IVOc_8.js";import{m as x}from"./PmShared.D6iq_Z9g.js";import{n as S,r as C,t as w}from"./TableFieldConfig.C_NeWm8L.js";import{showToast as T}from"./Toast.BO2NFckG.js";import{i as E,n as D,o as O}from"./case-gen-run.FzgC_1Ki.js";import{a as ee,i as k,r as A,t as j}from"./case-fields.CmePqYfh.js";import{c as M,d as te,f as N,g as P,h as ne,n as re,o as F,p as I,r as ie,u as ae}from"./project-docs.DAw9bzgk.js";import{c as oe}from"./case-template.C-GBxgBC.js";import{b as se,p as ce,s as le,u as ue}from"./settings.NTeTjmxg.js";import{M as de,v as fe,z as pe}from"./req-analysis.BqvytN69.js";import{s as me}from"./llm.DyweO-KK.js";import{n as he}from"./doc-roots.DAJP9Svr.js";import{i as ge,n as _e,r as ve,t as ye}from"./DocsFileBrowser.DceJyP9V.js";import{d as L,f as be,h as R,l as xe,n as Se,o as Ce,p as z,t as we,v as B}from"./open-docs-in-session.5cTowYAC.js";import{A as Te,C as V,D as Ee,E as H,M as De,N as Oe,O as U,P as ke,S as Ae,T as je,_ as Me,a as W,b as Ne,c as G,d as Pe,f as Fe,g as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,n as He,o as Ue,p as K,s as q,t as J,u as We,v as Ge,w as Ke,x as qe,y as Je}from"./case-review.TdDs1WFM.js";import{a as Ye,c as Xe,d as Ze,i as Qe,l as $e,n as et,o as tt,t as Y}from"./ColumnResize.CkE59sGq.js";import{t as nt}from"./NamePromptDialog.Csfnh5eM.js";import{o as rt,r as it,s as at,t as ot}from"./composer-task.DJmluzPT.js";var X=e(t(),1),st=`备份列表`;function ct(e){return String(e??``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()===st}function lt(e){let t=String(e??``).split(/[/\\]/).pop();return t?/\.bak(?:$|[-_.])/i.test(t):!1}var Z=m(),ut=40,dt=20,ft=`tw.case-backup.page-size.v1`,pt=[{key:`select`,width:ut,min:36},{key:`name`,width:280,min:140},{key:`kind`,width:100,min:72},{key:`mtime`,width:148,min:120},{key:`size`,width:88,min:64},{key:`filler`,filler:!0},{key:`action`,width:72,min:64}];async function mt(e=`.`){let{entries:t}=await M(`cases`,e),n=[];for(let e of t)e.type===`file`?(lt(e.name)||lt(e.path))&&n.push(e):!ct(e.name)&&!ct(e.path)&&n.push(...await mt(e.path));return n}function ht(e){return e===`folder`?`备份列表`:e===`sidecar`?`旁路`:`历史`}function gt(e){if(!Number.isFinite(e))return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}function _t(e){return e==null||!Number.isFinite(e)?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function vt(){let e=[];try{if(await je()){let t=await V();for(let n of t){let t=n.kind===`legacy`?`legacy`:`folder`,r=n.casesPath||(t===`folder`?n.path:``);e.push({id:`${t}:${n.name}:${n.mtime}`,kind:t,name:n.name,path:r||n.path,reviewName:t===`legacy`?n.name:void 0,mtime:n.mtime,size:n.size})}}}catch{}try{let t=await mt(`.`);for(let n of t){let t=typeof n.mtime==`number`?n.mtime:0;e.push({id:`sidecar:${n.path}`,kind:`sidecar`,name:n.name,path:n.path,mtime:t,size:n.size})}}catch{}return e.sort((e,t)=>t.mtime-e.mtime),e}function yt({open:e,onClose:t,onChanged:n}){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)({}),[p,m]=(0,X.useState)(null),[y,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[E,D]=(0,X.useState)(1),[O,ee]=g(dt,ft),k=$e(`lh:case-backup:cols:v4`,pt),A=Ze(`case-backup`),j=(0,X.useCallback)(async()=>{o(!0),u(null);try{let e=await vt();i(e),f(t=>{let n={};for(let r of e)t[r.id]&&(n[r.id]=!0);return n})}catch(e){u(e instanceof Error?e.message:String(e))}finally{o(!1)}},[]);(0,X.useEffect)(()=>{e&&(D(1),j())},[e,j]);let M=Math.max(1,Math.ceil(r.length/O)),N=Math.min(E,M),P=(0,X.useMemo)(()=>r.slice((N-1)*O,N*O),[r,N,O]),F=(0,X.useMemo)(()=>Object.keys(d).filter(e=>d[e]),[d]),I=P.length>0&&P.every(e=>d[e.id]);async function ie(e){c(!0),u(null);try{let t=e.filter(e=>e.kind===`folder`||e.kind===`sidecar`),r=e.filter(e=>e.kind===`legacy`);for(let e of t)await re(`cases`,e.path);r.length&&await Je(r.map(e=>e.reviewName||e.name)),T(e.length===1?`已删除「${e[0].name}」`:`已删除 ${e.length} 个备份`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);u(t),T(`删除失败:${t}`,`error`)}finally{c(!1)}}async function oe(){let e=p;if(m(null),!e)return;if(e.kind===`one`){await ie([e.row]);return}let t=new Map(r.map(e=>[e.id,e])),n=e.ids.map(e=>t.get(e)).filter(Boolean);n.length&&await ie(n)}async function se(e){if(e.kind!==`legacy`)try{await ae(`cases`,e.path)}catch(e){u(e instanceof Error?e.message:String(e))}}function ce(e){e.kind!==`legacy`&&(w(``),S(e))}async function le(e){let t=y;if(!t||t.kind===`legacy`)return;let i=e.trim();if(!i||i===t.name){S(null),w(``);return}let a=te(t.path),o=(a===`.`?i:`${a}/${i}`).toLowerCase(),s=r.find(e=>e.id!==t.id&&e.kind!==`legacy`&&e.path.toLowerCase()===o);if(s)w(`已存在同名文件「${s.name}」,换个名字再试`);else{c(!0),u(null),w(``);try{await ne(`cases`,t.path,i),S(null),T(`已重命名为「${i}」`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);w(t),T(`重命名失败:${t}`,`error`)}finally{c(!1)}}}let ue=p?.kind===`one`?`删除备份「${p.row.name}」?此操作不可恢复。`:p?.kind===`batch`?`确认删除已选中的 ${p.ids.length} 个备份?此操作不可恢复。`:``;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(b,{open:e,onClose:t,title:`备份列表`,closeAriaLabel:`关闭备份列表`,widthClass:`max-w-5xl`,bodyClassName:`flex flex-col gap-3 overflow-hidden`,escDisabled:!!p||y!=null,footer:(0,Z.jsxs)(`footer`,{className:`shrink-0 p-4 border-t border-stone-100 flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:s||F.length===0,onClick:()=>m({kind:`batch`,ids:F}),className:`h-9 px-3 text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:[`删除所选`,F.length?`(${F.length})`:``]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsx)(`button`,{type:`button`,disabled:s||a,onClick:()=>void j(),className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40`,children:`刷新`}),(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50`,children:`关闭`})]}),children:[(0,Z.jsxs)(`p`,{className:`shrink-0 text-xs text-stone-500 leading-5`,children:[`新备份在「用例管理/`,st,`/」(首次备份时自动创建,主列表不展示该文件夹)。历史旁路 .bak* 仍可在此查看。备份不会自动过期,请手动删除。`]}),l?(0,Z.jsx)(`div`,{className:`shrink-0 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:l}):null,(0,Z.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 text-xs text-stone-500`,children:[(0,Z.jsxs)(`span`,{children:[`共 `,(0,Z.jsx)(`span`,{className:`font-medium text-stone-800`,children:r.length}),` 个`]}),a?(0,Z.jsx)(`span`,{children:`加载中…`}):null]}),r.length===0&&!a?(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-dashed border-stone-200 px-4 py-10 flex items-center justify-center text-sm text-stone-400`,children:`暂无备份文件`}):(0,Z.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-hidden rounded-xl border border-stone-200 flex flex-col`,children:[(0,Z.jsx)(`div`,{ref:A,className:`tw-scroll-x flex-1 min-h-0 overflow-auto`,children:(0,Z.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-left text-sm`,style:k.tableStyle,children:[(0,Z.jsx)(`colgroup`,{children:pt.map(e=>(0,Z.jsx)(`col`,{style:k.widthOf(e.key)?{width:k.widthOf(e.key)}:void 0},e.key))}),(0,Z.jsx)(`thead`,{className:`bg-stone-50 text-xs text-stone-500`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`${Ye} relative`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:I,disabled:s||P.length===0,onChange:e=>{let t=e.target.checked;f(e=>{let n={...e};for(let e of P)t?n[e.id]=!0:delete n[e.id];return n})},"aria-label":`全选本页备份`}),(0,Z.jsx)(Y,{...k.resizeProps(`select`)})]}),(0,Z.jsxs)(`th`,{className:tt,style:{"--tw-sticky-left":`${ut}px`},children:[`文件名`,(0,Z.jsx)(Y,{...k.resizeProps(`name`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`类型`,(0,Z.jsx)(Y,{...k.resizeProps(`kind`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`备份时间`,(0,Z.jsx)(Y,{...k.resizeProps(`mtime`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`大小`,(0,Z.jsx)(Y,{...k.resizeProps(`size`)})]}),(0,Z.jsx)(`th`,{"aria-hidden":`true`}),(0,Z.jsx)(`th`,{className:Xe,children:`操作`})]})}),(0,Z.jsx)(`tbody`,{children:P.map(e=>(0,Z.jsxs)(`tr`,{className:`group border-t border-stone-100 ${e.kind===`legacy`?``:`cursor-pointer`}`,onDoubleClick:()=>{e.kind===`legacy`||s||se(e)},children:[(0,Z.jsx)(`td`,{className:et,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!d[e.id],disabled:s,onChange:t=>f(n=>({...n,[e.id]:t.target.checked})),"aria-label":`选择 ${e.name}`})}),(0,Z.jsx)(`td`,{className:`${et} min-w-0 max-w-0`,style:{"--tw-sticky-left":`${ut}px`},children:(0,Z.jsxs)(`div`,{className:`inline-flex min-w-0 max-w-full items-center`,children:[(0,Z.jsx)(v,{text:e.name,className:`min-w-0 truncate font-medium text-stone-800`}),e.kind===`legacy`?null:(0,Z.jsx)(`span`,{className:`ml-0.5 mr-1 flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100`,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,"aria-label":`重命名 ${e.name}`,onClick:()=>ce(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,Z.jsx)(x,{name:`pencil`,size:12})})})]})}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:ht(e.kind)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:gt(e.mtime)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap tabular-nums`,children:_t(e.size)}),(0,Z.jsx)(`td`,{"aria-hidden":`true`}),(0,Z.jsx)(`td`,{className:Qe,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 whitespace-nowrap`,children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>m({kind:`one`,row:e}),className:`h-7 px-2 text-xs font-medium text-red-600 rounded-md hover:bg-red-50 disabled:opacity-40`,children:`删除`})})})]},e.id))})]})}),r.length>0?(0,Z.jsx)(_,{page:N,totalPages:M,pageSize:O,busy:s||a,className:`shrink-0 !px-4 !py-2`,onPage:D,onPageSize:e=>{ee(e),D(1)}}):null]})]}),(0,Z.jsx)(h,{open:!!p,title:p?.kind===`batch`?`批量删除备份`:`删除备份`,message:ue,confirmLabel:`删除`,danger:!0,onClose:()=>m(null),onConfirm:()=>void oe()}),(0,Z.jsx)(nt,{open:y!=null,title:`重命名备份`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:y?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:C,onClose:()=>{s||(S(null),w(``))},onConfirm:e=>void le(e)})]})}async function bt(e){let t=[...pe(e.outline??[]).entries()].sort((e,t)=>e[1]-t[1]).map(([e])=>e),n=new Map((e.stories??[]).map(e=>[e.id.toUpperCase(),e.sourceRefs??[]])),r=[];if(e.sourcePath)try{let t=await xt(e.sourcePath);r=fe(t)}catch{r=[]}return{outlineOrder:t,testPointIds:e.testPoints?.points?.map(e=>e.id)??void 0,idealOrder:r,storySourceRefs:n}}async function xt(t){let n=t.toLowerCase();if(n.endsWith(`.xlsx`)||n.endsWith(`.xls`)){let e=await N(`requirements`,t);if(e.encoding!==`base64`||!e.contentBase64)throw Error(`无法读取 Excel`);let n=await se(()=>import(`./case-fields.CmePqYfh.js`).then(e=>e.d),__vite__mapDeps([0,1])),r=n.read(e.contentBase64,{type:`base64`,cellDates:!0}),i=[];for(let e of r.SheetNames){let t=r.Sheets[e];if(!t)continue;let a=n.utils.sheet_to_csv(t,{blankrows:!1}).trim();a&&i.push(`## 工作表:${e}\n${a}`)}return i.join(`
|
|
3
3
|
|
|
4
4
|
`).trim()}if(n.endsWith(`.docx`)){let n=await N(`requirements`,t);if(n.encoding!==`base64`||!n.contentBase64)throw Error(`无法读取 docx`);let r=atob(n.contentBase64),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return((await(await se(()=>import(`./lib.S37S0T6S.js`).then(t=>e(t.default,1)),__vite__mapDeps([2,1,3]))).extractRawText({arrayBuffer:i.buffer})).value??``).trim()}return(await I(`requirements`,t)).content}async function St(){try{return await de()}catch{return[]}}function Ct(e,t){let n=A(t).no;return n?e.map((e,t)=>({...e,[n]:String(t+1)})):e}async function wt(e,t={}){let n=await oe(e),r=O(n.rows,n.headers,{outlineOrder:t.outlineOrder,testPointIds:t.testPointIds,idealOrder:t.idealOrder,storySourceRefs:t.storySourceRefs}),i=r.filter((e,t)=>e!==n.rows[t]).length,a=Ct(r,n.headers),o=A(n.headers),s=o.no,c=o.title,l=o.reqCite,u=a.slice(0,5).map(e=>({no:s?String(e[s]??``):``,title:c?String(e[c]??``):``,cite:l?String(e[l]??``):``}));return{casePath:e,headers:n.headers,rows:a,moved:i,total:a.length,preview:u}}async function Tt(e){let t=await Ge(e.casePath);return{backup:(await Re(e.casePath,e.headers,e.rows)).backup||t.backup}}var Et=`__none__`;function Dt({open:e,casePath:t,fileName:n,onClose:r,onDone:i,onError:a}){let[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)(Et),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!e)return;let t=!0;return l(Et),h(null),S(``),b(!1),(async()=>{try{let e=await St();if(!t)return;s(e)}catch{t&&s([])}})(),()=>{t=!1}},[e]);let C=(0,X.useCallback)(async()=>{if(c===Et)return{};let e=o.find(e=>e.id===c);if(!e)return{};try{return await bt(e)}catch{return{outlineOrder:void 0,testPointIds:e.testPoints?.points?.map(e=>e.id)}}},[c,o]);(0,X.useEffect)(()=>{if(!e||!t)return;let n=!0;return _(!0),S(``),(async()=>{try{let e=await wt(t,await C());n&&h(e)}catch(e){if(!n)return;h(null),S(e instanceof Error?e.message:String(e))}finally{n&&_(!1)}})(),()=>{n=!1}},[e,t,C]);let w=(0,X.useMemo)(()=>[{value:Et,label:`仅按引用编号(RO / TP)`,muted:!0},...o.map(e=>({value:e.id,label:e.title||e.sourceTitle||e.id,secondary:e.sourcePath}))],[o]);async function T(){if(m&&!v){if(m.moved===0)i(`用例顺序已是最终顺序,文件未改动`),r();else{b(!0),S(``);try{await Tt(m),i(`已重排 ${m.total} 条用例(移动 ${m.moved} 行),原文件已备份到「备份列表」`),r()}catch(e){let t=e instanceof Error?e.message:String(e);S(t),a(`重排失败:${t}`)}finally{b(!1)}}}}return(0,Z.jsxs)(f,{open:e,onClose:()=>v?void 0:r(),className:`relative z-110`,children:[(0,Z.jsx)(p,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,Z.jsxs)(u,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim flex w-full max-w-lg flex-col rounded-xl border border-stone-200 bg-white p-5 shadow-xl`,children:[(0,Z.jsx)(d,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:`按需求重排用例`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 break-all`,children:n}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:`需求来源`}),(0,Z.jsx)(y,{options:w,value:c,onChange:l,ariaLabel:`重排依据的需求分析记录`,className:`mt-1.5`,disabled:v}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`排序口径:需求条目(RO)→ 条目内测试点(TP)→ 原文件顺序;用例编号会按新顺序重编为 1…N。`})]}),(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-stone-200 bg-stone-50/60 p-3`,children:g?(0,Z.jsx)(`p`,{className:`text-xs text-stone-500`,children:`正在计算排序结果…`}):m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-xs text-stone-600`,children:[`共 `,m.total,` 条用例,需要移动`,` `,(0,Z.jsx)(`span`,{className:`font-semibold tabular-nums`,children:m.moved}),` 行`,m.moved===0?`(已是最终顺序)`:``]}),m.preview.length?(0,Z.jsxs)(`table`,{className:`mt-2 w-full table-fixed border-collapse text-[11px]`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`text-stone-400`,children:[(0,Z.jsx)(`th`,{className:`w-10 pb-1 text-left font-normal`,children:`编号`}),(0,Z.jsx)(`th`,{className:`pb-1 text-left font-normal`,children:`用例标题`}),(0,Z.jsx)(`th`,{className:`w-40 pb-1 text-left font-normal`,children:`引用需求点`})]})}),(0,Z.jsx)(`tbody`,{children:m.preview.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`align-top text-stone-600`,children:[(0,Z.jsx)(`td`,{className:`py-0.5 pr-2 tabular-nums`,children:e.no}),(0,Z.jsx)(`td`,{className:`truncate py-0.5 pr-2`,children:e.title}),(0,Z.jsx)(`td`,{className:`truncate py-0.5 text-stone-500`,children:e.cite})]},`${e.no}-${t}`))})]}):null]}):(0,Z.jsx)(`p`,{className:`text-xs text-stone-500`,children:`暂无可预览的行`})}),x?(0,Z.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-red-600`,children:x}):null,(0,Z.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:`取消`}),(0,Z.jsx)(`button`,{type:`button`,disabled:v||g||!m,onClick:()=>void T(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:v?`重排中…`:`开始重排`})]})]})})]})}var Ot=[`all`,...Be,`ignored`],kt={blue:`text-sky-700`,purple:`text-violet-700`,green:`text-emerald-700`,amber:`text-amber-700`,yellow:`text-yellow-700`,red:`text-rose-700`,gray:`text-stone-600`,muted:`text-stone-500`},At={blue:`bg-sky-500`,purple:`bg-violet-500`,green:`bg-emerald-500`,amber:`bg-amber-500`,yellow:`bg-yellow-500`,red:`bg-rose-500`,gray:`bg-stone-400`,muted:`bg-stone-300`};function jt(e){return e>=85?`green`:e>=60?`amber`:`red`}function Mt(e){let t=Date.parse(e);if(!Number.isFinite(t))return`—`;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`刚刚`;let r=Math.floor(n/60);if(r<60)return`${r} 分钟前`;let i=Math.floor(r/60);if(i<24)return`${i} 小时前`;let a=Math.floor(i/24);return a<30?`${a} 天前`:new Date(t).toLocaleDateString()}function Nt({review:e,running:t,modelReady:n,onRun:r,onStop:i,onFix:a,onFixBatch:u,onIgnore:d,onUnignore:f,autoFixedKeys:p,onExport:m}){let[h,g]=(0,X.useState)(()=>o(`caseReview.quality.filter`,[...Ot],`all`)),[_,v]=(0,X.useState)(()=>c(`caseReview.quality.search`)),[y,b]=(0,X.useState)({}),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(()=>o(`caseReview.quality.worstFirst`,[`1`,`0`],`0`)===`1`),T=e=>{g(e),s(`caseReview.quality.filter`,e)},E=e=>{v(e),l(`caseReview.quality.search`,e)},D=e=>{w(e),s(`caseReview.quality.worstFirst`,e?`1`:`0`)},O=(0,X.useMemo)(()=>{let t=e?.cases??[];return p?.size?t.map(e=>{let t=K(e);return t&&p.has(t)?{...e,fixed:!0}:e}):t},[e,p]),ee=(0,X.useMemo)(()=>O.filter(e=>e.ignored).length,[O]),k=(0,X.useMemo)(()=>{let e={usable:0,revise:0,invalid:0};for(let t of O)t.ignored||(e[t.verdict]+=1);return e},[O]),A=(0,X.useMemo)(()=>{let e=_.trim().toLowerCase(),t=O.filter(t=>{if(h===`ignored`){if(!t.ignored)return!1}else if(t.ignored||h!==`all`&&t.verdict!==h)return!1;return!e||`${t.no} ${t.title}`.toLowerCase().includes(e)});return C?[...t].sort((e,t)=>e.score-t.score):t},[O,h,_,C]),j=h===`revise`||h===`invalid`,[M,te]=(0,X.useState)(()=>new Set);(0,X.useEffect)(()=>{te(new Set)},[h]);let N=(0,X.useMemo)(()=>A.filter(e=>!e.ignored&&e.verdict!==`usable`&&!e.fixed),[A]),P=(0,X.useMemo)(()=>N.filter(e=>{let t=K(e);return!!(t&&M.has(t))}),[N,M]),ne=N.length>0&&N.every(e=>{let t=K(e);return!!(t&&M.has(t))}),re=P.length?P:N,F=!j||N.length===0,I=e=>{e&&te(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t?(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 px-3 rounded-lg text-xs font-medium border border-rose-300 bg-rose-50 text-rose-700 hover:bg-rose-100`,children:`停止评审`}):(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`h-8 px-3 rounded-lg text-xs font-medium bg-stone-900 text-white hover:bg-stone-800`,children:e?`重新评审`:`开始评审`}),(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:!e||t,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:`导出 Markdown`}),(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:n?`规则 + 模型:语义问题与扣分原因由模型补`:`未配置模型:只跑规则判定`}),e?(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[11px] text-stone-400`,children:[e.modelCovered!=null&&e.modelCovered<O.length?(0,Z.jsxs)(`span`,{className:`text-amber-700`,children:[`模型只评到 `,e.modelCovered,`/`,O.length,` 条,其余按规则分`]}):null,(0,Z.jsxs)(`span`,{children:[`上次评审:`,Mt(e.at)]})]}):null]}),e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-stone-50/60 px-3 py-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`flex w-full items-center gap-2 text-left`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`看到结论后怎么处理`}),(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:x?`收起`:`展开`})]}),x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`ul`,{className:`mt-1.5 space-y-1 text-[11px] leading-relaxed text-stone-600`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.invalid.badge}`,children:`错误无效`}),`点这条右侧的「修改」,会带着编号、扣分原因与建议跳到工作台(用例绑定的会话,没有就新建), 让模型按建议改;跳转本身不标「已修改」。改完文件后回来,若正文相对上次评审有变,会自动标「已修改」。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.revise.badge}`,children:`待修改`}),`不影响执行,按建议补齐边界 / 异常 / 前置条件即可;改完回来自动识别,或批量改完再整体重评一次。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`忽略`}),`这条不再参与后续评审与「待修改」统计;点「忽略」后可在「忽略」筛选里「取消忽略」。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`批量修改`}),`切到「错误无效 / 待修改」,可勾选后点「批量修改」;未勾选时对本筛选下全部可改条生效。跳转不标已修改。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.usable.badge}`,children:`可用`}),`可直接执行或入库;这里只读,不会自动改你的用例文件。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`重新评审`}),`首次(无「已修改」)评全部未忽略条;有「已修改」时只重审这些条并按分数重判(未达可用仍为待修改 / 无效,不会因标过「已修改」就自动变可用),未改的保留上次判定;忽略的永远不送评。`]})]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-[10px] text-stone-400`,children:`改文件后报告会标「可能已过期」,重新评审即刷新;每次结果都存在「用例评审」目录里。`})]}):null]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:`总分`}),(0,Z.jsx)(`div`,{className:`text-xl font-semibold ${kt[jt(e.score)]}`,children:e.score}),(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:e.modeled?`规则 + 模型`:`仅规则`})]}),Be.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:G[e].label}),(0,Z.jsx)(`div`,{className:`text-xl font-semibold ${kt[G[e].tone]}`,children:k[e]}),(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:G[e].hint})]},e))]}),(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`五维得分(整批平均)`}),(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-400`,children:`每维 0–100 分;左侧百分比是权重,右侧数字才是这一维的得分`})]}),(0,Z.jsxs)(`div`,{className:`mt-2 mb-1 flex items-center gap-2 text-[10px] text-stone-400`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0`,children:`维度`}),(0,Z.jsx)(`span`,{className:`w-9 shrink-0 text-right`,children:`权重`}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(`span`,{className:`w-8 shrink-0 text-right`,children:`得分`})]}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:e.dimensions.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 text-[11px] text-stone-600`,children:e.label}),(0,Z.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-[11px] tabular-nums text-stone-400`,children:[e.weight,`%`]}),(0,Z.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,Z.jsx)(`div`,{className:`h-full ${At[W[e.key]?.tone??`gray`]}`,style:{width:`${e.score}%`}})}),(0,Z.jsx)(`span`,{className:`w-8 shrink-0 text-right text-[11px] tabular-nums text-stone-700`,children:e.score})]},e.key))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-stone-400`,children:[`总分 `,e.score,` = 各维度得分 × 权重求和(不是右侧某个数字); ≥`,` `,We.usable,` 可用 · `,We.revise,`–`,We.usable-1,` 待修改 · < `,We.revise,` 错误无效。`]})]}),(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsxs)(`h3`,{className:`mb-2 text-xs font-semibold text-stone-700`,children:[`量化指标`,(0,Z.jsx)(`span`,{className:`ml-1 font-normal text-stone-400`,children:`七项 + 硬伤条数`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:e.metrics.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-lg border border-stone-100 bg-stone-50/60 px-2.5 py-2`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-base font-semibold text-stone-800 tabular-nums`,children:e.text}),(0,Z.jsx)(`div`,{className:`text-[10px] leading-tight text-stone-400`,children:e.hint})]},e.key))})]}),e.summary?(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsx)(`h3`,{className:`mb-1 text-xs font-semibold text-stone-700`,children:`整体结论`}),(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-stone-600 whitespace-pre-wrap`,children:e.summary})]}):null,(0,Z.jsx)(`div`,{className:`sticky -top-4 z-10 -mx-4 bg-white px-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-stone-200 bg-white px-3 py-2 shadow-sm`,children:[j?(0,Z.jsxs)(`label`,{className:`flex h-6 shrink-0 items-center gap-1.5 text-[11px] text-stone-600`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:ne,disabled:!N.length,onChange:()=>{if(ne){te(new Set);return}let e=new Set;for(let t of N){let n=K(t);n&&e.add(n)}te(e)},className:`rounded border-stone-300`}),`全选`]}):null,(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`逐条明细`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(Pt,{active:h===`all`,onClick:()=>T(`all`),children:[`全部 `,O.length-ee]}),Be.map(e=>(0,Z.jsxs)(Pt,{active:h===e,onClick:()=>T(e),children:[G[e].label,` `,k[e]]},e)),(0,Z.jsxs)(Pt,{active:h===`ignored`,onClick:()=>T(`ignored`),children:[`忽略`,ee?` ${ee}`:``]})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>D(!C),className:`ml-auto h-6 shrink-0 rounded-md px-2 text-[11px] transition-colors ${C?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:`按分数升序`}),(0,Z.jsx)(`input`,{value:_,onChange:e=>E(e.target.value),placeholder:`搜编号 / 标题`,className:`h-7 w-40 rounded-lg border border-stone-200 px-2 text-xs outline-none focus:border-stone-400`}),(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>u(re),className:`h-7 shrink-0 rounded-lg border border-stone-200 px-2 text-[11px] text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-40`,children:[`批量修改`,j&&P.length?` ${P.length}`:j&&N.length?` ${N.length}`:``]})]})}),(0,Z.jsx)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:(0,Z.jsxs)(`ul`,{className:`divide-y divide-stone-100`,children:[A.map((e,t)=>{let n=K(e),r=`${e.no}-${t}`,i=!e.ignored&&e.verdict!==`usable`&&!e.fixed;return(0,Z.jsx)(Ft,{item:e,open:y[r]===!0,onToggle:()=>b(e=>({...e,[r]:!e[r]})),onFix:()=>a(e),onIgnore:()=>d(e),onUnignore:()=>f(e),selectable:j&&i,checked:!!(n&&M.has(n)),onToggleSelect:n?()=>I(n):void 0},r)}),A.length?null:(0,Z.jsx)(`li`,{className:`px-3 py-8 text-center text-xs text-stone-400`,children:`没有符合条件的用例`})]})})]}):(0,Z.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-stone-600`,children:`还没有评审结果`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`评审按五维打分(需求覆盖 / 步骤可执行 / 预期可判定 / 数据与边界 / 规范完整), 算七项量化指标,并把每条判成「可用 / 待修改 / 错误无效」;只读不改用例。`})]})]})}function Pt({active:e,onClick:t,children:n}){return(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-6 rounded-md px-2 text-[11px] transition-colors ${e?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:n})}function Ft({item:e,open:t,onToggle:n,onFix:r,onIgnore:i,onUnignore:a,selectable:o,checked:s,onToggleSelect:c}){let l=G[e.verdict],u=!e.ignored&&e.verdict!==`usable`&&!e.fixed,d=Ve(e);return(0,Z.jsxs)(`li`,{className:`group px-3 py-2 ${e.fixed||e.ignored?`opacity-70`:``}`,children:[(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`flex w-full items-center gap-2 text-left`,children:[o?(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!s,onChange:()=>c?.(),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:`shrink-0 rounded border-stone-300`}):null,(0,Z.jsx)(`span`,{className:`inline-flex w-14 shrink-0 items-center justify-center rounded border px-1 py-0.5 text-[10px] leading-4 ${e.ignored?`border-stone-200 bg-stone-50 text-stone-500`:e.fixed?`border-emerald-200 bg-emerald-50 text-emerald-700`:l.badge}`,children:e.ignored?`已忽略`:e.fixed?`已修改`:l.label}),(0,Z.jsx)(`span`,{className:`w-16 shrink-0 truncate text-left text-[11px] tabular-nums leading-4 text-stone-500`,children:e.no||`—`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left text-xs leading-4 text-stone-800`,children:e.title||`(无标题)`}),e.ignored?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`取消忽略`}):u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`修改`}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`忽略`})]}):null]}),(0,Z.jsx)(`span`,{className:`w-7 shrink-0 text-right text-[11px] tabular-nums leading-4 text-stone-500`,children:e.score}),(0,Z.jsx)(`span`,{className:`flex h-5 w-8 shrink-0 items-center justify-center text-[10px] text-stone-400`,children:t?`收起`:`详情`})]}),t?(0,Z.jsxs)(`div`,{className:`mt-2 space-y-2 pl-1`,children:[e.hard?(0,Z.jsxs)(`p`,{className:`rounded-md border border-rose-200 bg-rose-50 px-2 py-1 text-[11px] text-rose-700`,children:[`硬伤:`,e.hard]}):null,(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.keys(W).map(t=>(0,Z.jsxs)(`span`,{className:`rounded-md border border-stone-100 bg-stone-50 px-2 py-0.5 text-[10px] text-stone-600`,children:[W[t].label,` `,e.dimensions[t]]},t))}),e.deductions.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:e.deductions.map((e,t)=>(0,Z.jsxs)(`li`,{className:`rounded-md bg-stone-50 px-2 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-[11px] text-stone-700`,children:[(0,Z.jsxs)(`span`,{className:`mr-1 font-medium text-stone-500`,children:[`[`,W[e.dimension]?.label??e.dimension,e.points?` −${e.points}`:``,`]`]}),e.reason]}),e.suggestion?(0,Z.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-emerald-700`,children:[`建议:`,e.suggestion]}):null]},t))}):d.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:d.map((e,t)=>(0,Z.jsx)(`li`,{className:`rounded-md bg-stone-50 px-2 py-1.5 text-[11px] text-stone-500`,children:e},t))}):(0,Z.jsx)(`p`,{className:`text-[11px] text-stone-400`,children:`没有扣分项。`})]}):null]})}var It={blue:`border-sky-200 bg-sky-50 text-sky-700`,purple:`border-violet-200 bg-violet-50 text-violet-700`,green:`border-emerald-200 bg-emerald-50 text-emerald-700`,amber:`border-amber-200 bg-amber-50 text-amber-800`,yellow:`border-yellow-200 bg-yellow-50 text-yellow-800`,red:`border-rose-200 bg-rose-50 text-rose-700`,gray:`border-stone-200 bg-stone-50 text-stone-600`,muted:`border-stone-200 bg-white text-stone-400`};function Lt({report:e,loading:t,running:n,completing:r,modelReady:i,selected:a,onToggle:o,onToggleCategory:s,onDetect:c,onStop:l,onComplete:u,onWriteback:d,onExport:f}){let p=e?.items??[],m=(0,X.useMemo)(()=>p.filter(e=>!e.added),[p]),h=p.length-m.length,g=(0,X.useMemo)(()=>U(p),[p]),[_,v]=(0,X.useState)(new Set),y=(0,X.useMemo)(()=>m.map(e=>e.id),[m]),b=(0,X.useMemo)(()=>y.filter(e=>a.has(e)).length,[y,a]),x=y.length>0&&y.every(e=>a.has(e)),S=e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg border border-stone-200 bg-stone-50/60 px-3 py-2 text-[11px] leading-relaxed text-stone-500`,children:`用途:找出「需求里有、用例里没有」的场景(非功能、安全边界、兼容性、隐藏业务规则), 不是挑现有用例的毛病,而是补漏。流程:① 探测盲区 → ② 勾选要补的条目 → ③「补全选中」写全前置 / 步骤 / 预期 → ④「去工作台写回」跳到绑定会话,按归属需求插到对应分组最后一行之后(写前备份,不动原有行;对不上组才落到末尾)。写回后标「已修改」;重新探测会去掉已确认写回的场景。`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:c,disabled:n||r,className:`h-8 px-3 rounded-lg text-xs font-medium bg-stone-900 text-white hover:bg-stone-800 disabled:opacity-50`,children:n?`探测中…`:e?`重新探测`:`探测盲区`}),n?(0,Z.jsx)(`button`,{type:`button`,onClick:l,className:`h-8 px-3 rounded-lg text-xs border border-rose-200 text-rose-600 hover:bg-rose-50`,children:`停止`}):null,(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!b||r||n,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:r?`补全中…`:`补全选中 ${b||``}`}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,disabled:!b||n||t,className:`h-8 px-3 rounded-lg text-xs font-medium border border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 disabled:opacity-40`,children:`去工作台写回 ${b||``}`}),(0,Z.jsx)(`button`,{type:`button`,onClick:f,disabled:!e,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:`导出 Markdown`}),(0,Z.jsx)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:m.length?`已选 ${b} / 共 ${m.length}${h?` · 已修改 ${h}`:``}`:h?`已修改 ${h}`:``}),(0,Z.jsx)(`button`,{type:`button`,disabled:!y.length,onClick:()=>s(y,!x),className:`h-6 shrink-0 rounded-md px-2 text-[11px] text-stone-500 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:x?`清空`:`全选`})]}),i?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[11px] text-amber-800`,children:`场景探测要靠模型推理,先在设置里配好模型。`}),t?(0,Z.jsx)(`p`,{className:`py-8 text-center text-xs text-stone-400`,children:`读取中…`}):!e||!e.items.length&&!n?(0,Z.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-stone-600`,children:`还没有探测结果`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`会从非功能、安全边界、兼容性与隐藏业务规则四个方向找现有用例的缺口。`})]}):(0,Z.jsxs)(Z.Fragment,{children:[e.summary?(0,Z.jsx)(`p`,{className:`rounded-lg border border-stone-200 bg-white px-3 py-2 text-xs leading-relaxed text-stone-600 whitespace-pre-wrap`,children:e.summary}):null,g.map(e=>{let t=J[e.key],n=e.items.filter(e=>!e.added).map(e=>e.id),r=n.length>0&&n.every(e=>a.has(e)),i=_.has(e.key),c=n.filter(e=>a.has(e)).length,l=e.items.filter(e=>e.added).length;return(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S(e.key),className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,Z.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] ${It[t.tone]}`,children:t.mark}),(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:t.label}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[e.items.length,` 条`,c?` · 已选 ${c}`:``,l?` · 已修改 ${l}`:``]}),(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] text-stone-400`,children:i?`展开`:`收起`})]}),n.length?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>s(n,!r),className:`h-6 shrink-0 rounded-md px-2 text-[11px] text-stone-500 transition-colors hover:bg-stone-100`,children:r?`取消本类`:`全选本类`}):null]}),i?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`px-3 pt-2 text-[11px] text-stone-400`,children:t.hint}),(0,Z.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:e.items.map(e=>(0,Z.jsx)(Rt,{item:e,checked:a.has(e.id),onToggle:()=>o(e.id)},e.id))})]})]},e.key)})]}),b?(0,Z.jsxs)(`p`,{className:`sticky bottom-0 rounded-lg border border-stone-200 bg-white/95 px-3 py-2 text-[11px] text-stone-500 shadow-sm backdrop-blur`,children:[`已选 `,b,` 条:可以先「补全选中」把字段写全,也可以直接「去工作台写回」—— 会按归属需求插到对应分组下面(不是整份追加到末尾),写前自动备份。`]}):null]})}function Rt({item:e,checked:t,onToggle:n}){let[r,i]=(0,X.useState)(!1),a=q[e.severity],o=e.added;return(0,Z.jsxs)(`li`,{className:`px-3 py-2 ${o?`opacity-70`:``}`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:t&&!o,disabled:o,onChange:n,className:`mt-1 h-3.5 w-3.5 shrink-0 accent-stone-900 disabled:opacity-40`,"aria-label":`选择 ${e.title}`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex-1 min-w-0 text-left`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 rounded border px-1 py-0.5 text-[10px] ${It[a.tone]}`,children:a.label}),o?(0,Z.jsx)(`span`,{className:`shrink-0 rounded border border-emerald-200 bg-emerald-50 px-1 py-0.5 text-[10px] text-emerald-700`,children:`已修改`}):null,(0,Z.jsx)(`span`,{className:`flex-1 min-w-0 text-xs text-stone-800`,children:e.title}),(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-stone-400`,children:e.priority})]}),e.reqAnchor?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-stone-400`,children:[`归属:`,e.reqAnchor]}):null,e.why?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-500`,children:[`容易漏:`,e.why]}):null]})]}),r?(0,Z.jsxs)(`dl`,{className:`mt-2 space-y-1 rounded-md bg-stone-50 px-2 py-1.5 text-[11px] text-stone-600`,children:[(0,Z.jsx)(zt,{label:`归属需求`,value:e.reqAnchor}),(0,Z.jsx)(zt,{label:`前置条件`,value:e.precondition}),(0,Z.jsx)(zt,{label:`步骤`,value:e.steps.map((e,t)=>`${t+1}. ${e}`).join(` `)}),(0,Z.jsx)(zt,{label:`预期`,value:e.expected})]}):null]})}function zt({label:e,value:t}){return t?(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-14 shrink-0 text-stone-400`,children:e}),(0,Z.jsx)(`dd`,{className:`flex-1 whitespace-pre-wrap`,children:t})]}):null}var Bt=[`module`,`type`,`priority`],Vt=[{key:`no`,width:84,min:72},{key:`title`,width:168,min:120},{key:`steps`,width:200,min:150},{key:`expected`,width:192,min:150},{key:`verdict`,width:112,min:104},{key:`suggestions`,width:220,min:200},{key:`filler`,filler:!0}],Ht=new Set([`no`,`title`,`filler`]),Ut=[{key:`steps`,label:`测试步骤`},{key:`expected`,label:`预期结果`},{key:`verdict`,label:`规则判定`},{key:`suggestions`,label:`修改建议`}],Wt=`case-review.fields`,Gt=`lh:case-review:cols:v1`;function Kt(e){return e.replace(/\.[A-Za-z0-9]+$/,``).trim().toLowerCase()}function qt({file:e,audit:t,review:n,fileName:r,autoFixedKeys:i}){let a=(0,X.useMemo)(()=>e?.rows??[],[e]),[u,d]=(0,X.useState)(()=>o(`caseReview.table.filter`,[`all`,...Be],`all`)),[f,p]=(0,X.useState)(()=>c(`caseReview.table.search`)),m=e=>{d(e),s(`caseReview.table.filter`,e)},h=e=>{p(e),l(`caseReview.table.search`,e)},g=C(Wt,Ut,Ht),_=(0,X.useMemo)(()=>S(Vt,g.isVisible),[g.isVisible]),y=$e(Gt,_),b=Ze(`case-review`),x=(0,X.useMemo)(()=>A(e?.headers??[]),[e]),T=(0,X.useMemo)(()=>{let e=new Map,r=new Map;for(let t of n?.cases??[]){let n=K(t),a=n&&i?.has(n)&&!t.fixed?{...t,fixed:!0}:t;a.no&&e.set(a.no.trim(),a),a.title&&r.set(a.title.trim(),a)}return a.map((n,i)=>{let a=String(n[x.no??j.no]??``).trim(),o=String(n[x.title??j.title]??``).trim();return(a?e.get(a):void 0)??(o?r.get(o):void 0)??t?.cases[i]??null})},[a,x,n,t,i]),E=(0,X.useMemo)(()=>{let e={usable:0,revise:0,invalid:0};for(let t of T)t&&(e[t.verdict]+=1);return e},[T]),D=(0,X.useMemo)(()=>a.map((e,t)=>{let n=T[t],i=t=>String(e[x[t]??j[t]]??``),a=r?Kt(r):``,o=Bt.map(i).map(e=>e.trim()).filter(e=>!!e&&(!a||Kt(e)!==a)).join(` · `);return{key:t,no:i(`no`),title:i(`title`),meta:o,steps:i(`steps`),expected:i(`expected`),verdict:n,suggestions:n?Ve(n):[]}}),[a,x,T,r]),O=(0,X.useMemo)(()=>{let e=f.trim().toLowerCase();return D.filter(t=>u!==`all`&&t.verdict?.verdict!==u?!1:!e||`${t.no} ${t.title}`.toLowerCase().includes(e))},[D,u,f]);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,style:{height:`calc(100vh - 9rem)`},children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:e?`${a.length} 条 · ${e.ext}`:`未读到用例文件`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(Jt,{active:u===`all`,onClick:()=>m(`all`),children:[`全部 `,D.length]}),Be.map(e=>(0,Z.jsxs)(Jt,{active:u===e,onClick:()=>m(e),children:[G[e].label,` `,E[e]]},e))]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{value:f,onChange:e=>h(e.target.value),placeholder:`搜编号 / 标题`,className:`h-7 w-40 rounded-lg border border-stone-200 px-2 text-xs outline-none focus:border-stone-400`}),(0,Z.jsx)(w,{fields:g.fields,isVisible:g.isVisible,onToggle:g.toggle})]})]}),(0,Z.jsxs)(`p`,{className:`shrink-0 text-[11px] text-stone-400`,children:[n?`只读对照:判定与「质量评审」一致;要改用例回「用例管理」,或在质量评审里点「修改」跳工作台。`:`只读对照:还没评审,先用规则体检结果;要改用例回「用例管理」。`,(0,Z.jsx)(`span`,{className:`ml-1 text-stone-300`,children:`拖动表头右边缘可调列宽,双击恢复默认。`})]}),a.length?(0,Z.jsx)(`div`,{ref:b,className:`tw-scroll-x min-h-0 flex-1 overflow-auto rounded-xl border border-stone-200 bg-white`,children:(0,Z.jsxs)(`table`,{className:`tw-sticky-table table-fixed text-left text-xs`,style:y.tableStyle,children:[(0,Z.jsx)(`colgroup`,{children:_.map(e=>(0,Z.jsx)(`col`,{style:y.widthOf(e.key)?{width:y.widthOf(e.key)}:void 0},e.key))}),(0,Z.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-[11px] text-stone-500`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:tt,children:[`用例编号`,(0,Z.jsx)(Y,{...y.resizeProps(`no`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`用例标题`,(0,Z.jsx)(Y,{...y.resizeProps(`title`)})]}),g.isVisible(`steps`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`测试步骤`,(0,Z.jsx)(Y,{...y.resizeProps(`steps`)})]}):null,g.isVisible(`expected`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`预期结果`,(0,Z.jsx)(Y,{...y.resizeProps(`expected`)})]}):null,g.isVisible(`verdict`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium whitespace-nowrap`,children:[`规则判定`,(0,Z.jsx)(Y,{...y.resizeProps(`verdict`)})]}):null,g.isVisible(`suggestions`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`修改建议`,(0,Z.jsx)(Y,{...y.resizeProps(`suggestions`)})]}):null,(0,Z.jsx)(`th`,{"aria-hidden":`true`})]})}),(0,Z.jsxs)(`tbody`,{children:[O.map(e=>{let t=e.verdict;return(0,Z.jsxs)(`tr`,{className:`align-top`,children:[(0,Z.jsx)(`td`,{className:`${et} tabular-nums text-stone-600`,children:(0,Z.jsx)(v,{text:e.no||`—`,className:`block truncate`})}),(0,Z.jsxs)(`td`,{className:`px-2.5 py-1.5`,children:[(0,Z.jsx)(v,{text:e.title||`(无标题)`,className:`block truncate text-stone-800`}),e.meta?(0,Z.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-stone-400`,children:e.meta}):null]}),g.isVisible(`steps`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5 text-stone-700`,children:(0,Z.jsx)(v,{text:e.steps,clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words`})}):null,g.isVisible(`expected`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5 text-stone-700`,children:(0,Z.jsx)(v,{text:e.expected,clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words`})}):null,g.isVisible(`verdict`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5`,children:t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[t.fixed?(0,Z.jsxs)(`span`,{className:`rounded border border-emerald-200 bg-emerald-50 px-1.5 py-0.5 text-[10px] text-emerald-700`,children:[`已修改 `,t.score]}):(0,Z.jsxs)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] ${G[t.verdict].badge}`,children:[G[t.verdict].label,` `,t.score]}),t.hard&&!t.fixed?(0,Z.jsx)(`span`,{className:`rounded border border-rose-200 bg-white px-1 py-0.5 text-[10px] text-rose-600`,children:`硬伤`}):null]}):(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-300`,children:`—`})}):null,g.isVisible(`suggestions`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5`,children:e.suggestions.length?(0,Z.jsx)(v,{text:e.suggestions.map((e,t)=>`${t+1}. ${e}`).join(`
|
|
5
5
|
`),clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words text-[11px] text-stone-600`}):(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-300`,children:`—`})}):null,(0,Z.jsx)(`td`,{"aria-hidden":`true`})]},e.key)}),O.length?null:(0,Z.jsx)(`tr`,{children:(0,Z.jsx)(`td`,{colSpan:_.length,className:`px-3 py-10 text-center text-xs text-stone-400`,children:`没有符合条件的用例`})})]})]})}):(0,Z.jsx)(`p`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center text-xs text-stone-400`,children:`没解析到用例行:确认第一行是表头,且有编号与标题列(也认「测试项目 / 用例名称」这类叫法)。支持 md 表格、csv、xlsx。`})]})}function Jt({active:e,onClick:t,children:n}){return(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-6 rounded-md px-2 text-[11px] transition-colors ${e?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:n})}var Yt=`可用工具(只调用这些,不要自己编工具名):
|