nx-kv 0.35.0 → 0.36.0

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 (24) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +1 -1
  3. package/src/web/frontend/page/repos/index.jsx +6 -6
  4. package/src/web/public/assets/{Introduction-DO6_gTk-.js → Introduction-EDM3eqXe.js} +1 -1
  5. package/src/web/public/assets/{bar-DoiwB4eA.js → bar-P_ky_qA9.js} +1 -1
  6. package/src/web/public/assets/{cloud-DSu1a2Dn.js → cloud-Bl7EJoQ_.js} +1 -1
  7. package/src/web/public/assets/{composer-launch-D-b7HKk5.js → composer-launch-DOB0Hm0B.js} +1 -1
  8. package/src/web/public/assets/{composer-panel-CJuaj0Jp.js → composer-panel-DCV7JGNt.js} +1 -1
  9. package/src/web/public/assets/{dag-_5FWJlq5.js → dag-NSMkkWrt.js} +1 -1
  10. package/src/web/public/assets/{dir-GUpDi0kq.js → dir-ClkYDLql.js} +1 -1
  11. package/src/web/public/assets/{group-BzC_R2k-.js → group-DqBGGAEA.js} +1 -1
  12. package/src/web/public/assets/{index-B_HPAoNR.js → index-CLsU9Lad.js} +2 -2
  13. package/src/web/public/assets/{md-panes-BvQXV_C9.js → md-panes-DMs3KANu.js} +1 -1
  14. package/src/web/public/assets/{overview-sLaedHVZ.js → overview-CFGcpG_m.js} +1 -1
  15. package/src/web/public/assets/{progress-DOI2YFEi.js → progress-B0fipz7a.js} +1 -1
  16. package/src/web/public/assets/{refs-D97SxNRW.js → refs-DLThlN46.js} +1 -1
  17. package/src/web/public/assets/{repos-fp0D_GDq.js → repos-BygXrPSp.js} +2 -2
  18. package/src/web/public/assets/{route-crumb-C5LPu1Qx.js → route-crumb-Cyesq6KK.js} +1 -1
  19. package/src/web/public/assets/{settings-D13mfwe0.js → settings-KHM4F3Sy.js} +1 -1
  20. package/src/web/public/assets/{status-tag-D4wxIj1q.js → status-tag-Bts7p2cp.js} +1 -1
  21. package/src/web/public/assets/{task-Cu-rh5jA.js → task-BoJGRYpA.js} +1 -1
  22. package/src/web/public/assets/{templates-xbR-qZMs.js → templates-CdPNcDxd.js} +1 -1
  23. package/src/web/public/assets/{tool-bar-CHoZSF6T.js → tool-bar-Bh3XH8MU.js} +1 -1
  24. package/src/web/public/index.html +1 -1
@@ -1 +1 @@
1
- import{S as e,_ as t,f as n,g as r,v as i,y as a}from"./task-status-BP6y8MVu.js";import{h as o}from"./md-parse-C2bDc3IZ.js";import{s,t as c}from"./board-view-t8CKtq17.js";import{t as l}from"./status-tag-D4wxIj1q.js";import{t as u}from"./route-crumb-C5LPu1Qx.js";var d=e(a(),1),f=i();function p({rows:e,onNavigate:i,refreshLocal:a}){let o=r(),{dialog:l,node:p}=n(),[h,g]=(0,d.useState)(()=>new Set),[_,v]=(0,d.useState)(``),y=(0,d.useMemo)(()=>{let t=[];for(let n of e){let e=s(n.tasks||[]),r=n.isGlobal?`#/global`:`#/dir/`+encodeURIComponent(n.key);for(let i of[...e.pending,...e.claimed])t.push({t:i,secKey:n.isGlobal?c:n.key,proj:n.isGlobal?`全局`:n.name||n.key,cwd:n.cwd||``,waiting:!!n.waiting,base:r})}return t},[e]),b=(0,d.useMemo)(()=>e.filter(e=>e.waiting).length,[e]),x=(0,d.useMemo)(()=>{let e=[],t=new Map;for(let n of y)t.has(n.proj)||(t.set(n.proj,0),e.push(n.proj)),t.set(n.proj,t.get(n.proj)+1);return e.map(e=>({proj:e,count:t.get(e)}))},[y]),S=x.some(e=>e.proj===_)?_:``,C=(0,d.useMemo)(()=>S?y.filter(e=>e.proj===S):y,[y,S]),w=(0,d.useMemo)(()=>C.filter(e=>e.t.status!==`claimed`).length,[C]),T=(0,d.useMemo)(()=>{let e=new Set(C.map(e=>Number(e.t.id)));return[...h].filter(t=>e.has(t))},[h,C]),E=T.length,D=e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},O=e=>{g(e?new Set:new Set(C.map(e=>Number(e.t.id))))},k=C.length>0&&T.length===C.length,A=async()=>{let e=new Set(T),n=[];for(let t of y){if(!e.has(Number(t.t.id)))continue;let r=n.find(e=>e.key===t.secKey);r||(r={key:t.secKey,name:t.proj,ids:[]},n.push(r)),r.ids.push(Number(t.t.id))}let r=n.reduce((e,t)=>e+t.ids.length,0);if(!r)return;let i=n.length>1?`(跨 ${n.length} 个目录)`:``;if(!await l({title:`删除 ${r} 条任务${i}`,message:`软删除:CLI localtask task restore 可恢复。`,danger:!0,okText:`删除`}))return;let s=0,c=0,u=[];for(let e of n)try{let n=await t(`/api/localtasks/items`,{method:`DELETE`,body:{key:e.key,ids:e.ids}});s+=Number(n?.count??0),c+=(n?.missing||[]).length}catch(t){let n=String(t.message||t);if(/接口不存在/.test(n)){o(`本机面板服务较旧,重启面板后再试(批量删除接口未上线)`);return}u.push(`${e.name}: ${n}`)}u.length?o(`已删除 ${s} 条;${u.length} 个目录失败:${u[0]}${u.length>1?` 等 ${u.length} 项`:``}`):o(`已删除 ${s} 条${c?`(${c} 条未找到,可能已被删除)`:``}`),g(new Set),a?.()},j=(e,t)=>{i(e.t.boardMark?`#/group/${encodeURIComponent(e.t.boardMark)}?task=${encodeURIComponent(t)}`:`${e.base}?task=${encodeURIComponent(t)}`)};return(0,f.jsxs)(`div`,{className:`ov-wrap`,children:[(0,f.jsx)(u,{}),p,(0,f.jsxs)(`div`,{className:`ov-head`,children:[(0,f.jsx)(`h2`,{children:`全部目录总览`}),(0,f.jsxs)(`span`,{className:`muted`,children:[C.length,` 个未完成任务(待领取 `,w,`)`,b?` · ${b} 个目录等待回填`:``]}),C.length>0&&(0,f.jsxs)(`label`,{className:`ov-all`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:k,ref:e=>{e&&(e.indeterminate=!k&&E>0)},onChange:()=>O(k),"aria-label":`全选未完成任务`}),`全选`]})]}),x.length>1&&(0,f.jsxs)(`div`,{className:`ov-tabs`,role:`tablist`,"aria-label":`按项目筛选`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`ov-tab`+(S?``:` on`),onClick:()=>v(``),children:[`全部 `,y.length]}),x.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`ov-tab`+(S===e.proj?` on`:``),onClick:()=>v(e.proj),children:[e.proj,` `,e.count]},e.proj))]}),C.length?(0,f.jsx)(`div`,{className:`ov-list`,children:C.map(e=>(0,f.jsx)(m,{t:e.t,proj:e.proj,waiting:e.waiting,checked:h.has(Number(e.t.id)),onToggle:D,onOpenTask:t=>j(e,t),meta:e.t.status===`claimed`&&e.t.consumedAt?String(e.t.consumedAt).slice(5,16):``},`${e.secKey}-${e.t.id}`))}):(0,f.jsx)(`div`,{className:`ov-task muted`,children:`没有未完成的任务——当前队列都清空了。在侧边栏点 + 添加目录,或让 agent 在任意目录提交任务。`}),E>0&&(0,f.jsxs)(`div`,{className:`ov-bar`,role:`toolbar`,"aria-label":`批量删除操作条`,children:[(0,f.jsxs)(`span`,{className:`ov-bar-n`,children:[`已选 `,(0,f.jsx)(`b`,{children:E}),` 条任务`]}),(0,f.jsx)(`span`,{className:`grow`}),(0,f.jsx)(`button`,{type:`button`,className:`mini`,onClick:()=>g(new Set),children:`取消选择`}),(0,f.jsxs)(`button`,{type:`button`,className:`btn small danger`,onClick:A,children:[`删除选中 `,E]})]})]})}function m({t:e,proj:t,waiting:n,checked:r,onToggle:i,onOpenTask:a,meta:s=``}){return(0,f.jsxs)(`div`,{className:`ov-task link`,role:`button`,tabIndex:0,title:`打开任务详情`,onClick:()=>a(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e.id))},children:[(0,f.jsx)(`label`,{className:`ov-ck`,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(Number(e.id)),"aria-label":`选择 #${e.id}`})}),(0,f.jsxs)(`span`,{className:`mono faint`,children:[`#`,e.id]}),(0,f.jsx)(`span`,{className:`tx`,title:e.text,children:o(e.text,e.text||`未命名任务`)}),e.boardMark?(0,f.jsx)(`span`,{className:`tag t-board`,title:`项目组任务:详情在组页打开`,children:`组`}):null,t?(0,f.jsxs)(`span`,{className:`tag t-proj`,title:`所属项目`,children:[t,n?(0,f.jsx)(`span`,{className:`wdot`}):null]}):null,e.from===`cloud`&&(0,f.jsx)(`span`,{className:`tag t-cloud`,children:`云端`}),s?(0,f.jsx)(`span`,{className:`m mono`,children:s}):null,(0,f.jsx)(l,{t:e})]})}export{p as default};
1
+ import{S as e,_ as t,f as n,g as r,v as i,y as a}from"./task-status-BP6y8MVu.js";import{h as o}from"./md-parse-C2bDc3IZ.js";import{s,t as c}from"./board-view-t8CKtq17.js";import{t as l}from"./status-tag-Bts7p2cp.js";import{t as u}from"./route-crumb-Cyesq6KK.js";var d=e(a(),1),f=i();function p({rows:e,onNavigate:i,refreshLocal:a}){let o=r(),{dialog:l,node:p}=n(),[h,g]=(0,d.useState)(()=>new Set),[_,v]=(0,d.useState)(``),y=(0,d.useMemo)(()=>{let t=[];for(let n of e){let e=s(n.tasks||[]),r=n.isGlobal?`#/global`:`#/dir/`+encodeURIComponent(n.key);for(let i of[...e.pending,...e.claimed])t.push({t:i,secKey:n.isGlobal?c:n.key,proj:n.isGlobal?`全局`:n.name||n.key,cwd:n.cwd||``,waiting:!!n.waiting,base:r})}return t},[e]),b=(0,d.useMemo)(()=>e.filter(e=>e.waiting).length,[e]),x=(0,d.useMemo)(()=>{let e=[],t=new Map;for(let n of y)t.has(n.proj)||(t.set(n.proj,0),e.push(n.proj)),t.set(n.proj,t.get(n.proj)+1);return e.map(e=>({proj:e,count:t.get(e)}))},[y]),S=x.some(e=>e.proj===_)?_:``,C=(0,d.useMemo)(()=>S?y.filter(e=>e.proj===S):y,[y,S]),w=(0,d.useMemo)(()=>C.filter(e=>e.t.status!==`claimed`).length,[C]),T=(0,d.useMemo)(()=>{let e=new Set(C.map(e=>Number(e.t.id)));return[...h].filter(t=>e.has(t))},[h,C]),E=T.length,D=e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},O=e=>{g(e?new Set:new Set(C.map(e=>Number(e.t.id))))},k=C.length>0&&T.length===C.length,A=async()=>{let e=new Set(T),n=[];for(let t of y){if(!e.has(Number(t.t.id)))continue;let r=n.find(e=>e.key===t.secKey);r||(r={key:t.secKey,name:t.proj,ids:[]},n.push(r)),r.ids.push(Number(t.t.id))}let r=n.reduce((e,t)=>e+t.ids.length,0);if(!r)return;let i=n.length>1?`(跨 ${n.length} 个目录)`:``;if(!await l({title:`删除 ${r} 条任务${i}`,message:`软删除:CLI localtask task restore 可恢复。`,danger:!0,okText:`删除`}))return;let s=0,c=0,u=[];for(let e of n)try{let n=await t(`/api/localtasks/items`,{method:`DELETE`,body:{key:e.key,ids:e.ids}});s+=Number(n?.count??0),c+=(n?.missing||[]).length}catch(t){let n=String(t.message||t);if(/接口不存在/.test(n)){o(`本机面板服务较旧,重启面板后再试(批量删除接口未上线)`);return}u.push(`${e.name}: ${n}`)}u.length?o(`已删除 ${s} 条;${u.length} 个目录失败:${u[0]}${u.length>1?` 等 ${u.length} 项`:``}`):o(`已删除 ${s} 条${c?`(${c} 条未找到,可能已被删除)`:``}`),g(new Set),a?.()},j=(e,t)=>{i(e.t.boardMark?`#/group/${encodeURIComponent(e.t.boardMark)}?task=${encodeURIComponent(t)}`:`${e.base}?task=${encodeURIComponent(t)}`)};return(0,f.jsxs)(`div`,{className:`ov-wrap`,children:[(0,f.jsx)(u,{}),p,(0,f.jsxs)(`div`,{className:`ov-head`,children:[(0,f.jsx)(`h2`,{children:`全部目录总览`}),(0,f.jsxs)(`span`,{className:`muted`,children:[C.length,` 个未完成任务(待领取 `,w,`)`,b?` · ${b} 个目录等待回填`:``]}),C.length>0&&(0,f.jsxs)(`label`,{className:`ov-all`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:k,ref:e=>{e&&(e.indeterminate=!k&&E>0)},onChange:()=>O(k),"aria-label":`全选未完成任务`}),`全选`]})]}),x.length>1&&(0,f.jsxs)(`div`,{className:`ov-tabs`,role:`tablist`,"aria-label":`按项目筛选`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`ov-tab`+(S?``:` on`),onClick:()=>v(``),children:[`全部 `,y.length]}),x.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`ov-tab`+(S===e.proj?` on`:``),onClick:()=>v(e.proj),children:[e.proj,` `,e.count]},e.proj))]}),C.length?(0,f.jsx)(`div`,{className:`ov-list`,children:C.map(e=>(0,f.jsx)(m,{t:e.t,proj:e.proj,waiting:e.waiting,checked:h.has(Number(e.t.id)),onToggle:D,onOpenTask:t=>j(e,t),meta:e.t.status===`claimed`&&e.t.consumedAt?String(e.t.consumedAt).slice(5,16):``},`${e.secKey}-${e.t.id}`))}):(0,f.jsx)(`div`,{className:`ov-task muted`,children:`没有未完成的任务——当前队列都清空了。在侧边栏点 + 添加目录,或让 agent 在任意目录提交任务。`}),E>0&&(0,f.jsxs)(`div`,{className:`ov-bar`,role:`toolbar`,"aria-label":`批量删除操作条`,children:[(0,f.jsxs)(`span`,{className:`ov-bar-n`,children:[`已选 `,(0,f.jsx)(`b`,{children:E}),` 条任务`]}),(0,f.jsx)(`span`,{className:`grow`}),(0,f.jsx)(`button`,{type:`button`,className:`mini`,onClick:()=>g(new Set),children:`取消选择`}),(0,f.jsxs)(`button`,{type:`button`,className:`btn small danger`,onClick:A,children:[`删除选中 `,E]})]})]})}function m({t:e,proj:t,waiting:n,checked:r,onToggle:i,onOpenTask:a,meta:s=``}){return(0,f.jsxs)(`div`,{className:`ov-task link`,role:`button`,tabIndex:0,title:`打开任务详情`,onClick:()=>a(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e.id))},children:[(0,f.jsx)(`label`,{className:`ov-ck`,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(Number(e.id)),"aria-label":`选择 #${e.id}`})}),(0,f.jsxs)(`span`,{className:`mono faint`,children:[`#`,e.id]}),(0,f.jsx)(`span`,{className:`tx`,title:e.text,children:o(e.text,e.text||`未命名任务`)}),e.boardMark?(0,f.jsx)(`span`,{className:`tag t-board`,title:`项目组任务:详情在组页打开`,children:`组`}):null,t?(0,f.jsxs)(`span`,{className:`tag t-proj`,title:`所属项目`,children:[t,n?(0,f.jsx)(`span`,{className:`wdot`}):null]}):null,e.from===`cloud`&&(0,f.jsx)(`span`,{className:`tag t-cloud`,children:`云端`}),s?(0,f.jsx)(`span`,{className:`m mono`,children:s}):null,(0,f.jsx)(l,{t:e})]})}export{p as default};
@@ -1,3 +1,3 @@
1
- import{S as e,_ as t,f as n,g as r,p as i,v as a,y as o}from"./task-status-BP6y8MVu.js";import{g as s,m as c}from"./md-parse-C2bDc3IZ.js";import{r as l,t as u}from"./board-view-t8CKtq17.js";import{C as d,T as f}from"./index-B_HPAoNR.js";var p=e(o(),1);function m(e){let t=e&&e.taskId!==void 0&&e.taskId!==null?e.taskId:e&&e.id;return String(t??``)}function h(e,t){let n=String(e??``).toLowerCase(),r=(t||[]).map(e=>String(e).toLowerCase()).filter(Boolean);if(!r.length)return!0;let i=0;for(let e of r){let t=n.indexOf(e,i);if(t<0)return!1;i=t+e.length}return!0}function g(e,t){let n=String(e??``).toLowerCase(),r=String(t??``).toLowerCase().split(``),i=0;for(let e of r){let t=n.indexOf(e,i);if(t<0)return!1;i=t+1}return!0}function _(e,t){let n=String(t??``).trim().toLowerCase();if(!n)return!0;let r=n.startsWith(`#`)?n.slice(1).trim():n;if(!r)return!0;let i=m(e),a=String(e&&e.title||``).toLowerCase();if(r.includes(`*`)){let e=r.split(`*`).filter(Boolean);return h(a,e)?!0:h(i,e)}return/^\d+$/.test(r)?i===r||i.startsWith(r)?!0:g(a,r):a.includes(r)}var v=a();function y(e){if(e==null||e<0||Number.isNaN(e))return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%60/60),i=t%60;return n?`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function b(e,t){if(e.status!==`run`)return`—`;let n=e.receivedAt?Date.parse(e.receivedAt):NaN;return Number.isFinite(n)?y(t-n):`—`}function x({dirKey:e,task:a,rows:o=[],refreshLocal:m,model:h,onOpenTask:g,onClosePage:y,group:x=null}){let S=r(),{dialog:C,node:w}=n(),T=!e||e===`__GLOBAL__`,E=(0,p.useMemo)(()=>T?(o||[]).find(e=>e.isGlobal)||null:(o||[]).find(t=>t.key===e)||null,[o,e,T]),D=(0,p.useMemo)(()=>(E?.tasks||[]).filter(e=>!e.deletedAt&&!l(e)),[E]),[O,k]=(0,p.useState)(Date.now()),[A,j]=(0,p.useState)(()=>new Set),[M,N]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);let P=(0,p.useMemo)(()=>{if(!x)return[];let e=[x.id,x.key,x.name].filter(Boolean),t=x.repos||[],n=new Map;for(let e of t)e&&e.key&&n.set(e.key,e);let r=(e,n)=>{let r=t.find(t=>t&&(t.key===e||t.name===e||t.path&&t.path===e));return r&&r.name?r.name:e?String(e).split(`/`).pop()||String(e):n&&n.name||``},i=[];for(let t of o||[]){if(!t||t.isGlobal||!Array.isArray(t.tasks))continue;let a=t.repo&&n.get(t.repo.key)||null,o=!!a;for(let n of t.tasks){if(!n||n.deletedAt)continue;let l={};try{l=s(n.text||``)}catch{l={}}(o||l.board&&e.includes(l.board))&&i.push({...c(n),key:`${t.key}:${n.id}`,taskId:n.id,topicKey:t.key,topicCwd:t.cwd||``,project:l.project||``,projectName:o&&a.name||r(l.project,t)})}}let a={run:0,wait:1,done:2};return i.sort((e,t)=>(a[e.status]??9)-(a[t.status]??9)||e.projectName.localeCompare(t.projectName)||Number(e.taskId)-Number(t.taskId))},[x,o]),[F,I]=(0,p.useState)(``),[L,R]=(0,p.useState)(``),z=(0,p.useMemo)(()=>{let e=new Map;for(let t of P)t.projectName&&!e.has(t.projectName)&&e.set(t.projectName,!0);return[...e.keys()]},[P]),B=(0,p.useMemo)(()=>{let e=x?(()=>{let e=F&&z.includes(F)?F:``;return P.filter(t=>!e||t.projectName===e)})():(()=>{let e=D.map(c),t={run:0,wait:1,done:2};return e.sort((e,n)=>(t[e.status]??9)-(t[n.status]??9))})(),t=L.trim().toLowerCase();return t?e.filter(e=>_(e,t)):e},[x,P,F,z,D,L]),V=e=>x?e.key:e.id;(0,p.useEffect)(()=>{j(e=>{if(!e.size)return e;let t=new Set(B.map(V)),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[B,x]);let H=B.filter(e=>e.status===`run`).length,U=B.filter(e=>e.status===`wait`).length,W=B.filter(e=>e.status===`done`).length,G=B.length?Math.round(W*100/B.length):0,K=B.length>0&&A.size===B.length,q=B.filter(e=>A.has(V(e))),J=e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Y=()=>{j(K?new Set:new Set(B.map(V)))},X=async()=>{if(M||!q.length)return;let n=q.map(e=>`#${e.taskId??e.id} ${e.title}`),r=n.length<=6?n.join(`
1
+ import{S as e,_ as t,f as n,g as r,p as i,v as a,y as o}from"./task-status-BP6y8MVu.js";import{g as s,m as c}from"./md-parse-C2bDc3IZ.js";import{r as l,t as u}from"./board-view-t8CKtq17.js";import{C as d,T as f}from"./index-CLsU9Lad.js";var p=e(o(),1);function m(e){let t=e&&e.taskId!==void 0&&e.taskId!==null?e.taskId:e&&e.id;return String(t??``)}function h(e,t){let n=String(e??``).toLowerCase(),r=(t||[]).map(e=>String(e).toLowerCase()).filter(Boolean);if(!r.length)return!0;let i=0;for(let e of r){let t=n.indexOf(e,i);if(t<0)return!1;i=t+e.length}return!0}function g(e,t){let n=String(e??``).toLowerCase(),r=String(t??``).toLowerCase().split(``),i=0;for(let e of r){let t=n.indexOf(e,i);if(t<0)return!1;i=t+1}return!0}function _(e,t){let n=String(t??``).trim().toLowerCase();if(!n)return!0;let r=n.startsWith(`#`)?n.slice(1).trim():n;if(!r)return!0;let i=m(e),a=String(e&&e.title||``).toLowerCase();if(r.includes(`*`)){let e=r.split(`*`).filter(Boolean);return h(a,e)?!0:h(i,e)}return/^\d+$/.test(r)?i===r||i.startsWith(r)?!0:g(a,r):a.includes(r)}var v=a();function y(e){if(e==null||e<0||Number.isNaN(e))return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%60/60),i=t%60;return n?`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`}function b(e,t){if(e.status!==`run`)return`—`;let n=e.receivedAt?Date.parse(e.receivedAt):NaN;return Number.isFinite(n)?y(t-n):`—`}function x({dirKey:e,task:a,rows:o=[],refreshLocal:m,model:h,onOpenTask:g,onClosePage:y,group:x=null}){let S=r(),{dialog:C,node:w}=n(),T=!e||e===`__GLOBAL__`,E=(0,p.useMemo)(()=>T?(o||[]).find(e=>e.isGlobal)||null:(o||[]).find(t=>t.key===e)||null,[o,e,T]),D=(0,p.useMemo)(()=>(E?.tasks||[]).filter(e=>!e.deletedAt&&!l(e)),[E]),[O,k]=(0,p.useState)(Date.now()),[A,j]=(0,p.useState)(()=>new Set),[M,N]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);let P=(0,p.useMemo)(()=>{if(!x)return[];let e=[x.id,x.key,x.name].filter(Boolean),t=x.repos||[],n=new Map;for(let e of t)e&&e.key&&n.set(e.key,e);let r=(e,n)=>{let r=t.find(t=>t&&(t.key===e||t.name===e||t.path&&t.path===e));return r&&r.name?r.name:e?String(e).split(`/`).pop()||String(e):n&&n.name||``},i=[];for(let t of o||[]){if(!t||t.isGlobal||!Array.isArray(t.tasks))continue;let a=t.repo&&n.get(t.repo.key)||null,o=!!a;for(let n of t.tasks){if(!n||n.deletedAt)continue;let l={};try{l=s(n.text||``)}catch{l={}}(o||l.board&&e.includes(l.board))&&i.push({...c(n),key:`${t.key}:${n.id}`,taskId:n.id,topicKey:t.key,topicCwd:t.cwd||``,project:l.project||``,projectName:o&&a.name||r(l.project,t)})}}let a={run:0,wait:1,done:2};return i.sort((e,t)=>(a[e.status]??9)-(a[t.status]??9)||e.projectName.localeCompare(t.projectName)||Number(e.taskId)-Number(t.taskId))},[x,o]),[F,I]=(0,p.useState)(``),[L,R]=(0,p.useState)(``),z=(0,p.useMemo)(()=>{let e=new Map;for(let t of P)t.projectName&&!e.has(t.projectName)&&e.set(t.projectName,!0);return[...e.keys()]},[P]),B=(0,p.useMemo)(()=>{let e=x?(()=>{let e=F&&z.includes(F)?F:``;return P.filter(t=>!e||t.projectName===e)})():(()=>{let e=D.map(c),t={run:0,wait:1,done:2};return e.sort((e,n)=>(t[e.status]??9)-(t[n.status]??9))})(),t=L.trim().toLowerCase();return t?e.filter(e=>_(e,t)):e},[x,P,F,z,D,L]),V=e=>x?e.key:e.id;(0,p.useEffect)(()=>{j(e=>{if(!e.size)return e;let t=new Set(B.map(V)),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[B,x]);let H=B.filter(e=>e.status===`run`).length,U=B.filter(e=>e.status===`wait`).length,W=B.filter(e=>e.status===`done`).length,G=B.length?Math.round(W*100/B.length):0,K=B.length>0&&A.size===B.length,q=B.filter(e=>A.has(V(e))),J=e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Y=()=>{j(K?new Set:new Set(B.map(V)))},X=async()=>{if(M||!q.length)return;let n=q.map(e=>`#${e.taskId??e.id} ${e.title}`),r=n.length<=6?n.join(`
2
2
  `):`${n.slice(0,6).join(`
3
3
  `)}… 共 ${n.length} 条`;if(await C({title:`删除选中的 ${q.length} 条任务`,message:`${r}\n\n软删除:CLI localtask task restore 可恢复。`,danger:!0,okText:`删除`})){N(!0);try{let n=0,r=0;if(x){let e=new Map;for(let t of q)e.has(t.topicKey)||e.set(t.topicKey,{cwd:t.topicCwd,ids:[]}),e.get(t.topicKey).ids.push(t.taskId);for(let{cwd:i,ids:a}of e.values()){let e=await t(`/api/localtasks/items`,{method:`DELETE`,body:{cwd:i,ids:a}});n+=e?.count??a.length,r+=e?.missing?.length||0}}else{let e=q.map(e=>e.id),i=await t(`/api/localtasks/items`,{method:`DELETE`,body:{...T?{key:u}:{cwd:E.cwd},ids:e}});n=i?.count??e.length,r=i?.missing?.length||0}let i=r?`(${r} 条已不存在)`:``;if(h)for(let t of q){let n=x?t.topicKey:e,r=x?t.taskId:t.id,i=f(h,`page`,{dirKey:n,task:String(r)});i&&y&&y(i.getId())}j(new Set),m(),S(`已删除 ${n} 条任务${i}`)}catch(e){S(`删除失败: `+(e.message||e))}finally{N(!1)}}},Z=e=>{g&&(x?g(e.taskId,e.topicKey):g(e.id))},Q=a!=null&&String(a)!==``?String(a):``;return(0,v.jsxs)(`div`,{className:`mdw-prog-host`,children:[w,(0,v.jsxs)(`div`,{className:`mdw-prog-h`,children:[(0,v.jsx)(`span`,{className:`t`,children:x?`${x.name} · 任务进程`:E?.name||(T?`全局任务池`:`任务进程`)}),B.length>0&&(0,v.jsx)(`button`,{type:`button`,className:`mdw-prog-all`,onClick:Y,title:K?`取消全选`:`全选任务`,children:K?`取消全选`:`全选`}),h&&(0,v.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`关闭进程面板`,"aria-label":`关闭进程面板`,onClick:()=>d(h),children:(0,v.jsx)(i,{name:`x`,size:14})})]}),(x?P.length>0:D.length>0)&&(0,v.jsxs)(`div`,{className:`mdw-prog-search`,children:[(0,v.jsx)(i,{name:`search`,size:13}),(0,v.jsx)(`input`,{value:L,onChange:e=>R(e.target.value),placeholder:`搜索编号或标题(如 12 → #12、#120-129;1*2 通配)`,spellCheck:`false`,"aria-label":`按编号或标题搜索任务`}),L&&(0,v.jsx)(`button`,{type:`button`,className:`mdw-prog-qclear`,"aria-label":`清空搜索`,title:`清空搜索`,onClick:()=>R(``),children:(0,v.jsx)(i,{name:`x`,size:11})})]}),x&&z.length>1&&(0,v.jsxs)(`div`,{className:`mdw-prog-filters`,role:`tablist`,"aria-label":`按项目筛选进程卡`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`mdw-prog-fchip`+(!F||!z.includes(F)?` on`:``),onClick:()=>I(``),children:[`全部 `,(0,v.jsx)(`b`,{children:P.length})]}),z.map(e=>(0,v.jsxs)(`button`,{type:`button`,className:`mdw-prog-fchip`+(F===e?` on`:``),onClick:()=>I(F===e?``:e),children:[e,` `,(0,v.jsx)(`b`,{children:P.filter(t=>t.projectName===e).length})]},e))]}),(0,v.jsxs)(`div`,{className:`mdw-prog-sum`,children:[(0,v.jsxs)(`div`,{className:`counts`,children:[(0,v.jsxs)(`span`,{className:`run`,children:[`进行中 `,(0,v.jsx)(`b`,{children:H})]}),(0,v.jsxs)(`span`,{className:`wait`,children:[`等待 `,(0,v.jsx)(`b`,{children:U})]}),(0,v.jsxs)(`span`,{className:`done`,children:[`已完成 `,(0,v.jsx)(`b`,{children:W})]})]}),(0,v.jsx)(`div`,{className:`bar`,title:`已完成 ${W} / 共 ${B.length}`,children:(0,v.jsx)(`i`,{style:{width:`${G}%`}})})]}),A.size>0&&(0,v.jsxs)(`div`,{className:`mdw-prog-sel`,children:[(0,v.jsxs)(`span`,{className:`n`,children:[`已选 `,(0,v.jsx)(`b`,{children:A.size}),` / `,B.length]}),(0,v.jsx)(`button`,{type:`button`,className:`mdw-prog-clear`,onClick:()=>j(new Set),children:`清除`}),(0,v.jsxs)(`button`,{type:`button`,className:`mdw-prog-del`,onClick:X,disabled:M,children:[(0,v.jsx)(i,{name:`trash`,size:12}),`删除所选`]})]}),(0,v.jsxs)(`div`,{className:`mdw-prog-list`,children:[!B.length&&(0,v.jsx)(`div`,{className:`mdw-prog-empty`,children:L.trim()?(0,v.jsxs)(v.Fragment,{children:[`没有匹配的卡片`,(0,v.jsx)(`br`,{}),`试试编号(如 127)或标题关键词`]}):x?(0,v.jsxs)(v.Fragment,{children:[`本组成员项目还没有任务`,(0,v.jsx)(`br`,{}),`任务会随成员队列自动聚到这里`]}):(0,v.jsxs)(v.Fragment,{children:[`此目录还没有 MD 任务`,(0,v.jsx)(`br`,{}),`写 MD 提交或导入`]})}),B.map(e=>{let t=V(e),n=A.has(t),r=Q!==``&&String(e.taskId??e.id)===Q;return(0,v.jsxs)(`div`,{className:`mdw-tcard-row${n?` on`:``}`,children:[(0,v.jsx)(`input`,{type:`checkbox`,className:`mdw-tcard-pick`,checked:n,onChange:()=>J(t),"aria-label":`选择任务 #${e.taskId??e.id} ${e.title}`,title:`选择此任务(可多选后批量删除)`}),(0,v.jsx)(`button`,{type:`button`,className:`mdw-tcard ${e.status}${r?` focus`:``}`,onClick:()=>Z(e),children:(0,v.jsxs)(`div`,{className:`mdw-tcard-h`,children:[(0,v.jsx)(`span`,{className:`st ${e.status}`}),(0,v.jsxs)(`div`,{className:`titles`,children:[(0,v.jsxs)(`div`,{className:`n`,children:[e.title,x&&e.projectName&&(0,v.jsx)(`span`,{className:`rp-ptag mdw-tcard-proj`,title:`归属项目:${e.projectName}`,children:e.projectName})]}),(0,v.jsx)(`div`,{className:`sub`,children:e.detail})]}),(0,v.jsxs)(`span`,{className:`mdw-tcard-num`,title:`任务编号 #${e.taskId??e.id}`,children:[`#`,e.taskId??e.id]}),(0,v.jsx)(`span`,{className:`el ${e.status}`,title:`从领取时刻起计;待领取与已完成回填不计时间`,children:b(e,O)})]})})]},t)})]}),(0,v.jsx)(`div`,{className:`mdw-prog-note`,children:x?`组内各项目的任务聚在这里;可按项目筛选,勾选后批量删除。`:`本目录的任务;点卡打开,勾选后批量删除。`})]})}export{x as default};
@@ -1 +1 @@
1
- import{S as e,_ as t,p as n,v as r,y as i}from"./task-status-BP6y8MVu.js";import{S as a}from"./index-B_HPAoNR.js";import{i as o}from"./Introduction-DO6_gTk-.js";var s=e(i(),1),c=r();function l(e){return e?e.rel?`rel:`+e.rel:e.path?`path:`+e.path:``:``}function u(e){let t=e.rel||e.path||``;return String(t).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||t||`未命名`}function d(e){let t=[],n=e&&(e.main||e.introMain);n&&t.push({...n,docId:l(n),main:!0,label:e.repo?e.repo.name:`主篇`});for(let n of e&&(e.extras||e.introExtras)||[]){let e=l(n);e&&t.push({...n,docId:e,main:!1,label:u(n)})}for(let n of e&&(e.links||e.docLinks)||[]){let e=l(n);e&&t.push({...n,docId:e,main:!1,label:u(n)})}return t.filter(e=>e.docId)}function f({repoKey:e,boardKey:r,boardName:i,model:l}){let{openByDocId:u}=o(l),[f,p]=(0,s.useState)(null),[m,h]=(0,s.useState)(``),[g,_]=(0,s.useState)(0),v=(0,s.useCallback)(()=>_(e=>e+1),[]);(0,s.useEffect)(()=>{let n=!0;return h(``),(async()=>{try{let i=e?await t(`/api/repos/docs?id=`+encodeURIComponent(e)):await t(`/api/boards/`+encodeURIComponent(String(r)));n&&p(i)}catch(e){n&&(p(null),h(String(e.message||e)))}})(),()=>{n=!1}},[e,r,g]);let y=d(f),b=f?f.repo?f.repo.name:f.name||i||`项目组`:i||`文档列表`,x=e?{repoKey:e}:{boardKey:r,boardName:i};return(0,c.jsxs)(`div`,{className:`nx-refs`,children:[(0,c.jsxs)(`div`,{className:`nx-refs-h`,children:[(0,c.jsxs)(`span`,{className:`t`,title:b,children:[b,` · 文档列表`]}),(0,c.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`刷新`,"aria-label":`刷新文档列表`,onClick:v,children:(0,c.jsx)(n,{name:`refresh`,size:13})}),l&&(0,c.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`关闭文档列表面板`,"aria-label":`关闭文档列表面板`,onClick:()=>a(l,`refs`),children:(0,c.jsx)(n,{name:`x`,size:14})})]}),(0,c.jsxs)(`div`,{className:`nx-refs-list`,children:[m?(0,c.jsx)(`div`,{className:`nx-refs-empty`,children:m}):null,!m&&!f?(0,c.jsx)(`div`,{className:`nx-refs-empty`,children:`读取中…`}):null,!m&&f&&!y.length?(0,c.jsxs)(`div`,{className:`nx-refs-empty`,children:[`还没有文档`,(0,c.jsx)(`br`,{}),e?`在目录页「查看详情」里点「+ 补充」开始写`:`在项目组页「查看详情」里点「+ 补充」开始写`]}):null,y.map(e=>(0,c.jsxs)(`button`,{type:`button`,className:`nx-refs-row`+(e.main?` main`:``),title:`${e.rel||e.path||``}${e.note?`\n${e.note}`:``}`,onClick:()=>u(e.docId,null,x),children:[(0,c.jsxs)(`span`,{className:`nx-refs-row-label`,children:[e.main?`● `:`○ `,e.label]}),e.tag?(0,c.jsx)(`span`,{className:`nx-refs-row-tag`,children:e.tag}):null,(0,c.jsx)(`span`,{className:`nx-refs-row-sub mono`,children:e.rel||e.path||``})]},e.docId))]}),(0,c.jsx)(`div`,{className:`nx-refs-note`,children:`点一行在工作区打开文档页签;完整管理与就地编辑走「查看详情」。`})]})}export{f as default};
1
+ import{S as e,_ as t,p as n,v as r,y as i}from"./task-status-BP6y8MVu.js";import{S as a}from"./index-CLsU9Lad.js";import{i as o}from"./Introduction-EDM3eqXe.js";var s=e(i(),1),c=r();function l(e){return e?e.rel?`rel:`+e.rel:e.path?`path:`+e.path:``:``}function u(e){let t=e.rel||e.path||``;return String(t).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||t||`未命名`}function d(e){let t=[],n=e&&(e.main||e.introMain);n&&t.push({...n,docId:l(n),main:!0,label:e.repo?e.repo.name:`主篇`});for(let n of e&&(e.extras||e.introExtras)||[]){let e=l(n);e&&t.push({...n,docId:e,main:!1,label:u(n)})}for(let n of e&&(e.links||e.docLinks)||[]){let e=l(n);e&&t.push({...n,docId:e,main:!1,label:u(n)})}return t.filter(e=>e.docId)}function f({repoKey:e,boardKey:r,boardName:i,model:l}){let{openByDocId:u}=o(l),[f,p]=(0,s.useState)(null),[m,h]=(0,s.useState)(``),[g,_]=(0,s.useState)(0),v=(0,s.useCallback)(()=>_(e=>e+1),[]);(0,s.useEffect)(()=>{let n=!0;return h(``),(async()=>{try{let i=e?await t(`/api/repos/docs?id=`+encodeURIComponent(e)):await t(`/api/boards/`+encodeURIComponent(String(r)));n&&p(i)}catch(e){n&&(p(null),h(String(e.message||e)))}})(),()=>{n=!1}},[e,r,g]);let y=d(f),b=f?f.repo?f.repo.name:f.name||i||`项目组`:i||`文档列表`,x=e?{repoKey:e}:{boardKey:r,boardName:i};return(0,c.jsxs)(`div`,{className:`nx-refs`,children:[(0,c.jsxs)(`div`,{className:`nx-refs-h`,children:[(0,c.jsxs)(`span`,{className:`t`,title:b,children:[b,` · 文档列表`]}),(0,c.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`刷新`,"aria-label":`刷新文档列表`,onClick:v,children:(0,c.jsx)(n,{name:`refresh`,size:13})}),l&&(0,c.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`关闭文档列表面板`,"aria-label":`关闭文档列表面板`,onClick:()=>a(l,`refs`),children:(0,c.jsx)(n,{name:`x`,size:14})})]}),(0,c.jsxs)(`div`,{className:`nx-refs-list`,children:[m?(0,c.jsx)(`div`,{className:`nx-refs-empty`,children:m}):null,!m&&!f?(0,c.jsx)(`div`,{className:`nx-refs-empty`,children:`读取中…`}):null,!m&&f&&!y.length?(0,c.jsxs)(`div`,{className:`nx-refs-empty`,children:[`还没有文档`,(0,c.jsx)(`br`,{}),e?`在目录页「查看详情」里点「+ 补充」开始写`:`在项目组页「查看详情」里点「+ 补充」开始写`]}):null,y.map(e=>(0,c.jsxs)(`button`,{type:`button`,className:`nx-refs-row`+(e.main?` main`:``),title:`${e.rel||e.path||``}${e.note?`\n${e.note}`:``}`,onClick:()=>u(e.docId,null,x),children:[(0,c.jsxs)(`span`,{className:`nx-refs-row-label`,children:[e.main?`● `:`○ `,e.label]}),e.tag?(0,c.jsx)(`span`,{className:`nx-refs-row-tag`,children:e.tag}):null,(0,c.jsx)(`span`,{className:`nx-refs-row-sub mono`,children:e.rel||e.path||``})]},e.docId))]}),(0,c.jsx)(`div`,{className:`nx-refs-note`,children:`点一行在工作区打开文档页签;完整管理与就地编辑走「查看详情」。`})]})}export{f as default};
@@ -1,10 +1,10 @@
1
- import{S as e,_ as t,f as n,g as r,h as i,l as a,v as o,y as s}from"./task-status-BP6y8MVu.js";import{A as c,k as ee}from"./index-B_HPAoNR.js";import{t as l}from"./route-crumb-C5LPu1Qx.js";import{i as u,n as d}from"./Introduction-DO6_gTk-.js";import{t as f}from"./bar-DoiwB4eA.js";import{t as p}from"./member-picker--32VkTmv.js";import{t as m}from"./button-M9TUn-AR.js";var h=e(s(),1),g=o(),_={new:{label:`新增`,cls:`new`},changed:{label:`有差异`,cls:`changed`},same:{label:`一致`,cls:`same`}};function te({onClose:e,onChanged:n,repos:a,boards:o}){let s=i(),c=r(),[ee,l]=(0,h.useState)(`import`),[u,d]=(0,h.useState)({}),[f,p]=(0,h.useState)({}),[m,te]=(0,h.useState)(!1),[v,y]=(0,h.useState)(``),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(null),[w,T]=(0,h.useState)({}),[E,D]=(0,h.useState)({}),[ne,re]=(0,h.useState)(`ours`),[ie,ae]=(0,h.useState)(`none`),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),P=(0,h.useMemo)(()=>a||[],[a]),F=(0,h.useMemo)(()=>P.map(e=>e.key),[P]),oe=(0,h.useMemo)(()=>(o||[]).map(e=>e.name),[o]),se=e=>{let t={};for(let n of F)t[n]=e;d(t)},ce=e=>{let t={};for(let n of oe)t[n]=e;p(t)},le=()=>{let e={};for(let t of F)e[t]=!u[t];d(e)},ue=()=>s(async()=>{let e=Object.keys(u).filter(e=>u[e]),n=Object.keys(f).filter(e=>f[e]),r={repos:e.length&&e.length!==F.length?e:void 0,boards:n.length&&n.length!==oe.length?n.map(e=>`board/${e}`):void 0,noUnassigned:m},i=new URLSearchParams;r.repos?.length&&i.set(`repos`,r.repos.join(`,`)),r.boards?.length&&i.set(`boards`,r.boards.join(`,`)),m&&i.set(`no-unassigned`,`1`);let a=await t(`/api/repos/export`+(i.toString()?`?`+i:``));y(JSON.stringify(a,null,2)),c(`已生成布局:${a.repos.length} 个仓库 / ${a.boards.length} 个看板`)}),de=()=>{if(!v)return;let e=new Blob([v],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`nx-kv-layout-${new Date().toISOString().slice(0,10)}.json`,t.click(),URL.revokeObjectURL(t.href)},I=async e=>{let t=e.target.files?.[0];t&&(x(await t.text()),C(null),j(null))},L=()=>s(async()=>{if(b.trim()){N(!0);try{let e=await t(`/api/repos/import/diff`,{method:`POST`,body:{json:b}});C(e);let n={};for(let t of e.repos)n[t.key]=t.status!==`same`;T(n);let r={};for(let t of e.boards)r[t.key]=t.status!==`same`;D(r),j(null),c(`差异:新增 ${e.summary.new} · 有差异 ${e.summary.changed} · 一致 ${e.summary.same} · 本地未拥有 ${e.summary.missing}`)}finally{N(!1)}}}),fe=()=>s(async()=>{let e=Object.keys(w).filter(e=>w[e]),r=Object.keys(E).filter(e=>E[e]);N(!0);try{let i=await t(`/api/repos/import`,{method:`POST`,body:{json:b,strategy:ne,clone:ie,selection:e.length?e:void 0,boards:r.length?r:void 0}});j(i),c(`导入完成:新建 ${i.created.length} · 覆盖 ${i.updated.length} · 另存 ${i.duplicated.length}`),await pe(),n&&await n()}finally{N(!1)}}),pe=(0,h.useCallback)(async()=>{try{let e=await t(`/api/repos/import/diff`,{method:`POST`,body:{json:b}});C(e);let n={};for(let t of e.repos)n[t.key]=t.status!==`same`;T(n)}catch{}},[b]),me=(0,h.useMemo)(()=>S?O?S.repos.filter(e=>e.status===O):S.repos:[],[S,O]),R=(e,r)=>s(async()=>{if(r){N(!0);try{await t(`/api/repos/clone`,{method:`POST`,body:{remote:r,key:e,type:`ref`,depth:1}}),c(`已克隆: ${e}`),await pe(),n&&await n()}finally{N(!1)}}}),he=e=>{let t={...w};for(let n of me)t[n.key]=e;T(t)};(0,h.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(t.stopImmediatePropagation(),e())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[e]);let ge=(0,h.useMemo)(()=>{if(!S)return null;let e={new:0,changed:0,same:0};for(let t of S.repos)e[t.status]=(e[t.status]||0)+1;return e},[S]);return(0,g.jsx)(`div`,{className:`rp-full`,onMouseDown:t=>{t.target===t.currentTarget&&e()},children:(0,g.jsxs)(`div`,{className:`rp-full-box`,children:[(0,g.jsxs)(`div`,{className:`rp-full-head`,children:[(0,g.jsxs)(`div`,{className:`rp-full-title`,children:[`导入导出`,(0,g.jsx)(`span`,{className:`muted`,children:`以全局 key 为身份 · 不含本地路径 · 逐条选择与冲突方案`})]}),(0,g.jsxs)(`div`,{className:`rp-full-tabs`,children:[(0,g.jsx)(`button`,{className:`rp-tab`+(ee===`import`?` on`:``),onClick:()=>l(`import`),children:`导入`}),(0,g.jsx)(`button`,{className:`rp-tab`+(ee===`export`?` on`:``),onClick:()=>l(`export`),children:`导出`})]}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:e,children:`关闭`})]}),ee===`export`?(0,g.jsxs)(`div`,{className:`rp-full-body`,children:[(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,g.jsx)(`span`,{children:`导出范围`}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>se(!0),children:`全选仓库`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>se(!1),children:`全不选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:le,children:`反选`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-sel`,children:[P.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!u[e.key],onChange:t=>d(n=>({...n,[e.key]:t.target.checked}))}),(0,g.jsx)(`span`,{className:e.type===`ref`?`rp-full-tag-ref`:``,children:e.name}),(0,g.jsx)(`span`,{className:`muted rp-full-key`,title:e.key,children:e.key})]},e.key)),P.length?null:(0,g.jsx)(`div`,{className:`muted`,children:`还没有仓库`})]}),(0,g.jsxs)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:[(0,g.jsx)(`span`,{children:`看板`}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ce(!0),children:`全选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ce(!1),children:`全不选`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-sel`,children:[(o||[]).map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!f[e.name],onChange:t=>p(n=>({...n,[e.name]:t.target.checked}))}),(0,g.jsx)(`span`,{children:e.name})]},e.name)),o?.length?null:(0,g.jsx)(`div`,{className:`muted`,children:`还没有看板`})]}),(0,g.jsxs)(`label`,{className:`rp-pick-item`,style:{marginTop:10},children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>te(e.target.checked)}),(0,g.jsx)(`span`,{children:`不带未分组的仓库`})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(`button`,{className:`btn`,onClick:ue,children:`生成布局`}),(0,g.jsx)(`button`,{className:`btn ghost`,disabled:!v,onClick:de,children:`下载 JSON`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`导出结果`})}),(0,g.jsx)(`textarea`,{className:`rp-full-out`,readOnly:!0,value:v,spellCheck:`false`,placeholder:`点「生成布局」后在这里预览 JSON(可直接复制或下载)`})]})]}):(0,g.jsxs)(`div`,{className:`rp-full-body`,children:[(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`导入来源`})}),(0,g.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:I}),(0,g.jsx)(`textarea`,{className:`rp-full-input`,rows:7,spellCheck:`false`,placeholder:`粘贴布局 JSON,或选一个 .json 文件`,value:b,onChange:e=>{x(e.target.value),C(null)}}),(0,g.jsx)(`div`,{className:`form-hint`,children:`每个仓库的 key 必须有:文件里已写 key 就直接用;只写了远程地址就按 host/owner/repo 归一化; 两样都没有会在差异检查阶段直接报错(不会按名字猜 key)。要改 key 就改上面的 JSON 再检查。`}),(0,g.jsx)(`div`,{className:`form-acts`,children:(0,g.jsx)(`button`,{className:`btn`,disabled:!b.trim()||M,onClick:L,children:`差异检查`})}),S?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:12},children:(0,g.jsx)(`span`,{children:`冲突方案`})}),(0,g.jsx)(`div`,{className:`rp-strategy`,children:[[`ours`,`保留本地`,`本地已有的不动,只新建缺失的`],[`overwrite`,`强制覆盖`,`用导入文件覆盖本地字段(key 不变)`],[`duplicate`,`另存新 key`,`为冲突项新建 key-import-1/2/3,两条并存`]].map(([e,t,n])=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,title:n,children:[(0,g.jsx)(`input`,{type:`radio`,name:`strategy`,checked:ne===e,onChange:()=>re(e)}),(0,g.jsx)(`span`,{children:t})]},e))}),(0,g.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:(0,g.jsx)(`span`,{children:`克隆`})}),(0,g.jsxs)(`select`,{value:ie,onChange:e=>ae(e.target.value),children:[(0,g.jsx)(`option`,{value:`none`,children:`不克隆,只登记`}),(0,g.jsx)(`option`,{value:`ref`,children:`克隆参考仓库`}),(0,g.jsx)(`option`,{value:`dev`,children:`克隆开发仓库`}),(0,g.jsx)(`option`,{value:`all`,children:`全部克隆`})]}),(0,g.jsx)(`div`,{className:`form-acts`,children:(0,g.jsxs)(`button`,{className:`btn`,disabled:M,onClick:fe,children:[`执行导入(已选 `,Object.values(w).filter(Boolean).length,`)`]})})]}):null,A?(0,g.jsxs)(`div`,{className:`rp-import-result`,children:[(0,g.jsxs)(`div`,{children:[`新建 `,A.created.length,` · 覆盖 `,A.updated.length,` · 另存 `,A.duplicated.length,` · 跳过 `,A.skipped.length]}),(0,g.jsxs)(`div`,{className:`muted`,children:[`看板 新建 `,A.boardsCreated,` / 合并 `,A.boardsMerged,` · 参考关系 `,A.links]}),A.cloned.length?(0,g.jsxs)(`div`,{children:[`克隆 `,A.cloned.length,` 个`]}):null,A.unmatched.length?(0,g.jsxs)(`div`,{className:`rp-layout-warn`,children:[`本地未拥有 `,A.unmatched.length,` 条(见下方差异表)`]}):null]}):null]}),(0,g.jsx)(`div`,{className:`rp-full-col rp-full-col-wide`,children:S?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,g.jsxs)(`span`,{children:[`差异(新增 `,ge.new,` · 有差异 `,ge.changed,` · 一致 `,ge.same,S.summary.missing?` · 本地未拥有 ${S.summary.missing}`:``,`)`]}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`rp-chip`+(O===``?` on`:``),onClick:()=>k(``),children:`全部`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`new`?` on`:``),onClick:()=>k(`new`),children:`新增`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`changed`?` on`:``),onClick:()=>k(`changed`),children:`有差异`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`same`?` on`:``),onClick:()=>k(`same`),children:`一致`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>he(!0),children:`全选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>he(!1),children:`全不选`})]})]}),(0,g.jsx)(`div`,{className:`rp-diff-table-wrap`,children:(0,g.jsxs)(`table`,{className:`rp-diff-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{style:{width:`32px`}}),(0,g.jsx)(`th`,{style:{width:`90px`},children:`状态`}),(0,g.jsx)(`th`,{children:`仓库 key`}),(0,g.jsx)(`th`,{children:`差异字段`})]})}),(0,g.jsxs)(`tbody`,{children:[me.map(e=>(0,g.jsxs)(`tr`,{className:`rp-diff-row `+_[e.status]?.cls,children:[(0,g.jsx)(`td`,{children:(0,g.jsx)(`input`,{type:`checkbox`,disabled:e.status===`same`,checked:!!w[e.key],onChange:t=>T(n=>({...n,[e.key]:t.target.checked}))})}),(0,g.jsx)(`td`,{children:(0,g.jsx)(`span`,{className:`rp-status `+_[e.status]?.cls,children:_[e.status]?.label})}),(0,g.jsxs)(`td`,{className:`mono rp-diff-key`,children:[e.key,e.status===`new`&&e.canClone?(0,g.jsx)(`span`,{className:`rp-can-clone`,title:`导入时可克隆`,children:`可克隆`}):null,e.status===`new`&&e.canClone?(0,g.jsx)(`button`,{className:`btn small ghost rp-clone-btn`,title:`现在就克隆到本地(用这个 key 登记 → 组里的占位自动补齐)`,disabled:M,onClick:()=>R(e.key,e.incoming?.remote||``),children:`克隆到本地`}):null]}),(0,g.jsx)(`td`,{className:`rp-diff-fields`,children:e.fields.length?e.fields.map(e=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`b`,{children:e.field}),`: `,(0,g.jsx)(`span`,{className:`rp-was`,children:JSON.stringify(e.local)}),` → `,(0,g.jsx)(`span`,{className:`rp-now`,children:JSON.stringify(e.incoming)})]},e.field)):(0,g.jsx)(`span`,{className:`muted`,children:`—`})})]},e.key)),S.missing.map(e=>(0,g.jsxs)(`tr`,{className:`rp-diff-row missing`,children:[(0,g.jsx)(`td`,{}),(0,g.jsx)(`td`,{children:(0,g.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`})}),(0,g.jsx)(`td`,{className:`mono rp-diff-key`,children:e}),(0,g.jsx)(`td`,{className:`rp-diff-fields muted`,children:`文件里被引用,但文件与本地都没有定义`})]},`miss-`+e))]})]})}),S.boards.length?(0,g.jsxs)(`div`,{className:`rp-diff-boards`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`看板`})}),S.boards.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!E[e.key],onChange:t=>D(n=>({...n,[e.key]:t.target.checked}))}),(0,g.jsx)(`span`,{className:`rp-status `+_[e.status]?.cls,children:_[e.status]?.label}),(0,g.jsx)(`span`,{children:e.key}),(0,g.jsxs)(`span`,{className:`muted`,children:[`(`,e.incoming.repos.length,` 个成员`,e.missingMembers.length?`,本地未拥有 ${e.missingMembers.length}`:``,`)`]})]},e.key)),S.boards.flatMap(e=>e.missingMembers||[]).map(e=>(0,g.jsxs)(`div`,{className:`rp-missing-item`,children:[(0,g.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`}),(0,g.jsx)(`span`,{className:`mono rp-missing-key`,children:e.key}),e.remote?(0,g.jsx)(`span`,{className:`muted rp-missing-remote`,title:e.remote,children:e.remote}):null,e.clonable?(0,g.jsx)(`button`,{className:`btn small`,disabled:M,onClick:()=>R(e.key,e.remote),children:`克隆到本地`}):(0,g.jsx)(`span`,{className:`muted`,title:`没有远程地址 —— 自行创建后用 repo key set 指定同一个 key`,children:`需手工创建`})]},e.key))]}):null]}):(0,g.jsx)(`div`,{className:`muted rp-full-empty`,children:`粘贴或选择一份布局 JSON,点「差异检查」后在这里逐条查看与勾选。`})})]})]})})}function v(e){let t=String(e??``);return t.trim()?t.replace(/\{\{#[^}]*\}\}/g,``).replace(/\{\{\/[^}]*\}\}/g,``).replace(/\{\{[^}]*\}\}/g,``).replace(/「\s*」/g,``).replace(/〔\s*〕/g,``).replace(/\s+/g,` `).trim()||t.replace(/\s+/g,` `).trim():``}function y({value:e,onChange:t,placeholder:n,rows:r=3,hint:i=``}){return(0,g.jsxs)(`div`,{className:`pp-field`,children:[(0,g.jsx)(`textarea`,{className:`pp-field-ta mono`,rows:r,value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value)}),i?(0,g.jsx)(`div`,{className:`pp-field-hint`,children:i}):null]})}function b({items:e,onChange:t,disabled:n=!1,placeholder:r,rows:i=3,accordion:a=!1,openIndex:o,onOpenChange:s}){let[c,ee]=(0,h.useState)(-1),l=o===void 0?c:o,u=e=>{ee(e),s&&s(e)},d=(n,r)=>t(e.map((e,t)=>t===n?r:e)),f=n=>{t(e.filter((e,t)=>t!==n)),u(e=>e===n?-1:e>n?e-1:e)};return a?(0,g.jsx)(`div`,{className:`pp-items`,children:e.map((e,t)=>{let a=l===t,o=v(e.split(`
1
+ import{S as e,_ as t,f as n,g as r,h as i,l as a,v as o,y as s}from"./task-status-BP6y8MVu.js";import{A as c,k as ee}from"./index-CLsU9Lad.js";import{t as l}from"./route-crumb-Cyesq6KK.js";import{i as u,n as d}from"./Introduction-EDM3eqXe.js";import{t as f}from"./bar-P_ky_qA9.js";import{t as p}from"./member-picker--32VkTmv.js";import{t as m}from"./button-M9TUn-AR.js";var h=e(s(),1),g=o(),_={new:{label:`新增`,cls:`new`},changed:{label:`有差异`,cls:`changed`},same:{label:`一致`,cls:`same`}};function te({onClose:e,onChanged:n,repos:a,boards:o}){let s=i(),c=r(),[ee,l]=(0,h.useState)(`import`),[u,d]=(0,h.useState)({}),[f,p]=(0,h.useState)({}),[m,te]=(0,h.useState)(!1),[v,y]=(0,h.useState)(``),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(null),[w,T]=(0,h.useState)({}),[E,D]=(0,h.useState)({}),[ne,re]=(0,h.useState)(`ours`),[ie,ae]=(0,h.useState)(`none`),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),P=(0,h.useMemo)(()=>a||[],[a]),F=(0,h.useMemo)(()=>P.map(e=>e.key),[P]),oe=(0,h.useMemo)(()=>(o||[]).map(e=>e.name),[o]),se=e=>{let t={};for(let n of F)t[n]=e;d(t)},ce=e=>{let t={};for(let n of oe)t[n]=e;p(t)},le=()=>{let e={};for(let t of F)e[t]=!u[t];d(e)},ue=()=>s(async()=>{let e=Object.keys(u).filter(e=>u[e]),n=Object.keys(f).filter(e=>f[e]),r={repos:e.length&&e.length!==F.length?e:void 0,boards:n.length&&n.length!==oe.length?n.map(e=>`board/${e}`):void 0,noUnassigned:m},i=new URLSearchParams;r.repos?.length&&i.set(`repos`,r.repos.join(`,`)),r.boards?.length&&i.set(`boards`,r.boards.join(`,`)),m&&i.set(`no-unassigned`,`1`);let a=await t(`/api/repos/export`+(i.toString()?`?`+i:``));y(JSON.stringify(a,null,2)),c(`已生成布局:${a.repos.length} 个仓库 / ${a.boards.length} 个看板`)}),de=()=>{if(!v)return;let e=new Blob([v],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`nx-kv-layout-${new Date().toISOString().slice(0,10)}.json`,t.click(),URL.revokeObjectURL(t.href)},I=async e=>{let t=e.target.files?.[0];t&&(x(await t.text()),C(null),j(null))},L=()=>s(async()=>{if(b.trim()){N(!0);try{let e=await t(`/api/repos/import/diff`,{method:`POST`,body:{json:b}});C(e);let n={};for(let t of e.repos)n[t.key]=t.status!==`same`;T(n);let r={};for(let t of e.boards)r[t.key]=t.status!==`same`;D(r),j(null),c(`差异:新增 ${e.summary.new} · 有差异 ${e.summary.changed} · 一致 ${e.summary.same} · 本地未拥有 ${e.summary.missing}`)}finally{N(!1)}}}),fe=()=>s(async()=>{let e=Object.keys(w).filter(e=>w[e]),r=Object.keys(E).filter(e=>E[e]);N(!0);try{let i=await t(`/api/repos/import`,{method:`POST`,body:{json:b,strategy:ne,clone:ie,selection:e.length?e:void 0,boards:r.length?r:void 0}});j(i),c(`导入完成:新建 ${i.created.length} · 覆盖 ${i.updated.length} · 另存 ${i.duplicated.length}`),await pe(),n&&await n()}finally{N(!1)}}),pe=(0,h.useCallback)(async()=>{try{let e=await t(`/api/repos/import/diff`,{method:`POST`,body:{json:b}});C(e);let n={};for(let t of e.repos)n[t.key]=t.status!==`same`;T(n)}catch{}},[b]),me=(0,h.useMemo)(()=>S?O?S.repos.filter(e=>e.status===O):S.repos:[],[S,O]),R=(e,r)=>s(async()=>{if(r){N(!0);try{await t(`/api/repos/clone`,{method:`POST`,body:{remote:r,key:e,type:`ref`,depth:1}}),c(`已克隆: ${e}`),await pe(),n&&await n()}finally{N(!1)}}}),he=e=>{let t={...w};for(let n of me)t[n.key]=e;T(t)};(0,h.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(t.stopImmediatePropagation(),e())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[e]);let ge=(0,h.useMemo)(()=>{if(!S)return null;let e={new:0,changed:0,same:0};for(let t of S.repos)e[t.status]=(e[t.status]||0)+1;return e},[S]);return(0,g.jsx)(`div`,{className:`rp-full`,onMouseDown:t=>{t.target===t.currentTarget&&e()},children:(0,g.jsxs)(`div`,{className:`rp-full-box`,children:[(0,g.jsxs)(`div`,{className:`rp-full-head`,children:[(0,g.jsxs)(`div`,{className:`rp-full-title`,children:[`导入导出`,(0,g.jsx)(`span`,{className:`muted`,children:`以全局 key 为身份 · 不含本地路径 · 逐条选择与冲突方案`})]}),(0,g.jsxs)(`div`,{className:`rp-full-tabs`,children:[(0,g.jsx)(`button`,{className:`rp-tab`+(ee===`import`?` on`:``),onClick:()=>l(`import`),children:`导入`}),(0,g.jsx)(`button`,{className:`rp-tab`+(ee===`export`?` on`:``),onClick:()=>l(`export`),children:`导出`})]}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:e,children:`关闭`})]}),ee===`export`?(0,g.jsxs)(`div`,{className:`rp-full-body`,children:[(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,g.jsx)(`span`,{children:`导出范围`}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>se(!0),children:`全选仓库`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>se(!1),children:`全不选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:le,children:`反选`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-sel`,children:[P.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!u[e.key],onChange:t=>d(n=>({...n,[e.key]:t.target.checked}))}),(0,g.jsx)(`span`,{className:e.type===`ref`?`rp-full-tag-ref`:``,children:e.name}),(0,g.jsx)(`span`,{className:`muted rp-full-key`,title:e.key,children:e.key})]},e.key)),P.length?null:(0,g.jsx)(`div`,{className:`muted`,children:`还没有仓库`})]}),(0,g.jsxs)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:[(0,g.jsx)(`span`,{children:`看板`}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ce(!0),children:`全选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ce(!1),children:`全不选`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-sel`,children:[(o||[]).map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!f[e.name],onChange:t=>p(n=>({...n,[e.name]:t.target.checked}))}),(0,g.jsx)(`span`,{children:e.name})]},e.name)),o?.length?null:(0,g.jsx)(`div`,{className:`muted`,children:`还没有看板`})]}),(0,g.jsxs)(`label`,{className:`rp-pick-item`,style:{marginTop:10},children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>te(e.target.checked)}),(0,g.jsx)(`span`,{children:`不带未分组的仓库`})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(`button`,{className:`btn`,onClick:ue,children:`生成布局`}),(0,g.jsx)(`button`,{className:`btn ghost`,disabled:!v,onClick:de,children:`下载 JSON`})]})]}),(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`导出结果`})}),(0,g.jsx)(`textarea`,{className:`rp-full-out`,readOnly:!0,value:v,spellCheck:`false`,placeholder:`点「生成布局」后在这里预览 JSON(可直接复制或下载)`})]})]}):(0,g.jsxs)(`div`,{className:`rp-full-body`,children:[(0,g.jsxs)(`div`,{className:`rp-full-col`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`导入来源`})}),(0,g.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:I}),(0,g.jsx)(`textarea`,{className:`rp-full-input`,rows:7,spellCheck:`false`,placeholder:`粘贴布局 JSON,或选一个 .json 文件`,value:b,onChange:e=>{x(e.target.value),C(null)}}),(0,g.jsx)(`div`,{className:`form-hint`,children:`每个仓库的 key 必须有:文件里已写 key 就直接用;只写了远程地址就按 host/owner/repo 归一化; 两样都没有会在差异检查阶段直接报错(不会按名字猜 key)。要改 key 就改上面的 JSON 再检查。`}),(0,g.jsx)(`div`,{className:`form-acts`,children:(0,g.jsx)(`button`,{className:`btn`,disabled:!b.trim()||M,onClick:L,children:`差异检查`})}),S?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:12},children:(0,g.jsx)(`span`,{children:`冲突方案`})}),(0,g.jsx)(`div`,{className:`rp-strategy`,children:[[`ours`,`保留本地`,`本地已有的不动,只新建缺失的`],[`overwrite`,`强制覆盖`,`用导入文件覆盖本地字段(key 不变)`],[`duplicate`,`另存新 key`,`为冲突项新建 key-import-1/2/3,两条并存`]].map(([e,t,n])=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,title:n,children:[(0,g.jsx)(`input`,{type:`radio`,name:`strategy`,checked:ne===e,onChange:()=>re(e)}),(0,g.jsx)(`span`,{children:t})]},e))}),(0,g.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:(0,g.jsx)(`span`,{children:`克隆`})}),(0,g.jsxs)(`select`,{value:ie,onChange:e=>ae(e.target.value),children:[(0,g.jsx)(`option`,{value:`none`,children:`不克隆,只登记`}),(0,g.jsx)(`option`,{value:`ref`,children:`克隆参考仓库`}),(0,g.jsx)(`option`,{value:`dev`,children:`克隆开发仓库`}),(0,g.jsx)(`option`,{value:`all`,children:`全部克隆`})]}),(0,g.jsx)(`div`,{className:`form-acts`,children:(0,g.jsxs)(`button`,{className:`btn`,disabled:M,onClick:fe,children:[`执行导入(已选 `,Object.values(w).filter(Boolean).length,`)`]})})]}):null,A?(0,g.jsxs)(`div`,{className:`rp-import-result`,children:[(0,g.jsxs)(`div`,{children:[`新建 `,A.created.length,` · 覆盖 `,A.updated.length,` · 另存 `,A.duplicated.length,` · 跳过 `,A.skipped.length]}),(0,g.jsxs)(`div`,{className:`muted`,children:[`看板 新建 `,A.boardsCreated,` / 合并 `,A.boardsMerged,` · 参考关系 `,A.links]}),A.cloned.length?(0,g.jsxs)(`div`,{children:[`克隆 `,A.cloned.length,` 个`]}):null,A.unmatched.length?(0,g.jsxs)(`div`,{className:`rp-layout-warn`,children:[`本地未拥有 `,A.unmatched.length,` 条(见下方差异表)`]}):null]}):null]}),(0,g.jsx)(`div`,{className:`rp-full-col rp-full-col-wide`,children:S?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,g.jsxs)(`span`,{children:[`差异(新增 `,ge.new,` · 有差异 `,ge.changed,` · 一致 `,ge.same,S.summary.missing?` · 本地未拥有 ${S.summary.missing}`:``,`)`]}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(`button`,{className:`rp-chip`+(O===``?` on`:``),onClick:()=>k(``),children:`全部`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`new`?` on`:``),onClick:()=>k(`new`),children:`新增`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`changed`?` on`:``),onClick:()=>k(`changed`),children:`有差异`}),(0,g.jsx)(`button`,{className:`rp-chip`+(O===`same`?` on`:``),onClick:()=>k(`same`),children:`一致`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>he(!0),children:`全选`}),(0,g.jsx)(`button`,{className:`btn small ghost`,onClick:()=>he(!1),children:`全不选`})]})]}),(0,g.jsx)(`div`,{className:`rp-diff-table-wrap`,children:(0,g.jsxs)(`table`,{className:`rp-diff-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{style:{width:`32px`}}),(0,g.jsx)(`th`,{style:{width:`90px`},children:`状态`}),(0,g.jsx)(`th`,{children:`仓库 key`}),(0,g.jsx)(`th`,{children:`差异字段`})]})}),(0,g.jsxs)(`tbody`,{children:[me.map(e=>(0,g.jsxs)(`tr`,{className:`rp-diff-row `+_[e.status]?.cls,children:[(0,g.jsx)(`td`,{children:(0,g.jsx)(`input`,{type:`checkbox`,disabled:e.status===`same`,checked:!!w[e.key],onChange:t=>T(n=>({...n,[e.key]:t.target.checked}))})}),(0,g.jsx)(`td`,{children:(0,g.jsx)(`span`,{className:`rp-status `+_[e.status]?.cls,children:_[e.status]?.label})}),(0,g.jsxs)(`td`,{className:`mono rp-diff-key`,children:[e.key,e.status===`new`&&e.canClone?(0,g.jsx)(`span`,{className:`rp-can-clone`,title:`导入时可克隆`,children:`可克隆`}):null,e.status===`new`&&e.canClone?(0,g.jsx)(`button`,{className:`btn small ghost rp-clone-btn`,title:`现在就克隆到本地(用这个 key 登记 → 组里的占位自动补齐)`,disabled:M,onClick:()=>R(e.key,e.incoming?.remote||``),children:`克隆到本地`}):null]}),(0,g.jsx)(`td`,{className:`rp-diff-fields`,children:e.fields.length?e.fields.map(e=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`b`,{children:e.field}),`: `,(0,g.jsx)(`span`,{className:`rp-was`,children:JSON.stringify(e.local)}),` → `,(0,g.jsx)(`span`,{className:`rp-now`,children:JSON.stringify(e.incoming)})]},e.field)):(0,g.jsx)(`span`,{className:`muted`,children:`—`})})]},e.key)),S.missing.map(e=>(0,g.jsxs)(`tr`,{className:`rp-diff-row missing`,children:[(0,g.jsx)(`td`,{}),(0,g.jsx)(`td`,{children:(0,g.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`})}),(0,g.jsx)(`td`,{className:`mono rp-diff-key`,children:e}),(0,g.jsx)(`td`,{className:`rp-diff-fields muted`,children:`文件里被引用,但文件与本地都没有定义`})]},`miss-`+e))]})]})}),S.boards.length?(0,g.jsxs)(`div`,{className:`rp-diff-boards`,children:[(0,g.jsx)(`div`,{className:`rp-full-colhead`,children:(0,g.jsx)(`span`,{children:`看板`})}),S.boards.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!E[e.key],onChange:t=>D(n=>({...n,[e.key]:t.target.checked}))}),(0,g.jsx)(`span`,{className:`rp-status `+_[e.status]?.cls,children:_[e.status]?.label}),(0,g.jsx)(`span`,{children:e.key}),(0,g.jsxs)(`span`,{className:`muted`,children:[`(`,e.incoming.repos.length,` 个成员`,e.missingMembers.length?`,本地未拥有 ${e.missingMembers.length}`:``,`)`]})]},e.key)),S.boards.flatMap(e=>e.missingMembers||[]).map(e=>(0,g.jsxs)(`div`,{className:`rp-missing-item`,children:[(0,g.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`}),(0,g.jsx)(`span`,{className:`mono rp-missing-key`,children:e.key}),e.remote?(0,g.jsx)(`span`,{className:`muted rp-missing-remote`,title:e.remote,children:e.remote}):null,e.clonable?(0,g.jsx)(`button`,{className:`btn small`,disabled:M,onClick:()=>R(e.key,e.remote),children:`克隆到本地`}):(0,g.jsx)(`span`,{className:`muted`,title:`没有远程地址 —— 自行创建后用 repo key set 指定同一个 key`,children:`需手工创建`})]},e.key))]}):null]}):(0,g.jsx)(`div`,{className:`muted rp-full-empty`,children:`粘贴或选择一份布局 JSON,点「差异检查」后在这里逐条查看与勾选。`})})]})]})})}function v(e){let t=String(e??``);return t.trim()?t.replace(/\{\{#[^}]*\}\}/g,``).replace(/\{\{\/[^}]*\}\}/g,``).replace(/\{\{[^}]*\}\}/g,``).replace(/「\s*」/g,``).replace(/〔\s*〕/g,``).replace(/\s+/g,` `).trim()||t.replace(/\s+/g,` `).trim():``}function y({value:e,onChange:t,placeholder:n,rows:r=3,hint:i=``}){return(0,g.jsxs)(`div`,{className:`pp-field`,children:[(0,g.jsx)(`textarea`,{className:`pp-field-ta mono`,rows:r,value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value)}),i?(0,g.jsx)(`div`,{className:`pp-field-hint`,children:i}):null]})}function b({items:e,onChange:t,disabled:n=!1,placeholder:r,rows:i=3,accordion:a=!1,openIndex:o,onOpenChange:s}){let[c,ee]=(0,h.useState)(-1),l=o===void 0?c:o,u=e=>{ee(e),s&&s(e)},d=(n,r)=>t(e.map((e,t)=>t===n?r:e)),f=n=>{t(e.filter((e,t)=>t!==n)),u(e=>e===n?-1:e>n?e-1:e)};return a?(0,g.jsx)(`div`,{className:`pp-items`,children:e.map((e,t)=>{let a=l===t,o=v(e.split(`
2
2
  `)[0]);return(0,g.jsx)(`div`,{className:`pp-items-item`,children:a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,g.jsx)(`div`,{className:`pp-items-body`,children:(0,g.jsx)(y,{value:e,onChange:e=>d(t,e),placeholder:r,rows:i})}),(0,g.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>f(t),title:`删除第 ${t+1} 条`,children:`删除`})]}):(0,g.jsxs)(`button`,{type:`button`,className:`pp-items-row`,disabled:n,title:`点击展开编辑`,onClick:()=>u(t),children:[(0,g.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,g.jsx)(`span`,{className:`pp-items-title`,children:o||`(空)`}),(0,g.jsxs)(`span`,{className:`pp-items-len`,children:[String(e).length,` 字`]})]})},t)})}):(0,g.jsx)(g.Fragment,{children:e.map((e,t)=>(0,g.jsxs)(`div`,{className:`pp-items-item`,children:[(0,g.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,g.jsx)(`div`,{className:`pp-items-body`,children:(0,g.jsx)(y,{value:e,onChange:e=>d(t,e),placeholder:r,rows:i})}),(0,g.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>f(t),title:`删除第 ${t+1} 条`,children:`删除`})]},t))})}var x=10,S=2e3,C=`不要直接结束本轮:完成上面的任务(%s)之后,继续调用 nx-kv localtask get(带 --summary 当前现状)领取下一条任务,直到 get 返回 timeout 为止。`;function w({repo:e,onClose:n,onSaved:i}){let o=ee()||{},s=r(),c=e.getLoop&&typeof e.getLoop==`object`?e.getLoop:null,[l,u]=(0,h.useState)(!!(c&&c.enabled)),[d,f]=(0,h.useState)(String(c&&c.waitMinutes||10)),[p,_]=(0,h.useState)(()=>{let e=c&&c.template;return(Array.isArray(e)?e:e==null?[]:[e]).map(e=>String(e??``).trim()).filter(Boolean).map(e=>e.replaceAll(`{{task.id}}`,`%s`))}),[te,v]=(0,h.useState)(-1),[y,w]=(0,h.useState)(``),[T,E]=(0,h.useState)(!1),D=async n=>{E(!0);try{let r=n&&n.enabled!==void 0?n.enabled:l,a=p.map(e=>String(e??``).trim().replaceAll(`%s`,`{{task.id}}`)).filter(Boolean).slice(0,x);await t(`/api/repos/`+encodeURIComponent(e.id),{method:`PATCH`,body:{getLoop:{enabled:r,...r?{waitMinutes:Number(d)||10,template:a}:{}}}}),s(r?`已保存「${e.name}」的持续 get 设置(模板 ${a.length} 条)`:`已关闭「${e.name}」的持续 get`),o.refreshRepos&&o.refreshRepos(),i&&i()}catch(e){s(String(e.message||e))}finally{E(!1)}},ne=async e=>{u(e),await D({enabled:e})},re=()=>{let e=y.trim();!e||p.length>=x||(_([...p,e.slice(0,S)]),v(p.length),w(``))};return(0,g.jsx)(a,{title:`持续 get · ${e.name}`,onClose:n,size:`md`,children:(0,g.jsxs)(`div`,{className:`rp-gl`,children:[(0,g.jsxs)(`div`,{className:`rp-gl-head`,children:[(0,g.jsxs)(`div`,{className:`rp-gl-title`,children:[(0,g.jsx)(`span`,{className:`rp-gl-name`,children:`持续 get`}),(0,g.jsx)(`span`,{className:`rp-gl-desc`,children:`无任务时阻塞等待新任务回填(waitgoal)`})]}),(0,g.jsxs)(`button`,{className:`toggle`+(l?` on`:``),onClick:()=>ne(!l),disabled:T,children:[(0,g.jsx)(`span`,{className:`dot`}),l?`开`:`关`]})]}),l&&(0,g.jsxs)(`div`,{className:`rp-gl-body`,children:[(0,g.jsxs)(`div`,{className:`rp-gl-row`,children:[(0,g.jsx)(`span`,{children:`阻塞窗口`}),(0,g.jsxs)(`span`,{className:`rp-gl-unit`,children:[(0,g.jsx)(`input`,{className:`rp-gl-min`,value:d,onChange:e=>f(e.target.value),inputMode:`numeric`}),`分钟`]})]}),(0,g.jsxs)(`div`,{className:`rp-gl-tpl`,children:[(0,g.jsx)(`div`,{className:`rp-gl-h`,children:`收尾模板`}),(0,g.jsxs)(`div`,{className:`rp-gl-oneline`,children:[(0,g.jsx)(m,{variant:`secondary`,title:`填入内置默认(继续 get 直到 timeout)`,onClick:()=>w(C),children:`填入内置默认`}),(0,g.jsx)(`input`,{className:`rp-gl-oneline-input`,value:y,placeholder:`一句话(%s = 任务编号)`,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&re()}}),(0,g.jsx)(m,{variant:`secondary`,disabled:T||!y.trim(),onClick:re,children:`添加`})]}),p.length?(0,g.jsx)(b,{items:p,onChange:_,disabled:T,placeholder:`一句话(%s = 任务编号)`,accordion:!0,openIndex:te,onOpenChange:v}):(0,g.jsx)(`div`,{className:`rp-gl-note`,children:`未配置模板 —— 用默认「完成后续调 localtask get;没活时每轮最多阻塞 {{getloop.waitMinutes}} 分钟,直到 timeout」。`})]}),(0,g.jsxs)(`div`,{className:`rp-gl-acts`,children:[(0,g.jsx)(m,{variant:`secondary`,disabled:T||p.length>=x,title:p.length>=x?`最多 ${x} 条`:`新增一条「继续 get」指令`,onClick:()=>{_([...p,``]),v(p.length)},children:`添加一条…`}),(0,g.jsx)(`span`,{className:`spacer`}),(0,g.jsx)(m,{variant:`primary`,disabled:T,onClick:()=>D(),children:`保存持续 get 设置`})]})]})]})})}function T(e){return String(e||``).trim().replace(/\s+/g,`-`).replace(/[<>:"\\|?*\x00-\x1f]/g,`-`).replace(/\.git$/i,``).replace(/\/{2,}/g,`/`).replace(/^\/+|\/+$/g,``).slice(0,160).toLowerCase()}function E(e){let t=String(e||``).trim();if(!t)return``;t=t.replace(/\/+$/,``);let n=/^git@([^:/]+):(.+)$/i.exec(t);n?t=n[1]+`/`+n[2]:/^[a-z][a-z0-9+.-]*:\/\//i.test(t)&&(t=t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``),t=t.replace(/^[^/]*@/,``),t=t.replace(/^([^/]+?):\d+(\/|$)/,`$1$2`),t=t.replace(/^([a-z]):/i,`$1`)),t=t.replace(/\.git$/i,``),t=t.replace(/\/{2,}/g,`/`);let r={"ssh.github.com":`github.com`,"www.github.com":`github.com`},i=t.indexOf(`/`);if(i>0){let e=t.slice(0,i).toLowerCase();t=(r[e]||e)+t.slice(i)}return t=t.replace(/^\/+|\/+$/g,``),t.toLowerCase()}var D={path:``,name:``,desc:``,notes:``,type:`dev`,remote:``,key:``,icon:``};function ne({path:e}){let t=String(e||``),n=t.replace(/\\/g,`/`).lastIndexOf(`/`);return n<0?(0,g.jsx)(c,{text:t,children:t}):(0,g.jsxs)(c,{text:t,title:`点击复制完整路径`,children:[(0,g.jsx)(`span`,{className:`anc`,children:t.slice(0,n)}),t.slice(n)]})}function re({docs:e,onOpen:t}){let n=e&&e.main,r=e&&e.links||[],i=+!!n+r.length;return(0,g.jsxs)(`button`,{type:`button`,className:`rp-docs-entry`,title:`查看完整文档列表(主篇 / 补充 / reference / 组内),可就地编辑`,onClick:t,children:[(0,g.jsx)(`span`,{className:`rp-docs-entry-main`+(n&&n.exists?``:` ghost`),children:n&&n.exists?n.summary||n.title:`+ 写项目介绍`}),(0,g.jsx)(`span`,{className:`rp-docs-entry-n`,children:i>0?`${i} 篇 · 查看详情`:`查看详情`})]})}function ie({r:e,filterBoard:t,refsOfRepo:n,acts:r}){let i=n.get(e.key)||[];return(0,g.jsxs)(`tr`,{id:`rp-row-`+e.key,children:[(0,g.jsxs)(`td`,{className:`rp-name`,children:[(0,g.jsxs)(`strong`,{children:[e.icon?(0,g.jsx)(`span`,{className:`rp-icon`,"aria-hidden":!0,children:e.icon}):null,e.name,e.getLoop&&e.getLoop.enabled?(0,g.jsx)(`span`,{className:`rp-gl-dot`,title:`持续 get 已开启(${Number(e.getLoop.waitMinutes)||10} 分钟阻塞窗口)`,"aria-label":`持续 get 已开启`}):null]}),(0,g.jsx)(`span`,{className:`mono rp-name-path`,children:(0,g.jsx)(ne,{path:e.path})})]}),(0,g.jsx)(`td`,{className:`rp-cell-docs`,children:(0,g.jsx)(re,{docs:e.descDocs,onOpen:()=>r.docs(e)})}),(0,g.jsxs)(`td`,{className:`rp-refs`,children:[i.length?i.map(t=>(0,g.jsxs)(`button`,{className:`rp-ref-chip`,title:`直接绑定:${t.remote||``}${t.note?`
3
3
  `+t.note:``}\n点击改绑定描述`,onClick:()=>r.refNote(t,e),children:[t.note?(0,g.jsx)(`span`,{className:`rp-ref-chip-dot`}):null,t.name]},t.key)):(0,g.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}),(0,g.jsx)(m,{small:!0,className:`rp-ref-bind`,title:`管理这个仓库绑定的参考仓库`,onClick:()=>r.bind(e),children:`绑定`})]}),(0,g.jsx)(`td`,{className:`rp-cell-groups`,children:(e.boards||[]).length?e.boards.map(e=>(0,g.jsx)(`button`,{className:`rp-group-chip`+(t&&t.id===e.id?` on`:``),title:`只看「${e.name}」${e.note?`\n组内描述:${e.note}`:``}`,onClick:()=>r.filter(e.id),children:e.name},e.id)):(0,g.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`})}),(0,g.jsx)(`td`,{className:`rp-acts`,children:(0,g.jsx)(f,{kind:`repos-row`,renderers:{edit:()=>(0,g.jsx)(m,{small:!0,onClick:()=>r.edit(e),children:`编辑`}),open:()=>(0,g.jsx)(m,{small:!0,title:`在文件管理器中打开`,onClick:()=>r.open(e),children:`打开`}),del:()=>(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>r.del(e),children:`删除`}),getloop:()=>(0,g.jsx)(m,{small:!0,title:`持续 get(waitgoal)配置`,onClick:()=>r.getloop(e),children:(0,g.jsxs)(`span`,{className:`rp-gl-menu-it`,children:[e.getLoop&&e.getLoop.enabled?(0,g.jsx)(`span`,{className:`rp-gl-dot`,"aria-hidden":!0}):null,`持续 get…`]})}),remote:()=>(0,g.jsx)(m,{small:!0,onClick:()=>r.remote(e),children:`对齐 remote`})},actions:{edit:()=>r.edit(e),open:()=>r.open(e),del:()=>r.del(e),getloop:()=>r.getloop(e),remote:()=>r.remote(e)},titles:{getloop:`持续 get(waitgoal)配置`,remote:`key 与远程 git 地址对齐`,del:`删除仓库登记(磁盘文件不受影响)`}})})]})}function ae(){let e=i(),o=r(),{dialog:s,node:_}=n(),v=ee()||{},{openByDocId:y}=u(),[b,x]=(0,h.useState)(D),[S,C]=(0,h.useState)(null),[ne,ae]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(``),[oe,se]=(0,h.useState)(``),[ce,le]=(0,h.useState)(!1),[ue,de]=(0,h.useState)(!1),[I,L]=(0,h.useState)(null),[fe,pe]=(0,h.useState)(!1),[me,R]=(0,h.useState)(``),[he,ge]=(0,h.useState)(null),[z,_e]=(0,h.useState)([]),[B,ve]=(0,h.useState)([]),ye=e=>t=>x(n=>({...n,[e]:t.target.value})),be=e=>{let t=e.target.value;x(e=>({...e,remote:t,key:O?e.key:E(t)}))},xe=e=>{k(!0),x(t=>({...t,key:e.target.value}))},[Se,Ce]=(0,h.useState)(!1),[we,Te]=(0,h.useState)(null),[Ee,De]=(0,h.useState)(!1),[Oe,ke]=(0,h.useState)({gitRepoRoot:``,gitDevRoot:``}),[Ae,je]=(0,h.useState)(!1),[V,Me]=(0,h.useState)({url:``,name:``,desc:``,depth:`1`}),[Ne,Pe]=(0,h.useState)({}),[Fe,Ie]=(0,h.useState)(null),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)({}),[H,Ve]=(0,h.useState)(null),[He,Ue]=(0,h.useState)({}),[U,We]=(0,h.useState)(null),[Ge,Ke]=(0,h.useState)(``),[qe,Je]=(0,h.useState)(!1),[W,Ye]=(0,h.useState)(null),[G,Xe]=(0,h.useState)(null),[Ze,Qe]=(0,h.useState)(!1),[$e,et]=(0,h.useState)(null),[tt,nt]=(0,h.useState)(null),rt=()=>{x(D),C(null),ae(!1),k(!1)},K=(0,h.useCallback)(async()=>{_e(await t(`/api/repos`).catch(()=>[])||[])},[]),q=(0,h.useCallback)(async()=>{N(await t(`/api/boards`).catch(()=>null))},[]),it=(0,h.useCallback)(async()=>{let e=await t(`/api/docs`).catch(()=>null);ve(e&&e.docs||[])},[]);(0,h.useEffect)(()=>{K(),q(),it()},[K,q,it]),(0,h.useEffect)(()=>{let e=()=>{let e=location.hash.split(`?`)[1]||``;if(!e)return;let t=new URLSearchParams(e),n=t.get(`board`);n&&(F(n),t.get(`add`)&&j(n))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let at=(0,h.useCallback)(async()=>{Te(await t(`/api/setting`).catch(()=>null))},[]),J=(0,h.useCallback)(async()=>{Ie(await t(`/api/repos/ref/check`).catch(()=>null))},[]);(0,h.useEffect)(()=>{at(),J()},[at,J]);let ot=()=>e(async()=>{let e={};Oe.gitRepoRoot.trim()&&(e.gitRepoRoot=Oe.gitRepoRoot.trim()),Oe.gitDevRoot.trim()&&(e.gitDevRoot=Oe.gitDevRoot.trim()),Object.keys(e).length&&(Te(await t(`/api/setting`,{method:`POST`,body:e})),De(!1),o(`已保存存储根目录`))}),st=()=>e(async()=>{let e=V.url.trim();if(!e)return;let n={url:e,name:V.name.trim()||void 0,desc:V.desc.trim()||void 0,depth:parseInt(V.depth,10)||1,"no-bind":!0},r=X.filter(e=>Ne[`repo:`+e.id]).map(e=>e.id),i=Y.filter(e=>Ne[`board:`+e.id]).map(e=>e.id);r.length&&(n.bind=r),i.length&&(n.board=i);let a=await t(`/api/repos/ref/clone`,{method:`POST`,body:n});je(!1),Me({url:``,name:``,desc:``,depth:`1`}),Pe({}),o(`已克隆: ${a.name} → ${a.dest||a.path}`),await Promise.all([K(),q(),J()])}),ct=n=>e(async()=>{let e=await t(`/api/repos/ref/sync`,{method:`POST`,body:{id:n.id}});o(e.status===`updated`?`已更新: ${e.name}`:e.status===`upToDate`?`${e.name} 已是最新`:`${e.name}: ${e.status} ${e.output||``}`)}),lt=()=>e(async()=>{let e=await t(`/api/repos/ref/sync`,{method:`POST`,body:{all:!0}}),n=e.results.filter(e=>e.status!==`updated`&&e.status!==`upToDate`);o(`同步 ${e.synced} 个${n.length?`,${n.length} 个有问题(见检查结果)`:`,全部完成`}`),await J()}),ut=e=>{let t={};for(let n of e.linked||[])t[n.kind+`:`+n.id]=!0;Be(t),Re(e)},dt=()=>e(async()=>{if(!Le)return;let e=new Set((Le.linked||[]).map(e=>e.kind+`:`+e.id)),n=new Set(Object.keys(ze).filter(e=>ze[e]));for(let r of n){if(e.has(r))continue;let[n,i]=r.split(`:`);await t(`/api/repos/bind`,{method:`POST`,body:{id:Le.key,[n]:[i]}})}for(let r of e){if(n.has(r))continue;let[e,i]=r.split(`:`);await t(`/api/repos/bind`,{method:`POST`,body:{id:Le.key,[e]:[i],remove:!0}})}Re(null),await Promise.all([K(),J()])}),ft=()=>e(async()=>{if(!H)return;let e=new Set;for(let t of H.linked||[])t.kind===`ref`&&e.add(t.id);for(let t of Z)(t.linked||[]).some(e=>e.kind===`repo`&&e.id===H.key)&&e.add(t.key);let n=new Set(Object.keys(He).filter(e=>He[e]));for(let r of n)e.has(r)||await t(`/api/repos/bind`,{method:`POST`,body:{id:r,repo:[H.key]}});for(let r of e)n.has(r)||await t(`/api/repos/bind`,{method:`POST`,body:{id:r,repo:[H.key],remove:!0}});Ve(null),await Promise.all([K(),J()])}),pt=(e,t,n,r)=>{let i=(e.linked||[]).find(e=>e.kind===t&&e.id===n);We({ref:e,kind:t,targetId:n,targetName:r}),Ke(i?.note||``)},mt=()=>e(async()=>{let{ref:e,kind:n,targetId:r}=U;await t(`/api/repos/ref/note`,{method:`POST`,body:{id:e.key,[n]:r,note:Ge}}),We(null),await Promise.all([K(),J()]),o(`已保存绑定描述`)}),ht=(n,r,i)=>e(async()=>{await t(`/api/repos/bind`,{method:`POST`,body:{id:n.key,[r]:[i],remove:!0}}),await Promise.all([K(),J()])}),gt=(0,h.useCallback)(async()=>{await Promise.all([K(),q(),J()])},[K,q,J]),_t=async e=>{let n=e&&e.key?e.key:``;if(!n){o(`这个仓库还没有 key —— 先 nx-kv repo key set <id> <key>`);return}try{let e=await t(`/api/repos/remote/list?id=`+encodeURIComponent(n));if(!e||!Array.isArray(e.remotes))throw Error(`远程地址读取失败`);Ye(e),Xe(null),Qe(!0)}catch(e){o(String(e&&e.message||e))}},vt=n=>e(async()=>{await t(`/api/repos/remote/pick`,{method:`POST`,body:{id:W.key,url:n}}),Qe(!1),o(`已对齐 remote`),await Promise.all([K(),J()])}),yt=async e=>{let n=W?W.key:``;if(!n){Xe({url:``,status:`unreachable`,detail:`没有仓库标识`});return}Xe({url:e||W.current||``,status:`checking`,detail:`检查中…`});try{let r=await t(`/api/repos/remote/check?id=`+encodeURIComponent(n)+(e?`&url=`+encodeURIComponent(e):``));Xe(r)}catch(t){Xe({url:e||W.current||``,status:`unreachable`,detail:String(t&&t.message||t)})}},Y=(0,h.useMemo)(()=>M&&M.boards||[],[M]),X=(0,h.useMemo)(()=>z.filter(e=>(e.type||`dev`)!==`ref`),[z]),Z=(0,h.useMemo)(()=>z.filter(e=>e.type===`ref`),[z]),bt=(0,h.useMemo)(()=>{let e=X;P&&(e=e.filter(e=>(e.boards||[]).some(e=>e.id===P)));let t=oe.trim().toLowerCase();if(!t)return e;let n=e=>{let n=e.descDocs&&e.descDocs.main;return n&&[n.title,n.summary,n.rel].some(e=>e&&String(e).toLowerCase().includes(t))?!0:(e.descDocs&&e.descDocs.links||[]).some(e=>[e.title,e.tag,e.note,e.rel].some(e=>e&&String(e).toLowerCase().includes(t)))};return e.filter(e=>[e.name,e.key,e.path,e.desc].some(e=>e&&String(e).toLowerCase().includes(t))||(e.boards||[]).some(e=>String(e.name||``).toLowerCase().includes(t))||n(e))},[X,P,oe]),Q=(0,h.useMemo)(()=>Y.find(e=>e.id===P)||null,[Y,P]),xt=(0,h.useMemo)(()=>Y.find(e=>e.id===A)||null,[Y,A]),St=(0,h.useMemo)(()=>{let e=new Map;return(Fe?.refs||[]).forEach(t=>e.set(t.id,t)),e},[Fe]),Ct=(0,h.useMemo)(()=>{let e=new Map,t=(t,n,r)=>{e.has(t)||e.set(t,[]),e.get(t).push({key:n.key,id:n.id,name:n.name,remote:n.remote||``,note:r||``})},n=new Map(Z.map(e=>[e.key,e])),r=new Set;for(let e of X)for(let i of e.linked||[]){if(i.kind!==`ref`)continue;let a=n.get(i.id);a&&(r.add(e.key+`:`+a.key),t(e.key,a,i.note))}for(let e of Z)for(let n of e.linked||[])n.kind===`repo`&&(r.has(n.id+`:`+e.key)||t(n.id,e,n.note));return e},[X,Z]),wt=(0,h.useMemo)(()=>{if(!Q)return[];let e=new Set((Q.repos||[]).map(e=>e.key)),t=Q.key||`board/${Q.name}`;return Z.map(n=>{let r=(n.linked||[]).find(e=>e.kind===`board`&&e.id===t),i=(n.linked||[]).filter(t=>t.kind===`repo`&&e.has(t.id));return!r&&!i.length?null:{...n,boardNote:r?.note||``,viaRepos:i.map(e=>(Q.repos||[]).find(t=>t.key===e.id)?.name||e.id)}}).filter(Boolean)},[Z,Q]),Tt=(0,h.useMemo)(()=>{let e=new Map,t=(t,n,r,i,a)=>{if(!t)return;e.has(t)||e.set(t,[]);let o=e.get(t);o.some(e=>e.label===r)||o.push({key:t+`|`+r,kind:n,label:r,tip:i||r,target:a})};for(let e of z){let n=e.descDocs&&e.descDocs.main;n&&n.rel&&t(n.rel,`repo`,`仓:${e.name}`,`「${e.name}」的项目介绍主篇`,e.key);for(let n of e.descDocs&&e.descDocs.links||[])t(String(n.docId||``).startsWith(`rel:`)?String(n.docId).slice(4):``,`repo`,`仓:${e.name}`,`「${e.name}」的补充文档${n.tag?`(${n.tag})`:``}`,e.key);for(let n of e.boards||[])t(n.noteDocRel,`scoped`,`组内:${n.name} / ${e.name}`,`「${e.name}」在组「${n.name}」里的组内描述`,n.id)}for(let e of Y){e.docRel&&t(e.docRel,`board`,`组:${e.name}`,`组「${e.name}」的介绍文档`,e.id);for(let n of e.docLinks||[])t(n.rel,`board`,`组:${e.name}`,`组「${e.name}」的补充文档`,e.id);for(let n of e.repos||[])t(n.noteDocRel,`scoped`,`组内:${e.name} / ${n.name||n.key}`,`组「${e.name}」里的组内描述`,e.id)}return e},[z,Y]),Et=()=>{x(D),C(null),k(!1),ae(!0)},[Dt,Ot]=(0,h.useState)(`all`),[kt,At]=(0,h.useState)(``),jt=(0,h.useMemo)(()=>{let e=kt.trim().toLowerCase(),t=B.map(e=>({d:e,hosts:Tt.get(e.rel)||[]})).filter(t=>!e||[t.d.title,t.d.name,t.d.rel].some(t=>t&&String(t).toLowerCase().includes(e))||t.hosts.some(t=>t.label.toLowerCase().includes(e)));return Dt===`orphan`?t.filter(e=>!e.hosts.length):Dt===`all`?t:t.filter(e=>e.hosts.some(e=>e.kind===Dt))},[B,Tt,Dt,kt]),Mt=(0,h.useMemo)(()=>{let e={all:B.length,repo:0,board:0,scoped:0,orphan:0};for(let t of B){let n=Tt.get(t.rel)||[];n.length||(e.orphan+=1);for(let t of[`repo`,`board`,`scoped`])n.some(e=>e.kind===t)&&(e[t]+=1)}return e},[B,Tt]),Nt=(e,t=`start`)=>{if(!e)return;let n=e.parentElement;for(;n;){let e=getComputedStyle(n);if((e.overflowY===`auto`||e.overflowY===`scroll`)&&n.scrollHeight>n.clientHeight)break;n=n.parentElement}n||=document.scrollingElement||document.documentElement;let r=n.getBoundingClientRect?n.getBoundingClientRect().top:0,i=e.getBoundingClientRect().top-r,a=t===`center`?(n.clientHeight-e.offsetHeight)/2:12;n.scrollTop=Math.max(0,n.scrollTop+i-a)},Pt=e=>Nt(document.getElementById(e)),Ft=e=>{if(!e||!e.target)return;if(e.kind===`board`){F(e.target),Pt(`rp-repos`);return}F(``);let t=document.getElementById(`rp-row-`+e.target);if(!t){Pt(`rp-repos`);return}Nt(t,`center`),t.classList.add(`rp-row-flash`),setTimeout(()=>t.classList.remove(`rp-row-flash`),1400)},It=(0,h.useMemo)(()=>{if(!S)return null;let e=z.find(e=>e.id===S);return e&&e.descDocs||null},[S,z]),Lt=()=>e(async()=>{if(!b.path.trim())return;let e=b.remote.trim(),n=b.key.trim(),r=n?T(n):E(e);if(!r){o(`仓库 key 必填:没有远程 git 地址时必须手工填写 key(不会再自动生成 local/<目录名>)`);return}let i={path:b.path.trim(),name:b.name.trim()||void 0,notes:b.notes,type:b.type===`ref`?`ref`:`dev`,remote:e||void 0,icon:b.icon.trim()};if(S){let t=z.find(e=>e.id===S),a=t&&t.key||``;if(O&&n===``){if(!e){o(`清空自定义 key 需要仓库有远程地址(否则 key 必填)`);return}i.key=``,i.keyCustom=!1}else if(O&&r!==a){if(!await s({title:`修改仓库 key`,message:`key 是仓库身份,改掉会连锁影响:\n\n「${a||`(空)`}」→「${r}」\n\n队列/看板/参考关系会跟随新 key 级联更新;docs/ 下按旧 key 生成的文档路径不会自动迁移,需要手动处理。确认修改?`,danger:!0}))return;i.key=r,i.keyCustom=!0}}else i.key=r,O&&(i.keyCustom=!0);S?await t(`/api/repos/${encodeURIComponent(S)}`,{method:`PATCH`,body:i}):await t(`/api/repos`,{method:`POST`,body:i}),rt(),await Promise.all([K(),q(),J()])}),$=(n,r)=>e(async()=>{if(n===`open`)await t(`/api/repos/open`,{method:`POST`,body:{id:r.id}});else if(n===`edit`)C(r.id),x({path:r.path,name:r.name||``,desc:r.desc||``,type:r.type||`dev`,remote:r.remote||``,notes:r.notes||``,key:r.key||``,icon:r.icon||``}),k(r.keyCustom===!0),ae(!0);else if(n===`del`){if(!await s({message:`删除仓库登记「${r.name}」?(仅移除登记,磁盘文件不受影响;各看板里的归属同步摘除)`,danger:!0}))return;await t(`/api/repos/${encodeURIComponent(r.id)}`,{method:`DELETE`}),await Promise.all([K(),q(),J()])}}),Rt=()=>e(async()=>{let e={name:I.name.trim()};e.name&&(I.id||(e.desc=I.desc.trim()||void 0),I.id?await t(`/api/boards/${encodeURIComponent(I.id)}`,{method:`PATCH`,body:e}):await t(`/api/boards`,{method:`POST`,body:e}),L(null),await q())}),zt=n=>e(async()=>{await s({message:`删看板「${n.name}」?它里面的 ${n.repos.length} 个仓库**仍留在中心清单里**(只是少了一份归属)。`,danger:!0})&&(await t(`/api/boards/${encodeURIComponent(n.id)}`,{method:`DELETE`,body:{}}),await Promise.all([K(),q()]))}),Bt=()=>e(async()=>{if(!me.trim())return;let e=await t(`/api/boards/import`,{method:`POST`,body:{json:me}});pe(!1),R(``),o(`已导入:新建 ${e.created} 个看板、合并 ${e.merged} 个、匹配仓库 ${e.matched} 个`+(e.unmatched.length?`;未匹配 ${e.unmatched.length} 条(见 CLI board import 输出)`:``)),await Promise.all([K(),q()])}),Vt=()=>e(async()=>{let e=await t(`/api/boards/export`);ge(JSON.stringify(e,null,2))}),Ht=async e=>{let t=e.target.files?.[0];t&&R(await t.text())},Ut=(0,h.useMemo)(()=>{let e=new Map;for(let t of[...X,...Z]){let n=String(t.path||``).split(/[\\/]/).filter(Boolean).pop()||``;for(let r of[t.name,n]){let n=String(r||``).toLowerCase();n&&!e.has(n)&&e.set(n,t)}}let t=[];for(let n of M&&M.boards||[])for(let r of n.repos||[]){if(r.present!==!1)continue;let i=String(r.key||``).split(`/`).filter(Boolean).pop()||``,a=e.get(String(r.name||``).toLowerCase())||e.get(i.toLowerCase())||null;t.push({...r,board:n.name,boardId:n.id,match:a})}return t},[M,X,Z]);if(M===null)return(0,g.jsxs)(`div`,{className:`rp-page`,children:[(0,g.jsx)(l,{}),(0,g.jsx)(`div`,{className:`muted`,style:{padding:20},children:`读取中…`}),_]});let Wt=n=>e(async()=>{await t(`/api/repos/clone`,{method:`POST`,body:{remote:n.remote,key:n.key,name:n.name||void 0,type:`dev`}}),o(`已克隆并登记:${n.name||n.key}`),K(),q()}),Gt=(n,r)=>e(async()=>{await t(`/api/boards/rekey`,{method:`POST`,body:{from:n.key,to:r}}),o(`已把「${n.name||n.key}」这个位置接到本机仓库`),K(),q()}),Kt=n=>e(async()=>{let e=await s({title:`把「${n.name||n.key}」接到哪个本机仓库?`,input:!0,placeholder:`本机仓库:id / key / 名称 / 绝对路径`});e&&(await t(`/api/boards/rekey`,{method:`POST`,body:{from:n.key,to:e}}),o(`已重绑——这个位置现在指向本机仓库`),K(),q())}),qt=n=>e(async()=>{confirm(`把「${n.name||n.key}」从组「${n.board}」里移除?\n\n只摘这个组里的位置:本机仓库与看板本身都不动。`)&&(await t(`/api/boards/assign`,{method:`POST`,body:{key:n.key,board:n.boardId,remove:!0}}),o(`已从组「${n.board}」移除`),q())}),Jt=()=>e(async()=>{let e=await t(`/api/boards/prune`,{method:`POST`,body:{apply:!1}});if(!e?.total){o(`没有可清理的占位(有远程地址的那些留着等 clone)`);return}let n=e.items.map(e=>`· ${e.name}(组 ${e.board})`).join(`
4
4
  `);confirm(`清理 ${e.total} 个无来源占位?\n\n${n}\n\n它们没有远程地址,克隆不回来,只能删。`)&&(await t(`/api/boards/prune`,{method:`POST`,body:{apply:!0}}),o(`已清理 ${e.total} 个占位`),q())}),Yt=(n,r)=>e(async()=>{n&&(await t(`/api/docs/item`,{method:`POST`,body:{rel:n,body:`# ${r||n}\n\n`}}).catch(()=>{}),y(`rel:`+n),K(),it())}),Xt=e=>e.docPath?y(`path:`+e.docPath):Yt(e.docRel,`${e.name} · 组介绍`),Zt=e=>{let t=new Set((B||[]).map(e=>String(e.rel||``).toLowerCase())),n=`${e}.md`;if(!t.has(n.toLowerCase()))return n;for(let r=2;;r+=1)if(n=`${e}-${r}.md`,!t.has(n.toLowerCase()))return n},Qt=()=>e(async()=>{let e=Zt(`note/untitled`);await t(`/api/docs/item`,{method:`POST`,body:{rel:e,body:``}}).catch(()=>{}),de(!1),y(`rel:`+e),await it()}),$t=n=>e(async()=>{let e=Tt.get(n.rel)||[];await s({message:`删除文档「${n.title||n.rel}」?磁盘文件会被删除。`+(e.length?`它正被 ${e.length} 处引用(${e.map(e=>e.label).join(`、`)})。`:``),danger:!0})&&(await t(`/api/docs/item`,{method:`DELETE`,body:{ref:n.docId}}),o(`已删除:${n.rel}`),await Promise.all([it(),K(),q()]))}),en={open:e=>$(`open`,e),edit:e=>$(`edit`,e),del:e=>$(`del`,e),remote:e=>_t(e),getloop:e=>nt(e),docs:e=>et({kind:`repo`,owner:e}),filter:e=>F(t=>t===e?``:e),bind:e=>{let t={};for(let n of e.linked||[])n.kind===`ref`&&(t[n.id]=!0);for(let n of Z)t[n.key]||(n.linked||[]).some(t=>t.kind===`repo`&&t.id===e.key)&&(t[n.key]=!0);Ue(t),Ve(e)},refNote:(e,t)=>{let n=Z.find(t=>t.key===e.key);n&&pt(n,`repo`,t.key,t.name)}};return(0,g.jsxs)(`div`,{className:`rp-page`,children:[(0,g.jsxs)(`div`,{className:`page-head`,children:[(0,g.jsx)(`div`,{className:`title-block`,children:(0,g.jsx)(`h2`,{children:`仓库管理`})}),(0,g.jsx)(`div`,{className:`acts`,children:(0,g.jsx)(f,{kind:`repos`,titles:{add:`登记本机开发仓库`,boards:`分组管理:建组 / 成员 / 组介绍文档`,refs:`参考仓库面板:克隆 / 绑定 / 同步 / 检查 / 存储根`,transfer:`布局与仓库的导入导出(逐条选择 / 冲突方案 / 差异检查)`},actions:{add:Et,boards:()=>le(!0),refs:()=>Ce(!0),transfer:()=>Je(!0)}})})]}),Ut.length>0&&(0,g.jsxs)(`section`,{className:`rp-pending`,"data-testid":`rp-pending-init`,children:[(0,g.jsxs)(`header`,{className:`rp-pending-head`,children:[(0,g.jsxs)(`div`,{className:`rp-pending-head-main`,children:[(0,g.jsxs)(`h3`,{children:[`待初始化`,(0,g.jsx)(`span`,{className:`rp-pending-count`,children:Ut.length})]}),(0,g.jsx)(`p`,{children:`组里有位置、本机没有登记。接到本机仓库、克隆下来,或者直接移除。`})]}),(0,g.jsx)(m,{small:!0,onClick:Jt,children:`清理无来源占位`})]}),(0,g.jsx)(`div`,{className:`rp-pending-list`,children:Ut.map(e=>(0,g.jsxs)(`article`,{className:`rp-pending-card`,children:[(0,g.jsxs)(`div`,{className:`rp-pending-info`,children:[(0,g.jsxs)(`div`,{className:`rp-pending-title`,children:[(0,g.jsx)(`strong`,{children:e.name||e.key}),(0,g.jsxs)(`span`,{className:`rp-pending-board`,children:[`组 · `,e.board]}),e.remote?null:(0,g.jsx)(`span`,{className:`rp-pending-tag`,children:`无远程地址`})]}),(0,g.jsx)(`code`,{className:`rp-pending-key`,children:e.key}),e.desc?(0,g.jsx)(`p`,{className:`rp-pending-desc`,children:e.desc}):null]}),(0,g.jsxs)(`div`,{className:`rp-pending-acts`,children:[e.match?(0,g.jsxs)(m,{small:!0,title:`把组里这个位置指向本机仓库「${e.match.name}」(仓库身份不变)`,onClick:()=>Gt(e,e.match.id),children:[`绑定到「`,e.match.name,`」`]}):null,e.remote?(0,g.jsx)(m,{small:!0,onClick:()=>Wt(e),children:`克隆到本地`}):null,(0,g.jsx)(m,{small:!0,onClick:()=>Kt(e),children:`选本机仓库`}),(0,g.jsx)(m,{small:!0,danger:!0,title:`只从组里摘掉这个位置,本机仓库与看板都不动`,onClick:()=>qt(e),children:`移除`})]})]},e.key+`@`+e.boardId))})]}),(0,g.jsxs)(`div`,{className:`rp-filters`,"data-testid":`rp-filters`,children:[(0,g.jsxs)(`div`,{className:`rp-filters-main`,children:[(0,g.jsxs)(`button`,{className:`rp-chip`+(P?``:` on`),onClick:()=>F(``),title:`显示全部开发仓库`,children:[`全部 `,(0,g.jsx)(`b`,{children:X.length})]}),Y.map(e=>(0,g.jsxs)(`button`,{className:`rp-chip`+(P===e.id?` on`:``),onClick:()=>F(P===e.id?``:e.id),title:`只看「${e.name}」里的仓库(${e.repos.length} 个)`,children:[e.name,` `,(0,g.jsx)(`b`,{children:e.repos.length})]},e.id))]}),(0,g.jsxs)(`div`,{className:`rp-filters-side`,children:[(0,g.jsx)(`input`,{className:`rp-search`,type:`search`,value:oe,onChange:e=>se(e.target.value),placeholder:`搜仓库 / 路径 / 分组 / 文档…`,"aria-label":`检索仓库与文档`}),oe?(0,g.jsx)(m,{small:!0,onClick:()=>se(``),children:`清空`}):null,(0,g.jsxs)(`span`,{className:`muted rp-search-count`,children:[bt.length,` / `,X.length]}),(0,g.jsx)(m,{small:!0,title:`按仓库 / 组内 / 分组三档检索文档`,onClick:()=>de(!0),children:`文档检索`})]})]}),Q?(0,g.jsxs)(`div`,{className:`rp-context`,"data-testid":`rp-context`,children:[(0,g.jsx)(`span`,{className:`rp-context-name`,children:Q.name}),Q.desc?(0,g.jsx)(`span`,{className:`rp-context-desc`,title:Q.desc,children:Q.desc}):(0,g.jsx)(`span`,{className:`muted rp-context-desc`,children:`还没有领域描述 —— 点「组介绍文档」补一段:侧重什么、谁配合谁、关键路径与搜索关键词在哪。`}),(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(m,{small:!0,title:`打开这个分组的组介绍文档`,onClick:()=>Xt(Q),children:`组介绍文档 ✎`}),(0,g.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(Q.id),title:`组页里看这个组的成员与任务`,children:`组页 ↗`}),(0,g.jsx)(m,{small:!0,onClick:()=>j(Q.id),children:`添加成员`})]})]}):null,Q?(0,g.jsxs)(`div`,{className:`rp-ref-mounted`,"data-testid":`rp-board-refs`,children:[(0,g.jsxs)(`div`,{className:`rp-ref-mounted-head`,children:[(0,g.jsxs)(`span`,{className:`rp-ref-mounted-label`,children:[`「`,Q.name,`」的参考仓库 `,(0,g.jsx)(`b`,{children:wt.length})]}),(0,g.jsx)(`span`,{className:`muted`,children:`组级参考 + 成员仓库各自的参考(多对多:一个参考可同时服务多个组/仓库)`})]}),wt.length?wt.map(e=>{let t=St.get(e.id),n=(e.linked||[]).find(e=>e.kind===`board`&&e.id===(Q.key||`board/${Q.name}`));return(0,g.jsxs)(`div`,{className:`rp-ref-mounted-item`,children:[(0,g.jsx)(`span`,{className:`rp-ref-dot`+(t?t.ok?` ok`:` bad`:``),title:t?t.ok?`检查通过`:t.issues.join(`
5
5
  `):`尚未检查`}),(0,g.jsx)(c,{text:e.remote||e.name,title:`点击复制远程地址`,className:`rp-ref-mounted-name`,children:e.name}),e.desc?(0,g.jsx)(`span`,{className:`muted rp-ref-mounted-desc`,title:e.desc,children:e.desc}):null,e.boardNote?(0,g.jsx)(`button`,{className:`rp-ref-note-chip`,title:`${e.boardNote}\n点击编辑这条命名空间描述`,onClick:()=>pt(e,`board`,Q.id,Q.name),children:e.boardNote.split(`
6
6
  `)[0]}):(0,g.jsx)(m,{small:!0,title:`写「${e.name}」在这个组里参考什么(命名空间描述)`,onClick:()=>pt(e,`board`,Q.id,Q.name),children:`写描述`}),e.viaRepos.length?(0,g.jsxs)(`span`,{className:`muted`,title:`经由成员仓库: `+e.viaRepos.join(`、`),children:[`经由 `,e.viaRepos.join(`、`)]}):null,(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>ct(e),children:`同步`}),(0,g.jsx)(m,{small:!0,onClick:()=>$(`open`,e),children:`打开`}),n?(0,g.jsx)(m,{small:!0,danger:!0,title:`只从本组摘除(不影响其它绑定)`,onClick:()=>ht(e,`board`,Q.id),children:`移出本组`}):null]})]},e.id)}):(0,g.jsx)(`div`,{className:`muted rp-refs-none`,children:`这个组还没有绑定的参考仓库 —— 在下方参考仓库面板里点「绑定」勾选本组,或在成员仓库行上绑定。`})]}):null,Se?(0,g.jsxs)(a,{size:`wide`,title:`参考仓库 · ${Z.length}`,onClose:()=>Ce(!1),children:[(0,g.jsx)(`div`,{className:`rp-modal-bar`,children:(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>{Pe({}),je(!0)},children:`克隆参考仓库`}),(0,g.jsx)(m,{small:!0,onClick:lt,children:`同步全部`}),(0,g.jsx)(m,{small:!0,onClick:J,children:`检查`}),(0,g.jsx)(m,{small:!0,onClick:()=>{ke({gitRepoRoot:we?.gitRepoRoot||``,gitDevRoot:we?.gitDevRoot||``}),De(!0)},children:`存储根`})]})}),we?.gitRepoRoot?null:(0,g.jsx)(`div`,{className:`rp-ref-warn`,children:`存储根未设置 —— 克隆会被拒绝。点「存储根」设一个非 C 盘目录(参考仓库体积不小,别放系统盘)。`}),(0,g.jsx)(`div`,{className:`rp-ref-table-wrap`,children:(0,g.jsxs)(`table`,{className:`rp-ref-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{scope:`col`,style:{width:`30px`}}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`17%`},children:`参考仓库`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`22%`},children:`远程地址`}),(0,g.jsx)(`th`,{scope:`col`,children:`绑定(组 / 仓库 · 点击写描述 · × 摘除)`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`220px`},children:`操作`})]})}),(0,g.jsxs)(`tbody`,{children:[Z.map(e=>{let t=St.get(e.id),n=e.linked||[];return(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{children:(0,g.jsx)(`span`,{className:`rp-ref-dot`+(t?t.ok?` ok`:` bad`:``),title:t?t.ok?`检查通过`:t.issues.join(`
7
7
  `):`尚未检查`})}),(0,g.jsxs)(`td`,{className:`rp-ref-cell-name`,children:[(0,g.jsx)(`strong`,{children:e.name}),(0,g.jsx)(re,{docs:e.descDocs,onOpen:()=>en.docs(e)})]}),(0,g.jsx)(`td`,{className:`mono rp-ref-cell-remote`,children:(0,g.jsx)(c,{text:e.remote||``,title:`点击复制远程地址`,children:e.remote||`(无)`})}),(0,g.jsxs)(`td`,{className:`rp-ref-cell-links`,children:[n.length?n.map(t=>{let n=t.kind===`board`?Y.find(e=>(e.key||`board/${e.name}`)===t.id)?.name||t.id:X.find(e=>e.key===t.id)?.name||t.id;return(0,g.jsxs)(`span`,{className:`rp-link-chip`,children:[(0,g.jsxs)(`button`,{className:`rp-link-chip-main`,title:t.note?`${t.note}\n点击编辑这条绑定描述`:`点击写「${e.name}」绑定到这里的描述`,onClick:()=>pt(e,t.kind,t.id,n),children:[(0,g.jsx)(`b`,{children:t.kind===`board`?`组`:`仓`}),` `,n,t.note?(0,g.jsx)(`i`,{className:`rp-link-chip-note`,title:t.note,children:t.note.split(`
8
- `)[0]}):null]}),(0,g.jsx)(`button`,{className:`rp-link-chip-x`,title:`摘除这条绑定(不影响其它)`,onClick:()=>ht(e,t.kind,t.id),children:`×`})]},t.kind+`:`+t.id)}):(0,g.jsx)(`span`,{className:`muted rp-refs-none`,children:`未绑定`}),(0,g.jsx)(m,{small:!0,className:`rp-ref-bind`,onClick:()=>ut(e),children:`绑定…`})]}),(0,g.jsxs)(`td`,{className:`rp-acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>ct(e),children:`同步`}),(0,g.jsx)(m,{small:!0,onClick:()=>$(`open`,e),children:`打开`}),(0,g.jsx)(m,{small:!0,onClick:()=>$(`edit`,e),children:`编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>$(`del`,e),children:`删除`})]})]},e.id)}),Z.length?null:(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:`5`,className:`muted rp-empty`,children:`还没有参考仓库 —— 点「克隆参考仓库」抓一个远程仓库下来(或用 CLI: nx-kv repo ref clone <url>)。`})})]})]})})]}):null,(0,g.jsx)(`div`,{className:`rp-table-wrap`,id:`rp-repos`,children:(0,g.jsxs)(`table`,{className:`rp-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{scope:`col`,style:{width:`17%`},children:`仓库`}),(0,g.jsxs)(`th`,{scope:`col`,style:{width:`24%`},children:[`文档`,(0,g.jsx)(`span`,{className:`rp-th-hint`,children:`主篇摘要 · 查看详情打开完整文档列表`})]}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`15%`},children:`参考仓库`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`12%`},children:`分组`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`250px`},children:`操作`})]})}),(0,g.jsxs)(`tbody`,{children:[bt.map(e=>(0,g.jsx)(ie,{r:e,filterBoard:Q,refsOfRepo:Ct,acts:en},e.id)),bt.length?null:(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:`5`,className:`muted rp-empty`,children:X.length?(0,g.jsxs)(g.Fragment,{children:[`这个分组还没有成员`,` `,Q?(0,g.jsx)(m,{small:!0,onClick:()=>j(Q.id),children:`添加成员`}):null]}):`还没有登记开发仓库 —— 点右上「登记仓库」加一条。`})})]})]})}),ue?(0,g.jsxs)(a,{size:`wide`,title:`文档检索 · ${B.length}`,onClose:()=>de(!1),children:[(0,g.jsxs)(`div`,{className:`rp-modal-bar rp-doc-bar`,children:[(0,g.jsx)(`input`,{className:`rp-search`,type:`search`,value:kt,onChange:e=>At(e.target.value),placeholder:`搜标题 / 路径 / 组名 / 仓库名…`,"aria-label":`检索文档`}),kt?(0,g.jsx)(m,{small:!0,onClick:()=>At(``),children:`清空`}):null,(0,g.jsx)(`span`,{className:`acts`,children:(0,g.jsx)(m,{small:!0,onClick:Qt,children:`新建文档`})})]}),B.length?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`rp-doc-scopes`,children:[[`all`,`全部`,Mt.all],[`repo`,`仓库文档`,Mt.repo],[`scoped`,`组内文档`,Mt.scoped],[`board`,`分组文档`,Mt.board],[`orphan`,`未绑定`,Mt.orphan]].map(([e,t,n])=>(0,g.jsxs)(`button`,{className:`rp-chip`+(Dt===e?` on`:``),onClick:()=>Ot(e),children:[t,` `,(0,g.jsx)(`b`,{children:n})]},e))}),(0,g.jsxs)(`div`,{className:`rp-doc-rows rp-doc-rows-modal`,children:[jt.map(({d:e,hosts:t})=>(0,g.jsxs)(`div`,{className:`rp-doc-row`,children:[(0,g.jsx)(`button`,{type:`button`,className:`rp-doc-row-title`,title:`打开「${e.title||e.rel}」`,onClick:()=>y(e.docId),children:e.title||e.name||e.rel}),(0,g.jsx)(`code`,{className:`rp-doc-row-rel`,title:e.rel,children:e.rel}),(0,g.jsx)(`span`,{className:`rp-doc-row-hosts`,children:t.length?t.map(e=>(0,g.jsx)(`button`,{type:`button`,className:`rp-bind-chip `+e.kind,title:`${e.tip}\n点击跳到这个宿主`,onClick:()=>{Ft(e),de(!1)},children:e.label},e.key)):(0,g.jsx)(`span`,{className:`rp-bind-chip none`,children:`未绑定`})}),(0,g.jsxs)(`span`,{className:`rp-doc-row-acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>y(e.docId),children:`打开编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>$t(e),children:`删除`})]})]},e.docId)),jt.length?null:(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`这一档没有匹配的文档。`})]})]}):(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有文档 —— 点「新建文档」给一个相对路径(如 note/inbox.md)就开写; 或在仓库行上点「+ 写项目介绍」。`})]}):null,ce?(0,g.jsxs)(a,{size:`wide`,title:`分组管理 · ${Y.length}`,onClose:()=>le(!1),children:[(0,g.jsxs)(`div`,{className:`rp-modal-bar`,children:[(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>L({id:null,name:``,desc:``}),children:`新建分组`}),(0,g.jsx)(m,{small:!0,title:`粘贴/选择看板 JSON`,onClick:()=>pe(!0),children:`导入`}),(0,g.jsx)(m,{small:!0,title:`导出全部看板为 JSON`,onClick:Vt,children:`导出`})]}),(0,g.jsx)(`span`,{className:`muted`,children:`一个分组 = 一个主题;同一个仓库可以同时在多个分组里。`})]}),Y.length?(0,g.jsxs)(`div`,{className:`rp-board-admin`,children:[(0,g.jsxs)(`div`,{className:`rp-board-admin-head`,children:[(0,g.jsx)(`span`,{children:`分组`}),(0,g.jsx)(`span`,{children:`成员`}),(0,g.jsx)(`span`,{children:`组介绍`}),(0,g.jsx)(`span`,{children:`操作`})]}),Y.map(e=>{let t=(e.repos||[]).filter(e=>e.present!==!1),n=(e.repos||[]).filter(e=>e.present===!1);return(0,g.jsxs)(`div`,{className:`rp-board-admin-row`,children:[(0,g.jsxs)(`span`,{className:`rp-board-admin-name`,children:[e.name,(0,g.jsx)(`button`,{className:`rp-mini-link`,title:`只看「${e.name}」里的仓库`,onClick:()=>{F(e.id),le(!1)},children:`筛选`})]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-members`,children:[t.slice(0,4).map(e=>(0,g.jsx)(`span`,{className:`rp-board-mchip`,title:e.note||e.key,children:e.name||e.key},e.key)),t.length>4?(0,g.jsxs)(`span`,{className:`rp-board-more`,children:[`+`,t.length-4]}):null,n.length?(0,g.jsxs)(`span`,{className:`rp-board-missing`,children:[n.length,` 待初始化`]}):null,e.repos.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`—`})]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-doc`,children:[(0,g.jsx)(m,{small:!0,title:`打开组介绍文档`,onClick:()=>Xt(e),children:`组介绍 ✎`}),e.docLinks&&e.docLinks.length?(0,g.jsxs)(`span`,{className:`muted`,children:[`+`,e.docLinks.length]}):null]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-acts`,children:[(0,g.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(e.id),title:`组页:成员与任务`,children:`组页 ↗`}),(0,g.jsx)(m,{small:!0,onClick:()=>j(e.id),children:`成员`}),(0,g.jsx)(m,{small:!0,onClick:()=>L({id:e.id,name:e.name,desc:e.desc||``}),children:`编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>zt(e),children:`删除`})]})]},e.id)}),M.unassigned?.length?(0,g.jsxs)(`div`,{className:`rp-boards-unassigned`,children:[`未分组 `,(0,g.jsx)(`b`,{children:M.unassigned.length}),` 个 —— 不属于任何分组,只在「全部」里可见。`]}):null]}):(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有分组 —— 点「新建分组」建一个当主题用(如「前端」「AI 工具」),再把仓库点选进去。`})]}):null,ne?(0,g.jsx)(a,{title:S?`编辑仓库 · ${S}`:`添加仓库`,onClose:rt,children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-path`,children:`仓库绝对路径 *`}),(0,g.jsx)(`input`,{id:`repo-path`,placeholder:`D:/code/my-project`,spellCheck:`false`,value:b.path,onChange:ye(`path`)})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-name`,children:`名称`}),(0,g.jsx)(`input`,{id:`repo-name`,placeholder:`留空则用目录末段`,value:b.name,onChange:ye(`name`)})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-icon`,children:`图标`}),(0,g.jsx)(`input`,{id:`repo-icon`,maxLength:8,placeholder:`emoji 或单字符(留空 = 默认文件夹图标)`,value:b.icon,onChange:ye(`icon`)})]}),It?(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`项目描述(文档)`}),(0,g.jsxs)(`div`,{className:`rp-docpick`,children:[(0,g.jsxs)(`button`,{type:`button`,className:`rp-doc`,onClick:()=>{ae(!1),y(It.main.docId)},children:[It.main.title,It.main.exists?null:(0,g.jsx)(`span`,{className:`rp-doc-todo`,children:`未写`})]}),It.links.length?(0,g.jsxs)(`span`,{className:`muted`,children:[`另有 `,It.links.length,` 篇补充文档`]}):null]})]}):null,(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-type`,children:`类型`}),(0,g.jsxs)(`select`,{id:`repo-type`,value:b.type,onChange:ye(`type`),children:[(0,g.jsx)(`option`,{value:`dev`,children:`开发仓库(本机开发的)`}),(0,g.jsx)(`option`,{value:`ref`,children:`参考仓库(远程 clone 下来的)`})]})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-remote`,children:`远程 git 地址`}),(0,g.jsx)(`input`,{id:`repo-remote`,spellCheck:`false`,placeholder:`https://github.com/me/x.git(导出时导它,不含本地路径)`,value:b.remote,onChange:be}),(0,g.jsx)(`div`,{className:`form-hint`,children:`有远程地址时,下面的 key 会按它自动归一化:ssh / https / 带 .git / 带 user 的写法 都归一成 host/owner/repo(如 github.com/on-devplan/nx-kv)。`})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-key`,children:`仓库 key *(全局唯一身份)`}),(0,g.jsx)(`input`,{id:`repo-key`,spellCheck:`false`,placeholder:`github.com/on-devplan/nx-kv`,value:b.key,onChange:xe}),(0,g.jsx)(`div`,{className:`form-hint`,children:`没有远程地址时必须手工填写;已有仓库可查看,改 key 会波及引用它的队列 / 看板 / 关系。`})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-notes`,children:`备注`}),(0,g.jsx)(`textarea`,{id:`repo-notes`,placeholder:`补充信息(可选)`,value:b.notes,onChange:ye(`notes`)})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:rt,children:`取消`}),(0,g.jsx)(m,{disabled:!b.path.trim()||!b.key.trim()&&!b.remote.trim(),onClick:Lt,children:S?`保存修改`:`添加仓库`})]})]})}):null,I?(0,g.jsx)(a,{title:I.id?`编辑看板`:`新建看板`,onClose:()=>L(null),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`bd-name`,children:`看板名称 *`}),(0,g.jsx)(`input`,{id:`bd-name`,placeholder:`如 前端 / AI 工具`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value}))})]}),I.id?(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`领域描述(文档)`}),(0,g.jsx)(`div`,{className:`rp-docpick`,children:(0,g.jsx)(`button`,{type:`button`,className:`rp-doc`+(I.desc?``:` ghost`),title:`打开组介绍文档`,onClick:()=>{let e=Y.find(e=>e.id===I.id);L(null),e&&(e.docRel||e.doc&&e.doc.rel)&&y(`rel:`+(e.docRel||e.doc.rel))},children:I.desc||`未写`})})]}):(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`bd-desc`,children:`初始描述`}),(0,g.jsx)(`textarea`,{id:`bd-desc`,rows:3,spellCheck:`false`,placeholder:`新建时给的介绍正文(之后以 board/<组>.md 文档为准)。
8
+ `)[0]}):null]}),(0,g.jsx)(`button`,{className:`rp-link-chip-x`,title:`摘除这条绑定(不影响其它)`,onClick:()=>ht(e,t.kind,t.id),children:`×`})]},t.kind+`:`+t.id)}):(0,g.jsx)(`span`,{className:`muted rp-refs-none`,children:`未绑定`}),(0,g.jsx)(m,{small:!0,className:`rp-ref-bind`,onClick:()=>ut(e),children:`绑定…`})]}),(0,g.jsxs)(`td`,{className:`rp-acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>ct(e),children:`同步`}),(0,g.jsx)(m,{small:!0,onClick:()=>$(`open`,e),children:`打开`}),(0,g.jsx)(m,{small:!0,onClick:()=>$(`edit`,e),children:`编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>$(`del`,e),children:`删除`})]})]},e.id)}),Z.length?null:(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:`5`,className:`muted rp-empty`,children:`还没有参考仓库 —— 点「克隆参考仓库」抓一个远程仓库下来(或用 CLI: nx-kv repo ref clone <url>)。`})})]})]})})]}):null,(0,g.jsx)(`div`,{className:`rp-table-wrap`,id:`rp-repos`,children:(0,g.jsxs)(`table`,{className:`rp-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{scope:`col`,style:{width:`16%`},children:`仓库`}),(0,g.jsxs)(`th`,{scope:`col`,style:{width:`36%`},children:[`文档`,(0,g.jsx)(`span`,{className:`rp-th-hint`,children:`主篇摘要 · 查看详情打开完整文档列表`})]}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`18%`},children:`参考仓库`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`14%`},children:`分组`}),(0,g.jsx)(`th`,{scope:`col`,style:{width:`250px`},children:`操作`})]})}),(0,g.jsxs)(`tbody`,{children:[bt.map(e=>(0,g.jsx)(ie,{r:e,filterBoard:Q,refsOfRepo:Ct,acts:en},e.id)),bt.length?null:(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:`5`,className:`muted rp-empty`,children:X.length?(0,g.jsxs)(g.Fragment,{children:[`这个分组还没有成员`,` `,Q?(0,g.jsx)(m,{small:!0,onClick:()=>j(Q.id),children:`添加成员`}):null]}):`还没有登记开发仓库 —— 点右上「登记仓库」加一条。`})})]})]})}),ue?(0,g.jsxs)(a,{size:`wide`,title:`文档检索 · ${B.length}`,onClose:()=>de(!1),children:[(0,g.jsxs)(`div`,{className:`rp-modal-bar rp-doc-bar`,children:[(0,g.jsx)(`input`,{className:`rp-search`,type:`search`,value:kt,onChange:e=>At(e.target.value),placeholder:`搜标题 / 路径 / 组名 / 仓库名…`,"aria-label":`检索文档`}),kt?(0,g.jsx)(m,{small:!0,onClick:()=>At(``),children:`清空`}):null,(0,g.jsx)(`span`,{className:`acts`,children:(0,g.jsx)(m,{small:!0,onClick:Qt,children:`新建文档`})})]}),B.length?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`rp-doc-scopes`,children:[[`all`,`全部`,Mt.all],[`repo`,`仓库文档`,Mt.repo],[`scoped`,`组内文档`,Mt.scoped],[`board`,`分组文档`,Mt.board],[`orphan`,`未绑定`,Mt.orphan]].map(([e,t,n])=>(0,g.jsxs)(`button`,{className:`rp-chip`+(Dt===e?` on`:``),onClick:()=>Ot(e),children:[t,` `,(0,g.jsx)(`b`,{children:n})]},e))}),(0,g.jsxs)(`div`,{className:`rp-doc-rows rp-doc-rows-modal`,children:[jt.map(({d:e,hosts:t})=>(0,g.jsxs)(`div`,{className:`rp-doc-row`,children:[(0,g.jsx)(`button`,{type:`button`,className:`rp-doc-row-title`,title:`打开「${e.title||e.rel}」`,onClick:()=>y(e.docId),children:e.title||e.name||e.rel}),(0,g.jsx)(`code`,{className:`rp-doc-row-rel`,title:e.rel,children:e.rel}),(0,g.jsx)(`span`,{className:`rp-doc-row-hosts`,children:t.length?t.map(e=>(0,g.jsx)(`button`,{type:`button`,className:`rp-bind-chip `+e.kind,title:`${e.tip}\n点击跳到这个宿主`,onClick:()=>{Ft(e),de(!1)},children:e.label},e.key)):(0,g.jsx)(`span`,{className:`rp-bind-chip none`,children:`未绑定`})}),(0,g.jsxs)(`span`,{className:`rp-doc-row-acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>y(e.docId),children:`打开编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>$t(e),children:`删除`})]})]},e.docId)),jt.length?null:(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`这一档没有匹配的文档。`})]})]}):(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有文档 —— 点「新建文档」给一个相对路径(如 note/inbox.md)就开写; 或在仓库行上点「+ 写项目介绍」。`})]}):null,ce?(0,g.jsxs)(a,{size:`wide`,title:`分组管理 · ${Y.length}`,onClose:()=>le(!1),children:[(0,g.jsxs)(`div`,{className:`rp-modal-bar`,children:[(0,g.jsxs)(`span`,{className:`acts`,children:[(0,g.jsx)(m,{small:!0,onClick:()=>L({id:null,name:``,desc:``}),children:`新建分组`}),(0,g.jsx)(m,{small:!0,title:`粘贴/选择看板 JSON`,onClick:()=>pe(!0),children:`导入`}),(0,g.jsx)(m,{small:!0,title:`导出全部看板为 JSON`,onClick:Vt,children:`导出`})]}),(0,g.jsx)(`span`,{className:`muted`,children:`一个分组 = 一个主题;同一个仓库可以同时在多个分组里。`})]}),Y.length?(0,g.jsxs)(`div`,{className:`rp-board-admin`,children:[(0,g.jsxs)(`div`,{className:`rp-board-admin-head`,children:[(0,g.jsx)(`span`,{children:`分组`}),(0,g.jsx)(`span`,{children:`成员`}),(0,g.jsx)(`span`,{children:`组介绍`}),(0,g.jsx)(`span`,{children:`操作`})]}),Y.map(e=>{let t=(e.repos||[]).filter(e=>e.present!==!1),n=(e.repos||[]).filter(e=>e.present===!1);return(0,g.jsxs)(`div`,{className:`rp-board-admin-row`,children:[(0,g.jsxs)(`span`,{className:`rp-board-admin-name`,children:[e.name,(0,g.jsx)(`button`,{className:`rp-mini-link`,title:`只看「${e.name}」里的仓库`,onClick:()=>{F(e.id),le(!1)},children:`筛选`})]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-members`,children:[t.slice(0,4).map(e=>(0,g.jsx)(`span`,{className:`rp-board-mchip`,title:e.note||e.key,children:e.name||e.key},e.key)),t.length>4?(0,g.jsxs)(`span`,{className:`rp-board-more`,children:[`+`,t.length-4]}):null,n.length?(0,g.jsxs)(`span`,{className:`rp-board-missing`,children:[n.length,` 待初始化`]}):null,e.repos.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`—`})]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-doc`,children:[(0,g.jsx)(m,{small:!0,title:`打开组介绍文档`,onClick:()=>Xt(e),children:`组介绍 ✎`}),e.docLinks&&e.docLinks.length?(0,g.jsxs)(`span`,{className:`muted`,children:[`+`,e.docLinks.length]}):null]}),(0,g.jsxs)(`span`,{className:`rp-board-admin-acts`,children:[(0,g.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(e.id),title:`组页:成员与任务`,children:`组页 ↗`}),(0,g.jsx)(m,{small:!0,onClick:()=>j(e.id),children:`成员`}),(0,g.jsx)(m,{small:!0,onClick:()=>L({id:e.id,name:e.name,desc:e.desc||``}),children:`编辑`}),(0,g.jsx)(m,{small:!0,danger:!0,onClick:()=>zt(e),children:`删除`})]})]},e.id)}),M.unassigned?.length?(0,g.jsxs)(`div`,{className:`rp-boards-unassigned`,children:[`未分组 `,(0,g.jsx)(`b`,{children:M.unassigned.length}),` 个 —— 不属于任何分组,只在「全部」里可见。`]}):null]}):(0,g.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有分组 —— 点「新建分组」建一个当主题用(如「前端」「AI 工具」),再把仓库点选进去。`})]}):null,ne?(0,g.jsx)(a,{title:S?`编辑仓库 · ${S}`:`添加仓库`,onClose:rt,children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-path`,children:`仓库绝对路径 *`}),(0,g.jsx)(`input`,{id:`repo-path`,placeholder:`D:/code/my-project`,spellCheck:`false`,value:b.path,onChange:ye(`path`)})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-name`,children:`名称`}),(0,g.jsx)(`input`,{id:`repo-name`,placeholder:`留空则用目录末段`,value:b.name,onChange:ye(`name`)})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-icon`,children:`图标`}),(0,g.jsx)(`input`,{id:`repo-icon`,maxLength:8,placeholder:`emoji 或单字符(留空 = 默认文件夹图标)`,value:b.icon,onChange:ye(`icon`)})]}),It?(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`项目描述(文档)`}),(0,g.jsxs)(`div`,{className:`rp-docpick`,children:[(0,g.jsxs)(`button`,{type:`button`,className:`rp-doc`,onClick:()=>{ae(!1),y(It.main.docId)},children:[It.main.title,It.main.exists?null:(0,g.jsx)(`span`,{className:`rp-doc-todo`,children:`未写`})]}),It.links.length?(0,g.jsxs)(`span`,{className:`muted`,children:[`另有 `,It.links.length,` 篇补充文档`]}):null]})]}):null,(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-type`,children:`类型`}),(0,g.jsxs)(`select`,{id:`repo-type`,value:b.type,onChange:ye(`type`),children:[(0,g.jsx)(`option`,{value:`dev`,children:`开发仓库(本机开发的)`}),(0,g.jsx)(`option`,{value:`ref`,children:`参考仓库(远程 clone 下来的)`})]})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-remote`,children:`远程 git 地址`}),(0,g.jsx)(`input`,{id:`repo-remote`,spellCheck:`false`,placeholder:`https://github.com/me/x.git(导出时导它,不含本地路径)`,value:b.remote,onChange:be}),(0,g.jsx)(`div`,{className:`form-hint`,children:`有远程地址时,下面的 key 会按它自动归一化:ssh / https / 带 .git / 带 user 的写法 都归一成 host/owner/repo(如 github.com/on-devplan/nx-kv)。`})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-key`,children:`仓库 key *(全局唯一身份)`}),(0,g.jsx)(`input`,{id:`repo-key`,spellCheck:`false`,placeholder:`github.com/on-devplan/nx-kv`,value:b.key,onChange:xe}),(0,g.jsx)(`div`,{className:`form-hint`,children:`没有远程地址时必须手工填写;已有仓库可查看,改 key 会波及引用它的队列 / 看板 / 关系。`})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`repo-notes`,children:`备注`}),(0,g.jsx)(`textarea`,{id:`repo-notes`,placeholder:`补充信息(可选)`,value:b.notes,onChange:ye(`notes`)})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:rt,children:`取消`}),(0,g.jsx)(m,{disabled:!b.path.trim()||!b.key.trim()&&!b.remote.trim(),onClick:Lt,children:S?`保存修改`:`添加仓库`})]})]})}):null,I?(0,g.jsx)(a,{title:I.id?`编辑看板`:`新建看板`,onClose:()=>L(null),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`bd-name`,children:`看板名称 *`}),(0,g.jsx)(`input`,{id:`bd-name`,placeholder:`如 前端 / AI 工具`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value}))})]}),I.id?(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`领域描述(文档)`}),(0,g.jsx)(`div`,{className:`rp-docpick`,children:(0,g.jsx)(`button`,{type:`button`,className:`rp-doc`+(I.desc?``:` ghost`),title:`打开组介绍文档`,onClick:()=>{let e=Y.find(e=>e.id===I.id);L(null),e&&(e.docRel||e.doc&&e.doc.rel)&&y(`rel:`+(e.docRel||e.doc.rel))},children:I.desc||`未写`})})]}):(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`bd-desc`,children:`初始描述`}),(0,g.jsx)(`textarea`,{id:`bd-desc`,rows:3,spellCheck:`false`,placeholder:`新建时给的介绍正文(之后以 board/<组>.md 文档为准)。
9
9
  如:这组仓库在这个环境里的侧重、配合关系、关键路径与搜索关键词。`,value:I.desc,onChange:e=>L(t=>({...t,desc:e.target.value}))})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>L(null),children:`取消`}),(0,g.jsx)(m,{disabled:!I.name.trim(),onClick:Rt,children:I.id?`保存`:`新建看板`})]})]})}):null,fe?(0,g.jsx)(a,{title:`导入看板 JSON`,size:`lg`,onClose:()=>{pe(!1),R(``)},children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`bd-imp`,children:`看板 JSON`}),(0,g.jsxs)(`div`,{className:`form-hint`,children:[`结构 `,`{ boards:[{ name, repos:[{ path|name }] }] }`,` —— 按 path 或 name 匹配已登记仓库,匹配不上的会如实报告`]}),(0,g.jsx)(`input`,{id:`bd-imp-file`,type:`file`,accept:`.json,application/json`,onChange:Ht}),(0,g.jsx)(`textarea`,{id:`bd-imp`,rows:10,spellCheck:`false`,placeholder:`{"boards":[{"name":"前端","repos":[{"path":"D:/code/a_js/proj/nx-ft"}]}]}`,value:me,onChange:e=>R(e.target.value)})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>{pe(!1),R(``)},children:`取消`}),(0,g.jsx)(m,{disabled:!me.trim(),onClick:Bt,children:`导入`})]})]})}):null,he?(0,g.jsx)(a,{title:`看板 JSON(可回灌给导入)`,size:`lg`,onClose:()=>ge(null),children:(0,g.jsx)(`textarea`,{className:`bd-exp`,rows:14,readOnly:!0,value:he,spellCheck:`false`})}):null,xt?(0,g.jsx)(p,{board:xt,boards:Y,repos:z,onClose:()=>j(null),onChanged:async()=>{await Promise.all([K(),q()])}}):null,Ae?(0,g.jsx)(a,{title:`克隆参考仓库`,onClose:()=>{je(!1),Pe({})},children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`ref-url`,children:`远程 git 地址 *`}),(0,g.jsx)(`input`,{id:`ref-url`,spellCheck:`false`,placeholder:`git@github.com:lib/x.git 或 https://github.com/lib/x`,value:V.url,onChange:e=>Me(t=>({...t,url:e.target.value}))})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`ref-name`,children:`名称`}),(0,g.jsx)(`input`,{id:`ref-name`,placeholder:`留空则用 URL 末段`,value:V.name,onChange:e=>Me(t=>({...t,name:e.target.value}))})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`ref-desc`,children:`它参考什么`}),(0,g.jsx)(`input`,{id:`ref-desc`,spellCheck:`false`,placeholder:`如:liquid glass 的官方实现参考`,value:V.desc,onChange:e=>Me(t=>({...t,desc:e.target.value}))})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`克隆后绑定到(可多选)`}),(0,g.jsxs)(`div`,{className:`rp-pick-list`,children:[(0,g.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,g.jsx)(`span`,{className:`rp-pick-group-label`,children:`开发仓库`}),X.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!Ne[`repo:`+e.id],onChange:t=>Pe(n=>({...n,[`repo:`+e.id]:t.target.checked}))}),(0,g.jsx)(`span`,{title:e.path,children:e.name})]},e.id)),X.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`(还没有开发仓库)`})]}),(0,g.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,g.jsx)(`span`,{className:`rp-pick-group-label`,children:`看板(项目组)`}),Y.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!Ne[`board:`+e.id],onChange:t=>Pe(n=>({...n,[`board:`+e.id]:t.target.checked}))}),(0,g.jsx)(`span`,{title:e.desc||``,children:e.name})]},e.id)),Y.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`(还没有看板)`})]})]}),(0,g.jsx)(`div`,{className:`form-hint`,children:`一个参考可同时服务多个仓库/组;之后随时在「绑定…」里增删。`})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>{je(!1),Pe({})},children:`取消`}),(0,g.jsx)(m,{disabled:!V.url.trim()||!we?.gitRepoRoot,title:we?.gitRepoRoot?`克隆到 ${we.gitRepoRoot}`:`先在「存储根」设置 gitRepoRoot`,onClick:st,children:`克隆`})]})]})}):null,Le?(0,g.jsx)(a,{title:`绑定 · ${Le.name}`,onClose:()=>Re(null),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`div`,{className:`form-hint`,children:`勾选 = 绑定,取消 = 摘除(保存时对比差异)。一个参考可同时绑多个仓库/组。`}),(0,g.jsxs)(`div`,{className:`rp-pick-list`,children:[(0,g.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,g.jsx)(`span`,{className:`rp-pick-group-label`,children:`开发仓库`}),X.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!ze[`repo:`+e.id],onChange:t=>Be(n=>({...n,[`repo:`+e.id]:t.target.checked}))}),(0,g.jsx)(`span`,{title:e.path,children:e.name})]},e.id)),X.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`(还没有开发仓库)`})]}),(0,g.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,g.jsx)(`span`,{className:`rp-pick-group-label`,children:`看板(项目组)`}),Y.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!ze[`board:`+e.id],onChange:t=>Be(n=>({...n,[`board:`+e.id]:t.target.checked}))}),(0,g.jsx)(`span`,{title:e.desc||``,children:e.name})]},e.id)),Y.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`(还没有看板)`})]})]})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>Re(null),children:`取消`}),(0,g.jsx)(m,{onClick:dt,children:`保存绑定`})]})]})}):null,H?(0,g.jsx)(a,{title:`「${H.name}」的参考仓库`,onClose:()=>Ve(null),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsxs)(`div`,{className:`form-hint`,children:[`勾选 = 绑到「`,H.name,`」,取消 = 摘除。组级参考(绑在看板上)自动对该组所有成员生效,不在这里重复勾。`]}),(0,g.jsx)(`div`,{className:`rp-pick-list`,children:(0,g.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,g.jsx)(`span`,{className:`rp-pick-group-label`,children:`参考仓库`}),Z.map(e=>(0,g.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:!!He[e.key],onChange:t=>Ue(n=>({...n,[e.key]:t.target.checked}))}),(0,g.jsx)(`span`,{title:e.remote||``,children:e.name}),e.desc?(0,g.jsx)(`span`,{className:`muted rp-pick-desc`,children:e.desc}):null]},e.key)),Z.length?null:(0,g.jsx)(`span`,{className:`muted`,children:`(还没有参考仓库 —— 先在参考面板里克隆)`})]})})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>Ve(null),children:`取消`}),(0,g.jsx)(m,{onClick:ft,children:`保存绑定`})]})]})}):null,U?(0,g.jsx)(a,{title:`绑定描述 · ${U.ref.name} @ ${U.kind===`board`?`「`+U.targetName+`」`:U.targetName}`,onClose:()=>We(null),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsxs)(`label`,{htmlFor:`link-note`,children:[`「`,U.ref.name,`」`,U.kind===`board`?`在这个组里`:`在这个仓库里`,`参考什么`]}),(0,g.jsx)(`div`,{className:`form-hint`,children:`写这条参考在此处的角色与用法(可多行、可含关键路径/搜索词)。留空保存 = 清除。`}),(0,g.jsx)(`textarea`,{id:`link-note`,rows:5,spellCheck:`false`,placeholder:`如:project-graph 画布交互的实现参考;
10
10
  看 src/extensions/ 的注册方式,搜 registerExtension。`,value:Ge,onChange:e=>Ke(e.target.value)})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>We(null),children:`取消`}),(0,g.jsx)(m,{onClick:mt,children:`保存`})]})]})}):null,Ee?(0,g.jsx)(a,{title:`参考仓库存储根`,onClose:()=>De(!1),children:(0,g.jsxs)(`div`,{className:`form-grid`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`roots-ref`,children:`参考仓库存储根(gitRepoRoot)`}),(0,g.jsx)(`input`,{id:`roots-ref`,spellCheck:`false`,placeholder:`如 D:/gitrepo-ref(非 C 盘)`,value:Oe.gitRepoRoot,onChange:e=>ke(t=>({...t,gitRepoRoot:e.target.value}))}),(0,g.jsx)(`div`,{className:`form-hint`,children:`repo ref clone 的落盘位置。不设 = 克隆被拒绝。`})]}),(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{htmlFor:`roots-dev`,children:`开发仓库克隆根(gitDevRoot,可选)`}),(0,g.jsx)(`input`,{id:`roots-dev`,spellCheck:`false`,placeholder:`导入布局时开发仓库克隆到哪里`,value:Oe.gitDevRoot,onChange:e=>ke(t=>({...t,gitDevRoot:e.target.value}))})]}),(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>De(!1),children:`取消`}),(0,g.jsx)(m,{onClick:ot,children:`保存`})]})]})}):null,qe?(0,g.jsx)(te,{onClose:()=>Je(!1),onChanged:gt,repos:z,boards:Y}):null,tt?(0,g.jsx)(w,{repo:z.find(e=>e.id===tt.id)||tt,onClose:()=>nt(null),onSaved:K}):null,Ze&&W?(0,g.jsx)(a,{title:`对齐 remote · ${W.name}`,onClose:()=>Qe(!1),children:(0,g.jsxs)(`div`,{className:`form-grid`,"data-testid":`rp-remote-modal`,children:[(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsxs)(`div`,{className:`form-hint`,children:[`当前采纳:`,(0,g.jsx)(`b`,{children:W.current||`(无)`}),`。换一条即对齐(key 随之重算;自定义 key 不动)。`]}),(0,g.jsxs)(`div`,{className:`rp-remote-list`,children:[W.remotes.map(e=>(0,g.jsxs)(`div`,{className:`rp-remote-item`,children:[(0,g.jsx)(`span`,{className:`rp-remote-name`,children:e.name}),(0,g.jsx)(`span`,{className:`mono rp-remote-url`,children:e.url}),(0,g.jsx)(`span`,{className:`rp-remote-kind`,children:e.kind}),e.current?(0,g.jsx)(`span`,{className:`rp-remote-on`,children:`当前`}):null,(0,g.jsxs)(`span`,{className:`acts`,children:[e.current?null:(0,g.jsx)(m,{small:!0,onClick:()=>vt(e.url),children:`对齐这条`}),(0,g.jsx)(m,{small:!0,onClick:()=>yt(e.url),children:`检查`})]})]},e.name+`|`+e.url)),W.remotes.length?null:(0,g.jsx)(`div`,{className:`muted`,children:`这个仓库没有配置 remote —— 先在 git 里 git remote add`})]})]}),G?(0,g.jsxs)(`div`,{className:`form-field`,children:[(0,g.jsx)(`label`,{children:`存在性检查`}),(0,g.jsxs)(`div`,{className:`rp-remote-check`,children:[(0,g.jsx)(`span`,{className:`rp-status `+(G.status===`exists`?`same`:G.status===`missing`?`new`:G.status===`checking`?`checking`:`missing`),children:G.status===`exists`?`存在`:G.status===`missing`?`不存在`:G.status===`checking`?`检查中`:`不可达`}),(0,g.jsx)(`span`,{className:`mono rp-remote-url`,children:G.url}),(0,g.jsx)(`span`,{className:`muted`,children:G.detail})]})]}):null,(0,g.jsxs)(`div`,{className:`form-acts`,children:[(0,g.jsx)(m,{onClick:()=>Qe(!1),children:`关闭`}),(0,g.jsx)(m,{onClick:()=>yt(``),children:`检查当前 remote`})]})]})}):null,$e?(0,g.jsx)(d,{kind:$e.kind,owner:$e.owner,model:v.model,onClose:()=>et(null),onChanged:()=>{K(),it()}}):null,_]})}export{ae as default};
@@ -1 +1 @@
1
- import{S as e,v as t,y as n}from"./task-status-BP6y8MVu.js";import{n as r}from"./board-view-t8CKtq17.js";import{k as i,t as a}from"./index-B_HPAoNR.js";var o=e(n(),1);function s(e,t={}){if(!e||!e.view)return[];switch(e.view){case`dir`:{let n=[];return t.dirName&&n.push(t.dirName),e.task&&(/^draft/i.test(String(e.task))?n.push(`draft`):n.push(t.pageTitle||`#${e.task}`)),n}case`group`:if(e.task){let n=[t.boardName||`项目组`];return/^draft/i.test(String(e.task))?n.push(`draft`):n.push(t.pageTitle||`#${e.task}`),n}return t.boardName?[t.boardName]:[`项目组`];case`repos`:return[`仓库管理`];case`cloud`:return[`云端总览`];case`overview`:return[`全部目录总览`];case`templates`:return e.mode===`new`?[`新建模板`]:e.mode===`edit`?[`编辑模板`]:[`任务模板`];case`doc`:{let e=t.repoName||t.boardName||``;return e?[e]:[`文档`]}default:return[]}}function c(e){if(!e||!e.view)return``;switch(e.view){case`dir`:return e.task?`#/dir/${encodeURIComponent(e.key||``)}`:`#/overview`;case`group`:return e.task?`#/group/${encodeURIComponent(e.key||``)}`:`#/overview`;case`overview`:return``;case`doc`:return e.repoKey?`#/repos`:e.boardKey?`#/group/${encodeURIComponent(e.boardKey)}`:`#/repos`;default:return`#/overview`}}function l(e,t=[],n={}){if(!e)return{boardName:``,dirName:``,pageTitle:``};let i=(n.boards||[]).find(t=>t.id===e.key);if(e.view===`group`&&e.task){let a=r(t,n.boards||[],e.key,e.task);return{boardName:a.board&&a.board.name||i&&i.name||``,dirName:a.topic?a.topic.name:``,pageTitle:a.taskRow?`#${a.taskRow.id}`:``}}let a=(t||[]).find(t=>t.key===e.key),o=a&&e.task?(a.tasks||[]).find(t=>String(t.id)===String(e.task)):null;if(e.view===`doc`){let t=(n.repos||[]).find(t=>t.key===e.repoKey),r=(n.boards||[]).find(t=>t.id===e.boardKey||t.key===e.boardKey);return{boardName:e.boardName||r&&r.name||``,dirName:``,pageTitle:``,repoName:t&&t.name||``}}return{boardName:i&&i.name||``,dirName:a?a.name:``,pageTitle:o?`#${o.id}`:``}}var u=t();function d({route:e,ctx:t,onNavigate:n,onBack:r,inline:i=!1}){let a=(0,o.useMemo)(()=>s(e,t),[e,t]),l=(0,o.useMemo)(()=>c(e,t),[e,t]);if(!a.length)return null;let d=`nx-crumb`+(i?` nx-crumb-inline`:``),f=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`nx-crumb-br`,"aria-hidden":!0,children:`[`}),a.map((e,t)=>(0,u.jsxs)(`span`,{className:`nx-crumb-i`,children:[t>0?(0,u.jsx)(`span`,{className:`nx-crumb-sep`,children:`/`}):null,(0,u.jsx)(`span`,{className:`nx-crumb-t`,children:e})]},`${e}-${t}`)),(0,u.jsx)(`span`,{className:`nx-crumb-br`,"aria-hidden":!0,children:`]`})]});return l&&n?(0,u.jsx)(`nav`,{className:d,"aria-label":`当前位置`,children:(0,u.jsx)(`button`,{type:`button`,className:`nx-crumb-path`,title:`返回上一级`,"aria-label":`返回上一级(${a.join(` / `)})`,onClick:()=>r?r():n(l),children:f})}):(0,u.jsx)(`nav`,{className:d,"aria-label":`当前位置`,children:f})}function f(){let e=i()||{},t=e.route||{},n=e.rows||[],r=e.repoData||{},f=(0,o.useMemo)(()=>l(t,n,r),[t,n,r]);return(0,o.useMemo)(()=>s(t,f),[t,f]).length?(0,u.jsx)(d,{route:t,ctx:f,onNavigate:e.onNavigate,onBack:()=>{let n=a();if(n&&e.onNavigate){e.onNavigate(n);return}let r=c(t,f);r&&e.onNavigate&&e.onNavigate(r)},inline:!0}):null}export{f as t};
1
+ import{S as e,v as t,y as n}from"./task-status-BP6y8MVu.js";import{n as r}from"./board-view-t8CKtq17.js";import{k as i,t as a}from"./index-CLsU9Lad.js";var o=e(n(),1);function s(e,t={}){if(!e||!e.view)return[];switch(e.view){case`dir`:{let n=[];return t.dirName&&n.push(t.dirName),e.task&&(/^draft/i.test(String(e.task))?n.push(`draft`):n.push(t.pageTitle||`#${e.task}`)),n}case`group`:if(e.task){let n=[t.boardName||`项目组`];return/^draft/i.test(String(e.task))?n.push(`draft`):n.push(t.pageTitle||`#${e.task}`),n}return t.boardName?[t.boardName]:[`项目组`];case`repos`:return[`仓库管理`];case`cloud`:return[`云端总览`];case`overview`:return[`全部目录总览`];case`templates`:return e.mode===`new`?[`新建模板`]:e.mode===`edit`?[`编辑模板`]:[`任务模板`];case`doc`:{let e=t.repoName||t.boardName||``;return e?[e]:[`文档`]}default:return[]}}function c(e){if(!e||!e.view)return``;switch(e.view){case`dir`:return e.task?`#/dir/${encodeURIComponent(e.key||``)}`:`#/overview`;case`group`:return e.task?`#/group/${encodeURIComponent(e.key||``)}`:`#/overview`;case`overview`:return``;case`doc`:return e.repoKey?`#/repos`:e.boardKey?`#/group/${encodeURIComponent(e.boardKey)}`:`#/repos`;default:return`#/overview`}}function l(e,t=[],n={}){if(!e)return{boardName:``,dirName:``,pageTitle:``};let i=(n.boards||[]).find(t=>t.id===e.key);if(e.view===`group`&&e.task){let a=r(t,n.boards||[],e.key,e.task);return{boardName:a.board&&a.board.name||i&&i.name||``,dirName:a.topic?a.topic.name:``,pageTitle:a.taskRow?`#${a.taskRow.id}`:``}}let a=(t||[]).find(t=>t.key===e.key),o=a&&e.task?(a.tasks||[]).find(t=>String(t.id)===String(e.task)):null;if(e.view===`doc`){let t=(n.repos||[]).find(t=>t.key===e.repoKey),r=(n.boards||[]).find(t=>t.id===e.boardKey||t.key===e.boardKey);return{boardName:e.boardName||r&&r.name||``,dirName:``,pageTitle:``,repoName:t&&t.name||``}}return{boardName:i&&i.name||``,dirName:a?a.name:``,pageTitle:o?`#${o.id}`:``}}var u=t();function d({route:e,ctx:t,onNavigate:n,onBack:r,inline:i=!1}){let a=(0,o.useMemo)(()=>s(e,t),[e,t]),l=(0,o.useMemo)(()=>c(e,t),[e,t]);if(!a.length)return null;let d=`nx-crumb`+(i?` nx-crumb-inline`:``),f=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`nx-crumb-br`,"aria-hidden":!0,children:`[`}),a.map((e,t)=>(0,u.jsxs)(`span`,{className:`nx-crumb-i`,children:[t>0?(0,u.jsx)(`span`,{className:`nx-crumb-sep`,children:`/`}):null,(0,u.jsx)(`span`,{className:`nx-crumb-t`,children:e})]},`${e}-${t}`)),(0,u.jsx)(`span`,{className:`nx-crumb-br`,"aria-hidden":!0,children:`]`})]});return l&&n?(0,u.jsx)(`nav`,{className:d,"aria-label":`当前位置`,children:(0,u.jsx)(`button`,{type:`button`,className:`nx-crumb-path`,title:`返回上一级`,"aria-label":`返回上一级(${a.join(` / `)})`,onClick:()=>r?r():n(l),children:f})}):(0,u.jsx)(`nav`,{className:d,"aria-label":`当前位置`,children:f})}function f(){let e=i()||{},t=e.route||{},n=e.rows||[],r=e.repoData||{},f=(0,o.useMemo)(()=>l(t,n,r),[t,n,r]);return(0,o.useMemo)(()=>s(t,f),[t,f]).length?(0,u.jsx)(d,{route:t,ctx:f,onNavigate:e.onNavigate,onBack:()=>{let n=a();if(n&&e.onNavigate){e.onNavigate(n);return}let r=c(t,f);r&&e.onNavigate&&e.onNavigate(r)},inline:!0}):null}export{f as t};
@@ -1,4 +1,4 @@
1
- import{S as e,_ as t,f as n,g as r,p as i,v as a,y as o}from"./task-status-BP6y8MVu.js";import{k as s,n as c,o as l}from"./index-B_HPAoNR.js";import{t as u}from"./button-M9TUn-AR.js";var d=e(o(),1),f=Object.freeze([{id:`xml`,label:`XML 区块(默认)`,desc:`每段系统内容包进独立标签,agent 一眼分清任务原文与系统规则`},{id:`plain`,label:`正文直追加`,desc:`不包标签,按空行拼接(与改造前的 instruction 逐字一致)`}]),p=8e3,m=`builtin`,h=`系统内置`,g=`{{#if repo}},〔项目介绍 · {{repo.name}}〕({{repo.introPath}}):,{{repo.intro}},{{#if repo.docs}},项目补充文档(可直接读取):,{{#each repo.docs}}, - {{path}}{{#if tag}} [{{tag}}]{{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/if}},{{/if}},{{#if group}},〔项目组上下文 · {{group.name}}〕,{{#if group.desc}},组定位:{{group.desc}},{{/if}},{{#if group.intro}},组介绍({{group.introPath}}):,{{group.intro}},{{/if}},{{#if group.note}},本项目在组里的位置:{{group.note}},{{/if}},{{#if group.peers}},组内成员:,{{#each group.peers}}, - {{name}}:{{#if note}}{{note}}{{else}}(无组内描述){{/if}},{{/each}},{{/if}},{{#if group.docs}},组绑定参考文件(可直接读取):,{{#each group.docs}}, - {{path}}{{#if tag}} [{{tag}}]{{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/if}},{{/if}}`.split(`,`).join(`
1
+ import{S as e,_ as t,f as n,g as r,p as i,v as a,y as o}from"./task-status-BP6y8MVu.js";import{k as s,n as c,o as l}from"./index-CLsU9Lad.js";import{t as u}from"./button-M9TUn-AR.js";var d=e(o(),1),f=Object.freeze([{id:`xml`,label:`XML 区块(默认)`,desc:`每段系统内容包进独立标签,agent 一眼分清任务原文与系统规则`},{id:`plain`,label:`正文直追加`,desc:`不包标签,按空行拼接(与改造前的 instruction 逐字一致)`}]),p=8e3,m=`builtin`,h=`系统内置`,g=`{{#if repo}},〔项目介绍 · {{repo.name}}〕({{repo.introPath}}):,{{repo.intro}},{{#if repo.docs}},项目补充文档(可直接读取):,{{#each repo.docs}}, - {{path}}{{#if tag}} [{{tag}}]{{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/if}},{{/if}},{{#if group}},〔项目组上下文 · {{group.name}}〕,{{#if group.desc}},组定位:{{group.desc}},{{/if}},{{#if group.intro}},组介绍({{group.introPath}}):,{{group.intro}},{{/if}},{{#if group.note}},本项目在组里的位置:{{group.note}},{{/if}},{{#if group.peers}},组内成员:,{{#each group.peers}}, - {{name}}:{{#if note}}{{note}}{{else}}(无组内描述){{/if}},{{/each}},{{/if}},{{#if group.docs}},组绑定参考文件(可直接读取):,{{#each group.docs}}, - {{path}}{{#if tag}} [{{tag}}]{{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/if}},{{/if}}`.split(`,`).join(`
2
2
  `),_=[`{{#if attach}}`,`〔附件〕本任务包含 {{attach.count}} 个附件(正文内嵌 {{attach.inlineCount}} · 附件区 {{attach.areaCount}})。请先识别附件内容(图片先看图、文档先读内容)再开始处理,不要跳过附件。`,``,`附件清单:`,`{{#each attach.list}}`,` - [{{originLabel}}] {{kindLabel}} {{name}}{{#if sizeText}}({{sizeText}}){{/if}}:{{#if file}}{{#if file.exists}}{{file.localPath}}{{else}}未同步到本地(fileId {{file.fileId}}){{/if}}{{/if}}{{#if url}}{{url.href}}{{/if}}{{#if task}}{{#if task.resolved}}#{{task.seq}} {{task.title}} · 地址 {{task.address}}({{task.statusLabel}}){{else}}地址 {{task.address}}({{task.statusLabel}}){{/if}}{{/if}}{{#if ref}}{{ref.title}}{{#if ref.relPath}}({{ref.relPath}}){{/if}}{{/if}}`,`{{/each}}`,``,`取用方式:`,`{{#each attach.list}}`,` - {{kindLabel}} 《{{name}}》:{{usage}}`,`{{/each}}`,`{{#if attach.syncSummary}}`,`同步情况:{{attach.syncSummary.text}}`,`{{/if}}`,`{{/if}}`].join(`
3
3
  `),v=[`{{#if goal.check}}`,`{{goal.check}}`,`{{/if}}`,`{{#if goal.statusLine}}`,`{{goal.statusLine}}`,`{{/if}}`].join(`
4
4
  `),y=[`{{#if ext.count}}`,`本队列({{ext.topic}})还有 {{ext.count}} 条待领取任务:`,`{{#each ext.list}}`,` - #{{id}} {{title}}`,`{{/each}}`,`先完成当前任务,再领取下一条;不要因为后面还有活就提前收尾或分心。`,`{{/if}}`].join(`
@@ -1 +1 @@
1
- import{v as e}from"./task-status-BP6y8MVu.js";import{b as t,v as n,y as r}from"./index-B_HPAoNR.js";var i=e();function a({t:e,short:a=!1,className:o=``,title:s}){let c=t(e);return(0,i.jsx)(`span`,{className:`tstat tstat-`+c+(a?` tstat-short`:``)+(o?` `+o:``),title:s||(a?n(e):void 0),children:a?r(e):n(e)})}export{a as t};
1
+ import{v as e}from"./task-status-BP6y8MVu.js";import{b as t,v as n,y as r}from"./index-CLsU9Lad.js";var i=e();function a({t:e,short:a=!1,className:o=``,title:s}){let c=t(e);return(0,i.jsx)(`span`,{className:`tstat tstat-`+c+(a?` tstat-short`:``)+(o?` `+o:``),title:s||(a?n(e):void 0),children:a?r(e):n(e)})}export{a as t};
@@ -1,4 +1,4 @@
1
- import{S as e,_ as t,f as n,g as r,l as i,p as a,v as o,y as s}from"./task-status-BP6y8MVu.js";import{_ as c,c as l,d as u,f as d,g as f,h as p,i as m,p as ee,u as te,v as ne}from"./md-parse-C2bDc3IZ.js";import{n as h,t as g}from"./board-view-t8CKtq17.js";import{E as re,M as ie,O as ae,c as oe,d as se,f as ce,h as le,k as ue,l as de,m as fe,p as _,s as pe,u as me}from"./index-B_HPAoNR.js";import{o as he,t as ge}from"./md-panes-BvQXV_C9.js";import{t as _e}from"./status-tag-D4wxIj1q.js";import{a as ve,i as ye,n as be}from"./composer-launch-D-b7HKk5.js";import{t as xe}from"./route-crumb-C5LPu1Qx.js";import{i as Se,n as Ce,r as we,t as Te}from"./reopen-text-BylkngqC.js";import{n as Ee,u as De}from"./tool-bar-CHoZSF6T.js";import{i as Oe,n as ke,r as Ae,t as je}from"./md-history-Uo6U7hYS.js";var v=e(s(),1),y=/^>\s*\[![A-Za-z][\w-]*\][ \t]*(.*)$/,b=/完成总结/,x=/反馈/,S=/第\s*(\d+)\s*轮/;function C(e){let t=String(e??``).split(`
1
+ import{S as e,_ as t,f as n,g as r,l as i,p as a,v as o,y as s}from"./task-status-BP6y8MVu.js";import{_ as c,c as l,d as u,f as d,g as f,h as p,i as m,p as ee,u as te,v as ne}from"./md-parse-C2bDc3IZ.js";import{n as h,t as g}from"./board-view-t8CKtq17.js";import{E as re,M as ie,O as ae,c as oe,d as se,f as ce,h as le,k as ue,l as de,m as fe,p as _,s as pe,u as me}from"./index-CLsU9Lad.js";import{o as he,t as ge}from"./md-panes-DMs3KANu.js";import{t as _e}from"./status-tag-Bts7p2cp.js";import{a as ve,i as ye,n as be}from"./composer-launch-DOB0Hm0B.js";import{t as xe}from"./route-crumb-Cyesq6KK.js";import{i as Se,n as Ce,r as we,t as Te}from"./reopen-text-BylkngqC.js";import{n as Ee,u as De}from"./tool-bar-Bh3XH8MU.js";import{i as Oe,n as ke,r as Ae,t as je}from"./md-history-Uo6U7hYS.js";var v=e(s(),1),y=/^>\s*\[![A-Za-z][\w-]*\][ \t]*(.*)$/,b=/完成总结/,x=/反馈/,S=/第\s*(\d+)\s*轮/;function C(e){let t=String(e??``).split(`
2
2
  `),n=t.length&&String(t[0]).match(y);if(!n)return null;let r=t.slice(1).map(e=>e.replace(/^>[ \t]?/,``)).filter(e=>e.trim()!==``).join(`
3
3
  `);return{title:String(n[1]??``).trim(),body:r}}function Me(e){let t=l(String(e??``));if(!t.length)return[];let n=[],r=null,i=``;return t.forEach((e,t)=>{let a=String(e||``).trim(),o=C(a);if(o&&b.test(o.title)){let e=Number((o.title.match(S)||[])[1]);r={round:Number.isFinite(e)&&e>0?e:n.length+1,blockIndex:t,feedbackBlockIndex:-1,ackText:o.body,feedbackText:``},n.push(r),i=`ack`;return}if(a===`## 上一轮完成总结`){r={round:n.length+1,blockIndex:t,feedbackBlockIndex:-1,ackText:``,feedbackText:``},n.push(r),i=`ack`;return}if(o&&x.test(o.title)){r&&i===`ack`&&(r.feedbackBlockIndex=t,r.feedbackText=o.body,i=`feedback`);return}if(a===`## 验收反馈`){r&&i===`ack`&&(r.feedbackBlockIndex=t,i=`feedback`);return}a&&r&&(i===`ack`?r.ackText+=(r.ackText?`
4
4
  `:``)+a:r.feedbackText+=(r.feedbackText?`
@@ -1 +1 @@
1
- import{S as e,g as t,v as n,y as r}from"./task-status-BP6y8MVu.js";import{u as i}from"./md-parse-C2bDc3IZ.js";import{D as a,M as o,i as s,k as c,t as l}from"./index-B_HPAoNR.js";import{t as u}from"./md-panes-BvQXV_C9.js";import{t as d}from"./route-crumb-C5LPu1Qx.js";import{i as f,n as p,r as m,t as h}from"./md-history-Uo6U7hYS.js";var g=e(r(),1),_=n(),v=e=>`tpl:${e||`new`}`;function y({templateId:e,initialName:n,initialBody:r,isNew:a,onSave:o,onClose:s,busy:c}){let l=t(),[y,b]=(0,g.useState)(n||``),[x,S]=(0,g.useState)(r||``),[C,w]=(0,g.useState)(`split`),[T,E]=(0,g.useState)(!1),D=(0,g.useRef)(null),O=(0,g.useRef)(new Map),k=v(a?`new`:e),A=(0,g.useMemo)(()=>i(x||``),[x]),j=(e,t,n=`typing`)=>{p(O.current,k,{title:y,body:x},n),b(e),S(t),E(!0)},M=(e,t=`typing`)=>j(e,x,t),N=(e,t=`op`)=>j(y,e,t),P=()=>{let e=f(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},F=()=>{let e=m(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},I=async()=>{if(!(y||``).trim()){l(`模板名不能为空(标题即名称)`);return}await o({name:y.trim(),body:x}),h(O.current,k),E(!1)};return(0,_.jsx)(`div`,{className:`mdw mdw-tpl-edpage`,"data-mode":C,children:(0,_.jsxs)(`div`,{className:`mdw-main`,children:[(0,_.jsxs)(`div`,{className:`mdw-top`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`mdw-head`,children:[(0,_.jsx)(`div`,{className:`mdw-title`,children:a?`新建模板`:`编辑模板`}),(0,_.jsxs)(`div`,{className:`mdw-path`,children:[`任务模板`,y?` / ${y}`:``,T?` · 未保存`:``]})]})]}),(0,_.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,_.jsx)(`div`,{className:`mdw-toolbar-left`,children:(0,_.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`编辑模式`,children:[{id:`split`,label:`并排`},{id:`edit`,label:`源码`}].map(e=>(0,_.jsx)(`button`,{type:`button`,className:C===e.id?`on`:``,onClick:()=>w(e.id),children:e.label},e.id))})}),(0,_.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`模板操作`,children:[(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:c,onClick:s,children:`关闭`}),(0,_.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:c||!T,onClick:I,children:a?`创建`:`保存`})]})]}),(0,_.jsx)(u,{mode:C,title:y,body:x,previewHtml:A,onTitle:M,onBody:N,docKey:k,editorApiRef:D,onSave:I,onUndo:P,onRedo:F,attachments:[]})]})})}function b({config:e,model:n,tabId:r}){let i=c()||{},u=i.tpl,f=t(),[p,m]=(0,g.useState)(!1),h=e||{},v=(h.mode||(h.id?`edit`:``))===`new`,b=h.id||``,x=()=>{let e=l();if(e&&i.onNavigate){i.onNavigate(e);return}if(i.onNavigate){i.onNavigate(`#/overview`);return}if(n&&r)try{n.doAction(o.deleteTab(r))}catch{}};if(!u)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsx)(`div`,{className:`pad muted`,children:`模板服务未就绪 —— 面板还在装载。`})]});if(!v&&!b)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`pad stack`,children:[(0,_.jsx)(`div`,{children:`模板在「设置 → 任务模板」管理;这里只承载全屏编辑。`}),(0,_.jsx)(`div`,{children:(0,_.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>{n&&a(n,{component:`settings`,name:`设置`,config:{}}),x()},children:`打开设置`})})]})]});let S=v?null:(u.templates||[]).find(e=>e.id===b);if(!v&&!S)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`pad muted`,children:[`找不到模板「`,b,`」——可能已删除。`]})]});let C=async({name:e,body:t})=>{m(!0);try{if(v){let n={};Array.isArray(h.scope)&&(n.scope=h.scope),h.topic&&(n.topic=h.topic),await u.add(e,t,!1,n),f(`已创建模板`)}else await u.update(b,{name:e,body:t}),f(`已保存模板`);x()}catch(e){f(String(e.message||e))}finally{m(!1)}},w=v?h.name||``:S.name,T=v?``:s(S.body||``,S.values||{});return(0,_.jsx)(y,{templateId:b,initialName:w,initialBody:T,isNew:v,busy:p,onSave:C,onClose:x},v?`new:${h.topic||``}:${(h.scope||[]).join(`,`)}`:b)}export{b as default};
1
+ import{S as e,g as t,v as n,y as r}from"./task-status-BP6y8MVu.js";import{u as i}from"./md-parse-C2bDc3IZ.js";import{D as a,M as o,i as s,k as c,t as l}from"./index-CLsU9Lad.js";import{t as u}from"./md-panes-DMs3KANu.js";import{t as d}from"./route-crumb-Cyesq6KK.js";import{i as f,n as p,r as m,t as h}from"./md-history-Uo6U7hYS.js";var g=e(r(),1),_=n(),v=e=>`tpl:${e||`new`}`;function y({templateId:e,initialName:n,initialBody:r,isNew:a,onSave:o,onClose:s,busy:c}){let l=t(),[y,b]=(0,g.useState)(n||``),[x,S]=(0,g.useState)(r||``),[C,w]=(0,g.useState)(`split`),[T,E]=(0,g.useState)(!1),D=(0,g.useRef)(null),O=(0,g.useRef)(new Map),k=v(a?`new`:e),A=(0,g.useMemo)(()=>i(x||``),[x]),j=(e,t,n=`typing`)=>{p(O.current,k,{title:y,body:x},n),b(e),S(t),E(!0)},M=(e,t=`typing`)=>j(e,x,t),N=(e,t=`op`)=>j(y,e,t),P=()=>{let e=f(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},F=()=>{let e=m(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},I=async()=>{if(!(y||``).trim()){l(`模板名不能为空(标题即名称)`);return}await o({name:y.trim(),body:x}),h(O.current,k),E(!1)};return(0,_.jsx)(`div`,{className:`mdw mdw-tpl-edpage`,"data-mode":C,children:(0,_.jsxs)(`div`,{className:`mdw-main`,children:[(0,_.jsxs)(`div`,{className:`mdw-top`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`mdw-head`,children:[(0,_.jsx)(`div`,{className:`mdw-title`,children:a?`新建模板`:`编辑模板`}),(0,_.jsxs)(`div`,{className:`mdw-path`,children:[`任务模板`,y?` / ${y}`:``,T?` · 未保存`:``]})]})]}),(0,_.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,_.jsx)(`div`,{className:`mdw-toolbar-left`,children:(0,_.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`编辑模式`,children:[{id:`split`,label:`并排`},{id:`edit`,label:`源码`}].map(e=>(0,_.jsx)(`button`,{type:`button`,className:C===e.id?`on`:``,onClick:()=>w(e.id),children:e.label},e.id))})}),(0,_.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`模板操作`,children:[(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:c,onClick:s,children:`关闭`}),(0,_.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:c||!T,onClick:I,children:a?`创建`:`保存`})]})]}),(0,_.jsx)(u,{mode:C,title:y,body:x,previewHtml:A,onTitle:M,onBody:N,docKey:k,editorApiRef:D,onSave:I,onUndo:P,onRedo:F,attachments:[]})]})})}function b({config:e,model:n,tabId:r}){let i=c()||{},u=i.tpl,f=t(),[p,m]=(0,g.useState)(!1),h=e||{},v=(h.mode||(h.id?`edit`:``))===`new`,b=h.id||``,x=()=>{let e=l();if(e&&i.onNavigate){i.onNavigate(e);return}if(i.onNavigate){i.onNavigate(`#/overview`);return}if(n&&r)try{n.doAction(o.deleteTab(r))}catch{}};if(!u)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsx)(`div`,{className:`pad muted`,children:`模板服务未就绪 —— 面板还在装载。`})]});if(!v&&!b)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`pad stack`,children:[(0,_.jsx)(`div`,{children:`模板在「设置 → 任务模板」管理;这里只承载全屏编辑。`}),(0,_.jsx)(`div`,{children:(0,_.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>{n&&a(n,{component:`settings`,name:`设置`,config:{}}),x()},children:`打开设置`})})]})]});let S=v?null:(u.templates||[]).find(e=>e.id===b);if(!v&&!S)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(d,{}),(0,_.jsxs)(`div`,{className:`pad muted`,children:[`找不到模板「`,b,`」——可能已删除。`]})]});let C=async({name:e,body:t})=>{m(!0);try{if(v){let n={};Array.isArray(h.scope)&&(n.scope=h.scope),h.topic&&(n.topic=h.topic),await u.add(e,t,!1,n),f(`已创建模板`)}else await u.update(b,{name:e,body:t}),f(`已保存模板`);x()}catch(e){f(String(e.message||e))}finally{m(!1)}},w=v?h.name||``:S.name,T=v?``:s(S.body||``,S.values||{});return(0,_.jsx)(y,{templateId:b,initialName:w,initialBody:T,isNew:v,busy:p,onSave:C,onClose:x},v?`new:${h.topic||``}:${(h.scope||[]).join(`,`)}`:b)}export{b as default};
@@ -1 +1 @@
1
- import{S as e,g as t,l as n,v as r,y as i}from"./task-status-BP6y8MVu.js";import{N as a}from"./index-B_HPAoNR.js";import{a as o,c as s,i as c,n as l,r as u,s as d}from"./md-panes-BvQXV_C9.js";import{n as f,o as p}from"./upload-L1g-pfvZ.js";var m=e(i(),1),h=r(),g={position:(e,t)=>(e.position||0)-(t.position||0)||String(e.id).localeCompare(String(t.id)),name:(e,t)=>String(e.name||``).localeCompare(String(t.name||``)),kind:(e,t)=>String(e.kind).localeCompare(String(t.kind))||String(e.name||``).localeCompare(String(t.name||``))};function _({host:e=`task`,hostId:r,hostKey:i,hostCwd:a,refId:o,allow:c={file:!0,url:!0,task:!1,ref:!1},taskOptions:_=[],docOptions:y,disabled:b=!1,disabledText:x=`提交任务后可以在这里挂附件(当前是草稿)。`,openRef:S,onChanged:C,onOpenTask:w,onOpenDoc:T}){let E=t(),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(``),[N,P]=(0,m.useState)(!1),[F,I]=(0,m.useState)(!1),[L,R]=(0,m.useState)(!1),[z,B]=(0,m.useState)(`position`),[V,H]=(0,m.useState)(null),[U,W]=(0,m.useState)(!1),[G,K]=(0,m.useState)(null),q=(0,m.useMemo)(()=>d(e,{hostId:r,hostKey:i,hostCwd:a,refId:o}),[e,r,i,a,o]),J=(0,m.useCallback)(async()=>{if(b){O([]);return}A(!0),M(``);try{let e=await q.list();O((e.attachments||[]).map(s))}catch(e){M(String(e&&e.message||e))}finally{A(!1)}},[q,b]);(0,m.useEffect)(()=>{J()},[J]),(0,m.useImperativeHandle)(S,()=>({open:()=>P(!0),refresh:J}),[J]),(0,m.useEffect)(()=>{if(!G)return;let e=e=>{e.key===`Escape`&&K(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[G]);let Y=(0,m.useMemo)(()=>[...D].sort(g[z]||g.position),[D,z]),X=Y.filter(e=>e.area===`inline`),Z=Y.filter(e=>e.area===`area`),Q=async(e,t)=>{if(b)return;let n=f(t),r=n.length?n:[...e||[]].filter(e=>e&&e.size>0);if(!r.length)return;R(!0);let i=0;for(let e of r)try{let t=await p(e,{local:!0}),n=t.fileId||t.id;if(!n)throw Error(`上传未返回 fileId`);await q.attach({fileId:n,name:t.name}),i+=1}catch(t){E(`「${e.name||`文件`}」添加失败:${t&&t.message||t}`)}R(!1),i&&(E(`已挂到附件区 ${i} 个文件`),await J(),C?.())},$=async e=>{let t=V;if(t){W(!0);try{await q.detach(t.id,!!e),H(null),E(e?`已移除并删除资源:${t.name}`:`已解除关联:${t.name}`),await J(),C?.()}catch(e){E(`移除失败:${e&&e.message||e}`)}finally{W(!1)}}},ee=!k&&!j&&!D.length;return(0,h.jsxs)(`div`,{className:`att-area${b?` is-disabled`:``}`,onDragOver:e=>{!b&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),I(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||I(!1)},onDrop:e=>{I(!1),!b&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),Q(null,e))},children:[(0,h.jsxs)(`div`,{className:`att-area-head`+(F&&!b?` is-over`:``),children:[(0,h.jsxs)(`span`,{className:`att-area-title`,children:[`附件`,D.length?(0,h.jsx)(`span`,{className:`att-count`,children:D.length}):null,L?(0,h.jsx)(`span`,{className:`att-area-note`,children:`上传中…`}):null]}),(0,h.jsxs)(`span`,{className:`att-area-acts`,children:[D.length?(0,h.jsxs)(`select`,{className:`att-sort`,value:z,onChange:e=>B(e.target.value),"aria-label":`附件排序`,children:[(0,h.jsx)(`option`,{value:`position`,children:`按添加顺序`}),(0,h.jsx)(`option`,{value:`name`,children:`按名称`}),(0,h.jsx)(`option`,{value:`kind`,children:`按类型`})]}):null,(0,h.jsx)(`button`,{type:`button`,className:`btn ghost att-add-btn`,disabled:b,onClick:()=>P(!0),children:`添加附件`})]})]}),b?(0,h.jsx)(`div`,{className:`att-empty`,children:x}):null,k?(0,h.jsx)(`div`,{className:`att-empty`,children:`加载附件…`}):null,j?(0,h.jsxs)(`div`,{className:`att-empty att-err-text`,children:[`附件加载失败:`,j]}):null,ee?(0,h.jsx)(`div`,{className:`att-empty`,children:`还没有附件。拖文件到这里,或点「添加附件」——只挂附件区,不写正文。`}):null,X.length?(0,h.jsxs)(`div`,{className:`att-section`,children:[(0,h.jsxs)(`div`,{className:`att-section-head`,children:[u.inline,(0,h.jsx)(`span`,{className:`att-section-hint`,children:`正文里的引用,删正文行会跟着消失`})]}),X.map(e=>v(e,{onRemove:H,onPreview:K,onOpenTask:w,onOpenDoc:T,key:e.id}))]}):null,Z.length?(0,h.jsxs)(`div`,{className:`att-section`,children:[(0,h.jsxs)(`div`,{className:`att-section-head`,children:[u.area,(0,h.jsx)(`span`,{className:`att-section-hint`,children:`不依赖正文,删正文行也不会丢`})]}),Z.map(e=>v(e,{onRemove:H,onPreview:K,onOpenTask:w,onOpenDoc:T,key:e.id}))]}):null,(0,h.jsx)(l,{open:N,host:e,hostId:r,hostKey:i,hostCwd:a,refId:o,allow:c,taskOptions:_,docOptions:y,onClose:()=>P(!1),onDone:async()=>{await J(),C?.()}}),V?(0,h.jsx)(n,{title:`移除附件`,size:`sm`,busy:U,onClose:U?void 0:()=>H(null),footer:(0,h.jsxs)(`div`,{className:`att-foot`,children:[(0,h.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:U,onClick:()=>H(null),children:`取消`}),(0,h.jsx)(`button`,{type:`button`,className:`btn`,disabled:U,onClick:()=>$(!1),children:`只解除关联`}),(0,h.jsx)(`button`,{type:`button`,className:`btn danger`,disabled:U,onClick:()=>$(!0),children:V.kind===`file`?`连文件一起删`:`连资源一起删`})]}),children:(0,h.jsxs)(`div`,{className:`att-confirm`,children:[(0,h.jsx)(`div`,{className:`att-confirm-name`,children:V.name}),(0,h.jsxs)(`div`,{className:`att-confirm-text`,children:[`只解除关联:从这份`,e===`task`?`任务`:`文档`,`的附件清单里移除,资源仍留在孤儿池,可被重新挂载。 连资源一起删:在本机没有其它任务/文档引用它时,删除资源行(本机文件同时删字节);仍被引用时只解除关联。`]})]})}):null,G?(0,h.jsx)(`div`,{className:`att-lightbox`,role:`dialog`,"aria-label":`图片预览`,onMouseDown:e=>{e.target===e.currentTarget&&K(null)},children:(0,h.jsxs)(`div`,{className:`att-lightbox-card`,children:[(0,h.jsxs)(`div`,{className:`att-lightbox-head`,children:[(0,h.jsx)(`span`,{className:`att-lightbox-name`,children:G.name}),(0,h.jsx)(`a`,{className:`att-lightbox-open`,href:G.src,target:`_blank`,rel:`noreferrer`,children:`新窗口打开`}),(0,h.jsx)(`button`,{type:`button`,className:`pp-x`,"aria-label":`关闭`,onClick:()=>K(null),children:`×`})]}),(0,h.jsx)(`img`,{className:`att-lightbox-img`,src:G.src,alt:G.name})]})}):null]})}function v(e,{onRemove:t,onPreview:n,onOpenTask:r,onOpenDoc:i}){let a=e.kind===`image`?o(e.id):``;return(0,h.jsxs)(`div`,{className:`att-item att-kind-${e.kind}`,children:[e.kind===`image`?(0,h.jsx)(`button`,{type:`button`,className:`att-thumb`,onClick:()=>n({src:a,name:e.name}),title:`点击看大图`,children:(0,h.jsx)(`img`,{src:a,alt:e.name,loading:`lazy`})}):(0,h.jsx)(`span`,{className:`att-kind-badge`,children:c(e.kind)}),(0,h.jsxs)(`span`,{className:`att-item-main`,children:[e.kind===`task`?(0,h.jsx)(`button`,{type:`button`,className:`att-link`,title:`跳转到任务 #${e.targetSeq??``}`,onClick:()=>r?.({key:e.targetKey,seq:e.targetSeq}),children:e.name}):e.kind===`ref`?(0,h.jsx)(`button`,{type:`button`,className:`att-link`,title:e.locator||e.targetRef||`打开文档`,onClick:()=>i?.(e.locator||e.targetRef),children:e.name}):e.kind===`url`?(0,h.jsx)(`a`,{className:`att-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,children:e.name}):(0,h.jsx)(`span`,{className:`att-item-name`,title:e.name,children:e.name}),(0,h.jsxs)(`span`,{className:`att-item-meta`,children:[e.sizeText?(0,h.jsx)(`span`,{children:e.sizeText}):null,e.note?(0,h.jsx)(`span`,{className:`att-note`,children:e.note}):null]})]}),e.kind===`file`||e.kind===`image`?(0,h.jsxs)(`span`,{className:`att-item-acts`,children:[(0,h.jsx)(`a`,{className:`att-act`,href:o(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,h.jsx)(`a`,{className:`att-act`,href:o(e.id),download:e.name,children:`下载`})]}):null,(0,h.jsx)(`button`,{type:`button`,className:`att-x`,"aria-label":`移除 ${e.name}`,onClick:()=>t(e),children:`×`})]},e.id)}var y=a(),b=[{id:`new`,label:`+ 新建页`,section:`primary`,noHide:!0},{id:`tpl`,label:`模板`,section:`bar`},{id:`import`,label:`导入`,section:`bar`},{id:`progress`,label:`进程`,section:`bar`},{id:`orch`,label:`编排`,section:`bar`},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`deleted`,label:`已删除任务`,section:`more`},{id:`refs`,label:`查看列表`,section:`more`}],x=[{id:`new`,label:`+ 新增任务`,section:`primary`,noHide:!0},{id:`progress`,label:`进程`,section:`bar`},{id:`addMember`,label:`添加成员`,section:`bar`},{id:`orch`,label:`编排`,section:`bar`},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,section:`more`}],S=[{id:`new`,label:`新任务`,section:`primary`,noHide:!0},{id:`submit`,label:`提交`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,section:`more`,menuGroup:`edit`},{id:`img`,label:`插入图片`,section:`more`,menuGroup:`edit`},{id:`att`,label:`添加附件`,section:`more`,menuGroup:`edit`},{id:`import`,label:`导入`,section:`more`,menuGroup:`edit`},{id:`draft`,label:`存草稿`,section:`more`,menuGroup:`edit`},{id:`chain`,label:`任务链`,section:`more`,menuGroup:`task`},{id:`clone`,label:`克隆任务`,section:`more`,menuGroup:`task`},{id:`fork`,label:`Fork 任务`,section:`more`,menuGroup:`task`},{id:`complete`,label:`标为完成`,section:`more`,menuGroup:`task`},{id:`cancel-task`,label:`取消任务`,section:`more`,menuGroup:`task`,danger:!0},{id:`mark`,label:`评论`,section:`more`,menuGroup:`task`},{id:`delete`,label:`删除`,section:`more`,menuGroup:`task`,danger:!0},{id:`preview`,label:`预览提示词`,section:`more`,menuGroup:`view`},{id:`overview`,label:`总览`,section:`more`,menuGroup:`view`},{id:`prog`,label:`进程`,section:`more`,menuGroup:`view`},{id:`source`,label:`原文`,section:`more`,menuGroup:`view`},{id:`shortcuts`,label:`快捷键`,section:`more`,menuGroup:`view`}],C=[{id:`save`,label:`保存`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,section:`more`,menuGroup:`edit`},{id:`rename`,label:`重命名`,section:`more`,menuGroup:`doc`},{id:`delete`,label:`删除`,section:`more`,menuGroup:`doc`,danger:!0},{id:`list`,label:`文字列表`,section:`more`,menuGroup:`view`}],w=[{id:`add`,label:`登记仓库`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`boards`,label:`分组管理`,section:`more`,menuGroup:`manage`},{id:`refs`,label:`参考仓库管理`,section:`more`,menuGroup:`manage`},{id:`transfer`,label:`导入导出`,section:`more`,menuGroup:`manage`}],T=[{id:`edit`,label:`编辑`,section:`bar`},{id:`open`,label:`打开`,section:`bar`},{id:`del`,label:`删除`,section:`bar`,danger:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`getloop`,label:`持续 get…`,section:`more`,menuGroup:`repo`},{id:`remote`,label:`对齐 remote`,section:`more`,menuGroup:`repo`}],E={dir:Object.fromEntries(b.map(e=>[e.id,e])),group:Object.fromEntries(x.map(e=>[e.id,e])),task:Object.fromEntries(S.map(e=>[e.id,e])),doc:Object.fromEntries(C.map(e=>[e.id,e])),repos:Object.fromEntries(w.map(e=>[e.id,e])),"repos-row":Object.fromEntries(T.map(e=>[e.id,e]))};function D(e){return e===`group`?x:e===`task`?S:e===`doc`?C:e===`repos`?w:e===`repos-row`?T:b}function O(e,t){return E[e]&&E[e][t]||{}}function k(e,t){let n=O(e,t);return String(n.section||``).startsWith(`more`)||!!n.defaultInMore}function A(e,t){return O(e,t.id).noHide?!0:t.visible===void 0?!k(e,t.id):t.visible!==!1}function j(e,t){return t.id===`more`||O(e,t.id).noHide?!1:!A(e,t)}function M(e,t){let n=D(e),r=new Set(n.map(e=>e.id)),i=new Set,a=[];for(let n of t||[]){if(!n||!n.id||!r.has(n.id)||i.has(n.id))continue;i.add(n.id);let t=O(e,n.id);a.push(t.noHide?{...n,visible:!0}:n)}for(let t of n)i.has(t.id)||a.push({id:t.id,visible:t.noHide?!0:!k(e,t.id)});let o=a.findIndex(e=>e.id===`more`);if(o>=0&&o<a.length-1){let[t]=a.splice(o,1),n=a.length;for(let t=0;t<a.length;t++)if(k(e,a[t].id)&&!A(e,a[t])){n=t;break}a.splice(n,0,t)}return a}function N(e){return M(e,D(e).map(t=>({id:t.id,visible:t.noHide?!0:!k(e,t.id)})))}var P=e=>`nx-kv-tb-${e}`;function F(e){let[t,n]=(0,m.useState)(()=>{try{let t=JSON.parse(localStorage.getItem(P(e)));if(Array.isArray(t))return M(e,t)}catch{}return N(e)});return(0,m.useEffect)(()=>{try{localStorage.setItem(P(e),JSON.stringify(t))}catch{}},[t,e]),{layout:t,setLayout:n,resetLayout:()=>n(N(e))}}function I(e,t){return!!O(e,t).lockLast}function L(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function R(e,t,{id:n,anchorId:r=null,after:i=!1,visible:a}){let o=t.findIndex(e=>e.id===n);if(o<0||I(e,n))return t;let s={...t[o]};a!==void 0&&(s.visible=O(e,n).noHide?!0:!!a);let c=t.filter((e,t)=>t!==o),l;if(r===n)l=o;else if(r){let e=c.findIndex(e=>e.id===r);l=e<0?c.length:e+ +!!i}else{let e=c.findIndex(e=>e.id===`more`);l=e>=0?e:c.length}let u=c.findIndex(t=>I(e,t.id));u>=0&&l>u&&(l=u);let d=c.slice();return d.splice(l,0,s),d}function z(e,t,n,r){let i=t.filter(t=>A(e,t)&&!I(e,t.id)),a=i.findIndex(e=>e.id===n);if(a<0)return t;let o=a+r;if(o<0||o>=i.length)return t;let s=i[o];return R(e,t,{id:n,anchorId:s.id,after:r>0})}function B({kind:e,layout:t,setLayout:n,onClose:r}){let[i,a]=(0,m.useState)(()=>t.map(e=>({...e}))),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(null),u=(0,m.useRef)(null),d=i.filter(t=>A(e,t)),f=i.filter(t=>j(e,t)),p=d.filter(t=>!I(e,t.id)),g=()=>{let t=u.current;return t&&!I(e,t.id)?t:null},_=(t,n)=>{I(e,n.id)||(u.current={id:n.id,onBar:A(e,n)},l(n.id),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,n.id)))},v=()=>{u.current=null,l(null),s(null)},y=(t,n)=>{a(r=>R(e,r,{...n,id:t.id,visible:t.onBar===!1||n.visible}))},b=e=>{let t=e.clientY;for(let n of e.currentTarget.querySelectorAll(`[data-row-id]`)){let e=n.getBoundingClientRect();if(t<e.top)return{anchorId:n.dataset.rowId,after:!1};if(t<=e.bottom)return{anchorId:n.dataset.rowId,after:t>e.top+e.height/2}}return{anchorId:null,after:!1}},x=e=>{let t=g();if(!t)return;e.preventDefault();let n=b(e);s(n.anchorId?n.anchorId===t.id?null:`row:${n.anchorId}:${n.after?`after`:`before`}`:`zone:bar:end`)},S=e=>{e.preventDefault();let t=b(e),n=g();v(),n&&y(n,{anchorId:t.anchorId,after:t.after,visible:!0})},C=e=>{e.currentTarget.contains(e.relatedTarget)||s(e=>e&&e.startsWith(`zone:`)?null:e)},w=t=>{let n=g();n&&!O(e,n.id).noHide&&(t.preventDefault(),s(`menu`))},T=t=>{t.preventDefault();let n=g();v(),n&&!O(e,n.id).noHide&&a(e=>L(e,n.id,{visible:!1}))},E=e=>{e.currentTarget.contains(e.relatedTarget)||s(e=>e===`menu`?null:e)},D=e=>{let t=e.currentTarget.getBoundingClientRect();return(e.clientX-t.left)/(t.width||1)>.5},k=(e,t)=>{let n=g();n&&n.id!==e.id&&(t.preventDefault(),s(`chip:${e.id}:${D(t)?`after`:`before`}`))},M=(e,t)=>{let n=D(t);t.preventDefault();let r=g();v(),r&&y(r,{anchorId:e.id,after:n,visible:!0})},P=t=>{O(e,t).noHide||a(n=>{let r=n.find(e=>e.id===t);return L(n,t,{visible:!(r&&A(e,r))})})},F=(t,n)=>a(r=>z(e,r,t.id,n)),B=(e,t)=>{t.altKey&&(t.key===`ArrowUp`?(t.preventDefault(),F(e,-1)):t.key===`ArrowDown`&&(t.preventDefault(),F(e,1)))},V=()=>{n(i),r()},H=()=>a(N(e)),U=(t,n)=>{let r=o===`row:${t.id}:before`?` drop-before`:o===`row:${t.id}:after`?` drop-after`:``;return[`tlp-row`,n?``:`off`,I(e,t.id)?`lock`:``,c===t.id?`dragging`:``,r].filter(Boolean).join(` `)};return(0,h.jsxs)(`div`,{className:`tlp-panel`,role:`dialog`,"aria-label":`自定义工具栏`,children:[(0,h.jsxs)(`div`,{className:`tlp-head`,children:[(0,h.jsx)(`b`,{children:`自定义工具栏`}),(0,h.jsx)(`span`,{className:`tlp-head-sub`,children:`拖拽排序;关显隐 → 收入「更多」`})]}),(0,h.jsxs)(`div`,{className:`tlp-body`,children:[(0,h.jsxs)(`div`,{className:`tlp-section tlp-span`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`预览(可直接拖动这里的按钮排序)`}),(0,h.jsx)(`div`,{className:`tlp-preview`,role:`list`,"data-testid":`tlp-preview`,children:d.map(t=>{let n=o===`chip:${t.id}:before`?` drop-before`:o===`chip:${t.id}:after`?` drop-after`:``;return(0,h.jsx)(`span`,{className:[`tlp-chip`,O(e,t.id).section===`primary`?`primary`:``,c===t.id?`dragging`:``,n].filter(Boolean).join(` `),draggable:!I(e,t.id),role:`listitem`,onDragStart:e=>_(e,t),onDragEnd:v,onDragOver:e=>k(t,e),onDrop:e=>M(t,e),children:O(e,t.id).label||t.id},t.id)})})]}),(0,h.jsxs)(`div`,{className:`tlp-section`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`工具栏 · 拖进来即排序(行上/下半 = 前/后)`}),(0,h.jsxs)(`div`,{className:`tlp-list`+(o===`zone:bar:end`?` drop-on`:``),role:`list`,onDragOver:x,onDragLeave:C,onDrop:S,children:[p.length===0&&d.every(t=>I(e,t.id))?(0,h.jsx)(`div`,{className:`tlp-empty`,children:`空 —— 把「更多」里的项拖到这里`}):null,d.map(t=>{let n=O(e,t.id),r=p.findIndex(e=>e.id===t.id);return(0,h.jsxs)(`div`,{className:U(t,!0),draggable:!I(e,t.id),"data-row-id":t.id,tabIndex:I(e,t.id)?void 0:0,role:`listitem`,"aria-label":`${n.label||t.id}:拖动排序,Alt+上下换位`,onKeyDown:e=>B(t,e),onDragStart:e=>_(e,t),onDragEnd:v,children:[(0,h.jsx)(`span`,{className:`tlp-hnd`,title:I(e,t.id)?`锁定`:`拖动排序`,children:I(e,t.id)?`·`:`⋮⋮`}),(0,h.jsx)(`input`,{type:`checkbox`,checked:!0,disabled:!!n.noHide,onChange:()=>P(t.id),title:n.noHide?`不可隐藏`:`收入「更多」`}),(0,h.jsxs)(`span`,{className:`tlp-nm`,children:[n.label||t.id,n.noHide?(0,h.jsx)(`span`,{className:`tlp-sub`,children:`固定显示`}):null]}),I(e,t.id)?null:(0,h.jsxs)(`span`,{className:`tlp-acts`,children:[(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:r<=0,title:`上移`,onClick:()=>F(t,-1),children:`↑`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:r<0||r>=p.length-1,title:`下移`,onClick:()=>F(t,1),children:`↓`})]})]},t.id)})]})]}),(0,h.jsxs)(`div`,{className:`tlp-section`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`更多菜单(拖到上方 = 显示到工具栏;拖回这里 = 收入更多)`}),(0,h.jsxs)(`div`,{className:`tlp-list tlp-menu`+(o===`menu`?` dropping`:``),role:`list`,onDragOver:w,onDragLeave:E,onDrop:T,children:[f.map(t=>{let n=O(e,t.id);return(0,h.jsxs)(`div`,{className:U(t,!1),draggable:!0,role:`listitem`,onDragStart:e=>_(e,t),onDragEnd:v,children:[(0,h.jsx)(`span`,{className:`tlp-hnd`,title:`拖到上方工具栏 = 显示`,children:`⋮⋮`}),(0,h.jsx)(`input`,{type:`checkbox`,checked:!1,onChange:()=>P(t.id),title:`显示到工具栏`}),(0,h.jsx)(`span`,{className:`tlp-nm`,children:n.label||t.id})]},t.id)}),(0,h.jsx)(`div`,{className:`tlp-drop-hint`,role:`presentation`,children:o===`menu`?`松手 = 收入「更多」`:f.length?`把项拖到上方工具栏区域 = 显示到工具栏`:`工具栏上的按钮拖到这里即可收入「更多」`})]})]})]}),(0,h.jsxs)(`div`,{className:`tlp-foot`,children:[(0,h.jsx)(`span`,{className:`tlp-equiv`,children:`保存到本机 localStorage(每种工具区各存一份)`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:H,children:`恢复默认`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:r,children:`取消`}),(0,h.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:V,children:`保存`})]})]})}var V=`task`,H=[{id:`edit`,label:`编辑`},{id:`task`,label:`任务`},{id:`view`,label:`查看`}];function U(){let[e,t]=(0,m.useState)(!1),[n,r]=(0,m.useState)({x:0,y:0}),i=(0,m.useRef)(null),a=(0,m.useRef)(null);return(0,m.useEffect)(()=>{if(!e)return;let n=e=>{i.current?.contains(e.target)||a.current?.contains(e.target)||t(!1)};return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e]),{open:e,setOpen:t,pos:n,setPos:r,ref:i,menuRef:a}}function W({menu:e,className:t=``,style:n,children:r}){return e.open?(0,y.createPortal)((0,h.jsx)(`div`,{className:`mdw-fmt-menu${t?` ${t}`:``}`,role:`menu`,ref:e.menuRef,style:{position:`fixed`,...e.pos,...n},children:r}),document.body):null}function G(e,t,n=`left`){let r=t.currentTarget.getBoundingClientRect(),i=r.bottom+4;e.setPos(n===`left`?{left:r.left,top:i}:{left:`auto`,right:Math.max(8,window.innerWidth-r.right),top:i}),e.setOpen(e=>!e)}function K({mode:e,onMode:t,showMark:n,submitLabel:r,onNew:i,onSubmit:a,onChain:o,onPreview:s,onImg:c,onAtt:l,onImport:u,onClone:d,onFork:f,onComplete:p,onCancelTask:g,onMark:_,onDraft:v,onDelete:b,onOverview:x,onProg:S,onSource:C,onShortcuts:w,goalBadge:T,goalMenu:E}){let D=U(),{layout:k,setLayout:M}=F(V),[N,P]=(0,m.useState)(!1);(0,m.useEffect)(()=>{D.setOpen(!1)},[e]);let I={new:i&&{label:`新任务`,run:i},submit:{label:r||`提交`,run:a,primary:!0},mode:t&&{label:e===`edit`?`返回实时预览`:`源码模式`,hint:e===`edit`?`当前`:``,run:()=>t(e===`edit`?`split`:`edit`)},img:c&&{label:`插入图片`,run:c},att:l&&{label:`添加附件`,run:l},import:u&&e!==`split`&&{label:`导入`,run:u},draft:v&&e!==`split`&&{label:`存草稿`,run:v},chain:o&&{label:`任务链`,run:o},clone:d&&{label:`克隆任务`,run:d},fork:f&&{label:`Fork 任务`,run:f},complete:p&&{label:`标为完成`,run:p},"cancel-task":g&&{label:`取消任务`,run:g,danger:!0},mark:n&&_&&{label:`评论`,run:_},delete:b&&{label:`删除`,run:b,danger:!0},preview:s&&{label:`预览提示词`,run:s},overview:x&&{label:`总览`,run:x},prog:S&&{label:`进程`,run:S},source:C&&{label:`原文`,run:C},shortcuts:w&&{label:`快捷键`,run:w}},L=e=>e===`more`||!!I[e],R=k.filter(e=>A(V,e)&&L(e.id)),z=k.filter(e=>j(V,e)&&L(e.id)),K=e=>{I[e]?.run?.(),D.setOpen(!1)},q=e=>{if(e===`more`)return(0,h.jsx)(`div`,{className:`mdw-actions-more`,ref:D.ref,children:(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm${D.open?` on`:``}`,title:`更多操作`,"aria-expanded":D.open,"aria-haspopup":`menu`,onClick:e=>G(D,e,`right`),children:`更多`})},`more`);let t=I[e];return t?(0,h.jsx)(`button`,{type:`button`,className:t.primary?`btn sm primary`:`btn ghost sm`,onClick:()=>K(e),children:t.label},e):null},J=H.map(e=>({...e,items:z.filter(t=>O(V,t.id).menuGroup===e.id)})).filter(e=>e.items.length),Y=z.filter(e=>!O(V,e.id).menuGroup);return(0,h.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,h.jsx)(`div`,{className:`mdw-toolbar-left`,children:T&&(0,h.jsx)(`button`,{type:`button`,className:`mdw-goal-badge`,title:T.title,"aria-haspopup":`menu`,"aria-expanded":D.open,onClick:e=>G(D,e,`right`),children:T.label})}),(0,h.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`任务操作`,children:[R.map(e=>q(e.id)),(0,h.jsxs)(W,{menu:D,className:`mdw-act-menu`,children:[E,E&&(0,h.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),J.map(e=>(0,h.jsxs)(`div`,{className:`mdw-fmt-menu-group`,role:`group`,"aria-label":e.label,children:[(0,h.jsx)(`div`,{className:`mdw-fmt-menu-cap`,children:e.label}),e.items.map(e=>{let t=I[e.id],n=t?.danger||O(V,e.id).danger;return(0,h.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(n?` danger`:``),onClick:()=>K(e.id),children:[t?.label||O(V,e.id).label||e.id,t?.hint?(0,h.jsx)(`span`,{className:`hint`,children:t.hint}):null]},e.id)})]},e.id)),Y.map(e=>{let t=I[e.id];return(0,h.jsx)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(t?.danger||O(V,e.id).danger?` danger`:``),onClick:()=>K(e.id),children:t?.label||O(V,e.id).label||e.id},e.id)}),(0,h.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),(0,h.jsx)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`,onClick:()=>{D.setOpen(!1),P(!0)},children:`自定义工具栏…`})]})]}),N&&(0,y.createPortal)((0,h.jsx)(`div`,{className:`ta-panel-mask`,onClick:()=>P(!1),children:(0,h.jsx)(`div`,{className:`ta-panel-wrap`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(B,{kind:V,layout:k,setLayout:M,onClose:()=>P(!1)})})}),document.body)]})}export{B as a,O as c,U as i,A as l,K as n,F as o,G as r,j as s,W as t,_ as u};
1
+ import{S as e,g as t,l as n,v as r,y as i}from"./task-status-BP6y8MVu.js";import{N as a}from"./index-CLsU9Lad.js";import{a as o,c as s,i as c,n as l,r as u,s as d}from"./md-panes-DMs3KANu.js";import{n as f,o as p}from"./upload-L1g-pfvZ.js";var m=e(i(),1),h=r(),g={position:(e,t)=>(e.position||0)-(t.position||0)||String(e.id).localeCompare(String(t.id)),name:(e,t)=>String(e.name||``).localeCompare(String(t.name||``)),kind:(e,t)=>String(e.kind).localeCompare(String(t.kind))||String(e.name||``).localeCompare(String(t.name||``))};function _({host:e=`task`,hostId:r,hostKey:i,hostCwd:a,refId:o,allow:c={file:!0,url:!0,task:!1,ref:!1},taskOptions:_=[],docOptions:y,disabled:b=!1,disabledText:x=`提交任务后可以在这里挂附件(当前是草稿)。`,openRef:S,onChanged:C,onOpenTask:w,onOpenDoc:T}){let E=t(),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(``),[N,P]=(0,m.useState)(!1),[F,I]=(0,m.useState)(!1),[L,R]=(0,m.useState)(!1),[z,B]=(0,m.useState)(`position`),[V,H]=(0,m.useState)(null),[U,W]=(0,m.useState)(!1),[G,K]=(0,m.useState)(null),q=(0,m.useMemo)(()=>d(e,{hostId:r,hostKey:i,hostCwd:a,refId:o}),[e,r,i,a,o]),J=(0,m.useCallback)(async()=>{if(b){O([]);return}A(!0),M(``);try{let e=await q.list();O((e.attachments||[]).map(s))}catch(e){M(String(e&&e.message||e))}finally{A(!1)}},[q,b]);(0,m.useEffect)(()=>{J()},[J]),(0,m.useImperativeHandle)(S,()=>({open:()=>P(!0),refresh:J}),[J]),(0,m.useEffect)(()=>{if(!G)return;let e=e=>{e.key===`Escape`&&K(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[G]);let Y=(0,m.useMemo)(()=>[...D].sort(g[z]||g.position),[D,z]),X=Y.filter(e=>e.area===`inline`),Z=Y.filter(e=>e.area===`area`),Q=async(e,t)=>{if(b)return;let n=f(t),r=n.length?n:[...e||[]].filter(e=>e&&e.size>0);if(!r.length)return;R(!0);let i=0;for(let e of r)try{let t=await p(e,{local:!0}),n=t.fileId||t.id;if(!n)throw Error(`上传未返回 fileId`);await q.attach({fileId:n,name:t.name}),i+=1}catch(t){E(`「${e.name||`文件`}」添加失败:${t&&t.message||t}`)}R(!1),i&&(E(`已挂到附件区 ${i} 个文件`),await J(),C?.())},$=async e=>{let t=V;if(t){W(!0);try{await q.detach(t.id,!!e),H(null),E(e?`已移除并删除资源:${t.name}`:`已解除关联:${t.name}`),await J(),C?.()}catch(e){E(`移除失败:${e&&e.message||e}`)}finally{W(!1)}}},ee=!k&&!j&&!D.length;return(0,h.jsxs)(`div`,{className:`att-area${b?` is-disabled`:``}`,onDragOver:e=>{!b&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),I(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||I(!1)},onDrop:e=>{I(!1),!b&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),Q(null,e))},children:[(0,h.jsxs)(`div`,{className:`att-area-head`+(F&&!b?` is-over`:``),children:[(0,h.jsxs)(`span`,{className:`att-area-title`,children:[`附件`,D.length?(0,h.jsx)(`span`,{className:`att-count`,children:D.length}):null,L?(0,h.jsx)(`span`,{className:`att-area-note`,children:`上传中…`}):null]}),(0,h.jsxs)(`span`,{className:`att-area-acts`,children:[D.length?(0,h.jsxs)(`select`,{className:`att-sort`,value:z,onChange:e=>B(e.target.value),"aria-label":`附件排序`,children:[(0,h.jsx)(`option`,{value:`position`,children:`按添加顺序`}),(0,h.jsx)(`option`,{value:`name`,children:`按名称`}),(0,h.jsx)(`option`,{value:`kind`,children:`按类型`})]}):null,(0,h.jsx)(`button`,{type:`button`,className:`btn ghost att-add-btn`,disabled:b,onClick:()=>P(!0),children:`添加附件`})]})]}),b?(0,h.jsx)(`div`,{className:`att-empty`,children:x}):null,k?(0,h.jsx)(`div`,{className:`att-empty`,children:`加载附件…`}):null,j?(0,h.jsxs)(`div`,{className:`att-empty att-err-text`,children:[`附件加载失败:`,j]}):null,ee?(0,h.jsx)(`div`,{className:`att-empty`,children:`还没有附件。拖文件到这里,或点「添加附件」——只挂附件区,不写正文。`}):null,X.length?(0,h.jsxs)(`div`,{className:`att-section`,children:[(0,h.jsxs)(`div`,{className:`att-section-head`,children:[u.inline,(0,h.jsx)(`span`,{className:`att-section-hint`,children:`正文里的引用,删正文行会跟着消失`})]}),X.map(e=>v(e,{onRemove:H,onPreview:K,onOpenTask:w,onOpenDoc:T,key:e.id}))]}):null,Z.length?(0,h.jsxs)(`div`,{className:`att-section`,children:[(0,h.jsxs)(`div`,{className:`att-section-head`,children:[u.area,(0,h.jsx)(`span`,{className:`att-section-hint`,children:`不依赖正文,删正文行也不会丢`})]}),Z.map(e=>v(e,{onRemove:H,onPreview:K,onOpenTask:w,onOpenDoc:T,key:e.id}))]}):null,(0,h.jsx)(l,{open:N,host:e,hostId:r,hostKey:i,hostCwd:a,refId:o,allow:c,taskOptions:_,docOptions:y,onClose:()=>P(!1),onDone:async()=>{await J(),C?.()}}),V?(0,h.jsx)(n,{title:`移除附件`,size:`sm`,busy:U,onClose:U?void 0:()=>H(null),footer:(0,h.jsxs)(`div`,{className:`att-foot`,children:[(0,h.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:U,onClick:()=>H(null),children:`取消`}),(0,h.jsx)(`button`,{type:`button`,className:`btn`,disabled:U,onClick:()=>$(!1),children:`只解除关联`}),(0,h.jsx)(`button`,{type:`button`,className:`btn danger`,disabled:U,onClick:()=>$(!0),children:V.kind===`file`?`连文件一起删`:`连资源一起删`})]}),children:(0,h.jsxs)(`div`,{className:`att-confirm`,children:[(0,h.jsx)(`div`,{className:`att-confirm-name`,children:V.name}),(0,h.jsxs)(`div`,{className:`att-confirm-text`,children:[`只解除关联:从这份`,e===`task`?`任务`:`文档`,`的附件清单里移除,资源仍留在孤儿池,可被重新挂载。 连资源一起删:在本机没有其它任务/文档引用它时,删除资源行(本机文件同时删字节);仍被引用时只解除关联。`]})]})}):null,G?(0,h.jsx)(`div`,{className:`att-lightbox`,role:`dialog`,"aria-label":`图片预览`,onMouseDown:e=>{e.target===e.currentTarget&&K(null)},children:(0,h.jsxs)(`div`,{className:`att-lightbox-card`,children:[(0,h.jsxs)(`div`,{className:`att-lightbox-head`,children:[(0,h.jsx)(`span`,{className:`att-lightbox-name`,children:G.name}),(0,h.jsx)(`a`,{className:`att-lightbox-open`,href:G.src,target:`_blank`,rel:`noreferrer`,children:`新窗口打开`}),(0,h.jsx)(`button`,{type:`button`,className:`pp-x`,"aria-label":`关闭`,onClick:()=>K(null),children:`×`})]}),(0,h.jsx)(`img`,{className:`att-lightbox-img`,src:G.src,alt:G.name})]})}):null]})}function v(e,{onRemove:t,onPreview:n,onOpenTask:r,onOpenDoc:i}){let a=e.kind===`image`?o(e.id):``;return(0,h.jsxs)(`div`,{className:`att-item att-kind-${e.kind}`,children:[e.kind===`image`?(0,h.jsx)(`button`,{type:`button`,className:`att-thumb`,onClick:()=>n({src:a,name:e.name}),title:`点击看大图`,children:(0,h.jsx)(`img`,{src:a,alt:e.name,loading:`lazy`})}):(0,h.jsx)(`span`,{className:`att-kind-badge`,children:c(e.kind)}),(0,h.jsxs)(`span`,{className:`att-item-main`,children:[e.kind===`task`?(0,h.jsx)(`button`,{type:`button`,className:`att-link`,title:`跳转到任务 #${e.targetSeq??``}`,onClick:()=>r?.({key:e.targetKey,seq:e.targetSeq}),children:e.name}):e.kind===`ref`?(0,h.jsx)(`button`,{type:`button`,className:`att-link`,title:e.locator||e.targetRef||`打开文档`,onClick:()=>i?.(e.locator||e.targetRef),children:e.name}):e.kind===`url`?(0,h.jsx)(`a`,{className:`att-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,children:e.name}):(0,h.jsx)(`span`,{className:`att-item-name`,title:e.name,children:e.name}),(0,h.jsxs)(`span`,{className:`att-item-meta`,children:[e.sizeText?(0,h.jsx)(`span`,{children:e.sizeText}):null,e.note?(0,h.jsx)(`span`,{className:`att-note`,children:e.note}):null]})]}),e.kind===`file`||e.kind===`image`?(0,h.jsxs)(`span`,{className:`att-item-acts`,children:[(0,h.jsx)(`a`,{className:`att-act`,href:o(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,h.jsx)(`a`,{className:`att-act`,href:o(e.id),download:e.name,children:`下载`})]}):null,(0,h.jsx)(`button`,{type:`button`,className:`att-x`,"aria-label":`移除 ${e.name}`,onClick:()=>t(e),children:`×`})]},e.id)}var y=a(),b=[{id:`new`,label:`+ 新建页`,section:`primary`,noHide:!0},{id:`tpl`,label:`模板`,section:`bar`},{id:`import`,label:`导入`,section:`bar`},{id:`progress`,label:`进程`,section:`bar`},{id:`orch`,label:`编排`,section:`bar`},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`deleted`,label:`已删除任务`,section:`more`},{id:`refs`,label:`查看列表`,section:`more`}],x=[{id:`new`,label:`+ 新增任务`,section:`primary`,noHide:!0},{id:`progress`,label:`进程`,section:`bar`},{id:`addMember`,label:`添加成员`,section:`bar`},{id:`orch`,label:`编排`,section:`bar`},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`refs`,label:`查看列表`,section:`more`}],S=[{id:`new`,label:`新任务`,section:`primary`,noHide:!0},{id:`submit`,label:`提交`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,section:`more`,menuGroup:`edit`},{id:`img`,label:`插入图片`,section:`more`,menuGroup:`edit`},{id:`att`,label:`添加附件`,section:`more`,menuGroup:`edit`},{id:`import`,label:`导入`,section:`more`,menuGroup:`edit`},{id:`draft`,label:`存草稿`,section:`more`,menuGroup:`edit`},{id:`chain`,label:`任务链`,section:`more`,menuGroup:`task`},{id:`clone`,label:`克隆任务`,section:`more`,menuGroup:`task`},{id:`fork`,label:`Fork 任务`,section:`more`,menuGroup:`task`},{id:`complete`,label:`标为完成`,section:`more`,menuGroup:`task`},{id:`cancel-task`,label:`取消任务`,section:`more`,menuGroup:`task`,danger:!0},{id:`mark`,label:`评论`,section:`more`,menuGroup:`task`},{id:`delete`,label:`删除`,section:`more`,menuGroup:`task`,danger:!0},{id:`preview`,label:`预览提示词`,section:`more`,menuGroup:`view`},{id:`overview`,label:`总览`,section:`more`,menuGroup:`view`},{id:`prog`,label:`进程`,section:`more`,menuGroup:`view`},{id:`source`,label:`原文`,section:`more`,menuGroup:`view`},{id:`shortcuts`,label:`快捷键`,section:`more`,menuGroup:`view`}],C=[{id:`save`,label:`保存`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`mode`,label:`源码模式`,section:`more`,menuGroup:`edit`},{id:`rename`,label:`重命名`,section:`more`,menuGroup:`doc`},{id:`delete`,label:`删除`,section:`more`,menuGroup:`doc`,danger:!0},{id:`list`,label:`文字列表`,section:`more`,menuGroup:`view`}],w=[{id:`add`,label:`登记仓库`,section:`primary`,noHide:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`boards`,label:`分组管理`,section:`more`,menuGroup:`manage`},{id:`refs`,label:`参考仓库管理`,section:`more`,menuGroup:`manage`},{id:`transfer`,label:`导入导出`,section:`more`,menuGroup:`manage`}],T=[{id:`edit`,label:`编辑`,section:`bar`},{id:`open`,label:`打开`,section:`bar`},{id:`del`,label:`删除`,section:`bar`,danger:!0},{id:`more`,label:`更多`,section:`bar`,noHide:!0},{id:`getloop`,label:`持续 get…`,section:`more`,menuGroup:`repo`},{id:`remote`,label:`对齐 remote`,section:`more`,menuGroup:`repo`}],E={dir:Object.fromEntries(b.map(e=>[e.id,e])),group:Object.fromEntries(x.map(e=>[e.id,e])),task:Object.fromEntries(S.map(e=>[e.id,e])),doc:Object.fromEntries(C.map(e=>[e.id,e])),repos:Object.fromEntries(w.map(e=>[e.id,e])),"repos-row":Object.fromEntries(T.map(e=>[e.id,e]))};function D(e){return e===`group`?x:e===`task`?S:e===`doc`?C:e===`repos`?w:e===`repos-row`?T:b}function O(e,t){return E[e]&&E[e][t]||{}}function k(e,t){let n=O(e,t);return String(n.section||``).startsWith(`more`)||!!n.defaultInMore}function A(e,t){return O(e,t.id).noHide?!0:t.visible===void 0?!k(e,t.id):t.visible!==!1}function j(e,t){return t.id===`more`||O(e,t.id).noHide?!1:!A(e,t)}function M(e,t){let n=D(e),r=new Set(n.map(e=>e.id)),i=new Set,a=[];for(let n of t||[]){if(!n||!n.id||!r.has(n.id)||i.has(n.id))continue;i.add(n.id);let t=O(e,n.id);a.push(t.noHide?{...n,visible:!0}:n)}for(let t of n)i.has(t.id)||a.push({id:t.id,visible:t.noHide?!0:!k(e,t.id)});let o=a.findIndex(e=>e.id===`more`);if(o>=0&&o<a.length-1){let[t]=a.splice(o,1),n=a.length;for(let t=0;t<a.length;t++)if(k(e,a[t].id)&&!A(e,a[t])){n=t;break}a.splice(n,0,t)}return a}function N(e){return M(e,D(e).map(t=>({id:t.id,visible:t.noHide?!0:!k(e,t.id)})))}var P=e=>`nx-kv-tb-${e}`;function F(e){let[t,n]=(0,m.useState)(()=>{try{let t=JSON.parse(localStorage.getItem(P(e)));if(Array.isArray(t))return M(e,t)}catch{}return N(e)});return(0,m.useEffect)(()=>{try{localStorage.setItem(P(e),JSON.stringify(t))}catch{}},[t,e]),{layout:t,setLayout:n,resetLayout:()=>n(N(e))}}function I(e,t){return!!O(e,t).lockLast}function L(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function R(e,t,{id:n,anchorId:r=null,after:i=!1,visible:a}){let o=t.findIndex(e=>e.id===n);if(o<0||I(e,n))return t;let s={...t[o]};a!==void 0&&(s.visible=O(e,n).noHide?!0:!!a);let c=t.filter((e,t)=>t!==o),l;if(r===n)l=o;else if(r){let e=c.findIndex(e=>e.id===r);l=e<0?c.length:e+ +!!i}else{let e=c.findIndex(e=>e.id===`more`);l=e>=0?e:c.length}let u=c.findIndex(t=>I(e,t.id));u>=0&&l>u&&(l=u);let d=c.slice();return d.splice(l,0,s),d}function z(e,t,n,r){let i=t.filter(t=>A(e,t)&&!I(e,t.id)),a=i.findIndex(e=>e.id===n);if(a<0)return t;let o=a+r;if(o<0||o>=i.length)return t;let s=i[o];return R(e,t,{id:n,anchorId:s.id,after:r>0})}function B({kind:e,layout:t,setLayout:n,onClose:r}){let[i,a]=(0,m.useState)(()=>t.map(e=>({...e}))),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(null),u=(0,m.useRef)(null),d=i.filter(t=>A(e,t)),f=i.filter(t=>j(e,t)),p=d.filter(t=>!I(e,t.id)),g=()=>{let t=u.current;return t&&!I(e,t.id)?t:null},_=(t,n)=>{I(e,n.id)||(u.current={id:n.id,onBar:A(e,n)},l(n.id),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,n.id)))},v=()=>{u.current=null,l(null),s(null)},y=(t,n)=>{a(r=>R(e,r,{...n,id:t.id,visible:t.onBar===!1||n.visible}))},b=e=>{let t=e.clientY;for(let n of e.currentTarget.querySelectorAll(`[data-row-id]`)){let e=n.getBoundingClientRect();if(t<e.top)return{anchorId:n.dataset.rowId,after:!1};if(t<=e.bottom)return{anchorId:n.dataset.rowId,after:t>e.top+e.height/2}}return{anchorId:null,after:!1}},x=e=>{let t=g();if(!t)return;e.preventDefault();let n=b(e);s(n.anchorId?n.anchorId===t.id?null:`row:${n.anchorId}:${n.after?`after`:`before`}`:`zone:bar:end`)},S=e=>{e.preventDefault();let t=b(e),n=g();v(),n&&y(n,{anchorId:t.anchorId,after:t.after,visible:!0})},C=e=>{e.currentTarget.contains(e.relatedTarget)||s(e=>e&&e.startsWith(`zone:`)?null:e)},w=t=>{let n=g();n&&!O(e,n.id).noHide&&(t.preventDefault(),s(`menu`))},T=t=>{t.preventDefault();let n=g();v(),n&&!O(e,n.id).noHide&&a(e=>L(e,n.id,{visible:!1}))},E=e=>{e.currentTarget.contains(e.relatedTarget)||s(e=>e===`menu`?null:e)},D=e=>{let t=e.currentTarget.getBoundingClientRect();return(e.clientX-t.left)/(t.width||1)>.5},k=(e,t)=>{let n=g();n&&n.id!==e.id&&(t.preventDefault(),s(`chip:${e.id}:${D(t)?`after`:`before`}`))},M=(e,t)=>{let n=D(t);t.preventDefault();let r=g();v(),r&&y(r,{anchorId:e.id,after:n,visible:!0})},P=t=>{O(e,t).noHide||a(n=>{let r=n.find(e=>e.id===t);return L(n,t,{visible:!(r&&A(e,r))})})},F=(t,n)=>a(r=>z(e,r,t.id,n)),B=(e,t)=>{t.altKey&&(t.key===`ArrowUp`?(t.preventDefault(),F(e,-1)):t.key===`ArrowDown`&&(t.preventDefault(),F(e,1)))},V=()=>{n(i),r()},H=()=>a(N(e)),U=(t,n)=>{let r=o===`row:${t.id}:before`?` drop-before`:o===`row:${t.id}:after`?` drop-after`:``;return[`tlp-row`,n?``:`off`,I(e,t.id)?`lock`:``,c===t.id?`dragging`:``,r].filter(Boolean).join(` `)};return(0,h.jsxs)(`div`,{className:`tlp-panel`,role:`dialog`,"aria-label":`自定义工具栏`,children:[(0,h.jsxs)(`div`,{className:`tlp-head`,children:[(0,h.jsx)(`b`,{children:`自定义工具栏`}),(0,h.jsx)(`span`,{className:`tlp-head-sub`,children:`拖拽排序;关显隐 → 收入「更多」`})]}),(0,h.jsxs)(`div`,{className:`tlp-body`,children:[(0,h.jsxs)(`div`,{className:`tlp-section tlp-span`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`预览(可直接拖动这里的按钮排序)`}),(0,h.jsx)(`div`,{className:`tlp-preview`,role:`list`,"data-testid":`tlp-preview`,children:d.map(t=>{let n=o===`chip:${t.id}:before`?` drop-before`:o===`chip:${t.id}:after`?` drop-after`:``;return(0,h.jsx)(`span`,{className:[`tlp-chip`,O(e,t.id).section===`primary`?`primary`:``,c===t.id?`dragging`:``,n].filter(Boolean).join(` `),draggable:!I(e,t.id),role:`listitem`,onDragStart:e=>_(e,t),onDragEnd:v,onDragOver:e=>k(t,e),onDrop:e=>M(t,e),children:O(e,t.id).label||t.id},t.id)})})]}),(0,h.jsxs)(`div`,{className:`tlp-section`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`工具栏 · 拖进来即排序(行上/下半 = 前/后)`}),(0,h.jsxs)(`div`,{className:`tlp-list`+(o===`zone:bar:end`?` drop-on`:``),role:`list`,onDragOver:x,onDragLeave:C,onDrop:S,children:[p.length===0&&d.every(t=>I(e,t.id))?(0,h.jsx)(`div`,{className:`tlp-empty`,children:`空 —— 把「更多」里的项拖到这里`}):null,d.map(t=>{let n=O(e,t.id),r=p.findIndex(e=>e.id===t.id);return(0,h.jsxs)(`div`,{className:U(t,!0),draggable:!I(e,t.id),"data-row-id":t.id,tabIndex:I(e,t.id)?void 0:0,role:`listitem`,"aria-label":`${n.label||t.id}:拖动排序,Alt+上下换位`,onKeyDown:e=>B(t,e),onDragStart:e=>_(e,t),onDragEnd:v,children:[(0,h.jsx)(`span`,{className:`tlp-hnd`,title:I(e,t.id)?`锁定`:`拖动排序`,children:I(e,t.id)?`·`:`⋮⋮`}),(0,h.jsx)(`input`,{type:`checkbox`,checked:!0,disabled:!!n.noHide,onChange:()=>P(t.id),title:n.noHide?`不可隐藏`:`收入「更多」`}),(0,h.jsxs)(`span`,{className:`tlp-nm`,children:[n.label||t.id,n.noHide?(0,h.jsx)(`span`,{className:`tlp-sub`,children:`固定显示`}):null]}),I(e,t.id)?null:(0,h.jsxs)(`span`,{className:`tlp-acts`,children:[(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:r<=0,title:`上移`,onClick:()=>F(t,-1),children:`↑`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:r<0||r>=p.length-1,title:`下移`,onClick:()=>F(t,1),children:`↓`})]})]},t.id)})]})]}),(0,h.jsxs)(`div`,{className:`tlp-section`,children:[(0,h.jsx)(`div`,{className:`tlp-section-label`,children:`更多菜单(拖到上方 = 显示到工具栏;拖回这里 = 收入更多)`}),(0,h.jsxs)(`div`,{className:`tlp-list tlp-menu`+(o===`menu`?` dropping`:``),role:`list`,onDragOver:w,onDragLeave:E,onDrop:T,children:[f.map(t=>{let n=O(e,t.id);return(0,h.jsxs)(`div`,{className:U(t,!1),draggable:!0,role:`listitem`,onDragStart:e=>_(e,t),onDragEnd:v,children:[(0,h.jsx)(`span`,{className:`tlp-hnd`,title:`拖到上方工具栏 = 显示`,children:`⋮⋮`}),(0,h.jsx)(`input`,{type:`checkbox`,checked:!1,onChange:()=>P(t.id),title:`显示到工具栏`}),(0,h.jsx)(`span`,{className:`tlp-nm`,children:n.label||t.id})]},t.id)}),(0,h.jsx)(`div`,{className:`tlp-drop-hint`,role:`presentation`,children:o===`menu`?`松手 = 收入「更多」`:f.length?`把项拖到上方工具栏区域 = 显示到工具栏`:`工具栏上的按钮拖到这里即可收入「更多」`})]})]})]}),(0,h.jsxs)(`div`,{className:`tlp-foot`,children:[(0,h.jsx)(`span`,{className:`tlp-equiv`,children:`保存到本机 localStorage(每种工具区各存一份)`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:H,children:`恢复默认`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:r,children:`取消`}),(0,h.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:V,children:`保存`})]})]})}var V=`task`,H=[{id:`edit`,label:`编辑`},{id:`task`,label:`任务`},{id:`view`,label:`查看`}];function U(){let[e,t]=(0,m.useState)(!1),[n,r]=(0,m.useState)({x:0,y:0}),i=(0,m.useRef)(null),a=(0,m.useRef)(null);return(0,m.useEffect)(()=>{if(!e)return;let n=e=>{i.current?.contains(e.target)||a.current?.contains(e.target)||t(!1)};return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e]),{open:e,setOpen:t,pos:n,setPos:r,ref:i,menuRef:a}}function W({menu:e,className:t=``,style:n,children:r}){return e.open?(0,y.createPortal)((0,h.jsx)(`div`,{className:`mdw-fmt-menu${t?` ${t}`:``}`,role:`menu`,ref:e.menuRef,style:{position:`fixed`,...e.pos,...n},children:r}),document.body):null}function G(e,t,n=`left`){let r=t.currentTarget.getBoundingClientRect(),i=r.bottom+4;e.setPos(n===`left`?{left:r.left,top:i}:{left:`auto`,right:Math.max(8,window.innerWidth-r.right),top:i}),e.setOpen(e=>!e)}function K({mode:e,onMode:t,showMark:n,submitLabel:r,onNew:i,onSubmit:a,onChain:o,onPreview:s,onImg:c,onAtt:l,onImport:u,onClone:d,onFork:f,onComplete:p,onCancelTask:g,onMark:_,onDraft:v,onDelete:b,onOverview:x,onProg:S,onSource:C,onShortcuts:w,goalBadge:T,goalMenu:E}){let D=U(),{layout:k,setLayout:M}=F(V),[N,P]=(0,m.useState)(!1);(0,m.useEffect)(()=>{D.setOpen(!1)},[e]);let I={new:i&&{label:`新任务`,run:i},submit:{label:r||`提交`,run:a,primary:!0},mode:t&&{label:e===`edit`?`返回实时预览`:`源码模式`,hint:e===`edit`?`当前`:``,run:()=>t(e===`edit`?`split`:`edit`)},img:c&&{label:`插入图片`,run:c},att:l&&{label:`添加附件`,run:l},import:u&&e!==`split`&&{label:`导入`,run:u},draft:v&&e!==`split`&&{label:`存草稿`,run:v},chain:o&&{label:`任务链`,run:o},clone:d&&{label:`克隆任务`,run:d},fork:f&&{label:`Fork 任务`,run:f},complete:p&&{label:`标为完成`,run:p},"cancel-task":g&&{label:`取消任务`,run:g,danger:!0},mark:n&&_&&{label:`评论`,run:_},delete:b&&{label:`删除`,run:b,danger:!0},preview:s&&{label:`预览提示词`,run:s},overview:x&&{label:`总览`,run:x},prog:S&&{label:`进程`,run:S},source:C&&{label:`原文`,run:C},shortcuts:w&&{label:`快捷键`,run:w}},L=e=>e===`more`||!!I[e],R=k.filter(e=>A(V,e)&&L(e.id)),z=k.filter(e=>j(V,e)&&L(e.id)),K=e=>{I[e]?.run?.(),D.setOpen(!1)},q=e=>{if(e===`more`)return(0,h.jsx)(`div`,{className:`mdw-actions-more`,ref:D.ref,children:(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm${D.open?` on`:``}`,title:`更多操作`,"aria-expanded":D.open,"aria-haspopup":`menu`,onClick:e=>G(D,e,`right`),children:`更多`})},`more`);let t=I[e];return t?(0,h.jsx)(`button`,{type:`button`,className:t.primary?`btn sm primary`:`btn ghost sm`,onClick:()=>K(e),children:t.label},e):null},J=H.map(e=>({...e,items:z.filter(t=>O(V,t.id).menuGroup===e.id)})).filter(e=>e.items.length),Y=z.filter(e=>!O(V,e.id).menuGroup);return(0,h.jsxs)(`div`,{className:`mdw-toolbar`,children:[(0,h.jsx)(`div`,{className:`mdw-toolbar-left`,children:T&&(0,h.jsx)(`button`,{type:`button`,className:`mdw-goal-badge`,title:T.title,"aria-haspopup":`menu`,"aria-expanded":D.open,onClick:e=>G(D,e,`right`),children:T.label})}),(0,h.jsxs)(`div`,{className:`mdw-actions`,role:`group`,"aria-label":`任务操作`,children:[R.map(e=>q(e.id)),(0,h.jsxs)(W,{menu:D,className:`mdw-act-menu`,children:[E,E&&(0,h.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),J.map(e=>(0,h.jsxs)(`div`,{className:`mdw-fmt-menu-group`,role:`group`,"aria-label":e.label,children:[(0,h.jsx)(`div`,{className:`mdw-fmt-menu-cap`,children:e.label}),e.items.map(e=>{let t=I[e.id],n=t?.danger||O(V,e.id).danger;return(0,h.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(n?` danger`:``),onClick:()=>K(e.id),children:[t?.label||O(V,e.id).label||e.id,t?.hint?(0,h.jsx)(`span`,{className:`hint`,children:t.hint}):null]},e.id)})]},e.id)),Y.map(e=>{let t=I[e.id];return(0,h.jsx)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`+(t?.danger||O(V,e.id).danger?` danger`:``),onClick:()=>K(e.id),children:t?.label||O(V,e.id).label||e.id},e.id)}),(0,h.jsx)(`div`,{className:`mdw-fmt-menu-sep`,role:`separator`}),(0,h.jsx)(`button`,{type:`button`,role:`menuitem`,className:`mdw-fmt-menu-item`,onClick:()=>{D.setOpen(!1),P(!0)},children:`自定义工具栏…`})]})]}),N&&(0,y.createPortal)((0,h.jsx)(`div`,{className:`ta-panel-mask`,onClick:()=>P(!1),children:(0,h.jsx)(`div`,{className:`ta-panel-wrap`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(B,{kind:V,layout:k,setLayout:M,onClose:()=>P(!1)})})}),document.body)]})}export{B as a,O as c,U as i,A as l,K as n,F as o,G as r,j as s,W as t,_ as u};
@@ -12,7 +12,7 @@
12
12
  <!-- .ico 兜底:浏览器不认上面的 <link> 时会自己请求 /favicon.ico -->
13
13
  <link rel="icon" type="image/x-icon" href="/favicon.ico">
14
14
  <link rel="apple-touch-icon" sizes="512x512" href="/logo-rounded.png">
15
- <script type="module" crossorigin src="/assets/index-B_HPAoNR.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-CLsU9Lad.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="/assets/task-status-BP6y8MVu.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/md-parse-C2bDc3IZ.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/board-view-t8CKtq17.js">