lantern-harness 0.1.6 → 0.1.8
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 +25 -0
- package/README.md +1 -1
- package/builtin/session/update-check.mjs +517 -0
- package/cli/lantern.mjs +123 -22
- package/cli/server.mjs +5 -2
- package/dist/500.html +3 -3
- package/dist/_astro/Base.DjIEQkT7.css +1 -0
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.D0snmAJ_.js +1 -0
- package/dist/_astro/{CaseExecBoard.FJ1Y9b4e.js → CaseExecBoard.BAV4EE3o.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.CT2n4VOf.js → CaseGenerateApp.Bz4ryNJG.js} +1 -1
- package/dist/_astro/{CasesLibrary.BjrehOiI.js → CasesLibrary.BPifyHUA.js} +1 -1
- package/dist/_astro/{ChatApp.Dqfx4FcI.js → ChatApp.DLo31SYZ.js} +5 -5
- package/dist/_astro/{DashboardBoard.wILBO_CD.js → DashboardBoard.Bd3eUPwZ.js} +2 -2
- package/dist/_astro/{DocsFileBrowser.D32MgVAR.js → DocsFileBrowser.D3cKurQE.js} +1 -1
- package/dist/_astro/{DocsPager.BARD7JvD.js → DocsPager.rzu4mnzw.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.C-Sg2R6B.js → KnowledgeLibrary.B0sO4QR1.js} +1 -1
- package/dist/_astro/{NavLibraries.BzInZVDf.js → NavLibraries.Cvg3wery.js} +1 -1
- package/dist/_astro/{PluginsPage.CVyua_fb.js → PluginsPage.DIltPILi.js} +2 -2
- package/dist/_astro/PluginsPage.uvmSuXzi.js +1 -0
- package/dist/_astro/PmBugsBoard.CiaIhCHv.js +1 -0
- package/dist/_astro/PmIterationsBoard.H67QwKFw.js +1 -0
- package/dist/_astro/{PmProjectDetail.CtQdpGes.js → PmProjectDetail.DqDoIg8a.js} +1 -1
- package/dist/_astro/PmProjectsBoard.nOC1Hugt.js +1 -0
- package/dist/_astro/PmRequirementsBoard.BPjZ7khP.js +1 -0
- package/dist/_astro/PmRequirementsBoard.CanxvcKg.js +1 -0
- package/dist/_astro/PmShared.CZnXaUq-.js +1 -0
- package/dist/_astro/{PromptsLibrary.Z1DQBrFL.js → PromptsLibrary.DU9EuSim.js} +1 -1
- package/dist/_astro/{ReportsPage.CGpIPPr9.js → ReportsPage.Cr88iz8c.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.D8078xLd.js → RequirementsLibrary.BwriF8F0.js} +1 -1
- package/dist/_astro/{SearchableSelect.BTJoZC_a.js → SearchableSelect.Ctg8V1Z1.js} +1 -1
- package/dist/_astro/SettingsDialog.DEgsVfaL.js +1 -0
- package/dist/_astro/SpaceSwitcher.BEJo5KFi.js +7 -0
- package/dist/_astro/{TasksBoard.CL-sNPZN.js → TasksBoard.BZi_GBPG.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.d6uIe7I-.js → TemplatesLibrary.T4K9jUex.js} +1 -1
- package/dist/_astro/{TestStatsBoard.CSdXWc4Q.js → TestStatsBoard.Dd1Kcmx6.js} +1 -1
- package/dist/_astro/{TodosBoard.nl23X5Gi.js → TodosBoard.C4yd_JFb.js} +1 -1
- package/dist/_astro/app-config.DKMxjv3g.js +1 -0
- package/dist/_astro/i18n.BXeGGutk.js +7 -0
- package/dist/_astro/{open-docs-in-session.B5cUxqHi.js → open-docs-in-session.B0ZdZNj2.js} +1 -1
- package/dist/_astro/{plugins.DaDJq-mn.js → plugins.D5ypJIXn.js} +1 -1
- package/dist/_astro/pm.BsnTv63L.js +4 -0
- package/dist/_astro/{settings.CMK4PEak.js → settings.CnDCvwnQ.js} +2 -2
- package/dist/_astro/{spaces-client.CoQfaOIO.js → spaces-client.Cai2tHEI.js} +1 -1
- package/dist/_astro/update.DXCPfU4a.js +1 -0
- package/dist/_astro/{view-prefs.Dhdh8Z5a.js → view-prefs.HCowOWXL.js} +1 -1
- package/dist/case-exec/index.html +4 -4
- package/dist/cases/generate/index.html +4 -4
- package/dist/cases/library/index.html +4 -4
- package/dist/dashboard/index.html +4 -4
- package/dist/docs/changelog/index.html +25 -4
- package/dist/docs/install/index.html +3 -3
- package/dist/docs/manual/index.html +15 -5
- package/dist/index.html +4 -4
- package/dist/knowledge/index.html +4 -4
- 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
- package/dist/plugins/index.html +4 -4
- 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 +4 -4
- package/dist/reports/index.html +4 -4
- package/dist/requirements/index.html +4 -4
- package/dist/tasks/index.html +4 -4
- package/dist/templates/index.html +4 -4
- 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
- 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
- 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
- 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
- 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
- package/dist/test-stats/index.html +4 -4
- package/dist/todos/index.html +4 -4
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +13 -2
- package/lh-plugins/lh-pm.mjs +18 -4
- package/lh-plugins/lh-update.mjs +171 -0
- package/package.json +1 -1
- package/dist/_astro/Base.DGaLtzMo.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.uhTNjhRY.js +0 -1
- package/dist/_astro/PluginsPage.CS1GaJtR.js +0 -1
- package/dist/_astro/PmBugsBoard.BXUu0kNL.js +0 -1
- package/dist/_astro/PmIterationsBoard.Deso1uyK.js +0 -1
- package/dist/_astro/PmProjectsBoard.MM4vxneK.js +0 -1
- package/dist/_astro/PmRequirementsBoard.62ONLCH5.js +0 -1
- package/dist/_astro/PmRequirementsBoard.SLVDgspp.js +0 -1
- package/dist/_astro/PmShared.CwCmF-kI.js +0 -1
- package/dist/_astro/SettingsDialog.BA57gp90.js +0 -1
- package/dist/_astro/SpaceSwitcher.DZ8b_85M.js +0 -7
- package/dist/_astro/app-config.huKxSIlN.js +0 -1
- package/dist/_astro/i18n.Bbh04ngD.js +0 -7
- package/dist/_astro/pm.CpFmMslU.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DKMxjv3g.js";import{a as r,n as i,o as a,r as o}from"./view-prefs.HCowOWXL.js";import{t as s}from"./jsx-runtime.BUXbF_vF.js";import{n as c,t as l}from"./DocsPager.rzu4mnzw.js";import{t as u}from"./SelectDropdown.Buv7rQJ_.js";import{t as d}from"./OverflowHint.lzmplP5j.js";import{t as f}from"./useListAnim.CpGB1cft.js";var p=`tw.docs.files.v1.`;function m(e){try{let t=sessionStorage.getItem(n(p+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function h(e,t){try{sessionStorage.setItem(n(p+e),JSON.stringify(t))}catch{}}var g=e(t(),1);function _(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function v(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var y=s(),b=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],x=b.map(e=>e.value),S=`h-8 px-3 text-sm border border-stone-300 rounded-lg bg-white text-stone-800 focus:outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,C=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,w=`w-38 shrink-0`,T=`w-16 shrink-0 text-left`,E=`w-40 shrink-0 text-right`,D=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function O(e,t,n){let[s,l]=(0,g.useState)(()=>n?o(`docs.${n}.search`):``),[u,d]=(0,g.useState)(()=>n?i(`docs.${n}.sort`,x,`mtime`):`mtime`),[f,p]=(0,g.useState)(1),[m,h]=c(t),_=(0,g.useMemo)(()=>{let t=s.trim().toLowerCase(),n=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return u===`name`?n.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):n.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),n},[e,s,u]),v=Math.max(1,Math.ceil(_.length/m)),y=Math.min(f,v);return{query:s,setQuery:e=>{l(e),n&&a(`docs.${n}.search`,e),p(1)},sortBy:u,setSortBy:e=>{d(e),n&&r(`docs.${n}.sort`,e),p(1)},page:y,setPage:p,pageSize:m,setPageSize:e=>{h(e),p(1)},filtered:_,totalPages:v,pageFiles:(0,g.useMemo)(()=>_.slice((y-1)*m,y*m),[_,y,m])}}function k({files:e,filtered:t,pageFiles:n,query:r,onQuery:i,sortBy:a,onSortBy:o,page:s,totalPages:c,pageSize:p,onPage:m,onPageSize:h,busy:g=!1,emptyText:x,searchPlaceholder:O,selectAllLabel:k=`全选本页`,renderBadge:A,renderActions:j,onRowDoubleClick:M,selectable:N,selected:P,onToggleRow:F,onSelectPage:I}){let L=N??(()=>!0),R=n.filter(L),z=R.length>0&&R.every(e=>P[e.path]),B=!z&&R.some(e=>P[e.path]),{cls:V,play:H}=f(),U=e=>{H(),i(e)};return(0,y.jsxs)(y.Fragment,{children:[e.length>0?(0,y.jsxs)(`div`,{className:`shrink-0 px-4 py-2 border-b border-stone-100 bg-stone-50/60 flex items-center gap-2 flex-wrap`,children:[(0,y.jsx)(`input`,{type:`search`,value:r,onChange:e=>U(e.target.value),placeholder:O,"aria-label":O,className:`${S} flex-1 min-w-48`}),(0,y.jsx)(u,{compact:!0,options:b,value:a,onChange:e=>{H(),o(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,y.jsx)(`p`,{className:D,children:x}):t.length===0?(0,y.jsxs)(`p`,{className:D,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,y.jsxs)(`ul`,{className:`${V}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:z,ref:e=>{e&&(e.indeterminate=B)},onChange:()=>I(R.map(e=>e.path),!z),disabled:g||R.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,y.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),(0,y.jsx)(`span`,{className:w,children:`创建时间`}),(0,y.jsx)(`span`,{className:w,children:`修改时间`}),(0,y.jsx)(`span`,{className:T,children:`大小`}),(0,y.jsx)(`span`,{className:E,children:`操作`})]}),n.map(e=>{let t=L(e);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2.5 ${C}`,onDoubleClick:M?()=>M(e):void 0,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:!!P[e.path],disabled:g||!t,onChange:()=>F(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,y.jsx)(d,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null]}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.ctime??e.mtime)}),(0,y.jsx)(`span`,{className:`${w} text-[11px] text-stone-500 tabular-nums`,children:v(e.mtime)}),(0,y.jsx)(`span`,{className:`${T} text-[11px] text-stone-400`,children:_(e.size)}),(0,y.jsx)(`div`,{className:`${E} flex justify-end gap-1 flex-wrap`,onDoubleClick:e=>e.stopPropagation(),children:j(e)})]},e.path)})]})}),e.length>0?(0,y.jsx)(l,{page:s,totalPages:c,pageSize:p,busy:g,onPage:e=>{H(),m(e)},onPageSize:e=>{H(),h(e)}}):null]})}export{h as i,O as n,m as r,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.DKMxjv3g.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./SelectDropdown.Buv7rQJ_.js";var a=e(t(),1),o=[5,10,20,50],s=`tw.docs.page-size.v1`;function c(e){return typeof e==`number`&&o.includes(e)}function l(e,t=s){try{let r=localStorage.getItem(n(t)),i=r===null?NaN:Number(r);return c(i)?i:e}catch{return e}}function u(e,t=s){if(c(e))try{localStorage.setItem(n(t),String(e))}catch{}}var d=r(),f=`h-8 px-3 shrink-0 whitespace-nowrap text-sm text-stone-600 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,p=o.map(e=>({value:String(e),label:String(e)}));function m(e,t){let[n,r]=(0,a.useState)(()=>l(e,t));return[n,(0,a.useCallback)(e=>{c(e)&&(u(e,t),r(e))},[t])]}function h({page:e,totalPages:t,pageSize:n,busy:r=!1,onPage:a,onPageSize:o}){return(0,d.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-t border-stone-100 flex items-center justify-between gap-2 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-xs text-stone-500 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{children:[`第 `,e,` / `,t,` 页 ·`]}),(0,d.jsx)(i,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:r,ariaLabel:`每页条数`,showCheck:!1,className:`w-18`}),(0,d.jsx)(`span`,{children:`条`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}export{m as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DKMxjv3g.js";import{a as r,o as i,r as a}from"./plugins.D5ypJIXn.js";import{t as o}from"./jsx-runtime.BUXbF_vF.js";import{t as s}from"./ConfirmDialog.CBVsDJ8f.js";import{l as c,n as l,r as u,s as d}from"./project-docs.Cd2gKPKh.js";import{n as f}from"./doc-roots.DAJP9Svr.js";import{i as p,n as m,r as h,t as g}from"./DocsFileBrowser.D3cKurQE.js";import{t as _,u as v}from"./open-docs-in-session.B0ZdZNj2.js";var y=e(t(),1),b=o(),x=10;async function S(e=`.`){let{entries:t}=await d(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await S(e.path));return n}function C({staticCount:e=0,base:t}){let o=h(`knowledge`),[d,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(o?!0:null),[O,k]=(0,y.useState)(()=>o??[]),[A,j]=(0,y.useState)(null),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),R=m(O,x,`knowledge`),z=(0,y.useCallback)(async()=>{j(null);try{let e=await S(`.`);k(e),p(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{let e=r(e=>T(!!e.knowledgeLib));return n().then(()=>{T(a(`knowledgeLib`)),C(!0)}),e},[]),(0,y.useEffect)(()=>{d&&w&&(async()=>{await u(`knowledge`)?(await v().catch(()=>null),await z(),D(!0)):D(!1)})()},[d,w,z]);let B=(0,y.useMemo)(()=>Object.keys(P).filter(e=>P[e]),[P]);function V(){a(`knowledgeGen`)?window.location.href=`${t}?plugin=knowledgeGen`:j(i(`knowledgeGen`))}async function H(e){N(!0),j(null);try{await c(`knowledge`,e.path)}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function U(e){N(!0),j(null);try{await _(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e)),N(!1)}}async function W(){let e=I;if(e){L(null),N(!0),j(null);try{if(e.kind===`one`)await l(`knowledge`,e.entry.path);else{for(let t of e.paths)await l(`knowledge`,t);F({})}await z()}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}}}let G=I?.kind===`one`?`删除「${I.entry.name}」?将从 ${f(`knowledge`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个知识库文件?此操作不可恢复。`:``;return d?w?E===null?(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):E?(0,b.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,b.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[R.query.trim()?(0,b.jsxs)(b.Fragment,{children:[`匹配 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:R.filtered.length}),` 个`,(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,O.length]})]}):(0,b.jsxs)(b.Fragment,{children:[`共 `,(0,b.jsx)(`span`,{className:`font-medium text-stone-800`,children:O.length}),` 个知识库文件`]}),B.length>0?(0,b.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,B.length]}):null]}),(0,b.jsx)(`button`,{type:`button`,disabled:M||B.length===0,onClick:()=>L({kind:`batch`,paths:B}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:V,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),A?(0,b.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:A}):null,(0,b.jsx)(g,{files:O,filtered:R.filtered,pageFiles:R.pageFiles,query:R.query,onQuery:R.setQuery,sortBy:R.sortBy,onSortBy:R.setSortBy,page:R.page,totalPages:R.totalPages,pageSize:R.pageSize,onPage:R.setPage,onPageSize:R.setPageSize,busy:M,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:P,onToggleRow:e=>F(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>F(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void H(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>void U(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,b.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>L({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,b.jsx)(s,{open:I!=null,title:I?.kind===`batch`?`批量删除`:`删除知识库文件`,message:G,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>L(null),onConfirm:()=>void W()})]}):(0,b.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,b.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:i(`knowledgeLib`)}):(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{A as r,C as i,D as a,E as o,F as s,I as c,L as l,M as u,N as d,O as f,P as p,S as m,T as h,_ as g,a as _,b as v,g as y,h as b,i as x,j as S,k as C,m as w,p as T,r as E,t as D,u as O,v as ee,w as te,x as k,y as A}from"./app-config.huKxSIlN.js";import{a as ne,i as re,r as j}from"./plugins.DaDJq-mn.js";import{i as M,n as N,r as P,t as F}from"./dialog.DXHznyjD.js";import{t as I}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{n as L}from"./i18n.Bbh04ngD.js";var R=e(t(),1),z=e(n(),1),B=`/__tb_nav/groups`;function ae(){return E().navGroups}function oe(){return a(E().navIcons)}function se(e,t){let n={...oe(),[e]:t};return O({navIcons:n}),D(),n}function ce(){return E().navOrder}function le(e,t){let n=o(e),r=f(t,n);return O({navGroups:n,navOrder:r}),D(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!_())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return o(n.groups,!1)}catch{return null}}async function de(){if(!_())return;let e=E(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=o(t.groups,!1),r=f(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(O({navGroups:n,navOrder:r}),D());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!V(n,e.navGroups)&&(O({navGroups:n,navOrder:f(e.navOrder,n)}),D())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let s=(0,R.useRef)(t);s.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=c(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,s.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=I(),W=`/`;function G(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function K(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function q(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function fe(e){return T(`tw.nav.groupOpen.${e}`)}function pe(){return T(`tw.nav.docsOpen`)}function me(e,t){try{let t=localStorage.getItem(fe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(pe());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(fe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(pe(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name}function he(e){return e.type===`group`?Y(e.group):L(v(e.id).i18n)}function X(e){return e.type===`item`?te(e.id):k(e.group.id)}function ge(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,U.jsx)(Z,{children:_e[t??w[e]]})}var _e={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`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`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`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`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ve(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`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`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function ye(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function be(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Se(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`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`})})}function Ce(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function we(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Te(){return(0,U.jsxs)(Z,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(i(e))return!1;let n=v(e).plugin;return!n||t[n]!==!1}function De({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=v(e),o=K(n,a.match);return(0,U.jsxs)(`div`,{className:[q(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:G(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Q,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(xe,{})})]})}function Oe(e,t,n){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return(!t||j(t))&&K(n,v(e).match)})?!0:h(t,e.id).some(e=>Oe(e,t,n))}function ke(e,t){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)})?!0:h(t,e.id).some(e=>ke(e,t))}function Ae({group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)}),f=d(t,e.id,n),p=Oe(e,t,a),[m,h]=(0,R.useState)(()=>me(e.id,!0)),[g,_]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!ke(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),_(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}_(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),_(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(ve,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(De,{id:e,icon:r[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),f.map(e=>(0,U.jsx)(Ae,{group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function je({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=b.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function y(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(P,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Ee,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:y,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Me({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Ne({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),f=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>f.map(X)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[_,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(f);w.current=f;let T=(0,R.useRef)(_);T.current=_;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?d(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let O=e=>{b.current=e,m(e)},ee=e=>{T.current=e,y(e)},te=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},k=new Map(f.map(e=>[X(e),he(e)])),A=t?r.find(e=>e.id===t):void 0,ne=A?(h[A.id]??A.items).filter(l):[],re=A?d(r,A.id,i):[],j=_.length?_:re.map(e=>e.id);return(0,U.jsxs)(P,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Me,{ids:ne,labelOf:e=>L(v(e).i18n),onChange:e=>te(A.id,e),onEnd:E,indent:!0}),j.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Me,{ids:j,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:ee,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Me,{ids:p,labelOf:e=>k.get(e)??e,onChange:O,onEnd:E})})]})})]})}function Pe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of d(e,r.id,t))n.push({group:i,indent:!0})}return n}function Fe(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Ie=120;function Le(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Ie)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Re(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function ze({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Re(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:y.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Be({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Re(r,i),children:a}),document.body)}function Ve(){let e=ge(),[t,n]=(0,R.useState)(()=>ae()),[i,a]=(0,R.useState)(()=>oe()),[o,c]=(0,R.useState)(()=>ce()),[d,f]=(0,R.useState)(()=>re()),[h,_]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[O,te]=(0,R.useState)(null),k=Le(),j=Le(),M=k.value,N=j.value,P=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);function F(e){te(e),D(!0)}function I(e){_(e),b(!0)}function z(){b(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ne(e=>{f({...e})});return x().then(async()=>{e&&(await de(),e&&(n(ae()),c(ce()),a(oe()),f(re())))}),()=>{e=!1,t()}},[]);let B=ee(t,o);function V(e,t){let r=le(e,t);n(r.groups),c(r.order),ue(r.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(r.groups))return;let t=le(e,r.order);n(t.groups),c(t.order)})}function H(){W(),j.close(),k.close()}function W(){P.current!==null&&(window.clearTimeout(P.current),P.current=null)}function G(){W(),P.current=window.setTimeout(()=>{P.current=null,j.close()},220)}function K(e,t){W(),j.open({itemId:e,rect:t.getBoundingClientRect()})}function q(e,t){M?.kind===`itemMenu`&&M.itemId===e?H():(j.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function fe(e,t){M?.kind===`groupMenu`&&M.group.id===e.id?H():(j.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function pe(e,n){V(g(t,e,n),o),H()}function me(e){let{groups:n,owner:i}=p(t,e);V(n,i?r(o,e,i,n):o),H()}let J=M?.kind===`assign`||M?.kind===`itemMenu`?M.itemId:void 0,he=M?.kind===`groupMenu`?M.group.id:void 0,X=M?.kind===`itemMenu`?M:null,Z=M?.kind===`groupMenu`?M:null,Q=M?.kind===`assign`?M:null,_e=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,d)?(0,U.jsx)(De,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>q(n.id,e)},n.id):null:(0,U.jsx)(Ae,{group:n.group,groups:t,order:o,icons:i,pathname:e,openItem:J,openGroupId:he,onMenu:fe,onItemMenu:q},n.group.id)),X?(0,U.jsxs)(Be,{rect:X.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:G,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(v(X.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),j.close())},children:[_e?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>me(X.itemId),children:[(0,U.jsx)(Ce,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;H(),I({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=_e?.id??null;H(),F(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>K(X.itemId,e.currentTarget),onClick:e=>K(X.itemId,e.currentTarget),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Fe,{})]})]})]}):null,N&&X&&N.itemId===X.itemId?(0,U.jsx)(ze,{anchor:N.rect,itemId:N.itemId,current:i[N.itemId],closing:j.closing,onHoverEnter:W,onHoverLeave:G,onPick:e=>{a(se(N.itemId,e)),H()}}):null,Z?(0,U.jsxs)(Be,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;H(),I({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),F(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),I({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,U.jsxs)(Be,{rect:Q.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Pe(t,o).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||pe(e.id,Q.itemId)},children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,U.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:L(`nav.currentGroup`)}):null]},e.id)}):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(`nav.noGroups`)})})]}):null,(0,U.jsx)(je,{open:y&&!w,draft:h,groups:t,plugins:d,icons:i,onClose:z,onSave:e=>{let n=l(t,e);V(n.groups,u(o,n.groups,n.id)),z()},onDelete:h?.id?()=>T(h.id):void 0}),(0,U.jsx)(Ne,{open:E,focusGroupId:O,nodes:B,groups:t,order:o,visible:e=>$(e,d),onClose:()=>D(!1),onCommit:(e,t)=>{let n=o.filter(e=>m(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,n)=>V(t,C(o,t,e,n))}),(0,U.jsx)(ie,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=A(t,w),r=s(t,w);V(r,e?S(o,e,r,n):o)}z()}})]})}export{Ve as default};
|
|
1
|
+
import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{A as r,C as i,D as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,g as y,h as b,i as x,j as S,k as C,m as w,p as T,r as E,t as D,u as O,v as ee,w as te,x as k,y as A}from"./app-config.DKMxjv3g.js";import{a as ne,i as re,r as j}from"./plugins.D5ypJIXn.js";import{i as M,n as N,r as P,t as F}from"./dialog.DXHznyjD.js";import{t as I}from"./jsx-runtime.BUXbF_vF.js";import{t as ie}from"./ConfirmDialog.CBVsDJ8f.js";import{n as L}from"./i18n.BXeGGutk.js";var R=e(t(),1),z=e(n(),1),B=`/__tb_nav/groups`;function ae(){return E().navGroups}function oe(){return d(E().navIcons)}function se(e,t){let n={...oe(),[e]:t};return O({navIcons:n}),D(),n}function ce(){return E().navOrder}function le(e,t){let n=a(e),r=C(t,n);return O({navGroups:n,navOrder:r}),D(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!_())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return a(n.groups,!1)}catch{return null}}async function de(){if(!_())return;let e=E(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=a(t.groups,!1),r=C(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(O({navGroups:n,navOrder:r}),D());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!V(n,e.navGroups)&&(O({navGroups:n,navOrder:C(e.navOrder,n)}),D())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let s=(0,R.useRef)(t);s.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=c(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,s.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=I(),W=`/`;function G(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function K(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function q(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function fe(e){return T(`tw.nav.groupOpen.${e}`)}function pe(){return T(`tw.nav.docsOpen`)}function me(e,t){try{let t=localStorage.getItem(fe(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(pe());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function J(e,t){try{localStorage.setItem(fe(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(pe(),t?`1`:`0`)}catch{}}function Y(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name}function he(e){return e.type===`group`?Y(e.group):L(v(e.id).i18n)}function X(e){return e.type===`item`?te(e.id):k(e.group.id)}function ge(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function Z({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Q({id:e,icon:t}){return(0,U.jsx)(Z,{children:_e[t??w[e]]})}var _e={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`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`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`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`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function ve(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`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`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function ye(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function be(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function Se(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`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`})})}function Ce(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function we(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Te(){return(0,U.jsxs)(Z,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(i(e))return!1;let n=v(e).plugin;return!n||t[n]!==!1}function De({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=v(e),o=K(n,a.match);return(0,U.jsxs)(`div`,{className:[q(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:G(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Q,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(xe,{})})]})}function Oe(e,t,n){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return(!t||j(t))&&K(n,v(e).match)})?!0:h(t,e.id).some(e=>Oe(e,t,n))}function ke(e,t){return e.items.some(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)})?!0:h(t,e.id).some(e=>ke(e,t))}function Ae({group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(i(e))return!1;let t=v(e).plugin;return!t||j(t)}),d=f(t,e.id,n),p=Oe(e,t,a),[m,h]=(0,R.useState)(()=>me(e.id,!0)),[g,_]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!ke(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),J(e.id,!0),_(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}_(!0),J(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),_(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(ve,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:Y(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(De,{id:e,icon:r[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),d.map(e=>(0,U.jsx)(Ae,{group:e,groups:t,order:n,icons:r,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function je({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=b.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function y(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(P,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Ee,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Q,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:y,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Me({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Ne({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),d=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>d.map(X)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[_,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(d);w.current=d;let T=(0,R.useRef)(_);T.current=_;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(X);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?f(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let O=e=>{b.current=e,m(e)},ee=e=>{T.current=e,y(e)},te=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},k=new Map(d.map(e=>[X(e),he(e)])),A=t?r.find(e=>e.id===t):void 0,ne=A?(h[A.id]??A.items).filter(l):[],re=A?f(r,A.id,i):[],j=_.length?_:re.map(e=>e.id);return(0,U.jsxs)(P,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(F,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(M,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(N,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Me,{ids:ne,labelOf:e=>L(v(e).i18n),onChange:e=>te(A.id,e),onEnd:E,indent:!0}),j.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Me,{ids:j,labelOf:e=>{let t=r.find(t=>t.id===e);return t?Y(t):e},onChange:ee,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Me,{ids:p,labelOf:e=>k.get(e)??e,onChange:O,onEnd:E})})]})})]})}function Pe(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of f(e,r.id,t))n.push({group:i,indent:!0})}return n}function Fe(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Ie=120;function Le(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Ie)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Re(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function ze({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Re(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:y.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Q,{id:n,icon:e})},e))})]}),document.body)}function Be({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Re(r,i),children:a}),document.body)}function Ve(){let e=ge(),[t,n]=(0,R.useState)(()=>ae()),[i,a]=(0,R.useState)(()=>oe()),[c,d]=(0,R.useState)(()=>ce()),[f,h]=(0,R.useState)(()=>re()),[_,y]=(0,R.useState)(null),[b,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[O,te]=(0,R.useState)(null),k=Le(),j=Le(),M=k.value,N=j.value,P=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);function F(e){te(e),D(!0)}function I(e){y(e),C(!0)}function z(){C(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ne(e=>{h({...e})});return x().then(async()=>{e&&(await de(),e&&(n(ae()),d(ce()),a(oe()),h(re())))}),()=>{e=!1,t()}},[]);let B=ee(t,c);function V(e,t){let r=le(e,t);n(r.groups),d(r.order),ue(r.groups).then(e=>{if(!e||JSON.stringify(e)===JSON.stringify(r.groups))return;let t=le(e,r.order);n(t.groups),d(t.order)})}function H(){W(),j.close(),k.close()}function W(){P.current!==null&&(window.clearTimeout(P.current),P.current=null)}function G(){W(),P.current=window.setTimeout(()=>{P.current=null,j.close()},220)}function K(e,t){W(),j.open({itemId:e,rect:t.getBoundingClientRect()})}function q(e,t){M?.kind===`itemMenu`&&M.itemId===e?H():(j.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function fe(e,t){M?.kind===`groupMenu`&&M.group.id===e.id?H():(j.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function pe(e,n){V(g(t,e,n),c),H()}function me(e){let{groups:n,owner:r}=o(t,e);V(n,r?S(c,e,r,n):c),H()}let J=M?.kind===`assign`||M?.kind===`itemMenu`?M.itemId:void 0,he=M?.kind===`groupMenu`?M.group.id:void 0,X=M?.kind===`itemMenu`?M:null,Z=M?.kind===`groupMenu`?M:null,Q=M?.kind===`assign`?M:null,_e=X?t.find(e=>e.items.includes(X.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,f)?(0,U.jsx)(De,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>q(n.id,e)},n.id):null:(0,U.jsx)(Ae,{group:n.group,groups:t,order:c,icons:i,pathname:e,openItem:J,openGroupId:he,onMenu:fe,onItemMenu:q},n.group.id)),X?(0,U.jsxs)(Be,{rect:X.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:G,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(v(X.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),j.close())},children:[_e?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>me(X.itemId),children:[(0,U.jsx)(Ce,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:X.itemId,rect:X.rect}),children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.itemId;H(),I({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=_e?.id??null;H(),F(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>K(X.itemId,e.currentTarget),onClick:e=>K(X.itemId,e.currentTarget),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Fe,{})]})]})]}):null,N&&X&&N.itemId===X.itemId?(0,U.jsx)(ze,{anchor:N.rect,itemId:N.itemId,current:i[N.itemId],closing:j.closing,onHoverEnter:W,onHoverLeave:G,onPick:e=>{a(se(N.itemId,e)),H()}}):null,Z?(0,U.jsxs)(Be,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:Y(Z.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[Z.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=Z.group.id;H(),I({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(be,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),F(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Te,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Z.group;H(),I({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(ye,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Q?(0,U.jsxs)(Be,{rect:Q.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Pe(t,c).map(({group:e,indent:t})=>{let n=e.items.includes(Q.itemId);return(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||pe(e.id,Q.itemId)},children:[(0,U.jsx)(Se,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:Y(e)}),n?(0,U.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:L(`nav.currentGroup`)}):null]},e.id)}):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(`nav.noGroups`)})})]}):null,(0,U.jsx)(je,{open:b&&!w,draft:_,groups:t,plugins:f,icons:i,onClose:z,onSave:e=>{let n=p(t,e);V(n.groups,u(c,n.groups,n.id)),z()},onDelete:_?.id?()=>T(_.id):void 0}),(0,U.jsx)(Ne,{open:E,focusGroupId:O,nodes:B,groups:t,order:c,visible:e=>$(e,f),onClose:()=>D(!1),onCommit:(e,t)=>{let n=c.filter(e=>m(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,n)=>V(t,r(c,t,e,n))}),(0,U.jsx)(ie,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=A(t,w),r=s(t,w);V(r,e?l(c,e,r,n):c)}z()}})]})}export{Ve as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.DKMxjv3g.js";import{a as r,c as i,i as a,n as o,t as s}from"./plugins.D5ypJIXn.js";import{o as c}from"./case-exec.BipZCK6G.js";import{a as l,n as u}from"./view-prefs.HCowOWXL.js";import{t as d}from"./jsx-runtime.BUXbF_vF.js";import"./settings.CnDCvwnQ.js";import{t as f}from"./OverflowHint.lzmplP5j.js";import{M as p,v as m}from"./pm.BsnTv63L.js";import{s as h,w as g}from"./tasks.otRBFydq.js";import{s as _}from"./report-prompt.Cmw4XzfY.js";import{r as v}from"./test-stats.MEm3K2rB.js";var y=e(t(),1),b=`/__tb_fs`,x=`你可以使用本地文件工具(侧栏工作区已连接时):
|
|
2
2
|
- 侧栏「工作区」决定当前目录;fs_* 默认相对该工作区
|
|
3
3
|
- working_directory_get / working_directory_set:查看或切换当前工作区(已注册列表内)
|
|
4
4
|
- 「仅可查看」「工作区内修改」:用工作区相对路径
|
|
@@ -36,4 +36,4 @@ Cite sources as markdown links when available.`}function me(e){return e.error&&!
|
|
|
36
36
|
`),n?`--- stdout ---\n${n}`:`--- stdout ---
|
|
37
37
|
(empty)`,r?`--- stderr ---\n${r}`:``].filter(Boolean).join(`
|
|
38
38
|
|
|
39
|
-
`)}async function J(e,t,n,r){if(r===`readonly`)return JSON.stringify({error:`${t} 需要「工作区内修改」或「完全权限」`});let i={};try{i=JSON.parse(n||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}let a=String(i.command??``).trim();if(!a)return JSON.stringify({error:`command is required`});let o=!!i.background;try{let t=await fetch(`${e}/exec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:a,workdir:i.workdir,access:r,background:o}),signal:AbortSignal.timeout(o?15e3:13e4)}),n=await t.json();return!t.ok&&n.error?q({error:String(n.error),command:a}):n.background&&n.jobId?q({background:!0,jobId:String(n.jobId),command:n.command||a,workdir:n.workdir}):q({ok:!!n.ok,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,truncated:!!n.truncated,timedOut:!!n.timedOut,error:n.error?String(n.error):void 0,workdir:n.workdir,cwd:n.cwd,durationMs:n.durationMs,command:n.command||a})}catch(e){return`${t} failed: ${e instanceof Error?e.message:String(e)}`}}async function Ge(e,t){return J(U,`Bash`,e,t)}async function Ke(e,t){return J(W,`Pwsh`,e,t)}async function qe(e,t,n){if(e===`job_kill`&&n===`readonly`)return JSON.stringify({error:`job_kill 需要「工作区内修改」或「完全权限」`});let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{if(e===`job_list`){let e=await(await fetch(`${U}/jobs`,{signal:AbortSignal.timeout(5e3)})).json();return JSON.stringify(e,null,2)}if(e===`job_output`){let e=String(r.jobId??r.id??``).trim();if(!e)return JSON.stringify({error:`jobId is required`});let t=await(await fetch(`${U}/job_output`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:e,offset:r.offset}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(t,null,2)}if(e===`job_kill`){let e=String(r.jobId??r.id??``).trim();if(!e)return JSON.stringify({error:`jobId is required`});let t=await(await fetch(`${U}/job_kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:e,access:n}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(t,null,2)}return JSON.stringify({error:`unknown tool: ${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function Y(e,t,n,r,i){if(i===`readonly`)return JSON.stringify({error:`${t} 需要「工作区内修改」或「完全权限」`});let a={};try{a=JSON.parse(r||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}let o=n.replace(/^(bash|pwsh)_session_/,``);try{if(o===`list`){let t=await(await fetch(`${e}/session/list`,{signal:AbortSignal.timeout(5e3)})).json();return JSON.stringify(t,null,2)}if(o===`open`){let t=await(await fetch(`${e}/session/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({access:i,workdir:a.workdir}),signal:AbortSignal.timeout(2e4)})).json();return JSON.stringify(t,null,2)}if(o===`exec`){let t=String(a.sessionId??a.id??``).trim(),n=String(a.command??``);if(!t)return JSON.stringify({error:`sessionId is required`});if(!n.trim())return JSON.stringify({error:`command is required`});let r=await(await fetch(`${e}/session/exec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({access:i,sessionId:t,command:n,timeoutMs:a.timeoutMs}),signal:AbortSignal.timeout(13e4)})).json();return JSON.stringify(r,null,2)}if(o===`read`){let t=String(a.sessionId??a.id??``).trim();if(!t)return JSON.stringify({error:`sessionId is required`});let n=await(await fetch(`${e}/session/read`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,offset:a.offset}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(n,null,2)}if(o===`close`){let t=String(a.sessionId??a.id??``).trim();if(!t)return JSON.stringify({error:`sessionId is required`});let n=await(await fetch(`${e}/session/close`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,access:i}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(n,null,2)}return JSON.stringify({error:`unknown tool: ${n}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function Je(e,t,n){return Y(U,`bash session`,e,t,n)}async function Ye(e,t,n){return Y(W,`pwsh session`,e,t,n)}function Xe(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var X=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],Z=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],Q=d(),Ze={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},$={tasks:h,todos:g,projects:m,iterations:m,pmRequirements:m,bugs:m,testStats:v,caseExec:c,dashboard:g},Qe=[`extension`,`session`,`global`],$e=`plugins.mine-tab`,et=a();function tt({embedded:e=!1}){let[t,a]=(0,y.useState)(()=>u($e,Qe,`extension`)),[s,c]=(0,y.useState)(()=>i()),[d,f]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(!0);async function O(){D(!0);try{let[e,t,n,r,i,a,o,s,c,l,u,d,p,m]=await Promise.all([H(),L(),ne(),G(),K(),$.tasks(),$.todos(),$.projects(),$.iterations(),$.pmRequirements(),$.bugs(),$.testStats(),$.caseExec(),$.dashboard()]);f(e),h(t),v(n),x(r),C(i),T({tasks:a,todos:o,projects:s,iterations:c,pmRequirements:l,bugs:u,testStats:d,caseExec:p,dashboard:m})}finally{D(!1)}}(0,y.useEffect)(()=>{let e=r(e=>c(e));return n().then(()=>{c(i()),O()}),()=>{e()}},[]);function k(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return s.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return s.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件;工作台按提示词写作`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=w?.[e];return t===void 0?{available:E?null:!1,detail:E?`探测中…`:`需本地服务`}:t?{available:!0,detail:Ze[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?s.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?E&&d===null?{available:null,detail:`探测中…`}:d?.ok?{available:!0,detail:`已连接 · ${d.entryCount??d.entityCount??0} 条记忆 / 待确认 ${d.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?E&&g===null?{available:null,detail:`探测中…`}:g?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function ee(e){let t=Xe(e.id);return t===`none`?{label:`规划中`,tone:`plan`}:t===`ready`?{label:`已就绪`,tone:`ready`}:E&&(t===`web`&&m===null||t===`fs`&&g===null||t===`bash`&&b===null||t===`pwsh`&&S===null)?{label:`探测中…`,tone:`plan`}:t===`web`?m?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`fs`?g?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`bash`?b?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`pwsh`?S?.ok&&S.available?{label:`已就绪`,tone:`ready`}:S?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}function te(e){let t=o(e,!s[e]);c(t),e===`reports`&&_(!!t.reports).catch(e=>{console.warn(`[reports] 同步工作汇报提示词失败`,e)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&t[e]&&p().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}function A(e){l($e,e),a(e)}return(0,Q.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Q.jsx)(`div`,{className:`w-full ${e?`px-6 py-5`:`px-6 py-6`}`,children:(0,Q.jsx)(it,{mineTab:t,onMineTab:A,enabled:s,runtimeFor:k,builtinStatus:ee,onToggle:te})})})}function nt(e){return`@lh-plugins/${e}`}function rt(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function it(e){let{mineTab:t,onMineTab:n,enabled:r,runtimeFor:i,builtinStatus:a,onToggle:o}=e,[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)({}),f=[{id:`extension`,label:`扩展插件`,count:s.length,hint:`可配置插件`},{id:`session`,label:`会话插件`,count:X.length,hint:`默认`},{id:`global`,label:`全局插件`,count:Z.length,hint:`默认`}],p=Math.max(0,f.findIndex(e=>e.id===t)),m=(0,y.useId)(),h=(0,y.useRef)(null),g=`${m}-panel`,_=e=>`${m}-tab-${e}`,v=Math.max(1,f.length),b=.5+.25*(v-1);function x(e){n(e),l(null)}function S(e){let t=f.length;if(!t)return;let n=p;if(e.key===`ArrowLeft`)n=(p-1+t)%t;else if(e.key===`ArrowRight`)n=(p+1)%t;else if(e.key===`Home`)n=0;else if(e.key===`End`)n=t-1;else return;e.preventDefault();let r=f[n];r&&(x(r.id),h.current?.querySelectorAll(`[role="tab"]`)[n]?.focus())}function C(e){l(t=>t===e?null:e)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`header`,{className:`mb-4 flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-bold text-stone-900`,children:`我的插件`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-sm text-stone-500 leading-6`,children:`扩展为可配置插件;会话 / 全局为平台默认。点击卡片展开详情。`})]})}),(0,Q.jsxs)(`div`,{ref:h,className:`mb-5 relative grid gap-1 p-1 rounded-2xl bg-stone-100 border border-stone-200/90`,style:{gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`},role:`tablist`,"aria-label":`插件分类`,"aria-orientation":`horizontal`,onKeyDown:S,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-1 top-1 bottom-1 rounded-xl bg-white shadow-sm ring-1 ring-stone-200/80 transition-transform duration-300 ease-out motion-reduce:transition-none`,style:{width:`calc((100% - ${b}rem) / ${v})`,transform:`translateX(calc(${p} * (100% + 0.25rem)))`}}),f.map(e=>{let n=t===e.id;return(0,Q.jsxs)(`button`,{id:_(e.id),type:`button`,role:`tab`,"aria-selected":n,"aria-controls":g,tabIndex:n?0:-1,onClick:()=>x(e.id),className:`relative min-w-0 h-11 px-2 rounded-xl text-left transition-colors ${n?`text-stone-900`:`text-stone-500 hover:text-stone-700`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-1.5 justify-center sm:justify-start sm:px-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.count})]}),(0,Q.jsx)(`div`,{className:`hidden sm:block text-[10px] px-1 mt-0.5 ${n?`text-stone-400`:`text-stone-400/80`}`,children:e.hint})]},e.id)})]}),(0,Q.jsxs)(`div`,{id:g,role:`tabpanel`,"aria-labelledby":_(t),children:[t===`extension`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[`可配置插件 · `,s.length,` 个`]}),(0,Q.jsx)(`div`,{className:`space-y-5`,children:et.map(e=>{let t=!!u[e.category];return(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":!t,onClick:()=>d(n=>({...n,[e.category]:!t})),className:`mb-2 flex w-full items-center gap-1.5 text-left text-[13px] font-medium text-stone-600`,children:[(0,Q.jsx)(st,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${t?`-rotate-90`:``}`}),(0,Q.jsx)(`span`,{children:e.category}),(0,Q.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.items.length})]}),t?null:(0,Q.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r[e.id],n=i(e.id),a=c===`ext:${e.id}`,s=e.alwaysOn?`内置常开`:t?`已启用`:`未启用`,l=t&&n.available===!0?`运行中`:`已停用`;return(0,Q.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${a?` z-40`:``}`,children:(0,Q.jsx)(ot,{open:a,onToggleOpen:()=>C(`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Q.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500 tabular-nums`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Q.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500`,children:`内置`}):(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":`${t?`关闭`:`打开`} ${e.name}`,onClick:()=>o(e.id),className:`tw-toggle`,children:(0,Q.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:nt(e.id),configLabel:s,runLabel:l,extra:n.detail})},e.id)})})]},e.category)})}),(0,Q.jsx)(`p`,{className:`mt-5 text-xs text-stone-400 leading-5`,children:`开关保存在本机。网页搜索 / 工作区文件已迁入会话默认能力。`})]}):null,t===`session`?(0,Q.jsx)(at,{title:`由平台按会话默认提供`,entries:X,statusOf:a,groupByCategory:!1,expandedId:c,onExpand:C,idPrefix:`sess`}):null,t===`global`?(0,Q.jsx)(at,{title:`由系统与全部会话共享`,entries:Z,statusOf:a,groupByCategory:!0,expandedId:c,onExpand:C,idPrefix:`glob`}):null]})]})}function at(e){let{title:t,entries:n,statusOf:r,groupByCategory:i,expandedId:a,onExpand:o,idPrefix:s}=e,c=(0,y.useMemo)(()=>{if(!i)return[{name:``,items:n}];let e=new Map;for(let t of n){let n=t.category||`其它`,r=e.get(n)??[];r.push(t),e.set(n,r)}return[...e.entries()].map(([e,t])=>({name:e,items:t}))},[n,i]);return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[t,` · `,n.length,` 个`]}),(0,Q.jsx)(`div`,{className:`space-y-5`,children:c.map(e=>(0,Q.jsxs)(`section`,{children:[e.name?(0,Q.jsx)(`h3`,{className:`mb-2 text-[13px] font-medium text-stone-600`,children:e.name}):null,(0,Q.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r(e),n=`${s}:${e.id}`,i=a===n,c=t.tone===`ready`?`运行中`:`已停用`;return(0,Q.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Q.jsx)(ot,{open:i,onToggleOpen:()=>o(n),title:e.id,titleMono:!0,subtitle:rt(e.roleZh),status:t,fullName:nt(e.id),configLabel:`已启用`,runLabel:c})},e.id)})})]},e.name||`all`))})]})}function ot(e){let{open:t,onToggleOpen:n,title:r,titleMono:i,subtitle:a,badge:o,status:s,trailing:c,fullName:l,configLabel:u,runLabel:d,extra:p}=e;return(0,Q.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 hover:z-40 focus-within:z-40 bg-white border rounded-xl transition-colors self-start w-full overflow-visible ${t?`border-[#4176e6]/50 shadow-sm z-40`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Q.jsxs)(`div`,{className:`relative px-4 py-3 flex gap-3 items-start h-17 overflow-visible`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:`relative flex-1 min-w-0 h-full text-left outline-none focus:outline-none overflow-visible`,"aria-expanded":t,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`font-medium text-stone-900 truncate min-w-0 ${i?`font-mono text-[13px]`:`text-[14px]`}`,children:r}),o,(0,Q.jsx)(st,{className:`w-3.5 h-3.5 text-stone-400 shrink-0 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Q.jsx)(f,{text:a,className:`mt-1 block min-w-0 text-[13px] text-stone-500 leading-5 truncate`,disabled:t})]}),(0,Q.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 pt-0.5 self-start`,children:[s?(0,Q.jsx)(ct,{tone:s.tone,label:s.label}):null,c]})]}),(0,Q.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Q.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Q.jsx)(`div`,{className:`px-4 pb-3 pt-0 border-t border-stone-100`,children:(0,Q.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`完整名称`}),(0,Q.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] text-stone-700 break-all`,children:l})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`配置状态`}),(0,Q.jsx)(`dd`,{className:`text-stone-700`,children:u})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`运行状态`}),(0,Q.jsx)(`dd`,{className:d===`运行中`?`text-emerald-600`:`text-stone-500`,children:d})]}),a?(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`简介`}),(0,Q.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:a})]}):null,p?(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`说明`}),(0,Q.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:p})]}):null]})})})})]})}function st({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function ct(e){let{tone:t,label:n}=e;return(0,Q.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border ${t===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:t===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`}`,children:n})}export{ae as $,je as A,C as B,Ae as C,we as D,Ce as E,de as F,w as G,T as H,fe as I,te as J,ne as K,L,Ee as M,Ie as N,Me as O,xe as P,ie as Q,he as R,Le as S,H as T,S as U,x as V,re as W,D as X,ue as Y,oe as Z,ye as _,He as a,le as at,ke as b,Ve as c,Je as d,ce as et,Ge as f,ve as g,Ke as h,Be as i,F as it,Ne as j,Fe as k,G as l,Ye as m,Ue as n,se as nt,We as o,qe as p,A as q,Re as r,j as rt,ze as s,tt as t,E as tt,K as u,Te as v,be as w,Oe as x,De as y,ge as z};
|
|
39
|
+
`)}async function J(e,t,n,r){if(r===`readonly`)return JSON.stringify({error:`${t} 需要「工作区内修改」或「完全权限」`});let i={};try{i=JSON.parse(n||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}let a=String(i.command??``).trim();if(!a)return JSON.stringify({error:`command is required`});let o=!!i.background;try{let t=await fetch(`${e}/exec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:a,workdir:i.workdir,access:r,background:o}),signal:AbortSignal.timeout(o?15e3:13e4)}),n=await t.json();return!t.ok&&n.error?q({error:String(n.error),command:a}):n.background&&n.jobId?q({background:!0,jobId:String(n.jobId),command:n.command||a,workdir:n.workdir}):q({ok:!!n.ok,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,truncated:!!n.truncated,timedOut:!!n.timedOut,error:n.error?String(n.error):void 0,workdir:n.workdir,cwd:n.cwd,durationMs:n.durationMs,command:n.command||a})}catch(e){return`${t} failed: ${e instanceof Error?e.message:String(e)}`}}async function Ge(e,t){return J(U,`Bash`,e,t)}async function Ke(e,t){return J(W,`Pwsh`,e,t)}async function qe(e,t,n){if(e===`job_kill`&&n===`readonly`)return JSON.stringify({error:`job_kill 需要「工作区内修改」或「完全权限」`});let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{if(e===`job_list`){let e=await(await fetch(`${U}/jobs`,{signal:AbortSignal.timeout(5e3)})).json();return JSON.stringify(e,null,2)}if(e===`job_output`){let e=String(r.jobId??r.id??``).trim();if(!e)return JSON.stringify({error:`jobId is required`});let t=await(await fetch(`${U}/job_output`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:e,offset:r.offset}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(t,null,2)}if(e===`job_kill`){let e=String(r.jobId??r.id??``).trim();if(!e)return JSON.stringify({error:`jobId is required`});let t=await(await fetch(`${U}/job_kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobId:e,access:n}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(t,null,2)}return JSON.stringify({error:`unknown tool: ${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function Y(e,t,n,r,i){if(i===`readonly`)return JSON.stringify({error:`${t} 需要「工作区内修改」或「完全权限」`});let a={};try{a=JSON.parse(r||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}let o=n.replace(/^(bash|pwsh)_session_/,``);try{if(o===`list`){let t=await(await fetch(`${e}/session/list`,{signal:AbortSignal.timeout(5e3)})).json();return JSON.stringify(t,null,2)}if(o===`open`){let t=await(await fetch(`${e}/session/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({access:i,workdir:a.workdir}),signal:AbortSignal.timeout(2e4)})).json();return JSON.stringify(t,null,2)}if(o===`exec`){let t=String(a.sessionId??a.id??``).trim(),n=String(a.command??``);if(!t)return JSON.stringify({error:`sessionId is required`});if(!n.trim())return JSON.stringify({error:`command is required`});let r=await(await fetch(`${e}/session/exec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({access:i,sessionId:t,command:n,timeoutMs:a.timeoutMs}),signal:AbortSignal.timeout(13e4)})).json();return JSON.stringify(r,null,2)}if(o===`read`){let t=String(a.sessionId??a.id??``).trim();if(!t)return JSON.stringify({error:`sessionId is required`});let n=await(await fetch(`${e}/session/read`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,offset:a.offset}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(n,null,2)}if(o===`close`){let t=String(a.sessionId??a.id??``).trim();if(!t)return JSON.stringify({error:`sessionId is required`});let n=await(await fetch(`${e}/session/close`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,access:i}),signal:AbortSignal.timeout(1e4)})).json();return JSON.stringify(n,null,2)}return JSON.stringify({error:`unknown tool: ${n}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function Je(e,t,n){return Y(U,`bash session`,e,t,n)}async function Ye(e,t,n){return Y(W,`pwsh session`,e,t,n)}function Xe(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var X=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],Z=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],Q=d(),Ze={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},$={tasks:h,todos:g,projects:m,iterations:m,pmRequirements:m,bugs:m,testStats:v,caseExec:c,dashboard:g},Qe=[`extension`,`session`,`global`],$e=`plugins.mine-tab`,et=o();function tt({embedded:e=!1}){let[t,o]=(0,y.useState)(()=>u($e,Qe,`extension`)),[s,c]=(0,y.useState)(()=>a()),[d,f]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(!0);async function O(){D(!0);try{let[e,t,n,r,i,a,o,s,c,l,u,d,p,m]=await Promise.all([H(),L(),ne(),G(),K(),$.tasks(),$.todos(),$.projects(),$.iterations(),$.pmRequirements(),$.bugs(),$.testStats(),$.caseExec(),$.dashboard()]);f(e),h(t),v(n),x(r),C(i),T({tasks:a,todos:o,projects:s,iterations:c,pmRequirements:l,bugs:u,testStats:d,caseExec:p,dashboard:m})}finally{D(!1)}}(0,y.useEffect)(()=>{let e=r(e=>c(e));return n().then(()=>{c(a()),O()}),()=>{e()}},[]);function k(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return s.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return s.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件;工作台按提示词写作`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=w?.[e];return t===void 0?{available:E?null:!1,detail:E?`探测中…`:`需本地服务`}:t?{available:!0,detail:Ze[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?s.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?E&&d===null?{available:null,detail:`探测中…`}:d?.ok?{available:!0,detail:`已连接 · ${d.entryCount??d.entityCount??0} 条记忆 / 待确认 ${d.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?E&&g===null?{available:null,detail:`探测中…`}:g?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function ee(e){let t=Xe(e.id);return t===`none`?{label:`规划中`,tone:`plan`}:t===`ready`?{label:`已就绪`,tone:`ready`}:E&&(t===`web`&&m===null||t===`fs`&&g===null||t===`bash`&&b===null||t===`pwsh`&&S===null)?{label:`探测中…`,tone:`plan`}:t===`web`?m?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`fs`?g?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`bash`?b?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`pwsh`?S?.ok&&S.available?{label:`已就绪`,tone:`ready`}:S?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}function te(e){let t=i(e,!s[e]);c(t),e===`reports`&&_(!!t.reports).catch(e=>{console.warn(`[reports] 同步工作汇报提示词失败`,e)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&t[e]&&p().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}function A(e){l($e,e),o(e)}return(0,Q.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Q.jsx)(`div`,{className:`w-full ${e?`px-6 py-5`:`px-6 py-6`}`,children:(0,Q.jsx)(it,{mineTab:t,onMineTab:A,enabled:s,runtimeFor:k,builtinStatus:ee,onToggle:te})})})}function nt(e){return`@lh-plugins/${e}`}function rt(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function it(e){let{mineTab:t,onMineTab:n,enabled:r,runtimeFor:i,builtinStatus:a,onToggle:o}=e,[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)({}),f=[{id:`extension`,label:`扩展插件`,count:s.length,hint:`可配置插件`},{id:`session`,label:`会话插件`,count:X.length,hint:`默认`},{id:`global`,label:`全局插件`,count:Z.length,hint:`默认`}],p=Math.max(0,f.findIndex(e=>e.id===t)),m=(0,y.useId)(),h=(0,y.useRef)(null),g=`${m}-panel`,_=e=>`${m}-tab-${e}`,v=Math.max(1,f.length),b=.5+.25*(v-1);function x(e){n(e),l(null)}function S(e){let t=f.length;if(!t)return;let n=p;if(e.key===`ArrowLeft`)n=(p-1+t)%t;else if(e.key===`ArrowRight`)n=(p+1)%t;else if(e.key===`Home`)n=0;else if(e.key===`End`)n=t-1;else return;e.preventDefault();let r=f[n];r&&(x(r.id),h.current?.querySelectorAll(`[role="tab"]`)[n]?.focus())}function C(e){l(t=>t===e?null:e)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`header`,{className:`mb-4 flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-bold text-stone-900`,children:`我的插件`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-sm text-stone-500 leading-6`,children:`扩展为可配置插件;会话 / 全局为平台默认。点击卡片展开详情。`})]})}),(0,Q.jsxs)(`div`,{ref:h,className:`mb-5 relative grid gap-1 p-1 rounded-2xl bg-stone-100 border border-stone-200/90`,style:{gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`},role:`tablist`,"aria-label":`插件分类`,"aria-orientation":`horizontal`,onKeyDown:S,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-1 top-1 bottom-1 rounded-xl bg-white shadow-sm ring-1 ring-stone-200/80 transition-transform duration-300 ease-out motion-reduce:transition-none`,style:{width:`calc((100% - ${b}rem) / ${v})`,transform:`translateX(calc(${p} * (100% + 0.25rem)))`}}),f.map(e=>{let n=t===e.id;return(0,Q.jsxs)(`button`,{id:_(e.id),type:`button`,role:`tab`,"aria-selected":n,"aria-controls":g,tabIndex:n?0:-1,onClick:()=>x(e.id),className:`relative min-w-0 h-11 px-2 rounded-xl text-left transition-colors ${n?`text-stone-900`:`text-stone-500 hover:text-stone-700`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-1.5 justify-center sm:justify-start sm:px-1`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.count})]}),(0,Q.jsx)(`div`,{className:`hidden sm:block text-[10px] px-1 mt-0.5 ${n?`text-stone-400`:`text-stone-400/80`}`,children:e.hint})]},e.id)})]}),(0,Q.jsxs)(`div`,{id:g,role:`tabpanel`,"aria-labelledby":_(t),children:[t===`extension`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[`可配置插件 · `,s.length,` 个`]}),(0,Q.jsx)(`div`,{className:`space-y-5`,children:et.map(e=>{let t=!!u[e.category];return(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":!t,onClick:()=>d(n=>({...n,[e.category]:!t})),className:`mb-2 flex w-full items-center gap-1.5 text-left text-[13px] font-medium text-stone-600`,children:[(0,Q.jsx)(st,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${t?`-rotate-90`:``}`}),(0,Q.jsx)(`span`,{children:e.category}),(0,Q.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.items.length})]}),t?null:(0,Q.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r[e.id],n=i(e.id),a=c===`ext:${e.id}`,s=e.alwaysOn?`内置常开`:t?`已启用`:`未启用`,l=t&&n.available===!0?`运行中`:`已停用`;return(0,Q.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${a?` z-40`:``}`,children:(0,Q.jsx)(ot,{open:a,onToggleOpen:()=>C(`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Q.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500 tabular-nums`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Q.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500`,children:`内置`}):(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":`${t?`关闭`:`打开`} ${e.name}`,onClick:()=>o(e.id),className:`tw-toggle`,children:(0,Q.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:nt(e.id),configLabel:s,runLabel:l,extra:n.detail})},e.id)})})]},e.category)})}),(0,Q.jsx)(`p`,{className:`mt-5 text-xs text-stone-400 leading-5`,children:`开关保存在本机。网页搜索 / 工作区文件已迁入会话默认能力。`})]}):null,t===`session`?(0,Q.jsx)(at,{title:`由平台按会话默认提供`,entries:X,statusOf:a,groupByCategory:!1,expandedId:c,onExpand:C,idPrefix:`sess`}):null,t===`global`?(0,Q.jsx)(at,{title:`由系统与全部会话共享`,entries:Z,statusOf:a,groupByCategory:!0,expandedId:c,onExpand:C,idPrefix:`glob`}):null]})]})}function at(e){let{title:t,entries:n,statusOf:r,groupByCategory:i,expandedId:a,onExpand:o,idPrefix:s}=e,c=(0,y.useMemo)(()=>{if(!i)return[{name:``,items:n}];let e=new Map;for(let t of n){let n=t.category||`其它`,r=e.get(n)??[];r.push(t),e.set(n,r)}return[...e.entries()].map(([e,t])=>({name:e,items:t}))},[n,i]);return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[t,` · `,n.length,` 个`]}),(0,Q.jsx)(`div`,{className:`space-y-5`,children:c.map(e=>(0,Q.jsxs)(`section`,{children:[e.name?(0,Q.jsx)(`h3`,{className:`mb-2 text-[13px] font-medium text-stone-600`,children:e.name}):null,(0,Q.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r(e),n=`${s}:${e.id}`,i=a===n,c=t.tone===`ready`?`运行中`:`已停用`;return(0,Q.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Q.jsx)(ot,{open:i,onToggleOpen:()=>o(n),title:e.id,titleMono:!0,subtitle:rt(e.roleZh),status:t,fullName:nt(e.id),configLabel:`已启用`,runLabel:c})},e.id)})})]},e.name||`all`))})]})}function ot(e){let{open:t,onToggleOpen:n,title:r,titleMono:i,subtitle:a,badge:o,status:s,trailing:c,fullName:l,configLabel:u,runLabel:d,extra:p}=e;return(0,Q.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 hover:z-40 focus-within:z-40 bg-white border rounded-xl transition-colors self-start w-full overflow-visible ${t?`border-[#4176e6]/50 shadow-sm z-40`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Q.jsxs)(`div`,{className:`relative px-4 py-3 flex gap-3 items-start h-17 overflow-visible`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:`relative flex-1 min-w-0 h-full text-left outline-none focus:outline-none overflow-visible`,"aria-expanded":t,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`font-medium text-stone-900 truncate min-w-0 ${i?`font-mono text-[13px]`:`text-[14px]`}`,children:r}),o,(0,Q.jsx)(st,{className:`w-3.5 h-3.5 text-stone-400 shrink-0 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Q.jsx)(f,{text:a,className:`mt-1 block min-w-0 text-[13px] text-stone-500 leading-5 truncate`,disabled:t})]}),(0,Q.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 pt-0.5 self-start`,children:[s?(0,Q.jsx)(ct,{tone:s.tone,label:s.label}):null,c]})]}),(0,Q.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Q.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Q.jsx)(`div`,{className:`px-4 pb-3 pt-0 border-t border-stone-100`,children:(0,Q.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`完整名称`}),(0,Q.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] text-stone-700 break-all`,children:l})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`配置状态`}),(0,Q.jsx)(`dd`,{className:`text-stone-700`,children:u})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`运行状态`}),(0,Q.jsx)(`dd`,{className:d===`运行中`?`text-emerald-600`:`text-stone-500`,children:d})]}),a?(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`简介`}),(0,Q.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:a})]}):null,p?(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`说明`}),(0,Q.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:p})]}):null]})})})})]})}function st({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function ct(e){let{tone:t,label:n}=e;return(0,Q.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border ${t===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:t===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`}`,children:n})}export{ae as $,je as A,C as B,Ae as C,we as D,Ce as E,de as F,w as G,T as H,fe as I,te as J,ne as K,L,Ee as M,Ie as N,Me as O,xe as P,ie as Q,he as R,Le as S,H as T,S as U,x as V,re as W,D as X,ue as Y,oe as Z,ye as _,He as a,le as at,ke as b,Ve as c,Je as d,ce as et,Ge as f,ve as g,Ke as h,Be as i,F as it,Ne as j,Fe as k,G as l,Ye as m,Ue as n,se as nt,We as o,qe as p,A as q,Re as r,j as rt,ze as s,tt as t,E as tt,K as u,Te as v,be as w,Oe as x,De as y,ge as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PluginsPage.DIltPILi.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.D5ypJIXn.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as ee}from"./ConfirmDialog.CBVsDJ8f.js";import{n as te,t as ne}from"./DocsPager.rzu4mnzw.js";import{t as i}from"./SelectDropdown.Buv7rQJ_.js";import{A as a,F as re,P as o,b as ie,g as ae,h as oe,i as se,k as s,m as c,n as l,p as ce,r as u,t as d}from"./pm.BsnTv63L.js";import{D as f,E as p,O as le,S as ue,T as de,_ as m,a as fe,c as pe,d as me,f as h,g as he,h as ge,k as _e,l as ve,m as g,n as ye,p as be,s as xe,t as Se,u as Ce,y as _}from"./PmShared.CZnXaUq-.js";var v=e(t(),1),y=r(),we=20,Te=`tw.pm-bugs.page-size.v1`,Ee=[`all`,...u],De=[`all`,...d],Oe=`pm.bugs.project`,ke=`pm.bugs.iteration`,Ae=`pm.bugs.status`,je=`pm.bugs.severity`,Me=`pm.bugs.keyword`,b=d.map(e=>({value:e,label:l[e]})),x=u.map(e=>({value:e,label:se[e]}));function S(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function Ne(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(t)}catch{return!1}}function C({scopeProjectId:e=``}={}){let t=!!e,r=le(`bugs`),{store:u,live:d,loading:C,error:w,setError:T,reload:E}=_e(),[D,O]=f(Oe,`all`),k=e||D,[A,j]=f(ke,`all`),[M,Pe]=p(Ae,Ee,`all`),[N,Fe]=p(je,De,`all`),[P,Ie]=f(Me),[Le,F]=(0,v.useState)(1),[I,Re]=te(we,Te),[L,R]=(0,v.useState)(null),[z,B]=(0,v.useState)(!1),[V,ze]=(0,v.useState)(!1),H=(0,v.useRef)(null),U=(0,v.useRef)(new Set),[W,G]=(0,v.useState)(null),[Be,K]=(0,v.useState)(null),q=(0,v.useMemo)(()=>a(L?.attachment??``),[L?.attachment]);(0,v.useEffect)(()=>{for(let e of q)U.current.add(e.url)},[q]);let Ve=(0,v.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),He=(0,v.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u.iterations.filter(e=>k===`all`||e.projectId===k).map(e=>({value:e.id,label:e.name}))],[u.iterations,k]),Ue=(0,v.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[u.projects]),We=(0,v.useMemo)(()=>{let e=new Map(u.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[u.iterations]),J=(0,v.useMemo)(()=>ie(u.bugs,{projectId:k,iterationId:A,status:M,severity:N,keyword:P}),[u.bugs,k,A,M,N,P]),Y=t?u.bugs.filter(e=>e.projectId===k).length:u.bugs.length,X=Math.max(1,Math.ceil(J.length/I)),Z=Math.min(Le,X),Ge=J.slice((Z-1)*I,Z*I);(0,v.useEffect)(()=>{t||d===!0&&D!==`all`&&!u.projects.some(e=>e.id===D)&&O(`all`)},[d,u.projects,D,O,t]),(0,v.useEffect)(()=>{d===!0&&A!==`all`&&!u.iterations.some(e=>e.id===A&&(k===`all`||e.projectId===k))&&j(`all`)},[d,u.iterations,k,A,j]);let Ke=L?u.iterations.filter(e=>e.projectId===L.projectId):[],qe=L?u.requirements.filter(e=>e.projectId===L.projectId):[];async function Je(){if(!L)return;if(!L.projectId){T(`请先选择所属项目`);return}let e=L.reproduceSteps.trim();if(!e){T(`缺陷描述不能为空`);return}let t=ce(e);B(!0);try{let n={projectId:L.projectId,iterationId:L.iterationId,requirementId:L.requirementId,title:t,severity:L.severity,status:L.status,reproduceSteps:e,expectedResult:L.expectedResult,actualResult:L.actualResult,environment:L.environment,githubIssue:L.githubIssue,attachment:L.attachment,remark:L.remark};L.id?await o(`bugs`,L.id,n):await oe(`bugs`,[n]),R(null),U.current.clear(),T(``),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}let Q=(0,v.useCallback)(async e=>{if(e&&e.length){ze(!0);try{let t=await re(Array.from(e));R(e=>{if(!e)return e;let n=a(e.attachment);return{...e,attachment:s([...n,...t])}}),T(``)}catch(e){T(e instanceof Error?e.message:String(e))}finally{ze(!1),H.current&&(H.current.value=``)}}},[T]),$=L!==null;(0,v.useEffect)(()=>{if(!$)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),Q(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[$,Q]);async function Ye(e){if(!L)return;let t=s(q.filter(t=>t.url!==e));if(L.id)try{await o(`bugs`,L.id,{attachment:t}),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e));return}R(e=>e&&{...e,attachment:t}),c([e],L.id??``)}function Xe(){let e=[...U.current,...q.map(e=>e.url)];U.current.clear(),R(null),e.length&&c(e)}async function Ze(e,t){B(!0);try{await o(`bugs`,e.id,{status:t}),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Qe(){let e=W;if(e){G(null),B(!0);try{await ae(`bugs`,[e.id]),await E(!0)}catch(e){T(e instanceof Error?e.message:String(e))}finally{B(!1)}}}if(!r.ready)return(0,y.jsx)(he,{label:`正在读取插件开关`});if(!r.on)return(0,y.jsx)(m,{children:n(`bugs`)});if(d===null)return(0,y.jsx)(he,{label:`正在连接项目管理服务`});if(!d)return(0,y.jsx)(m,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(u.projects.length===0&&!C&&!t)return(0,y.jsx)(m,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let $e=[{value:`all`,label:`全部`},...x];return(0,y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-600`,children:Y}),` 条缺陷`,J.length===Y?``:` · 筛选出 ${J.length} 条`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:Ve,value:D,onChange:e=>{O(e),j(`all`),F(1)}}),(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:He,value:A,onChange:e=>{j(e),F(1)}}),(0,y.jsx)(i,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...b],value:N,onChange:e=>{Fe(e),F(1)}}),(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(g,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,y.jsx)(`input`,{value:P,onChange:e=>{Ie(e.target.value),F(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,y.jsxs)(`button`,{type:`button`,disabled:z,onClick:()=>R(S(k===`all`?``:k)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,y.jsx)(g,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,y.jsx)(be,{ariaLabel:`按状态筛选缺陷`,options:$e,value:M,onChange:e=>{Pe(e),F(1)}})}),w?(0,y.jsx)(me,{message:w,onClose:()=>T(``)}):null,(0,y.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,y.jsxs)(`table`,{className:`tw-data-table w-full border-collapse text-sm`,children:[(0,y.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{className:`w-px px-4 py-2.5 text-left font-medium whitespace-nowrap`,children:`ID`}),(0,y.jsx)(`th`,{className:`px-4 py-2.5 text-left font-medium`,children:`缺陷标题`}),(0,y.jsx)(`th`,{className:`w-28 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`严重程度`}),(0,y.jsx)(`th`,{className:`w-32 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`缺陷状态`}),t?null:(0,y.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属项目`}),(0,y.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属迭代`}),(0,y.jsx)(`th`,{className:`w-24 px-3 py-2.5 text-center font-medium whitespace-nowrap`,children:`操作`})]})}),(0,y.jsxs)(`tbody`,{children:[C&&!u.bugs.length?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:t?6:7,className:`px-4 py-16 text-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):Ge.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:t?6:7,children:Y?(0,y.jsx)(ve,{children:`没有符合筛选条件的缺陷。`}):(0,y.jsx)(Ce,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,y.jsxs)(`button`,{type:`button`,onClick:()=>R(S(k===`all`?``:k)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,y.jsx)(g,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,Ge.map(e=>(0,y.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,y.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 font-mono text-xs text-stone-400`,children:e.autoId}),(0,y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,y.jsx)(`button`,{type:`button`,onClick:()=>R({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark}),className:`max-w-full truncate text-left text-stone-800 hover:text-[#3370ff]`,children:e.title})}),(0,y.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,y.jsx)(ue,{tone:Se[e.severity],children:l[e.severity]})}),(0,y.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,y.jsx)(i,{unstyled:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:z,options:x,value:e.status,onChange:t=>void Ze(e,t),renderOptionPrefix:e=>(0,y.jsx)(xe,{tone:ye[e.value]}),renderTrigger:()=>(0,y.jsx)(ue,{tone:ye[e.status],children:se[e.status]})})}),t?null:(0,y.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-600`,children:(0,y.jsx)(`a`,{href:de(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:Ue(e.projectId)})}),(0,y.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-500`,children:We(e.iterationId)}),(0,y.jsx)(`td`,{className:`px-3 py-2.5 text-center`,children:(0,y.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:z,onClick:()=>G(e),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 disabled:opacity-40`,children:(0,y.jsx)(g,{name:`trash`,size:15})})})]},e.id))]})]})}),J.length>0?(0,y.jsx)(ne,{page:Z,totalPages:X,pageSize:I,busy:z,onPage:F,onPageSize:e=>{Re(e),F(1)}}):null]}),(0,y.jsx)(pe,{open:L!==null,title:L?.id?`编辑缺陷`:`新建缺陷`,busy:z,submitLabel:L?.id?`保存`:`创建`,onClose:Xe,onSubmit:()=>void Je(),children:L?(0,y.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,y.jsx)(h,{label:`所属项目`,required:!0,children:(0,y.jsx)(_,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:L.projectId,onChange:e=>R({...L,projectId:e,iterationId:``,requirementId:``})})}),(0,y.jsx)(h,{label:`所属迭代`,children:(0,y.jsx)(_,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...Ke.map(e=>({value:e.id,label:e.name}))],value:L.iterationId,onChange:e=>R({...L,iterationId:e}),disabled:Ke.length===0})}),(0,y.jsx)(h,{label:`关联需求`,children:(0,y.jsx)(_,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...qe.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:L.requirementId,onChange:e=>R({...L,requirementId:e}),disabled:qe.length===0})}),(0,y.jsx)(h,{label:`缺陷描述`,required:!0,children:(0,y.jsx)(`textarea`,{autoFocus:!0,value:L.reproduceSteps,onChange:e=>R({...L,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:fe})}),(0,y.jsx)(h,{label:`严重程度`,children:(0,y.jsx)(_,{ariaLabel:`严重程度`,options:b,value:L.severity,onChange:e=>R({...L,severity:e}),renderOptionPrefix:e=>(0,y.jsx)(xe,{tone:Se[e.value]})})}),(0,y.jsx)(h,{label:`附件`,children:(0,y.jsxs)(`div`,{className:`space-y-2`,children:[q.length?(0,y.jsx)(`ul`,{className:`space-y-1.5`,children:q.map(e=>{let t=Ne(e.url);return(0,y.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>K(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,y.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,y.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,y.jsx)(g,{name:`file`,size:15})}),t?(0,y.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>Ye(e.url),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-stone-300 hover:bg-red-50 hover:text-red-600`,children:`✕`})]},e.url)})}):null,(0,y.jsx)(`input`,{ref:H,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void Q(e.target.files)}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,disabled:V,onClick:()=>H.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,y.jsx)(g,{name:V?`file`:`plus`,size:13}),V?`上传中…`:`上传文件 / 图片`]}),(0,y.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,y.jsx)(h,{label:`备注`,children:(0,y.jsx)(`textarea`,{value:L.remark,onChange:e=>R({...L,remark:e.target.value}),rows:2,className:fe})})]}):null}),(0,y.jsx)(ee,{open:W!==null,title:`删除缺陷`,message:`确定删除「${W?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>G(null),onConfirm:()=>void Qe()}),(0,y.jsx)(ge,{file:Be,onClose:()=>K(null)})]})}export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.D5ypJIXn.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./ConfirmDialog.CBVsDJ8f.js";import{t as a}from"./DatePicker.CMfX7F6z.js";import{t as o}from"./SelectDropdown.Buv7rQJ_.js";import{D as ee,N as te,O as ne,P as s,a as c,g as l,h as re,o as u,x as d}from"./pm.BsnTv63L.js";import{D as f,E as p,O as m,S as h,T as ie,_ as g,a as ae,c as oe,d as se,f as _,g as v,i as y,k as ce,l as le,m as b,r as x,s as ue,u as S,v as C,y as w}from"./PmShared.CZnXaUq-.js";var T=e(t(),1),E=r(),D=10,de=[`all`,...c],fe=`pm.iterations.project`,pe=`pm.iterations.status`,me=`pm.iterations.keyword`,O=c.map(e=>({value:e,label:u[e]}));function k(e=``){return{projectId:e,name:``,startDate:``,endDate:``,status:`planning`,remark:``}}function A({scopeProjectId:e=``}={}){let t=!!e,r=m(`iterations`),{store:c,live:A,loading:j,error:M,setError:N,reload:P}=ce(),[F,I]=f(fe,`all`),L=e||F,[R,he]=p(pe,de,`all`),[z,ge]=f(me),[_e,B]=(0,T.useState)(1),[V,H]=(0,T.useState)(null),[U,W]=(0,T.useState)(!1),[G,K]=(0,T.useState)(null),q=te(),ve=(0,T.useMemo)(()=>{let e=new Map(c.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`未关联项目`},[c.projects]),ye=(0,T.useMemo)(()=>[{value:`all`,label:`全部项目`},...c.projects.map(e=>({value:e.id,label:e.name}))],[c.projects]),J=(0,T.useMemo)(()=>d(c.iterations,{projectId:L,status:R,keyword:z}),[c.iterations,L,R,z]),Y=t?c.iterations.filter(e=>e.projectId===L).length:c.iterations.length,X=Math.max(1,Math.ceil(J.length/D)),Z=Math.min(_e,X),Q=J.slice((Z-1)*D,Z*D);(0,T.useEffect)(()=>{t||A===!0&&F!==`all`&&!c.projects.some(e=>e.id===F)&&I(`all`)},[A,c.projects,F,I,t]);async function be(){if(!V)return;if(!V.projectId){N(`请先选择所属项目`);return}let e=V.name.trim();if(!e)N(`迭代名称不能为空`);else if(V.startDate&&V.endDate&&V.endDate<V.startDate)N(`迭代结束日期不能早于开始日期`);else{W(!0);try{let t={projectId:V.projectId,name:e,startDate:V.startDate,endDate:V.endDate,status:V.status,remark:V.remark};V.id?await s(`iterations`,V.id,t):await re(`iterations`,[t]),H(null),N(``),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}}async function $(e,t){W(!0);try{await s(`iterations`,e.id,{status:t}),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}async function xe(){let e=G;if(e){K(null),W(!0);try{await l(`iterations`,[e.id]),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}}return r.ready?r.on?A===null?(0,E.jsx)(v,{label:`正在连接项目管理服务`}):A?c.projects.length===0&&!j&&!t?(0,E.jsx)(g,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护迭代。`}):(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,E.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,E.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,E.jsx)(`span`,{className:`font-medium text-stone-600`,children:Y}),` 个迭代`,J.length===Y?``:` · 筛选出 ${J.length} 个`]}),(0,E.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,E.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选迭代`,className:`w-36`,options:ye,value:F,onChange:e=>{I(e),B(1)}}),(0,E.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按状态筛选迭代`,className:`w-28`,options:[{value:`all`,label:`全部状态`},...O],value:R,onChange:e=>{he(e),B(1)}}),(0,E.jsxs)(`label`,{className:`relative block`,children:[(0,E.jsx)(b,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,E.jsx)(`input`,{value:z,onChange:e=>{ge(e.target.value),B(1)},placeholder:`搜索迭代名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,E.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>H(k(L===`all`?``:L)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,E.jsx)(b,{name:`plus`,size:14}),`新建迭代`]})]})]}),M?(0,E.jsx)(se,{message:M,onClose:()=>N(``)}):null,(0,E.jsx)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-auto pb-4`,children:j&&!c.iterations.length?(0,E.jsx)(`div`,{className:`flex min-h-[200px] items-center justify-center`,children:(0,E.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):Q.length===0?Y?(0,E.jsx)(le,{children:`没有符合筛选条件的迭代。`}):(0,E.jsx)(S,{icon:`calendar`,title:`暂无迭代`,hint:`新建一个迭代,用开始 / 截止日期跟踪进度。`,action:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(k(L===`all`?``:L)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,E.jsx)(b,{name:`plus`,size:13}),`新建迭代`]})}):(0,E.jsx)(`div`,{className:`space-y-3`,children:Q.map(e=>{let n=ne(e,q),r=ee(e,q),i=e.endDate&&e.status!==`done`?Math.round((Date.parse(`${e.endDate}T00:00:00`)-Date.parse(`${q}T00:00:00`))/864e5):null;return(0,E.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3.5 transition-[border-color,box-shadow] hover:border-[#ddd6fe] hover:shadow-sm`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-[15px] font-medium text-stone-800`,children:e.name}),(0,E.jsx)(h,{tone:x[e.status],children:u[e.status]})]}),(0,E.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-stone-500`,children:[t?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`a`,{href:ie(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:ve(e.projectId)}),(0,E.jsx)(`span`,{className:`text-stone-300`,children:`·`})]}),(0,E.jsxs)(`span`,{className:`tabular-nums`,children:[e.startDate||`—`,` → `,e.endDate||`—`]}),r===null?i!==null&&i>=0&&e.endDate?(0,E.jsxs)(`span`,{className:`text-stone-400`,children:[`还剩 `,i,` 天`]}):null:(0,E.jsxs)(`span`,{className:`text-red-500`,children:[`逾期 `,r,` 天`]})]}),e.remark?(0,E.jsx)(`p`,{className:`mt-1 line-clamp-1 text-xs text-stone-400`,children:e.remark}):null]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.status===`planning`?(0,E.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>void $(e,`in_progress`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,E.jsx)(b,{name:`play`,size:12}),`开始`]}):null,e.status===`in_progress`?(0,E.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>void $(e,`done`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,E.jsx)(b,{name:`check`,size:12}),`完成`]}):null,(0,E.jsx)(`button`,{type:`button`,"aria-label":`编辑 ${e.name}`,onClick:()=>H({id:e.id,projectId:e.projectId,name:e.name,startDate:e.startDate,endDate:e.endDate,status:e.status,remark:e.remark}),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,children:(0,E.jsx)(b,{name:`pencil`,size:15})}),(0,E.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.name}`,disabled:U,onClick:()=>K(e),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 disabled:opacity-40`,children:(0,E.jsx)(b,{name:`trash`,size:15})})]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,E.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,E.jsx)(`div`,{className:`h-full rounded-full bg-[#3370ff] transition-[width] duration-300`,style:{width:`${n}%`}})}),(0,E.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[n,`%`]})]})]},e.id)})})}),J.length>0?(0,E.jsx)(C,{page:Z,totalPages:X,busy:U,onPage:B}):null,(0,E.jsx)(oe,{open:V!==null,title:V?.id?`编辑迭代`:`新建迭代`,busy:U,submitLabel:V?.id?`保存`:`创建`,onClose:()=>H(null),onSubmit:()=>void be(),children:V?(0,E.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,E.jsx)(_,{label:`所属项目`,required:!0,children:(0,E.jsx)(w,{ariaLabel:`所属项目`,options:c.projects.map(e=>({value:e.id,label:e.name})),value:V.projectId,onChange:e=>H({...V,projectId:e}),disabled:c.projects.length===0})}),(0,E.jsx)(_,{label:`迭代名称`,required:!0,children:(0,E.jsx)(`input`,{autoFocus:!0,value:V.name,onChange:e=>H({...V,name:e.target.value}),placeholder:`如:v1.0 迭代`,className:y})}),(0,E.jsx)(_,{label:`开始日期`,children:(0,E.jsx)(a,{value:V.startDate,onChange:e=>H({...V,startDate:e}),placeholder:`选择开始日期`,className:`${y} tabular-nums`})}),(0,E.jsx)(_,{label:`截止日期`,children:(0,E.jsx)(a,{value:V.endDate,onChange:e=>H({...V,endDate:e}),placeholder:`选择截止日期`,className:`${y} tabular-nums`})}),(0,E.jsx)(_,{label:`状态`,children:(0,E.jsx)(w,{ariaLabel:`迭代状态`,options:O,value:V.status,onChange:e=>H({...V,status:e}),renderOptionPrefix:e=>(0,E.jsx)(ue,{tone:x[e.value]})})}),(0,E.jsx)(_,{label:`备注`,children:(0,E.jsx)(`textarea`,{value:V.remark,onChange:e=>H({...V,remark:e.target.value}),placeholder:`迭代目标、范围等(可选)`,rows:3,className:ae})})]}):null}),(0,E.jsx)(i,{open:G!==null,title:`删除迭代`,message:`确定删除「${G?.name??``}」?关联的需求与缺陷会保留,但不再关联到这个迭代。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>K(null),onConfirm:()=>void xe()})]}):(0,E.jsx)(g,{children:`迭代管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,E.jsx)(g,{children:n(`iterations`)}):(0,E.jsx)(v,{label:`正在读取插件开关`})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.D5ypJIXn.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{c as i,j as a}from"./pm.BsnTv63L.js";import{E as o,O as s,S as c,_ as l,b as u,g as d,k as f,m as p,o as m,u as h,x as g}from"./PmShared.CZnXaUq-.js";import _ from"./PmBugsBoard.CiaIhCHv.js";import v from"./PmIterationsBoard.H67QwKFw.js";import{t as y}from"./PmRequirementsBoard.CanxvcKg.js";var b=e(t(),1),x=r(),S=[`iterations`,`requirements`,`bugs`],C=`pm.project.tab`,w=`/pm/projects/`;function T(){let e=s(`projects`);return e.ready?e.on?(0,x.jsx)(u,{children:(0,x.jsx)(E,{})}):(0,x.jsx)(l,{children:n(`projects`)}):(0,x.jsx)(d,{label:`正在读取插件开关`})}function E(){let{store:e,live:t,loading:n}=f(),[r,s]=(0,b.useState)(``),[u,T]=o(C,S,`iterations`);(0,b.useEffect)(()=>{s(new URLSearchParams(window.location.search).get(`id`)??``)},[]);let E=(0,b.useMemo)(()=>e.projects.find(e=>e.id===r),[e.projects,r]),O=(0,b.useMemo)(()=>a(e),[e]);if(t===null)return(0,x.jsx)(d,{label:`正在连接项目管理服务`});if(!t)return(0,x.jsx)(l,{children:`项目详情需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(!E)return n&&!e.projects.length?(0,x.jsx)(d,{label:`正在读取项目`}):(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsx)(D,{}),(0,x.jsx)(h,{icon:`folder`,title:`没有找到这个项目`,hint:`它可能已被删除,或链接里的项目 id 不正确。`})]});let k=O[E.id],A=[{value:`iterations`,label:`迭代`,count:k?.iterations??0},{value:`requirements`,label:`需求`,count:k?.requirements??0},{value:`bugs`,label:`缺陷`,count:k?.bugs??0}];return(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3`,children:[(0,x.jsx)(`a`,{href:w,"aria-label":`返回项目列表`,className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-800`,children:(0,x.jsx)(p,{name:`arrowLeft`,size:18})}),(0,x.jsx)(`span`,{className:`tw-pm-tile flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-sm font-bold`,children:E.name.slice(0,1)}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`h1`,{className:`truncate text-lg font-semibold text-stone-800`,children:E.name}),(0,x.jsx)(c,{tone:m[E.status],children:i[E.status]})]}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs ${E.description?`text-stone-400`:`text-stone-300 italic`}`,children:E.description||`暂无描述`})]})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(g,{tabs:A,value:u,onChange:T,ariaLabel:`项目二级菜单`}),(0,x.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`需求完成 `,k?.requirementPercent??0,`% · 缺陷完成 `,k?.bugClosedPercent??100,`%`]})]}),(0,x.jsxs)(`div`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,children:[u===`iterations`?(0,x.jsx)(v,{scopeProjectId:E.id}):null,u===`requirements`?(0,x.jsx)(y,{scopeProjectId:E.id}):null,u===`bugs`?(0,x.jsx)(_,{scopeProjectId:E.id}):null]})]})}function D(){return(0,x.jsxs)(`a`,{href:w,className:`mb-2 inline-flex w-fit items-center gap-1.5 text-sm text-stone-500 transition-colors hover:text-stone-800`,children:[(0,x.jsx)(p,{name:`arrowLeft`,size:16}),`返回项目列表`]})}export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{o as n}from"./plugins.D5ypJIXn.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./ConfirmDialog.CBVsDJ8f.js";import{t as ee}from"./SelectDropdown.Buv7rQJ_.js";import{P as a,S as o,c as s,g as te,h as ne,j as re,s as c}from"./pm.BsnTv63L.js";import{D as ie,E as l,O as u,S as d,T as f,_ as p,a as m,c as h,d as g,f as _,g as v,i as y,k as b,l as x,m as S,o as C,s as ae,u as oe,v as se,y as ce}from"./PmShared.CZnXaUq-.js";var w=e(t(),1),T=r(),E=10,D=c.map(e=>({value:e,label:s[e]})),O=[`all`,...c],k=`pm.projects.status`,A=`pm.projects.keyword`;function j(){return{name:``,description:``,status:`planning`}}function M(){let e=u(`projects`),{store:t,live:r,loading:c,error:M,setError:N,reload:P}=b(),[F,I]=l(k,O,`all`),[L,R]=ie(A),[z,B]=(0,w.useState)(1),[V,H]=(0,w.useState)(null),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)(null),[q,J]=(0,w.useState)(null),Y=(0,w.useRef)(null),le=(0,w.useMemo)(()=>re(t),[t]),X=(0,w.useMemo)(()=>o(t.projects,{status:F,keyword:L}),[t.projects,F,L]),Z=Math.max(1,Math.ceil(X.length/E)),Q=Math.min(z,Z),$=X.slice((Q-1)*E,Q*E);(0,w.useEffect)(()=>{if(!q)return;function e(e){Y.current?.contains(e.target)||J(null)}function t(e){e.key===`Escape`&&J(null)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[q]);async function ue(){if(!V)return;let e=V.name.trim();if(!e)N(`项目名称不能为空`);else{W(!0);try{V.id?await a(`projects`,V.id,{name:e,description:V.description,status:V.status}):await ne(`projects`,[{name:e,description:V.description,status:V.status}]),H(null),N(``),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}}async function de(e){J(null),W(!0);try{await a(`projects`,e.id,{status:e.status===`archived`?`planning`:`archived`}),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}async function fe(){let e=G;if(e){K(null),W(!0);try{await te(`projects`,[e.id]),await P(!0)}catch(e){N(e instanceof Error?e.message:String(e))}finally{W(!1)}}}return e.ready?e.on?r===null?(0,T.jsx)(v,{label:`正在连接项目管理服务`}):r?(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`text-xs text-stone-400`,children:t.projects.length?(0,T.jsxs)(T.Fragment,{children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-600`,children:t.projects.length}),` 个项目`,X.length===t.projects.length?``:` · 筛选出 ${X.length} 个`]}):`暂无项目`}),(0,T.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(ee,{flat:!0,showCheck:!1,ariaLabel:`按状态筛选项目`,className:`w-32`,options:[{value:`all`,label:`全部状态`},...D],value:F,onChange:e=>{I(e),B(1)}}),(0,T.jsxs)(`label`,{className:`relative block`,children:[(0,T.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,T.jsx)(`input`,{value:L,onChange:e=>{R(e.target.value),B(1)},placeholder:`搜索项目名称 / 描述…`,className:`h-9 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,T.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>H(j()),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,T.jsx)(S,{name:`plus`,size:14}),`新建项目`]})]})]}),M?(0,T.jsx)(g,{message:M,onClose:()=>N(``)}):null,(0,T.jsx)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-auto pt-1 pb-4`,children:c&&!t.projects.length?(0,T.jsx)(`div`,{className:`flex min-h-[200px] items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):$.length===0?t.projects.length?(0,T.jsx)(x,{children:`没有符合筛选条件的项目。`}):(0,T.jsx)(oe,{icon:`folder`,title:`暂无项目`,hint:`创建第一个项目开始吧`,action:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>H(j()),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,T.jsx)(S,{name:`plus`,size:13}),`新建项目`]})}):(0,T.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>{let t=le[e.id];return(0,T.jsxs)(`article`,{className:`tw-pm-card group relative rounded-2xl border border-stone-200 bg-white`,children:[(0,T.jsx)(`span`,{className:`pointer-events-none absolute inset-0 overflow-hidden rounded-2xl`,"aria-hidden":`true`,children:(0,T.jsx)(`span`,{className:`tw-pm-card-accent absolute -right-6 -top-6 h-20 w-20 rounded-full bg-[#f1edff]`})}),(0,T.jsx)(`a`,{href:f(e.id),"aria-label":`打开项目 ${e.name}`,className:`absolute inset-0 z-0 rounded-2xl`}),(0,T.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex h-full flex-col p-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,T.jsx)(`span`,{className:`tw-pm-tile flex h-8 w-8 shrink-0 items-center justify-center rounded-xl text-xs font-bold`,children:e.name.slice(0,1)}),(0,T.jsx)(`h3`,{className:`truncate text-[15px] font-semibold text-stone-800`,children:e.name})]}),(0,T.jsx)(d,{tone:C[e.status],children:s[e.status]})]}),(0,T.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-[40px] text-sm ${e.description?`text-stone-500`:`italic text-stone-300`}`,children:e.description||`暂无描述`}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-xs text-stone-500`,children:[(0,T.jsxs)(`span`,{children:[t?.iterations??0,` 迭代`]}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,T.jsxs)(`span`,{children:[t?.requirements??0,` 需求`]}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,T.jsxs)(`span`,{children:[t?.bugs??0,` 缺陷`]})]}),(0,T.jsxs)(`div`,{className:`mt-auto flex items-center justify-between pt-4`,children:[(0,T.jsxs)(`div`,{className:`pointer-events-auto relative`,ref:q===e.id?Y:void 0,children:[(0,T.jsx)(`button`,{type:`button`,"aria-label":`${e.name} 的操作`,"aria-haspopup":`menu`,"aria-expanded":q===e.id,onClick:()=>J(q===e.id?null:e.id),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,children:(0,T.jsx)(S,{name:`more`,size:18})}),q===e.id?(0,T.jsxs)(`div`,{role:`menu`,className:`absolute left-0 top-9 z-30 w-36 overflow-hidden rounded-lg border border-stone-200 bg-white py-1 shadow-lg`,children:[(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{J(null),H({id:e.id,name:e.name,description:e.description,status:e.status})},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-stone-700 hover:bg-stone-50`,children:[(0,T.jsx)(S,{name:`pencil`,size:14}),`编辑`]}),(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void de(e),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-stone-700 hover:bg-stone-50`,children:[(0,T.jsx)(S,{name:`folder`,size:14}),e.status===`archived`?`取消归档`:`归档`]}),(0,T.jsx)(`div`,{className:`my-1 border-t border-stone-100`}),(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{J(null),K(e)},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-red-600 hover:bg-red-50`,children:[(0,T.jsx)(S,{name:`trash`,size:14}),`删除`]})]}):null]}),(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-stone-400`,children:[`需求完成 `,t?.requirementPercent??0,`%`,(0,T.jsx)(S,{name:`chevronRight`,size:14,className:`tw-pm-card-chevron text-stone-300`})]})]})]})]},e.id)})})}),X.length>0?(0,T.jsx)(se,{page:Q,totalPages:Z,busy:U,onPage:B}):null,(0,T.jsx)(h,{open:V!==null,title:V?.id?`编辑项目`:`新建项目`,busy:U,submitLabel:V?.id?`保存`:`创建`,onClose:()=>H(null),onSubmit:()=>void ue(),children:V?(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(_,{label:`项目名称`,required:!0,children:(0,T.jsx)(`input`,{autoFocus:!0,value:V.name,onChange:e=>H({...V,name:e.target.value}),placeholder:`输入项目名称`,className:y})}),(0,T.jsx)(_,{label:`描述`,children:(0,T.jsx)(`textarea`,{value:V.description,onChange:e=>H({...V,description:e.target.value}),placeholder:`项目描述(可选)`,rows:4,className:m})}),(0,T.jsx)(_,{label:`状态`,children:(0,T.jsx)(ce,{ariaLabel:`项目状态`,options:D,value:V.status,onChange:e=>H({...V,status:e}),renderOptionPrefix:e=>(0,T.jsx)(ae,{tone:C[e.value]})})})]}):null}),(0,T.jsx)(i,{open:G!==null,title:`删除项目`,message:`确定删除「${G?.name??``}」?该项目下的迭代、需求与缺陷会一并删除,且无法恢复。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:`solid`,onClose:()=>K(null),onConfirm:()=>void fe()})]}):(0,T.jsx)(p,{children:`项目列表需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,T.jsx)(p,{children:n(`projects`)}):(0,T.jsx)(v,{label:`正在读取插件开关`})}export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PmRequirementsBoard.CanxvcKg.js";
|