lantern-harness 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +6 -6
  3. package/builtin/session/lh-spaces.mjs +102 -0
  4. package/cli/data-root.mjs +80 -3
  5. package/cli/lantern.mjs +2 -1
  6. package/cli/server.mjs +4 -0
  7. package/cli/spaces.mjs +91 -5
  8. package/config/app.defaults.json +4 -2
  9. package/dist/500.html +9 -5
  10. package/dist/_astro/Base.ByB0D4ZA.css +1 -0
  11. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.lxEwQ1R4.js → Base.astro_astro_type_script_index_0_lang.Cg_8YLVA.js} +1 -1
  12. package/dist/_astro/CaseGenerateApp.BlZyjWEr.js +9 -0
  13. package/dist/_astro/CasesLibrary.C76La3Xj.js +1 -0
  14. package/dist/_astro/ChatApp.gfsPLvan.js +269 -0
  15. package/dist/_astro/ColumnResize.Bs6GL3DJ.js +1 -0
  16. package/dist/_astro/DatePicker.BdwFRioL.js +1 -0
  17. package/dist/_astro/{DocsFileBrowser.DkE26UTR.js → DocsFileBrowser.BxAyrkkw.js} +1 -1
  18. package/dist/_astro/KnowledgeLibrary.Cv488Hot.js +1 -0
  19. package/dist/_astro/NavLibraries.ALZ9e12z.js +1 -0
  20. package/dist/_astro/PluginsPage.B2uxCiHL.js +1 -0
  21. package/dist/_astro/{PluginsPage.BNzpPg2H.js → PluginsPage.DEkyOfQE.js} +2 -2
  22. package/dist/_astro/PromptsLibrary.BUC1OiCH.js +1 -0
  23. package/dist/_astro/RequirementsLibrary.D3olQI63.js +1 -0
  24. package/dist/_astro/{SearchableSelect.DMS2XmXc.js → SearchableSelect.DP74JRWW.js} +1 -1
  25. package/dist/_astro/SelectDropdown.D2i7-lQC.js +1 -0
  26. package/dist/_astro/{SettingsDialog.DC0e7580.js → SettingsDialog.CrMDjSLJ.js} +1 -1
  27. package/dist/_astro/SlideOverDrawer.C7UVeCX1.js +1 -0
  28. package/dist/_astro/SpaceSwitcher.Wf8EPYUx.js +7 -0
  29. package/dist/_astro/TasksBoard.2j7rGT9O.js +1 -0
  30. package/dist/_astro/TemplatesLibrary.J0x7yIcY.js +1 -0
  31. package/dist/_astro/TodosBoard.BugeB7_7.js +1 -0
  32. package/dist/_astro/app-config.vqDkEMS3.js +1 -0
  33. package/dist/_astro/doc-roots.DAJP9Svr.js +1 -0
  34. package/dist/_astro/i18n.9qZsrs3u.js +7 -0
  35. package/dist/_astro/{open-docs-in-session.D3JCwMWB.js → open-docs-in-session.fLwnA5qh.js} +1 -1
  36. package/dist/_astro/plugins.DSUPSizB.js +1 -0
  37. package/dist/_astro/project-docs.Cd2gKPKh.js +1 -0
  38. package/dist/_astro/{settings.BoQ0e0m1.js → settings.CkbipdPI.js} +2 -2
  39. package/dist/_astro/{useListAnim.CnbC_9MC.js → useListAnim.Y3N2budK.js} +1 -1
  40. package/dist/cases/generate/index.html +10 -6
  41. package/dist/cases/library/index.html +10 -6
  42. package/dist/docs/changelog/index.html +69 -6
  43. package/dist/docs/install/index.html +22 -8
  44. package/dist/docs/manual/index.html +74 -11
  45. package/dist/index.html +10 -6
  46. package/dist/knowledge/index.html +10 -6
  47. 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 +9 -5
  48. package/dist/plugins/index.html +10 -6
  49. package/dist/prompts/index.html +10 -6
  50. package/dist/requirements/index.html +10 -6
  51. package/dist/tasks/index.html +253 -0
  52. package/dist/templates/index.html +10 -6
  53. 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 +9 -5
  54. 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 +9 -5
  55. 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 +9 -5
  56. 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 +9 -5
  57. 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 +9 -5
  58. package/dist/todos/index.html +253 -0
  59. package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +2 -2
  60. package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +10 -8
  61. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +73 -23
  62. package/lh-plugins/lh-project-docs.mjs +2 -0
  63. package/lh-plugins/lh-tasks.mjs +223 -0
  64. package/lh-plugins/lh-todos.mjs +297 -0
  65. package/lh-plugins/storage-domain.mjs +1 -0
  66. package/package.json +1 -1
  67. package/dist/_astro/Base.B9f_iFAZ.css +0 -1
  68. package/dist/_astro/CaseGenerateApp.Br4uKjun.js +0 -9
  69. package/dist/_astro/CasesLibrary.CpPoVQ4P.js +0 -1
  70. package/dist/_astro/ChatApp.CYSPlSNP.js +0 -258
  71. package/dist/_astro/KnowledgeLibrary.DZinlAWn.js +0 -1
  72. package/dist/_astro/NavLibraries.EayBsg5g.js +0 -1
  73. package/dist/_astro/PluginsPage.CY61glLU.js +0 -1
  74. package/dist/_astro/PromptsLibrary.DfrrCjs7.js +0 -1
  75. package/dist/_astro/RequirementsLibrary.Dt0Gj6Nr.js +0 -1
  76. package/dist/_astro/SelectDropdown.Dc7QaPbH.js +0 -1
  77. package/dist/_astro/SpaceSwitcher.Yy2w8MDF.js +0 -7
  78. package/dist/_astro/TemplatesLibrary.uK-SjK1z.js +0 -1
  79. package/dist/_astro/app-config.CpjKWnzM.js +0 -1
  80. package/dist/_astro/i18n.BVvhz-vw.js +0 -7
  81. package/dist/_astro/plugins.CrpY8UI9.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{t as n}from"./jsx-runtime.BUXbF_vF.js";var r=e(t(),1),i=n(),a=44,o=200;function s(e){if(typeof window>`u`)return{};try{let t=window.localStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`)return{};let r={};for(let[e,t]of Object.entries(n))typeof t==`number`&&Number.isFinite(t)&&t>0&&(r[e]=Math.round(t));return r}catch{return{}}}function c(e,t){let[n,i]=(0,r.useState)(()=>s(e)),c=(0,r.useRef)(t);c.current=t;function l(e){return n[e]||t.find(t=>t.key===e)?.width}let u=t.reduce((e,t)=>e+(l(t.key)??o),0);function d(t){return n=>{let r=n.currentTarget.parentElement,s=r?.closest(`thead`);if(!r||!s)return;n.preventDefault(),n.stopPropagation();let l=s.querySelectorAll(`tr`)[0]?.children??[],u={};c.current.forEach((e,t)=>{let n=l[t]?.getBoundingClientRect().width??e.width??o;u[e.key]=Math.max(1,Math.round(n))}),i(u);let d=c.current[t];if(!d)return;let f=n.clientX,p=u[d.key]??o,m=Math.max(a,d.min??a);document.body.classList.add(`tw-col-resizing`);let h=e=>{let t=Math.max(m,Math.round(p+e.clientX-f));i(e=>({...e,[d.key]:t}))},g=()=>{window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g),document.body.classList.remove(`tw-col-resizing`),i(t=>{try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}return t})};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)}}return{widthOf:l,resizeProps(t){return{onStart:d(t),onReset:()=>{let n=c.current[t];n&&i(t=>{if(!(n.key in t))return t;let r={...t};delete r[n.key];try{window.localStorage.setItem(e,JSON.stringify(r))}catch{}return r})}}},tableStyle:{width:`100%`,minWidth:u}}}function l(e){return(0,i.jsx)(`span`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`拖动调整列宽,双击恢复默认`,onPointerDown:e.onStart,onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),e.onReset?.()},className:`tw-col-resize absolute top-0 right-0 z-20 h-full w-2 cursor-col-resize touch-none select-none`})}export{c as n,l as t};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./react-dom.CqAxpHMt.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";var i=`/__tb_todos`,a=[`pending`,`in_progress`,`done`,`cancelled`],o=[`urgent_important`,`important`,`urgent`,`normal`],s={pending:`待开始`,in_progress:`进行中`,done:`已完成`,cancelled:`已取消`,overdue:`已延期`},c={urgent_important:`重要紧急`,important:`重要不紧急`,urgent:`紧急不重要`,normal:`普通`,"":`—`},l=new Set(a),u=new Set(o),d=/^\d{4}-\d{2}-\d{2}$/;function f(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function p(e){let t=f(e,10);return d.test(t)?t:``}function m(e){return typeof e==`string`&&l.has(e)}function h(e){return typeof e==`string`&&u.has(e)}function g(e){return e===`done`||e===`cancelled`}function _(e){if(!e||typeof e!=`object`)return null;let t=e,n=f(t.title,200);if(!n)return null;let r={title:n};return m(t.status)&&(r.status=t.status),h(t.priority)&&(r.priority=t.priority),`linkedTask`in t&&(r.linkedTask=f(t.linkedTask,200)),`taskId`in t&&(r.taskId=f(t.taskId,64)),`startDate`in t&&(r.startDate=p(t.startDate)),`dueDate`in t&&(r.dueDate=p(t.dueDate)),`note`in t&&(r.note=f(t.note)),r}function v(e){if(!e||typeof e!=`object`)return null;let t=e,n=f(t.title,200);if(!n)return null;let r=new Date().toISOString(),i=m(t.status)?t.status:`pending`;return{id:f(t.id,64)||`td_${Math.random().toString(16).slice(2,10)}`,title:n,status:i,priority:h(t.priority)?t.priority:``,linkedTask:f(t.linkedTask,200),taskId:f(t.taskId,64),startDate:p(t.startDate),dueDate:p(t.dueDate),taskEndDate:g(i)?p(t.taskEndDate):``,note:f(t.note),source:t.source===`ai`?`ai`:`manual`,sessionId:f(t.sessionId,120),createdAt:f(t.createdAt,40)||r,updatedAt:f(t.updatedAt,40)||r,doneAt:f(t.doneAt,40)||null}}async function y(e,t,n=``){let r=await fetch(`${i}${n}`,{method:e,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.error||`HTTP ${r.status}`);return a}async function b(){try{return(await fetch(`${i}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function x(){let e=await y(`GET`);return(Array.isArray(e.items)?e.items:[]).map(v).filter(e=>!!e)}async function S(e,t){let n=await y(`POST`,{items:e,...t});return(Array.isArray(n.items)?n.items:[]).map(v).filter(e=>!!e)}async function C(e,t){let n=v((await y(`PUT`,{id:e,...t})).item);if(!n)throw Error(`更新待办失败`);return n}async function ee(e){let t=await y(`DELETE`,{ids:e});return Number(t.removed??0)}function w(e=new Date){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function T(e){let[t,n,r]=e.split(`-`).map(Number);return Date.UTC(t,(n??1)-1,r??1)}function E(e,t){return!d.test(e)||!d.test(t)?null:Math.round((T(t)-T(e))/864e5)}function te(e){let t=E(e.startDate,e.dueDate);return t===null?null:t+1}function D(e,t=w()){return E(t,e.dueDate)}function ne(e){return g(e.status)?e.taskEndDate:``}function O(e,t=w()){if(e.status===`done`||e.status===`cancelled`)return e.status;let n=D(e,t);return n!==null&&n<0?`overdue`:e.status}function k(e){let t=e=>e===`in_progress`?0:e===`pending`?1:e===`done`?2:3,n=e=>e===`urgent_important`?0:e===`important`?1:e===`urgent`?2:e===`normal`?3:4;return[...e].sort((e,r)=>{let i=t(e.status)-t(r.status);if(i!==0)return i;let a=e.dueDate||`9999-12-31`,o=r.dueDate||`9999-12-31`;if(a!==o)return a<o?-1:1;let s=n(e.priority)-n(r.priority);return s===0?e.createdAt<r.createdAt?1:-1:s})}function A(e,t={}){let n=t.status??`all`,r=t.priority??`all`,i=(t.keyword??``).trim().toLowerCase(),a=t.today??w();return e.filter(e=>!(n!==`all`&&O(e,a)!==n||r!==`all`&&e.priority!==r||i&&!`${e.title} ${e.linkedTask} ${e.note}`.toLowerCase().includes(i)))}var j=`/__tb_tasks`,M=[`pool`,`in_progress`,`done`,`closed`],N=[`urgent_important`,`important`,`urgent`,`normal`],re={pool:`任务池`,in_progress:`进行中`,done:`已完成`,closed:`已关闭`},ie={urgent_important:`重要紧急`,important:`重要不紧急`,urgent:`紧急不重要`,normal:`普通`,"":`—`},ae=new Set(M),oe=new Set(N),P=/^\d{4}-\d{2}-\d{2}$/;function F(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function I(e){let t=F(e,10);return P.test(t)?t:``}function L(e){return typeof e==`string`&&ae.has(e)}function R(e){return typeof e==`string`&&oe.has(e)}function z(e){if(!e||typeof e!=`object`)return null;let t=e,n=F(t.title,200);if(!n)return null;let r={title:n};return L(t.status)&&(r.status=t.status),R(t.priority)&&(r.priority=t.priority),`startDate`in t&&(r.startDate=I(t.startDate)),`dueDate`in t&&(r.dueDate=I(t.dueDate)),`note`in t&&(r.note=F(t.note)),r}function B(e){if(!e||typeof e!=`object`)return null;let t=e,n=F(t.title,200);if(!n)return null;let r=new Date().toISOString();return{id:F(t.id,64)||`tk_${Math.random().toString(16).slice(2,10)}`,title:n,status:L(t.status)?t.status:`pool`,priority:R(t.priority)?t.priority:``,startDate:I(t.startDate),dueDate:I(t.dueDate),note:F(t.note),source:t.source===`ai`?`ai`:`manual`,sessionId:F(t.sessionId,120),createdAt:F(t.createdAt,40)||r,updatedAt:F(t.updatedAt,40)||r,doneAt:F(t.doneAt,40)||null}}async function V(e,t){let n=await fetch(j,{method:e,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error||`HTTP ${n.status}`);return r}async function H(){try{return(await fetch(`${j}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function U(){let e=await V(`GET`);return(Array.isArray(e.items)?e.items:[]).map(B).filter(e=>!!e)}async function W(e,t){let n=await V(`POST`,{items:e,...t});return(Array.isArray(n.items)?n.items:[]).map(B).filter(e=>!!e)}async function G(e,t){let n=B((await V(`PUT`,{id:e,...t})).item);if(!n)throw Error(`更新任务失败`);return n}async function K(e){let t=await V(`DELETE`,{ids:e});return Number(t.removed??0)}function q(e){let[t,n,r]=e.split(`-`).map(Number);return Date.UTC(t,(n??1)-1,r??1)}function se(e){return!P.test(e.startDate)||!P.test(e.dueDate)?null:Math.round((q(e.dueDate)-q(e.startDate))/864e5)+1}function ce(e){let t={};for(let n of e){let e=n.taskId?.trim();if(!e)continue;let r=t[e]??={total:0,done:0,percent:0};r.total+=1,n.status===`done`&&(r.done+=1)}for(let e of Object.values(t))e.percent=e.total?Math.round(e.done/e.total*100):0;return t}function le(e,t={}){let n=t.status??`all`,r=t.priority??`all`,i=(t.keyword??``).trim().toLowerCase();return e.filter(e=>{if(n===`urgent`){if(e.priority!==`urgent_important`&&e.priority!==`urgent`)return!1}else if(n!==`all`&&e.status!==n)return!1;return!(r!==`all`&&e.priority!==r||i&&!`${e.title} ${e.note}`.toLowerCase().includes(i))})}function ue(e){let t=e=>e===`in_progress`?0:e===`pool`?1:e===`done`?2:3,n=e=>e===`urgent_important`?0:e===`important`?1:e===`urgent`?2:e===`normal`?3:4;return[...e].sort((e,r)=>{let i=t(e.status)-t(r.status);if(i!==0)return i;let a=e.dueDate||`9999-12-31`,o=r.dueDate||`9999-12-31`;if(a!==o)return a<o?-1:1;let s=n(e.priority)-n(r.priority);return s===0?e.createdAt<r.createdAt?1:-1:s})}function de(e){let t={total:e.length,pool:0,in_progress:0,done:0,closed:0,urgent:0};for(let n of e)t[n.status]+=1,(n.priority===`urgent_important`||n.priority===`urgent`)&&(t.urgent+=1);return t}var J=e(t(),1),fe=e(n(),1),Y=r(),X=[`日`,`一`,`二`,`三`,`四`,`五`,`六`],Z=272;function pe(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Q(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]);return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||r<0||r>11||i<1||i>31?null:{y:n,m:r,d:i}}function me(e,t,n){return`${e}-${String(t+1).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`}function $(e){let t=Q(e);return t?`${t.y}/${String(t.m+1).padStart(2,`0`)}/${String(t.d).padStart(2,`0`)}`:``}function he({value:e,onChange:t,placeholder:n=`选择日期`,className:r=``,disabled:i=!1,ariaLabel:a,clearable:o=!0}){let s=(0,J.useRef)(null),c=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),p=Q(e),m=pe(),[h,g]=(0,J.useState)(()=>{let e=p??Q(m);return{y:e.y,m:e.m}});(0,J.useEffect)(()=>{if(!l)return;let t=Q(e)??Q(m);g({y:t.y,m:t.m})},[l,e,m]),(0,J.useEffect)(()=>{if(!l)return;function e(){let e=s.current;if(!e)return;let t=e.getBoundingClientRect(),n=c.current?.offsetHeight??340,r=t.bottom+6,i=t.top-n-6,a=r+n>window.innerHeight-8&&i>8?i:r,o=Math.min(Math.max(8,t.left),Math.max(8,window.innerWidth-Z-8));f({top:a,left:o})}e();let t=e=>{let t=e.target;s.current?.contains(t)||c.current?.contains(t)||u(!1)},n=e=>{e.key===`Escape`&&(e.stopPropagation(),u(!1))},r=()=>u(!1);return window.addEventListener(`mousedown`,t),window.addEventListener(`keydown`,n,!0),window.addEventListener(`resize`,r),window.addEventListener(`scroll`,r,!0),()=>{window.removeEventListener(`mousedown`,t),window.removeEventListener(`keydown`,n,!0),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,r,!0)}},[l]);let _=(0,J.useMemo)(()=>{let e=new Date(h.y,h.m,1).getDay(),t=new Date(h.y,h.m,1-e);return Array.from({length:42},(e,n)=>{let r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+n);return{iso:me(r.getFullYear(),r.getMonth(),r.getDate()),day:r.getDate(),inMonth:r.getMonth()===h.m}})},[h]);function v(e){t(e),u(!1)}function y(e){g(t=>{let n=t.m+e;return n<0?{y:t.y-1,m:11}:n>11?{y:t.y+1,m:0}:{...t,m:n}})}let b=$(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{ref:s,type:`button`,disabled:i,"aria-label":a??n,"aria-haspopup":`dialog`,"aria-expanded":l,onClick:()=>u(e=>!e),className:`flex w-full min-w-0 items-center text-left outline-none disabled:cursor-not-allowed ${r}`,children:b?(0,Y.jsx)(`span`,{className:`truncate tabular-nums`,children:b}):(0,Y.jsx)(`span`,{className:`truncate text-stone-400`,children:n})}),l&&d?(0,fe.createPortal)((0,Y.jsxs)(`div`,{ref:c,role:`dialog`,"aria-label":`选择日期`,style:{top:d.top,left:d.left,width:Z},className:`tw-date-panel tw-menu-anim fixed z-120 rounded-xl border border-stone-200 bg-white p-3 shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`pl-1 text-sm font-semibold text-stone-800`,children:[h.y,`年`,h.m+1,`月`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":`上个月`,onClick:()=>y(-1),className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-800`,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`m15 6-6 6 6 6`})})}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`下个月`,onClick:()=>y(1),className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-800`,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`m9 6 6 6-6 6`})})})]})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-7 text-center text-xs text-stone-500`,children:X.map(e=>(0,Y.jsx)(`div`,{className:`py-1`,children:e},e))}),(0,Y.jsx)(`div`,{className:`grid grid-cols-7 gap-y-0.5 text-center text-sm`,children:_.map(t=>{let n=t.iso===e,r=t.iso===m;return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>v(t.iso),"aria-label":t.iso,"aria-current":n?`date`:void 0,className:`mx-auto flex h-8 w-8 items-center justify-center rounded-md tabular-nums transition-colors ${n?`bg-[#3370ff] font-medium text-white`:t.inMonth?`text-stone-700 hover:bg-stone-100`:`text-stone-300 hover:bg-stone-50`} ${r&&!n?`ring-1 ring-stone-300 ring-inset`:``}`,children:t.day},t.iso)})}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-stone-100 pt-2 text-sm`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{t(``),u(!1)},disabled:!o,className:`rounded-md px-2 py-1 text-[#3370ff] transition-colors hover:bg-[#eef3ff] disabled:opacity-40`,children:`清除`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>v(m),className:`rounded-md px-2 py-1 text-[#3370ff] transition-colors hover:bg-[#eef3ff]`,children:`今天`})]})]}),document.body):null]})}export{_ as A,S as C,A as D,b as E,D as F,C as I,w as M,te as N,g as O,ne as P,s as S,O as T,ce as _,M as a,c as b,K as c,R as d,U as f,se as g,de as h,ie as i,k as j,x as k,H as l,ue as m,$ as n,re as o,z as p,N as r,W as s,he as t,le as u,G as v,ee as w,a as x,o as y};
@@ -1 +1 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.CpjKWnzM.js";import{t as r}from"./SelectDropdown.Dc7QaPbH.js";import{t as i}from"./jsx-runtime.BUXbF_vF.js";import{n as a,r as o,t as s}from"./useListAnim.CnbC_9MC.js";import{t as c}from"./OverflowHint.lzmplP5j.js";var l=`tw.docs.files.v1.`;function u(e){try{let t=sessionStorage.getItem(n(l+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function d(e,t){try{sessionStorage.setItem(n(l+e),JSON.stringify(t))}catch{}}var f=e(t(),1);function p(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function m(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 h=i(),g=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],_=`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]`,v=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,y=`w-38 shrink-0`,b=`w-16 shrink-0 text-left`,x=`w-40 shrink-0 text-right`,S=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function C(e,t){let[n,r]=(0,f.useState)(``),[i,a]=(0,f.useState)(`mtime`),[s,c]=(0,f.useState)(1),[l,u]=o(t),d=(0,f.useMemo)(()=>{let t=n.trim().toLowerCase(),r=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return i===`name`?r.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):r.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),r},[e,n,i]),p=Math.max(1,Math.ceil(d.length/l)),m=Math.min(s,p);return{query:n,setQuery:e=>{r(e),c(1)},sortBy:i,setSortBy:e=>{a(e),c(1)},page:m,setPage:c,pageSize:l,setPageSize:e=>{u(e),c(1)},filtered:d,totalPages:p,pageFiles:(0,f.useMemo)(()=>d.slice((m-1)*l,m*l),[d,m,l])}}function w({files:e,filtered:t,pageFiles:n,query:i,onQuery:o,sortBy:l,onSortBy:u,page:d,totalPages:f,pageSize:C,onPage:w,onPageSize:T,busy:E=!1,emptyText:D,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}=s(),U=e=>{H(),o(e)};return(0,h.jsxs)(h.Fragment,{children:[e.length>0?(0,h.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,h.jsx)(`input`,{type:`search`,value:i,onChange:e=>U(e.target.value),placeholder:O,"aria-label":O,className:`${_} flex-1 min-w-48`}),(0,h.jsx)(r,{compact:!0,options:g,value:l,onChange:e=>{H(),u(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,h.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,h.jsx)(`p`,{className:S,children:D}):t.length===0?(0,h.jsxs)(`p`,{className:S,children:[`没有匹配「`,i.trim(),`」的文件。`]}):(0,h.jsxs)(`ul`,{className:`${V}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:z,ref:e=>{e&&(e.indeterminate=B)},onChange:()=>I(R.map(e=>e.path),!z),disabled:E||R.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,h.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),(0,h.jsx)(`span`,{className:y,children:`创建时间`}),(0,h.jsx)(`span`,{className:y,children:`修改时间`}),(0,h.jsx)(`span`,{className:b,children:`大小`}),(0,h.jsx)(`span`,{className:x,children:`操作`})]}),n.map(e=>{let t=L(e);return(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2.5 ${v}`,onDoubleClick:M?()=>M(e):void 0,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:!!P[e.path],disabled:E||!t,onChange:()=>F(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,h.jsx)(c,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null]}),(0,h.jsx)(`span`,{className:`${y} text-[11px] text-stone-500 tabular-nums`,children:m(e.ctime??e.mtime)}),(0,h.jsx)(`span`,{className:`${y} text-[11px] text-stone-500 tabular-nums`,children:m(e.mtime)}),(0,h.jsx)(`span`,{className:`${b} text-[11px] text-stone-400`,children:p(e.size)}),(0,h.jsx)(`div`,{className:`${x} flex justify-end gap-1 flex-wrap`,onDoubleClick:e=>e.stopPropagation(),children:j(e)})]},e.path)})]})}),e.length>0?(0,h.jsx)(a,{page:d,totalPages:f,pageSize:C,busy:E,onPage:e=>{H(),w(e)},onPageSize:e=>{H(),T(e)}}):null]})}export{d as i,C as n,u as r,w as t};
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{p as n}from"./app-config.vqDkEMS3.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{t as i}from"./SelectDropdown.D2i7-lQC.js";import{n as a,r as o,t as s}from"./useListAnim.Y3N2budK.js";import{t as c}from"./OverflowHint.lzmplP5j.js";var l=`tw.docs.files.v1.`;function u(e){try{let t=sessionStorage.getItem(n(l+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function d(e,t){try{sessionStorage.setItem(n(l+e),JSON.stringify(t))}catch{}}var f=e(t(),1);function p(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function m(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 h=r(),g=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],_=`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]`,v=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,y=`w-38 shrink-0`,b=`w-16 shrink-0 text-left`,x=`w-40 shrink-0 text-right`,S=`text-sm text-stone-400 py-10 text-center border border-dashed border-stone-200 rounded-lg`;function C(e,t){let[n,r]=(0,f.useState)(``),[i,a]=(0,f.useState)(`mtime`),[s,c]=(0,f.useState)(1),[l,u]=o(t),d=(0,f.useMemo)(()=>{let t=n.trim().toLowerCase(),r=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return i===`name`?r.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):r.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),r},[e,n,i]),p=Math.max(1,Math.ceil(d.length/l)),m=Math.min(s,p);return{query:n,setQuery:e=>{r(e),c(1)},sortBy:i,setSortBy:e=>{a(e),c(1)},page:m,setPage:c,pageSize:l,setPageSize:e=>{u(e),c(1)},filtered:d,totalPages:p,pageFiles:(0,f.useMemo)(()=>d.slice((m-1)*l,m*l),[d,m,l])}}function w({files:e,filtered:t,pageFiles:n,query:r,onQuery:o,sortBy:l,onSortBy:u,page:d,totalPages:f,pageSize:C,onPage:w,onPageSize:T,busy:E=!1,emptyText:D,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}=s(),U=e=>{H(),o(e)};return(0,h.jsxs)(h.Fragment,{children:[e.length>0?(0,h.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,h.jsx)(`input`,{type:`search`,value:r,onChange:e=>U(e.target.value),placeholder:O,"aria-label":O,className:`${_} flex-1 min-w-48`}),(0,h.jsx)(i,{compact:!0,options:g,value:l,onChange:e=>{H(),u(e)},ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,h.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:e.length===0?(0,h.jsx)(`p`,{className:S,children:D}):t.length===0?(0,h.jsxs)(`p`,{className:S,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,h.jsxs)(`ul`,{className:`${V}divide-y divide-stone-100 border border-stone-200 rounded-lg overflow-hidden`,children:[(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 bg-stone-50 text-xs text-stone-500`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:z,ref:e=>{e&&(e.indeterminate=B)},onChange:()=>I(R.map(e=>e.path),!z),disabled:E||R.length===0,className:`rounded border-stone-300`,"aria-label":k}),(0,h.jsx)(`span`,{className:`flex-1 min-w-0`,children:`文件名`}),(0,h.jsx)(`span`,{className:y,children:`创建时间`}),(0,h.jsx)(`span`,{className:y,children:`修改时间`}),(0,h.jsx)(`span`,{className:b,children:`大小`}),(0,h.jsx)(`span`,{className:x,children:`操作`})]}),n.map(e=>{let t=L(e);return(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2.5 ${v}`,onDoubleClick:M?()=>M(e):void 0,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:!!P[e.path],disabled:E||!t,onChange:()=>F(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0 text-left flex items-center gap-2`,children:[(0,h.jsx)(c,{text:e.name,className:`text-sm text-stone-800 truncate`}),A?A(e):null]}),(0,h.jsx)(`span`,{className:`${y} text-[11px] text-stone-500 tabular-nums`,children:m(e.ctime??e.mtime)}),(0,h.jsx)(`span`,{className:`${y} text-[11px] text-stone-500 tabular-nums`,children:m(e.mtime)}),(0,h.jsx)(`span`,{className:`${b} text-[11px] text-stone-400`,children:p(e.size)}),(0,h.jsx)(`div`,{className:`${x} flex justify-end gap-1 flex-wrap`,onDoubleClick:e=>e.stopPropagation(),children:j(e)})]},e.path)})]})}),e.length>0?(0,h.jsx)(a,{page:d,totalPages:f,pageSize:C,busy:E,onPage:e=>{H(),w(e)},onPageSize:e=>{H(),T(e)}}):null]})}export{d as i,C as n,u as r,w as t};
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.vqDkEMS3.js";import{l as r,n as i,r as a,s as o}from"./project-docs.Cd2gKPKh.js";import{n as s}from"./doc-roots.DAJP9Svr.js";import{t as c}from"./jsx-runtime.BUXbF_vF.js";import{t as l}from"./ConfirmDialog.BYz4HREM.js";import{i as u,n as d,r as f,t as p}from"./DocsFileBrowser.BxAyrkkw.js";import{a as m,o as h,r as g}from"./plugins.DSUPSizB.js";import{t as _,u as v}from"./open-docs-in-session.fLwnA5qh.js";var y=e(t(),1),b=c(),x=10;async function S(e=`.`){let{entries:t}=await o(`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=f(`knowledge`),[c,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=d(O,x),z=(0,y.useCallback)(async()=>{j(null);try{let e=await S(`.`);k(e),u(`knowledge`,e)}catch(e){j(e instanceof Error?e.message:String(e))}},[]);(0,y.useEffect)(()=>{let e=m(e=>T(!!e.knowledgeLib));return n().then(()=>{T(g(`knowledgeLib`)),C(!0)}),e},[]),(0,y.useEffect)(()=>{c&&w&&(async()=>{await a(`knowledge`)?(await v().catch(()=>null),await z(),D(!0)):D(!1)})()},[c,w,z]);let B=(0,y.useMemo)(()=>Object.keys(P).filter(e=>P[e]),[P]);function V(){g(`knowledgeGen`)?window.location.href=`${t}?plugin=knowledgeGen`:j(h(`knowledgeGen`))}async function H(e){N(!0),j(null);try{await r(`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 i(`knowledge`,e.entry.path);else{for(let t of e.paths)await i(`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}」?将从 ${s(`knowledge`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个知识库文件?此操作不可恢复。`:``;return c?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)(p,{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)(l,{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:h(`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};
@@ -0,0 +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,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,a as m,b as h,g,h as _,i as v,j as y,k as b,m as x,p as S,r as C,t as w,u as T,v as ee,w as E,x as te,y as ne}from"./app-config.vqDkEMS3.js";import{t as D}from"./jsx-runtime.BUXbF_vF.js";import{a as O,i as k,n as A,r as j,t as re}from"./ConfirmDialog.BYz4HREM.js";import{a as ie,i as ae,r as M}from"./plugins.DSUPSizB.js";import{n as N}from"./i18n.9qZsrs3u.js";var P=e(t(),1),F=e(n(),1),I=`/__tb_nav/groups`;function oe(){return C().navGroups}function L(){return o(C().navIcons)}function se(e,t){let n={...L(),[e]:t};return T({navIcons:n}),w(),n}function ce(){return C().navOrder}function le(e,t){let n=f(e),r=a(t,n);return T({navGroups:n,navOrder:r}),w(),{groups:n,order:r}}function R(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function ue(e){if(!m())return null;try{let t=await fetch(I,{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 f(n.groups,!1)}catch{return null}}async function de(){if(!m())return;let e=C(),t=null;try{let e=await fetch(I,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=f(t.groups,!1),r=a(e.navOrder,n);(!R(n,e.navGroups)||!R(r,e.navOrder))&&(T({navGroups:n,navOrder:r}),w());return}if(!e.navGroups.length)return;let n=await ue(e.navGroups);n&&!R(n,e.navGroups)&&(T({navGroups:n,navOrder:a(e.navOrder,n)}),w())}var z=D(),B=`/`;function V(e){return`${B.endsWith(`/`)?B:`${B}/`}${e.replace(/^\//,``)}`}function H(e,t){return e.includes(`/${t}`)}function U(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function W(e){return S(`tw.nav.groupOpen.${e}`)}function G(){return S(`tw.nav.docsOpen`)}function fe(e,t){try{let t=localStorage.getItem(W(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(G());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function K(e,t){try{localStorage.setItem(W(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(G(),t?`1`:`0`)}catch{}}function q(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?N(`nav.docs`):e.name}function pe(e){return e.type===`group`?q(e.group):N(h(e.id).i18n)}function J(e){return e.type===`item`?i(e.id):te(e.group.id)}function me(){let[e,t]=(0,P.useState)(()=>window.location.pathname);return(0,P.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 he({children:e}){return(0,z.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Y({id:e,icon:t}){return(0,z.jsx)(he,{children:X[t??x[e]]})}var X={check:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M12 20h9`}),(0,z.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M14 3v5h5`}),(0,z.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,z.jsx)(`path`,{d:`M8 13h8`}),(0,z.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,z.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M8 6h13`}),(0,z.jsx)(`path`,{d:`M8 12h13`}),(0,z.jsx)(`path`,{d:`M8 18h13`}),(0,z.jsx)(`path`,{d:`M3 6h.01`}),(0,z.jsx)(`path`,{d:`M3 12h.01`}),(0,z.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,z.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,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,z.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,z.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,z.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M9 3h6`}),(0,z.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,z.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,z.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,z.jsx)(`path`,{d:`M9 6l2 2`}),(0,z.jsx)(`path`,{d:`M15 6l-2 2`}),(0,z.jsx)(`path`,{d:`M7 11H4`}),(0,z.jsx)(`path`,{d:`M20 11h-3`}),(0,z.jsx)(`path`,{d:`M7 17H4`}),(0,z.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,z.jsx)(`path`,{d:`M8 3v4`}),(0,z.jsx)(`path`,{d:`M16 3v4`}),(0,z.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M4 20V10`}),(0,z.jsx)(`path`,{d:`M10 20V4`}),(0,z.jsx)(`path`,{d:`M16 20v-7`}),(0,z.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,z.jsx)(`path`,{d:`M3 12h18`}),(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.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,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,z.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,z.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,z.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,z.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{d:`M5 21V4`}),(0,z.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,z.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`})};function Z(){return(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.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,z.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,z.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 ge(){return(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,z.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function _e(){return(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,z.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function ve(){return(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,z.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,z.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function ye(){return(0,z.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,z.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 be(){return(0,z.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,z.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,z.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function xe(){return(0,z.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,z.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,z.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function Se(){return(0,z.jsxs)(he,{children:[(0,z.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,z.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,z.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ce(){return(0,z.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,z.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,z.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,z.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,z.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,z.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,z.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function we(e,t,n){let[r,i]=(0,P.useState)(null),a=(0,P.useRef)(null),o=(0,P.useRef)(e);o.current=e;let s=(0,P.useRef)(t);s.current=t;let l=(0,P.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}}function Q(e,t){if(d(e))return!1;let n=h(e).plugin;return!n||t[n]!==!1}function Te({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=h(e),o=H(n,a.match);return(0,z.jsxs)(`div`,{className:[U(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,z.jsxs)(`a`,{href:V(a.href),className:`tw-nav-item-main`,children:[(0,z.jsx)(Y,{id:e,icon:t}),(0,z.jsx)(`span`,{className:`tw-nav-label`,children:N(a.i18n)})]}),(0,z.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":N(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,z.jsx)(ve,{})})]})}function Ee(e,t,n){return e.items.some(e=>{if(d(e))return!1;let t=h(e).plugin;return(!t||M(t))&&H(n,h(e).match)})?!0:E(t,e.id).some(e=>Ee(e,t,n))}function De(e,t){return e.items.some(e=>{if(d(e))return!1;let t=h(e).plugin;return!t||M(t)})?!0:E(t,e.id).some(e=>De(e,t))}function Oe({group:e,groups:t,icons:n,pathname:r,openItem:i,openGroupId:a,onMenu:o,onItemMenu:s}){let c=e.items.filter(e=>{if(d(e))return!1;let t=h(e).plugin;return!t||M(t)}),l=E(t,e.id),u=Ee(e,t,r),[f,p]=(0,P.useState)(()=>fe(e.id,!0)),[m,g]=(0,P.useState)(!1),_=(0,P.useRef)(null),v=(0,P.useRef)(null),y=(0,P.useRef)(null);if((0,P.useEffect)(()=>b,[]),!De(e,t))return null;function b(){y.current&&_.current&&_.current.removeEventListener(`transitionend`,y.current),y.current=null,v.current!==null&&(window.clearTimeout(v.current),v.current=null)}function x(){b(),K(e.id,!0),g(!1),p(!0)}function S(t){if(t.preventDefault(),!f||m){x();return}g(!0),K(e.id,!1);let n=_.current,r=!1,i=()=>{r||(r=!0,b(),p(!1),g(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};b(),y.current=a,n?.addEventListener(`transitionend`,a),v.current=window.setTimeout(i,360)}return(0,z.jsxs)(`details`,{className:`tw-nav-details ${m?`is-closing`:``}`,open:f||m,"data-nav-group":e.id,children:[(0,z.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,u?`is-branch-active`:``,a===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:S,children:[(0,z.jsx)(Z,{}),(0,z.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:q(e)}),(0,z.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":N(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),o(e,t.currentTarget)},children:(0,z.jsx)(ge,{})}),(0,z.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,z.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,z.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:_,children:(0,z.jsxs)(`div`,{className:`tw-nav-subtree`,children:[c.map(e=>(0,z.jsx)(Te,{id:e,icon:n[e],pathname:r,actionOpen:i===e,onMenu:t=>s(e,t)},e)),l.map(e=>(0,z.jsx)(Oe,{group:e,groups:t,icons:n,pathname:r,openItem:i,openGroupId:a,onMenu:o,onItemMenu:s},e.id))]})})]})}function ke({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)([]),[f,p]=(0,P.useState)(``),m=(0,P.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=_.filter(e=>Q(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),v=we(u,d);(0,P.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>Q(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function y(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){let e=c.trim();if(!e){p(N(`nav.groupNameRequired`));return}if(!u.length){p(N(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!Q(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,z.jsxs)(k,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,z.jsx)(A,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,z.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,z.jsxs)(O,{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,z.jsx)(j,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?N(`nav.editGroupTitle`):t?.parentId?N(`nav.addSubgroup`):N(`nav.createGroup`)}),(0,z.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[N(`nav.groupName`),(0,z.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())},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,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:N(`nav.groupItems`)}),(0,z.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:N(`nav.groupItemsHint`)}),(0,z.jsxs)(`div`,{ref:v.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,z.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`:``,v.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||v.onPointerDown(e.id,t)}:void 0,children:[t?(0,z.jsx)(Ce,{}):(0,z.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,z.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>y(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,z.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,z.jsx)(Y,{id:e.id,icon:i[e.id]})}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:N(e.i18n)})]},e.id)}),x.length?null:(0,z.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:N(`nav.noAddableItems`)})]})]}),f?(0,z.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,z.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,z.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:N(`nav.deleteGroup`)}):null,(0,z.jsx)(`div`,{className:`flex-1`}),(0,z.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:N(`nav.groupCancel`)}),(0,z.jsx)(`button`,{type:`button`,onClick:b,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:N(`nav.groupSave`)})]})]})})]})}function Ae({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=we(e,n,r);return(0,z.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,z.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,z.jsx)(Ce,{}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function je({open:e,focusGroupId:t,nodes:n,groups:r,visible:i,onClose:a,onCommit:o}){let s=e=>!i||i(e),c=n.filter(e=>e.type===`item`?s(e.id):e.group.items.some(s)),[l,u]=(0,P.useState)(()=>c.map(J)),[d,f]=(0,P.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),p=(0,P.useRef)(l);p.current=l;let m=(0,P.useRef)(d);m.current=d;let g=(0,P.useRef)(r);g.current=r;let _=(0,P.useRef)(c);_.current=c;let v=()=>{let e=g.current.map(e=>({...e,items:m.current[e.id]??e.items}));o(p.current,e)};(0,P.useEffect)(()=>{if(!e)return;let t=_.current.map(J);p.current=t,u(t);let n=Object.fromEntries(g.current.map(e=>[e.id,[...e.items]]));m.current=n,f(n)},[e]);let y=e=>{p.current=e,u(e)},b=(e,t)=>{let n=(m.current[e]??[]).filter(e=>!s(e)),r={...m.current,[e]:t.length?[...t,...n]:n};m.current=r,f(r)},x=new Map(c.map(e=>[J(e),pe(e)])),S=t?r.find(e=>e.id===t):void 0,C=S?(d[S.id]??S.items).filter(s):[];return(0,z.jsxs)(k,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,z.jsx)(A,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,z.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,z.jsxs)(O,{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,z.jsx)(j,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:N(`nav.sortMenuTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:N(`nav.sortHint`)}),(0,z.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:S?(0,z.jsx)(Ae,{ids:C,labelOf:e=>N(h(e).i18n),onChange:e=>b(S.id,e),onEnd:v,indent:!0}):(0,z.jsx)(Ae,{ids:l,labelOf:e=>x.get(e)??e,onChange:y,onEnd:v})}),(0,z.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,z.jsx)(`button`,{type:`button`,onClick:a,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:N(`nav.done`)})})]})})]})}function Me(e){let t=[];for(let n of e.filter(e=>!e.parentId)){t.push({group:n,indent:!1});for(let r of E(e,n.id))t.push({group:r,indent:!0})}return t}function Ne(){return(0,z.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,z.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Pe=120;function Fe(){let[e,t]=(0,P.useState)(null),n=(0,P.useRef)(null),r=(0,P.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,P.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,P.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Pe)},[r]),o=(0,P.useCallback)(()=>{r(),t(null)},[r]);return(0,P.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Ie(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function Le({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,P.useRef)(null),[c,l]=(0,P.useState)({top:e.top,left:e.right+8});return(0,P.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,F.createPortal)((0,z.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},...Ie(a,o),children:[(0,z.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:N(`nav.chooseIcon`)}),(0,z.jsx)(`div`,{className:`tw-nav-icon-grid`,children:g.map(e=>(0,z.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,z.jsx)(Y,{id:n,icon:e})},e))})]}),document.body)}function $({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,P.useRef)(null),[s,c]=(0,P.useState)({top:e.top,left:e.right+6});return(0,P.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,P.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,F.createPortal)((0,z.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Ie(r,i),children:a}),document.body)}function Re(){let e=me(),[t,n]=(0,P.useState)(()=>oe()),[i,a]=(0,P.useState)(()=>L()),[o,c]=(0,P.useState)(()=>ce()),[d,f]=(0,P.useState)(()=>ae()),[m,g]=(0,P.useState)(null),[_,x]=(0,P.useState)(!1),[S,C]=(0,P.useState)(null),[w,T]=(0,P.useState)(!1),[E,te]=(0,P.useState)(null),D=Fe(),O=Fe(),k=D.value,A=O.value,j=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{j.current!==null&&window.clearTimeout(j.current)},[]);function M(e){te(e),T(!0)}function F(e){g(e),x(!0)}function I(){x(!1),C(null)}(0,P.useEffect)(()=>{let e=!0,t=ie(e=>{f({...e})});return v().then(async()=>{e&&(await de(),e&&(n(oe()),c(ce()),a(L()),f(ae())))}),()=>{e=!1,t()}},[]);let R=ee(t,o);function B(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 V(){H(),O.close(),D.close()}function H(){j.current!==null&&(window.clearTimeout(j.current),j.current=null)}function U(){H(),j.current=window.setTimeout(()=>{j.current=null,O.close()},220)}function W(e,t){H(),O.open({itemId:e,rect:t.getBoundingClientRect()})}function G(e,t){k?.kind===`itemMenu`&&k.itemId===e?V():(O.closeNow(),D.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function fe(e,t){k?.kind===`groupMenu`&&k.group.id===e.id?V():(O.closeNow(),D.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function K(e,n){B(p(t,e,n),o),V()}function pe(e){let{groups:n,owner:r}=y(t,e);B(n,r?l(o,e,r,n):o),V()}let J=k?.kind===`assign`||k?.kind===`itemMenu`?k.itemId:void 0,he=k?.kind===`groupMenu`?k.group.id:void 0,Y=k?.kind===`itemMenu`?k:null,X=k?.kind===`groupMenu`?k:null,Z=k?.kind===`assign`?k:null,ve=Y?t.find(e=>e.items.includes(Y.itemId))??null:null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),R.map(n=>n.type===`item`?Q(n.id,d)?(0,z.jsx)(Te,{id:n.id,icon:i[n.id],pathname:e,actionOpen:J===n.id,onMenu:e=>G(n.id,e)},n.id):null:(0,z.jsx)(Oe,{group:n.group,groups:t,icons:i,pathname:e,openItem:J,openGroupId:he,onMenu:fe,onItemMenu:G},n.group.id)),Y?(0,z.jsxs)($,{rect:Y.rect,closing:D.closing,onClose:V,onHoverEnter:H,onHoverLeave:U,children:[(0,z.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:N(h(Y.itemId).i18n)}),(0,z.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`&&(H(),O.close())},children:[ve?(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>pe(Y.itemId),children:[(0,z.jsx)(be,{}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.leaveGroup`)})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>D.open({kind:`assign`,itemId:Y.itemId,rect:Y.rect}),children:[(0,z.jsx)(ye,{}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.assignGroup`)})]}),(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Y.itemId;V(),F({name:``,items:[e]})},children:[(0,z.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,z.jsx)(_e,{})}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.addToGroup`)})]})]}),(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=ve?.id??null;V(),M(e)},children:[(0,z.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,z.jsx)(Se,{})}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.sortMenu`)})]}),(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>W(Y.itemId,e.currentTarget),onClick:e=>W(Y.itemId,e.currentTarget),children:[(0,z.jsx)(xe,{}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.chooseIcon`)}),(0,z.jsx)(Ne,{})]})]})]}):null,A&&Y&&A.itemId===Y.itemId?(0,z.jsx)(Le,{anchor:A.rect,itemId:A.itemId,current:i[A.itemId],closing:O.closing,onHoverEnter:H,onHoverLeave:U,onPick:e=>{a(se(A.itemId,e)),V()}}):null,X?(0,z.jsxs)($,{rect:X.rect,closing:D.closing,onClose:V,children:[(0,z.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:q(X.group)}),(0,z.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[X.group.parentId?null:(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=X.group.id;V(),F({name:``,items:[],parentId:e})},children:[(0,z.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,z.jsx)(_e,{})}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.addSubgroup`)})]}),(0,z.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.group;V(),F({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,z.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,z.jsx)(ge,{})}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:N(`nav.editGroupTitle`)})]})]})]}):null,Z?(0,z.jsxs)($,{rect:Z.rect,closing:D.closing,onClose:V,children:[(0,z.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:N(`nav.assignGroup`)}),(0,z.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:t.length?Me(t).map(({group:e,indent:t})=>{let n=e.items.includes(Z.itemId);return(0,z.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,n?`is-current`:``,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>{n||K(e.id,Z.itemId)},children:[(0,z.jsx)(ye,{}),(0,z.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:q(e)}),n?(0,z.jsx)(`span`,{className:`tw-nav-group-pop-tag`,children:N(`nav.currentGroup`)}):null]},e.id)}):(0,z.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:N(`nav.noGroups`)})})]}):null,(0,z.jsx)(ke,{open:_&&!S,draft:m,groups:t,plugins:d,icons:i,onClose:I,onSave:e=>{let n=u(t,e);B(n.groups,r(o,n.groups,n.id)),I()},onDelete:m?.id?()=>C(m.id):void 0}),(0,z.jsx)(je,{open:w,focusGroupId:E,nodes:R,groups:t,visible:e=>Q(e,d),onClose:()=>T(!1),onCommit:(e,t)=>B(t,e)}),(0,z.jsx)(re,{open:!!S,title:N(`nav.deleteGroup`),message:t.find(e=>e.id===S)?.parentId?N(`nav.deleteSubgroupMsg`):N(`nav.deleteGroupMsg`),confirmLabel:N(`nav.deleteGroup`),cancelLabel:N(`nav.groupCancel`),danger:`outline`,onClose:()=>C(null),onConfirm:()=>{if(S){let e=t.find(e=>e.id===S),n=ne(t,S),r=s(t,S);B(r,e?b(o,e,r,n):o)}I()}})]})}export{Re as default};
@@ -0,0 +1 @@
1
+ export{t as default}from"./PluginsPage.DEkyOfQE.js";
@@ -1,4 +1,4 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.CpjKWnzM.js";import"./settings.BoQ0e0m1.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{a as i,i as a,n as o,s,t as c}from"./plugins.CrpY8UI9.js";import{t as l}from"./OverflowHint.lzmplP5j.js";var u=e(t(),1),d=`/__tb_fs`,f=`你可以使用本地文件工具(侧栏工作区已连接时):
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.vqDkEMS3.js";import"./settings.CkbipdPI.js";import{t as r}from"./jsx-runtime.BUXbF_vF.js";import{a as i,i as a,n as o,s,t as c}from"./plugins.DSUPSizB.js";import{t as l}from"./OverflowHint.lzmplP5j.js";var u=e(t(),1),d=`/__tb_fs`,f=`你可以使用本地文件工具(侧栏工作区已连接时):
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 ue(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 W(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?U({error:String(n.error),command:a}):n.background&&n.jobId?U({background:!0,jobId:String(n.jobId),command:n.command||a,workdir:n.workdir}):U({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 Be(e,t){return W(z,`Bash`,e,t)}async function Ve(e,t){return W(B,`Pwsh`,e,t)}async function He(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(`${z}/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(`${z}/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(`${z}/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 G(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 Ue(e,t,n){return G(z,`bash session`,e,t,n)}async function We(e,t,n){return G(B,`pwsh session`,e,t,n)}function Ge(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 K=[{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:`会话能力`}],q=[{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 核心`}],J=r(),Y=o();function Ke({embedded:e=!1}){let[t,r]=(0,u.useState)(`extension`),[o,c]=(0,u.useState)(()=>a()),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(!0);async function S(){x(!0);try{let[e,t,n,r,i]=await Promise.all([L(),M(),C(),V(),H()]);d(e),p(t),h(n),_(r),y(i)}finally{x(!1)}}(0,u.useEffect)(()=>{let e=i(e=>c(e));return n().then(()=>{c(a()),S()}),()=>{e()}},[]);function w(e){return e===`cases`?{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`}:e===`caseGen`?o.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`}:e===`prompts`?{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`}:e===`promptGen`?o.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`}:e===`knowledgeLib`?{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`}:e===`requirements`?{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`}:e===`templates`?{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`}:e===`knowledgeGen`?o.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?b&&l===null?{available:null,detail:`探测中…`}:l?.ok?{available:!0,detail:`已连接 · ${l.entryCount??l.entityCount??0} 条记忆 / 待确认 ${l.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?b&&m===null?{available:null,detail:`探测中…`}:m?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function T(e){let t=Ge(e.id);return t===`none`?{label:`规划中`,tone:`plan`}:t===`ready`?{label:`已就绪`,tone:`ready`}:b&&(t===`web`&&f===null||t===`fs`&&m===null||t===`bash`&&g===null||t===`pwsh`&&v===null)?{label:`探测中…`,tone:`plan`}:t===`web`?f?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`fs`?m?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`bash`?g?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`pwsh`?v?.ok&&v.available?{label:`已就绪`,tone:`ready`}:v?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}function E(e){c(s(e,!o[e]))}return(0,J.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,J.jsx)(`div`,{className:`w-full ${e?`px-6 py-5`:`px-6 py-6`}`,children:(0,J.jsx)(Je,{mineTab:t,onMineTab:r,enabled:o,runtimeFor:w,builtinStatus:T,onToggle:E})})})}function X(e){return`@lh-plugins/${e}`}function qe(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 Je(e){let{mineTab:t,onMineTab:n,enabled:r,runtimeFor:i,builtinStatus:a,onToggle:o}=e,[s,l]=(0,u.useState)(null),[d,f]=(0,u.useState)({}),p=[{id:`extension`,label:`扩展插件`,count:c.length,hint:`可配置插件`},{id:`session`,label:`会话插件`,count:K.length,hint:`默认`},{id:`global`,label:`全局插件`,count:q.length,hint:`默认`}],m=Math.max(0,p.findIndex(e=>e.id===t)),h=(0,u.useId)(),g=(0,u.useRef)(null),_=`${h}-panel`,v=e=>`${h}-tab-${e}`,y=Math.max(1,p.length),b=.5+.25*(y-1);function x(e){n(e),l(null)}function S(e){let t=p.length;if(!t)return;let n=m;if(e.key===`ArrowLeft`)n=(m-1+t)%t;else if(e.key===`ArrowRight`)n=(m+1)%t;else if(e.key===`Home`)n=0;else if(e.key===`End`)n=t-1;else return;e.preventDefault();let r=p[n];r&&(x(r.id),g.current?.querySelectorAll(`[role="tab"]`)[n]?.focus())}function C(e){l(t=>t===e?null:e)}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`header`,{className:`mb-4 flex items-start gap-3`,children:(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-bold text-stone-900`,children:`我的插件`}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-stone-500 leading-6`,children:`扩展为可配置插件;会话 / 全局为平台默认。点击卡片展开详情。`})]})}),(0,J.jsxs)(`div`,{ref:g,className:`mb-5 relative grid gap-1 p-1 rounded-2xl bg-stone-100 border border-stone-200/90`,style:{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},role:`tablist`,"aria-label":`插件分类`,"aria-orientation":`horizontal`,onKeyDown:S,children:[(0,J.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) / ${y})`,transform:`translateX(calc(${m} * (100% + 0.25rem)))`}}),p.map(e=>{let n=t===e.id;return(0,J.jsxs)(`button`,{id:v(e.id),type:`button`,role:`tab`,"aria-selected":n,"aria-controls":_,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,J.jsxs)(`div`,{className:`flex items-baseline gap-1.5 justify-center sm:justify-start sm:px-1`,children:[(0,J.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,children:e.label}),(0,J.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.count})]}),(0,J.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,J.jsxs)(`div`,{id:_,role:`tabpanel`,"aria-labelledby":v(t),children:[t===`extension`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[`可配置插件 · `,c.length,` 个`]}),(0,J.jsx)(`div`,{className:`space-y-5`,children:Y.map(e=>{let t=!!d[e.category];return(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!t,onClick:()=>f(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,J.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${t?`-rotate-90`:``}`}),(0,J.jsx)(`span`,{children:e.category}),(0,J.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.items.length})]}),t?null:(0,J.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r[e.id],n=i(e.id),a=s===`ext:${e.id}`,c=t?`已启用`:`未启用`,l=t&&n.available===!0?`运行中`:`已停用`;return(0,J.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${a?` z-40`:``}`,children:(0,J.jsx)(Q,{open:a,onToggleOpen:()=>C(`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,J.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:(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":`${t?`关闭`:`打开`} ${e.name}`,onClick:()=>o(e.id),className:`tw-toggle`,children:(0,J.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:X(e.id),configLabel:c,runLabel:l,extra:n.detail})},e.id)})})]},e.category)})}),(0,J.jsx)(`p`,{className:`mt-5 text-xs text-stone-400 leading-5`,children:`开关保存在本机。网页搜索 / 工作区文件已迁入会话默认能力。`})]}):null,t===`session`?(0,J.jsx)(Z,{title:`由平台按会话默认提供`,entries:K,statusOf:a,groupByCategory:!1,expandedId:s,onExpand:C,idPrefix:`sess`}):null,t===`global`?(0,J.jsx)(Z,{title:`由系统与全部会话共享`,entries:q,statusOf:a,groupByCategory:!0,expandedId:s,onExpand:C,idPrefix:`glob`}):null]})]})}function Z(e){let{title:t,entries:n,statusOf:r,groupByCategory:i,expandedId:a,onExpand:o,idPrefix:s}=e,c=(0,u.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,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[t,` · `,n.length,` 个`]}),(0,J.jsx)(`div`,{className:`space-y-5`,children:c.map(e=>(0,J.jsxs)(`section`,{children:[e.name?(0,J.jsx)(`h3`,{className:`mb-2 text-[13px] font-medium text-stone-600`,children:e.name}):null,(0,J.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,J.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,J.jsx)(Q,{open:i,onToggleOpen:()=>o(n),title:e.id,titleMono:!0,subtitle:qe(e.roleZh),status:t,fullName:X(e.id),configLabel:`已启用`,runLabel:c})},e.id)})})]},e.name||`all`))})]})}function Q(e){let{open:t,onToggleOpen:n,title:r,titleMono:i,subtitle:a,badge:o,status:s,trailing:c,fullName:u,configLabel:d,runLabel:f,extra:p}=e;return(0,J.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,J.jsxs)(`div`,{className:`relative px-4 py-3 flex gap-3 items-start h-17 overflow-visible`,children:[(0,J.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,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,J.jsx)(`h3`,{className:`font-medium text-stone-900 truncate min-w-0 ${i?`font-mono text-[13px]`:`text-[14px]`}`,children:r}),o,(0,J.jsx)($,{className:`w-3.5 h-3.5 text-stone-400 shrink-0 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,J.jsx)(l,{text:a,className:`mt-1 block min-w-0 text-[13px] text-stone-500 leading-5 truncate`,disabled:t})]}),(0,J.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 pt-0.5 self-start`,children:[s?(0,J.jsx)(Ye,{tone:s.tone,label:s.label}):null,c]})]}),(0,J.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,J.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,J.jsx)(`div`,{className:`px-4 pb-3 pt-0 border-t border-stone-100`,children:(0,J.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`完整名称`}),(0,J.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] text-stone-700 break-all`,children:u})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`配置状态`}),(0,J.jsx)(`dd`,{className:`text-stone-700`,children:d})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`运行状态`}),(0,J.jsx)(`dd`,{className:f===`运行中`?`text-emerald-600`:`text-stone-500`,children:f})]}),a?(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`简介`}),(0,J.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:a})]}):null,p?(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`说明`}),(0,J.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:p})]}):null]})})})})]})}function $({className:e}){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,J.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function Ye(e){let{tone:t,label:n}=e;return(0,J.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{te as $,Ee as A,m as B,Te as C,ye as D,ve as E,se as F,h as G,g as H,ce as I,S as J,C as K,M as L,xe as M,je as N,De as O,ge as P,ee as Q,de as R,Me as S,L as T,p as U,f as V,E as W,v as X,oe as Y,ne as Z,he as _,Le as a,ae as at,we as b,Ie as c,Ue as d,ie as et,Be as f,me as g,Ve as h,Fe as i,A as it,Oe as j,Ae as k,V as l,We as m,Re as n,re as nt,ze as o,He as p,w as q,Ne as r,T as rt,Pe as s,Ke as t,_ as tt,H as u,be as v,R as w,Ce as x,Se as y,fe as z};
39
+ `)}async function W(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?U({error:String(n.error),command:a}):n.background&&n.jobId?U({background:!0,jobId:String(n.jobId),command:n.command||a,workdir:n.workdir}):U({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 Be(e,t){return W(z,`Bash`,e,t)}async function Ve(e,t){return W(B,`Pwsh`,e,t)}async function He(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(`${z}/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(`${z}/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(`${z}/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 G(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 Ue(e,t,n){return G(z,`bash session`,e,t,n)}async function We(e,t,n){return G(B,`pwsh session`,e,t,n)}function Ge(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 K=[{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:`会话能力`}],q=[{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 核心`}],J=r(),Y=o();function Ke({embedded:e=!1}){let[t,r]=(0,u.useState)(`extension`),[o,c]=(0,u.useState)(()=>a()),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(!0);async function S(){x(!0);try{let[e,t,n,r,i]=await Promise.all([L(),M(),C(),V(),H()]);d(e),p(t),h(n),_(r),y(i)}finally{x(!1)}}(0,u.useEffect)(()=>{let e=i(e=>c(e));return n().then(()=>{c(a()),S()}),()=>{e()}},[]);function w(e){return e===`cases`?{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`}:e===`caseGen`?o.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`}:e===`prompts`?{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`}:e===`promptGen`?o.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`}:e===`knowledgeLib`?{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`}:e===`requirements`?{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`}:e===`templates`?{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`}:e===`knowledgeGen`?o.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?b&&l===null?{available:null,detail:`探测中…`}:l?.ok?{available:!0,detail:`已连接 · ${l.entryCount??l.entityCount??0} 条记忆 / 待确认 ${l.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?b&&m===null?{available:null,detail:`探测中…`}:m?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function T(e){let t=Ge(e.id);return t===`none`?{label:`规划中`,tone:`plan`}:t===`ready`?{label:`已就绪`,tone:`ready`}:b&&(t===`web`&&f===null||t===`fs`&&m===null||t===`bash`&&g===null||t===`pwsh`&&v===null)?{label:`探测中…`,tone:`plan`}:t===`web`?f?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`fs`?m?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`bash`?g?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:t===`pwsh`?v?.ok&&v.available?{label:`已就绪`,tone:`ready`}:v?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}function E(e){c(s(e,!o[e]))}return(0,J.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,J.jsx)(`div`,{className:`w-full ${e?`px-6 py-5`:`px-6 py-6`}`,children:(0,J.jsx)(Je,{mineTab:t,onMineTab:r,enabled:o,runtimeFor:w,builtinStatus:T,onToggle:E})})})}function X(e){return`@lh-plugins/${e}`}function qe(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 Je(e){let{mineTab:t,onMineTab:n,enabled:r,runtimeFor:i,builtinStatus:a,onToggle:o}=e,[s,l]=(0,u.useState)(null),[d,f]=(0,u.useState)({}),p=[{id:`extension`,label:`扩展插件`,count:c.length,hint:`可配置插件`},{id:`session`,label:`会话插件`,count:K.length,hint:`默认`},{id:`global`,label:`全局插件`,count:q.length,hint:`默认`}],m=Math.max(0,p.findIndex(e=>e.id===t)),h=(0,u.useId)(),g=(0,u.useRef)(null),_=`${h}-panel`,v=e=>`${h}-tab-${e}`,y=Math.max(1,p.length),b=.5+.25*(y-1);function x(e){n(e),l(null)}function S(e){let t=p.length;if(!t)return;let n=m;if(e.key===`ArrowLeft`)n=(m-1+t)%t;else if(e.key===`ArrowRight`)n=(m+1)%t;else if(e.key===`Home`)n=0;else if(e.key===`End`)n=t-1;else return;e.preventDefault();let r=p[n];r&&(x(r.id),g.current?.querySelectorAll(`[role="tab"]`)[n]?.focus())}function C(e){l(t=>t===e?null:e)}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`header`,{className:`mb-4 flex items-start gap-3`,children:(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-xl font-bold text-stone-900`,children:`我的插件`}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-stone-500 leading-6`,children:`扩展为可配置插件;会话 / 全局为平台默认。点击卡片展开详情。`})]})}),(0,J.jsxs)(`div`,{ref:g,className:`mb-5 relative grid gap-1 p-1 rounded-2xl bg-stone-100 border border-stone-200/90`,style:{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},role:`tablist`,"aria-label":`插件分类`,"aria-orientation":`horizontal`,onKeyDown:S,children:[(0,J.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) / ${y})`,transform:`translateX(calc(${m} * (100% + 0.25rem)))`}}),p.map(e=>{let n=t===e.id;return(0,J.jsxs)(`button`,{id:v(e.id),type:`button`,role:`tab`,"aria-selected":n,"aria-controls":_,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,J.jsxs)(`div`,{className:`flex items-baseline gap-1.5 justify-center sm:justify-start sm:px-1`,children:[(0,J.jsx)(`span`,{className:`text-[13px] font-semibold truncate`,children:e.label}),(0,J.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.count})]}),(0,J.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,J.jsxs)(`div`,{id:_,role:`tabpanel`,"aria-labelledby":v(t),children:[t===`extension`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[`可配置插件 · `,c.length,` 个`]}),(0,J.jsx)(`div`,{className:`space-y-5`,children:Y.map(e=>{let t=!!d[e.category];return(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!t,onClick:()=>f(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,J.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${t?`-rotate-90`:``}`}),(0,J.jsx)(`span`,{children:e.category}),(0,J.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:e.items.length})]}),t?null:(0,J.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let t=r[e.id],n=i(e.id),a=s===`ext:${e.id}`,c=e.alwaysOn?`内置常开`:t?`已启用`:`未启用`,l=t&&n.available===!0?`运行中`:`已停用`;return(0,J.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${a?` z-40`:``}`,children:(0,J.jsx)(Q,{open:a,onToggleOpen:()=>C(`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,J.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,J.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded border border-stone-200 text-stone-500`,children:`内置`}):(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":`${t?`关闭`:`打开`} ${e.name}`,onClick:()=>o(e.id),className:`tw-toggle`,children:(0,J.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:X(e.id),configLabel:c,runLabel:l,extra:n.detail})},e.id)})})]},e.category)})}),(0,J.jsx)(`p`,{className:`mt-5 text-xs text-stone-400 leading-5`,children:`开关保存在本机。网页搜索 / 工作区文件已迁入会话默认能力。`})]}):null,t===`session`?(0,J.jsx)(Z,{title:`由平台按会话默认提供`,entries:K,statusOf:a,groupByCategory:!1,expandedId:s,onExpand:C,idPrefix:`sess`}):null,t===`global`?(0,J.jsx)(Z,{title:`由系统与全部会话共享`,entries:q,statusOf:a,groupByCategory:!0,expandedId:s,onExpand:C,idPrefix:`glob`}):null]})]})}function Z(e){let{title:t,entries:n,statusOf:r,groupByCategory:i,expandedId:a,onExpand:o,idPrefix:s}=e,c=(0,u.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,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{className:`mb-3 text-xs text-stone-500`,children:[t,` · `,n.length,` 个`]}),(0,J.jsx)(`div`,{className:`space-y-5`,children:c.map(e=>(0,J.jsxs)(`section`,{children:[e.name?(0,J.jsx)(`h3`,{className:`mb-2 text-[13px] font-medium text-stone-600`,children:e.name}):null,(0,J.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,J.jsx)(`li`,{className:`min-w-0 relative z-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,J.jsx)(Q,{open:i,onToggleOpen:()=>o(n),title:e.id,titleMono:!0,subtitle:qe(e.roleZh),status:t,fullName:X(e.id),configLabel:`已启用`,runLabel:c})},e.id)})})]},e.name||`all`))})]})}function Q(e){let{open:t,onToggleOpen:n,title:r,titleMono:i,subtitle:a,badge:o,status:s,trailing:c,fullName:u,configLabel:d,runLabel:f,extra:p}=e;return(0,J.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,J.jsxs)(`div`,{className:`relative px-4 py-3 flex gap-3 items-start h-17 overflow-visible`,children:[(0,J.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,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,J.jsx)(`h3`,{className:`font-medium text-stone-900 truncate min-w-0 ${i?`font-mono text-[13px]`:`text-[14px]`}`,children:r}),o,(0,J.jsx)($,{className:`w-3.5 h-3.5 text-stone-400 shrink-0 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,J.jsx)(l,{text:a,className:`mt-1 block min-w-0 text-[13px] text-stone-500 leading-5 truncate`,disabled:t})]}),(0,J.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 pt-0.5 self-start`,children:[s?(0,J.jsx)(Ye,{tone:s.tone,label:s.label}):null,c]})]}),(0,J.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,J.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,J.jsx)(`div`,{className:`px-4 pb-3 pt-0 border-t border-stone-100`,children:(0,J.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`完整名称`}),(0,J.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] text-stone-700 break-all`,children:u})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`配置状态`}),(0,J.jsx)(`dd`,{className:`text-stone-700`,children:d})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`运行状态`}),(0,J.jsx)(`dd`,{className:f===`运行中`?`text-emerald-600`:`text-stone-500`,children:f})]}),a?(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`简介`}),(0,J.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:a})]}):null,p?(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`shrink-0 w-18 text-stone-400`,children:`说明`}),(0,J.jsx)(`dd`,{className:`text-stone-500 text-[12px] leading-5`,children:p})]}):null]})})})})]})}function $({className:e}){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,J.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function Ye(e){let{tone:t,label:n}=e;return(0,J.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{te as $,Ee as A,m as B,Te as C,ye as D,ve as E,se as F,h as G,g as H,ce as I,S as J,C as K,M as L,xe as M,je as N,De as O,ge as P,ee as Q,de as R,Me as S,L as T,p as U,f as V,E as W,v as X,oe as Y,ne as Z,he as _,Le as a,ae as at,we as b,Ie as c,Ue as d,ie as et,Be as f,me as g,Ve as h,Fe as i,A as it,Oe as j,Ae as k,V as l,We as m,Re as n,re as nt,ze as o,He as p,w as q,Ne as r,T as rt,Pe as s,Ke as t,_ as tt,H as u,be as v,R as w,Ce as x,Se as y,fe as z};
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.vqDkEMS3.js";import{l as r,n as i,r as a,s as o}from"./project-docs.Cd2gKPKh.js";import{n as s}from"./doc-roots.DAJP9Svr.js";import{i as c}from"./prompts-meta.F4wwkjUA.js";import{t as l}from"./jsx-runtime.BUXbF_vF.js";import{t as u}from"./ConfirmDialog.BYz4HREM.js";import{i as d,n as f,r as p,t as m}from"./DocsFileBrowser.BxAyrkkw.js";import{a as h,o as g,r as _}from"./plugins.DSUPSizB.js";var v=e(t(),1),y=l(),b=10;async function x(e=`.`){let{entries:t}=await o(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await x(e.path));return n}function S(){let e=p(`prompts`),[t,o]=(0,v.useState)(!1),[l,S]=(0,v.useState)(!0),[C,w]=(0,v.useState)(e?!0:null),[T,E]=(0,v.useState)(()=>e??[]),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)({}),[N,P]=(0,v.useState)(null),F=f(T,b),I=(0,v.useCallback)(async()=>{O(null);try{let e=await x(`.`);E(e),d(`prompts`,e)}catch(e){O(e instanceof Error?e.message:String(e))}},[]);(0,v.useEffect)(()=>{let e=h(e=>S(!!e.prompts));return n().then(()=>{S(_(`prompts`)),o(!0)}),e},[]),(0,v.useEffect)(()=>{t&&l&&(async()=>{await a(`prompts`)?(await I(),w(!0)):w(!1)})()},[t,l,I]);let L=(0,v.useMemo)(()=>Object.keys(j).filter(e=>j[e]),[j]);async function R(e){A(!0),O(null);try{await r(`prompts`,e.path)}catch(e){O(e instanceof Error?e.message:String(e))}finally{A(!1)}}function z(e){c(e.path)?O(`默认提示词不可删除`):P({kind:`one`,entry:e})}async function B(){let e=N;if(e){P(null),A(!0),O(null);try{if(e.kind===`one`)await i(`prompts`,e.entry.path);else{for(let t of e.paths)c(t)||await i(`prompts`,t);M({})}await I()}catch(e){O(e instanceof Error?e.message:String(e))}finally{A(!1)}}}function V(){_(`promptGen`)?window.location.href=`/?plugin=promptGen`:O(g(`promptGen`))}let H=N?.kind===`one`?`删除「${N.entry.name}」?将从 ${s(`prompts`)} 中移除。`:N?.kind===`batch`?`确认删除已选中的 ${N.paths.length} 个提示词?此操作不可恢复。`:``;return t?l?C===null?(0,y.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,y.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):C?(0,y.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,y.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,y.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[F.query.trim()?(0,y.jsxs)(y.Fragment,{children:[`匹配 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-800`,children:F.filtered.length}),` 个`,(0,y.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,y.jsxs)(y.Fragment,{children:[`共 `,(0,y.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),L.length>0?(0,y.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,L.length]}):null]}),(0,y.jsx)(`button`,{type:`button`,disabled:k||L.length===0,onClick:()=>P({kind:`batch`,paths:L}),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,y.jsx)(`button`,{type:`button`,disabled:k,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:`生成提示词`})]}),D?(0,y.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:D}):null,(0,y.jsx)(m,{files:T,filtered:F.filtered,pageFiles:F.pageFiles,query:F.query,onQuery:F.setQuery,sortBy:F.sortBy,onSortBy:F.setSortBy,page:F.page,totalPages:F.totalPages,pageSize:F.pageSize,onPage:F.setPage,onPageSize:F.setPageSize,busy:k,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!c(e.path),selected:j,onToggleRow:e=>M(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>M(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void R(e),renderActions:e=>{let t=c(e.path);return(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(`button`,{type:`button`,disabled:k||t,"data-hint":t?`默认提示词不可删除`:void 0,onClick:()=>z(e),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`,children:`删除`})})}}),(0,y.jsx)(u,{open:N!=null,title:N?.kind===`batch`?`批量删除`:`删除提示词`,message:H,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>P(null),onConfirm:()=>void B()})]}):(0,y.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:`提示词管理需要本地文档服务,当前未就绪。`}):(0,y.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:g(`prompts`)}):(0,y.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,y.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,y.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{S as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{i as n}from"./app-config.vqDkEMS3.js";import{a as r,c as i,f as a,h as o,i as s,l as c,m as ee,n as te,o as l,p as ne,r as re,s as u,t as ie,u as ae}from"./project-docs.Cd2gKPKh.js";import{n as oe}from"./doc-roots.DAJP9Svr.js";import{t as d}from"./jsx-runtime.BUXbF_vF.js";import{t as se}from"./ConfirmDialog.BYz4HREM.js";import{a as ce,o as le,r as f}from"./plugins.DSUPSizB.js";import{n as ue,r as de,t as fe}from"./useListAnim.Y3N2budK.js";import{t as p}from"./NamePromptDialog.DGBlDH_k.js";var m=e(t(),1),h=d(),pe=5;function g({className:e=`w-4 h-4`,open:t=!1}){return(0,h.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,h.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`}):(0,h.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 _({className:e=`w-3 h-3`}){return(0,h.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,h.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,h.jsx)(`path`,{d:`m15 5 4 4`})]})}function v({className:e=`w-3 h-3`}){return(0,h.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,h.jsx)(`path`,{d:`M3 6h18`}),(0,h.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,h.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,h.jsx)(`path`,{d:`M10 11v6`}),(0,h.jsx)(`path`,{d:`M14 11v6`})]})}function y({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,h.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,h.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,h.jsx)(g,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,h.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name}),(0,h.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,h.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,h.jsx)(`div`,{className:`tw-collapse-inner`,children:e.children.map(e=>(0,h.jsx)(y,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function me(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function b(){let[e,t]=(0,m.useState)(()=>f(`requirements`)),[d,b]=(0,m.useState)(!1),[x,he]=(0,m.useState)(null),[S,ge]=(0,m.useState)([]),[_e,ve]=(0,m.useState)(0),[C,w]=(0,m.useState)(`.`),[T,E]=(0,m.useState)([]),[ye,D]=(0,m.useState)({}),[O,be]=(0,m.useState)(!0),[k,A]=(0,m.useState)(null),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(null),[xe,F]=(0,m.useState)(!1),[I,L]=(0,m.useState)(null),[R,z]=(0,m.useState)(null),[Se,B]=(0,m.useState)(1),[V,Ce]=de(pe),[we,H]=(0,m.useState)(null),U=(0,m.useRef)(null),{cls:Te,play:W}=fe(),G=(0,m.useCallback)(async()=>{let e=await s(`requirements`);ge(e.tree),ve(e.totalFiles)},[]),K=(0,m.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,m.useEffect)(()=>{let e=ce(e=>t(!!e.requirements));return n().then(()=>{t(f(`requirements`)),b(!0)}),e},[]),(0,m.useEffect)(()=>{d&&e&&(async()=>{let e=await re(`requirements`);if(he(e),e)try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path)}catch(e){A(e instanceof Error?e.message:String(e))}})()},[d,e,G]);function Ee(){be(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function De(e){F(!1),M(!0),A(null);try{await i(`requirements`,C,e),await K(C)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}async function Oe(e){if(e.type===`file`){M(!0),A(null);try{await c(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function ke(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await o(`requirements`,C,t);await K(C)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1),U.current&&(U.current.value=``)}}}function Ae(e){let t=r(S,e.path),n=t?.fileCount??0,i=t?ie(t):0;L({...e,isDir:!0,blocked:n>0||i>0,files:n,dirs:i})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function je(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await te(`requirements`,e.path),N&&l(N.path,e.path)&&P(null);let t=l(C,e.path)?ae(e.path):C;await K(t)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function Me(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ee(`requirements`,t.path,e);await K(ne(C,t.path,n))}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}let Ne=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Pe(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(!t.endsWith(`.md`)&&!t.endsWith(`.txt`))A(`仅 .md / .txt 支持就地预览;docx 请双击用本机程序打开。`);else{M(!0),A(null);try{let t=await a(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!d)return(0,h.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,h.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,h.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:le(`requirements`)});if(x===null)return(0,h.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,h.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!x)return(0,h.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:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(Se,Q),Fe=X.slice(($-1)*V,$*V);function Ie(e){W(),Ce(e),B(1)}return(0,h.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,h.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,h.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,h.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1`,children:[(0,h.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,h.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Ee()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,h.jsx)(g,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,h.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,h.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,_e,`)`]})]})}),(0,h.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,h.jsx)(`div`,{className:`tw-collapse-inner`,children:S.map(e=>(0,h.jsx)(y,{node:e,depth:0,activePath:C,expanded:ye,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,h.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,h.jsx)(`span`,{className:`text-stone-400`,children:oe(`requirements`)}),C===`.`?``:C]}),(0,h.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,text/plain,text/markdown,application/vnd.openxmlformats-officedocument.wordprocessingml.document`,className:`hidden`,onChange:e=>void ke(e.target.files)}),(0,h.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),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:`上传文件`})]}),k?(0,h.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,h.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,h.jsx)(g,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,h.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name})]}),(0,h.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,h.jsx)(_,{className:`w-3.5 h-3.5`})}),(0,h.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Ae({name:e.name,path:e.path}),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40`,children:(0,h.jsx)(v,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,h.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx)`}):(0,h.jsx)(`ul`,{className:`${Te}space-y-1`,children:Fe.map(e=>{let t=we===e.path;return(0,h.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Pe(e)},onDoubleClick:t=>{t.preventDefault(),Oe(e)},children:[(0,h.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,h.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:me(e.size)})]}),(0,h.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,h.jsx)(_,{className:`w-3.5 h-3.5`})}),(0,h.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`p-1.5 rounded text-red-600 hover:bg-red-50 disabled:opacity-40`,children:(0,h.jsx)(v,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,h.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,h.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,h.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,h.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,h.jsx)(ue,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Ie}):null]}),(0,h.jsx)(p,{open:xe,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void De(e)}),(0,h.jsx)(p,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Me(e)}),(0,h.jsx)(se,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Ne,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void je()})]})}export{b as default};