nx-kv 0.56.2 → 0.57.1

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 (35) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +4 -3
  3. package/assets/nx-kv/references/A04-/344/273/223/345/272/223/344/270/216/351/241/271/347/233/256/347/273/204.md +7 -2
  4. package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +2 -2
  5. package/package.json +1 -1
  6. package/src/modules/docs/link-note.ts +171 -0
  7. package/src/modules/localtask/actions/_manifest.generated.ts +3 -0
  8. package/src/modules/localtask/actions/localtask-boardtasks.ts +156 -0
  9. package/src/modules/localtask/actions/localtask-tasks.ts +12 -2
  10. package/src/modules/repos/actions/repo-ref-note.ts +9 -5
  11. package/src/modules/repos/link-note.ts +111 -0
  12. package/src/modules/repos/ref.ts +40 -71
  13. package/src/web/frontend/api/cli-tree.json +17 -2
  14. package/src/web/frontend/api/client.generated.ts +15 -2
  15. package/src/web/frontend/page/repos/api.ts +0 -5
  16. package/src/web/frontend/page/repos/bind-modals.tsx +6 -55
  17. package/src/web/frontend/page/repos/board-refs.tsx +8 -18
  18. package/src/web/frontend/page/repos/index.tsx +2 -20
  19. package/src/web/frontend/page/repos/ref-panel.tsx +4 -8
  20. package/src/web/frontend/refs/api.ts +0 -5
  21. package/src/web/frontend/styles/modals.css +0 -30
  22. package/src/web/public/assets/{composer-panel-CzUeT8Wm.js → composer-panel-qX7uVyLW.js} +1 -1
  23. package/src/web/public/assets/{dir-T3tJ6mj6.js → dir-B360Miyq.js} +1 -1
  24. package/src/web/public/assets/{group-D5sEX31u.js → group-CCcRCEjR.js} +1 -1
  25. package/src/web/public/assets/{index-ChaDvo2D.js → index-BLrw-ZQc.js} +2 -2
  26. package/src/web/public/assets/index-BPxgsnXM.css +1 -0
  27. package/src/web/public/assets/repo-form-modal-pyqiC7pB.js +1 -0
  28. package/src/web/public/assets/repos-CeyrjSQ_.js +11 -0
  29. package/src/web/public/assets/{settings-bvwdOF-n.js → settings-DhX_fRMm.js} +1 -1
  30. package/src/web/public/assets/{task-D7taZbrH.js → task-XXG4USTn.js} +1 -1
  31. package/src/web/public/assets/{templates-CRHBAwpm.js → templates-C9a5CUFd.js} +1 -1
  32. package/src/web/public/index.html +3 -3
  33. package/src/web/public/assets/index-CLGiMYZc.css +0 -1
  34. package/src/web/public/assets/repo-form-modal-DxEqerLy.js +0 -1
  35. package/src/web/public/assets/repos-CKbhG3cI.js +0 -14
@@ -1,14 +0,0 @@
1
- import{C as e,_ as t,b as n,g as r,p as i,u as a,v as o,y as s}from"./frontmatter-DEIM0yF2.js";import{r as c}from"./workspace-C0PPPfA1.js";import{A as l,C as u,D as d,E as f,O as p,S as m,T as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,k as T,l as E,m as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P,v as F,w as I,x as L,y as R}from"./repo-form-modal-DxEqerLy.js";import{n as z}from"./app-context-CR7f0AtI.js";import{a as B,i as V,n as H}from"./doc-CKkCGsZ4.js";import{t as ee}from"./route-crumb-CkhC1zw2.js";import{t as te}from"./bar-CmzzOYQi.js";import{t as ne}from"./member-picker-B_LsCqNq.js";var U=e(n(),1),W=s(),G={new:{label:`新增`,cls:`new`},changed:{label:`有差异`,cls:`changed`},same:{label:`一致`,cls:`same`}};function re({onClose:e,onChanged:n,repos:i,boards:a}){let s=r(),c=t(),[l,u]=(0,U.useState)(`import`),[d,f]=(0,U.useState)({}),[p,m]=(0,U.useState)({}),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(``),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)({}),[T,E]=(0,U.useState)({}),[D,O]=(0,U.useState)(`ours`),[k,A]=(0,U.useState)(`none`),[j,M]=(0,U.useState)(``),[N,P]=(0,U.useState)(null),[F,I]=(0,U.useState)(!1),L=(0,U.useMemo)(()=>i||[],[i]),R=(0,U.useMemo)(()=>L.map(e=>e.key),[L]),z=(0,U.useMemo)(()=>(a||[]).map(e=>e.name),[a]),B=e=>{let t={};for(let n of R)t[n]=e;f(t)},V=e=>{let t={};for(let n of z)t[n]=e;m(t)},H=()=>{let e={};for(let t of R)e[t]=!d[t];f(e)},ee=()=>s(async()=>{let e=Object.keys(d).filter(e=>d[e]),t=Object.keys(p).filter(e=>p[e]),n={repos:e.length&&e.length!==R.length?e:void 0,boards:t.length&&t.length!==z.length?t.map(e=>`board/${e}`):void 0,noUnassigned:h},r=new URLSearchParams;n.repos?.length&&r.set(`repos`,n.repos.join(`,`)),n.boards?.length&&r.set(`boards`,n.boards.join(`,`)),h&&r.set(`no-unassigned`,`1`);let i=await o(`/api/repos/export`+(r.toString()?`?`+r:``));v(JSON.stringify(i,null,2)),c(`已生成布局:${i.repos.length} 个仓库 / ${i.boards.length} 个看板`)}),te=()=>{if(!_)return;let e=new Blob([_],{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)},ne=async e=>{let t=e.target.files?.[0];t&&(b(await t.text()),S(null),P(null))},re=()=>s(async()=>{if(y.trim()){I(!0);try{let e=await o(`/api/repos/import/diff`,{method:`POST`,body:{json:y}});S(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;w(t);let n={};for(let t of e.boards)n[t.key]=t.status!==`same`;E(n),P(null),c(`差异:新增 ${e.summary.new} · 有差异 ${e.summary.changed} · 一致 ${e.summary.same} · 本地未拥有 ${e.summary.missing}`)}finally{I(!1)}}}),K=()=>s(async()=>{let e=Object.keys(C).filter(e=>C[e]),t=Object.keys(T).filter(e=>T[e]);I(!0);try{let r=await o(`/api/repos/import`,{method:`POST`,body:{json:y,strategy:D,clone:k,selection:e.length?e:void 0,boards:t.length?t:void 0}});P(r),c(`导入完成:新建 ${r.created.length} · 覆盖 ${r.updated.length} · 另存 ${r.duplicated.length}`),await q(),n&&await n()}finally{I(!1)}}),q=(0,U.useCallback)(async()=>{try{let e=await o(`/api/repos/import/diff`,{method:`POST`,body:{json:y}});S(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;w(t)}catch{}},[y]),J=(0,U.useMemo)(()=>x?j?x.repos.filter(e=>e.status===j):x.repos:[],[x,j]),Y=(e,t)=>s(async()=>{if(t){I(!0);try{await o(`/api/repos/clone`,{method:`POST`,body:{remote:t,key:e,type:`ref`,depth:1}}),c(`已克隆: ${e}`),await q(),n&&await n()}finally{I(!1)}}}),ie=e=>{let t={...C};for(let n of J)t[n.key]=e;w(t)};(0,U.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(t.stopImmediatePropagation(),e())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[e]);let X=(0,U.useMemo)(()=>{let e={new:0,changed:0,same:0};if(!x)return e;for(let t of x.repos)e[t.status]=(e[t.status]||0)+1;return e},[x]);return(0,W.jsx)(`div`,{className:`rp-full`,onMouseDown:t=>{t.target===t.currentTarget&&e()},children:(0,W.jsxs)(`div`,{className:`rp-full-box`,children:[(0,W.jsxs)(`div`,{className:`rp-full-head`,children:[(0,W.jsxs)(`div`,{className:`rp-full-title`,children:[`导入导出`,(0,W.jsx)(`span`,{className:`muted`,children:`以全局 key 为身份 · 不含本地路径 · 逐条选择与冲突方案`})]}),(0,W.jsxs)(`div`,{className:`rp-full-tabs`,children:[(0,W.jsx)(`button`,{className:`rp-tab`+(l===`import`?` on`:``),onClick:()=>u(`import`),children:`导入`}),(0,W.jsx)(`button`,{className:`rp-tab`+(l===`export`?` on`:``),onClick:()=>u(`export`),children:`导出`})]}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:e,children:`关闭`})]}),l===`export`?(0,W.jsxs)(`div`,{className:`rp-full-body`,children:[(0,W.jsxs)(`div`,{className:`rp-full-col`,children:[(0,W.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,W.jsx)(`span`,{children:`导出范围`}),(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>B(!0),children:`全选仓库`}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>B(!1),children:`全不选`}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:H,children:`反选`})]})]}),(0,W.jsxs)(`div`,{className:`rp-full-sel`,children:[L.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!d[e.key],onChange:t=>f(n=>({...n,[e.key]:t.target.checked}))}),(0,W.jsx)(`span`,{className:e.type===`ref`?`rp-full-tag-ref`:``,children:e.name}),(0,W.jsx)(`span`,{className:`muted rp-full-key`,title:e.key,children:e.key})]},e.key)),L.length?null:(0,W.jsx)(`div`,{className:`muted`,children:`还没有仓库`})]}),(0,W.jsxs)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:[(0,W.jsx)(`span`,{children:`看板`}),(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>V(!0),children:`全选`}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>V(!1),children:`全不选`})]})]}),(0,W.jsxs)(`div`,{className:`rp-full-sel`,children:[(a||[]).map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!p[e.name],onChange:t=>m(n=>({...n,[e.name]:t.target.checked}))}),(0,W.jsx)(`span`,{children:e.name})]},e.name)),a?.length?null:(0,W.jsx)(`div`,{className:`muted`,children:`还没有看板`})]}),(0,W.jsxs)(`label`,{className:`rp-pick-item`,style:{marginTop:10},children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),(0,W.jsx)(`span`,{children:`不带未分组的仓库`})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(`button`,{className:`btn`,onClick:ee,children:`生成布局`}),(0,W.jsx)(`button`,{className:`btn ghost`,disabled:!_,onClick:te,children:`下载 JSON`})]})]}),(0,W.jsxs)(`div`,{className:`rp-full-col`,children:[(0,W.jsx)(`div`,{className:`rp-full-colhead`,children:(0,W.jsx)(`span`,{children:`导出结果`})}),(0,W.jsx)(`textarea`,{className:`rp-full-out`,readOnly:!0,value:_,spellCheck:`false`,placeholder:`点「生成布局」后在这里预览 JSON(可直接复制或下载)`})]})]}):(0,W.jsxs)(`div`,{className:`rp-full-body`,children:[(0,W.jsxs)(`div`,{className:`rp-full-col`,children:[(0,W.jsx)(`div`,{className:`rp-full-colhead`,children:(0,W.jsx)(`span`,{children:`导入来源`})}),(0,W.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:ne}),(0,W.jsx)(`textarea`,{className:`rp-full-input`,rows:7,spellCheck:`false`,placeholder:`粘贴布局 JSON,或选一个 .json 文件`,value:y,onChange:e=>{b(e.target.value),S(null)}}),(0,W.jsx)(`div`,{className:`form-hint`,children:`每个仓库的 key 必须有:文件里已写 key 就直接用;只写了远程地址就按 host/owner/repo 归一化; 两样都没有会在差异检查阶段直接报错(不会按名字猜 key)。要改 key 就改上面的 JSON 再检查。`}),(0,W.jsx)(`div`,{className:`form-acts`,children:(0,W.jsx)(`button`,{className:`btn`,disabled:!y.trim()||F,onClick:re,children:`差异检查`})}),x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:12},children:(0,W.jsx)(`span`,{children:`冲突方案`})}),(0,W.jsx)(`div`,{className:`rp-strategy`,children:[[`ours`,`保留本地`,`本地已有的不动,只新建缺失的`],[`overwrite`,`强制覆盖`,`用导入文件覆盖本地字段(key 不变)`],[`duplicate`,`另存新 key`,`为冲突项新建 key-import-1/2/3,两条并存`]].map(([e,t,n])=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,title:n,children:[(0,W.jsx)(`input`,{type:`radio`,name:`strategy`,checked:D===e,onChange:()=>O(e)}),(0,W.jsx)(`span`,{children:t})]},e))}),(0,W.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:(0,W.jsx)(`span`,{children:`克隆`})}),(0,W.jsxs)(`select`,{value:k,onChange:e=>A(e.target.value),children:[(0,W.jsx)(`option`,{value:`none`,children:`不克隆,只登记`}),(0,W.jsx)(`option`,{value:`ref`,children:`克隆参考仓库`}),(0,W.jsx)(`option`,{value:`dev`,children:`克隆开发仓库`}),(0,W.jsx)(`option`,{value:`all`,children:`全部克隆`})]}),(0,W.jsx)(`div`,{className:`form-acts`,children:(0,W.jsxs)(`button`,{className:`btn`,disabled:F,onClick:K,children:[`执行导入(已选 `,Object.values(C).filter(Boolean).length,`)`]})})]}):null,N?(0,W.jsxs)(`div`,{className:`rp-import-result`,children:[(0,W.jsxs)(`div`,{children:[`新建 `,N.created.length,` · 覆盖 `,N.updated.length,` · 另存 `,N.duplicated.length,` · 跳过 `,N.skipped.length]}),(0,W.jsxs)(`div`,{className:`muted`,children:[`看板 新建 `,N.boardsCreated,` / 合并 `,N.boardsMerged,` · 参考关系 `,N.links]}),N.cloned.length?(0,W.jsxs)(`div`,{children:[`克隆 `,N.cloned.length,` 个`]}):null,N.unmatched.length?(0,W.jsxs)(`div`,{className:`rp-layout-warn`,children:[`本地未拥有 `,N.unmatched.length,` 条(见下方差异表)`]}):null]}):null]}),(0,W.jsx)(`div`,{className:`rp-full-col rp-full-col-wide`,children:x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,W.jsxs)(`span`,{children:[`差异(新增 `,X.new,` · 有差异 `,X.changed,` · 一致 `,X.same,x.summary.missing?` · 本地未拥有 ${x.summary.missing}`:``,`)`]}),(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(`button`,{className:`rp-chip`+(j===``?` on`:``),onClick:()=>M(``),children:`全部`}),(0,W.jsx)(`button`,{className:`rp-chip`+(j===`new`?` on`:``),onClick:()=>M(`new`),children:`新增`}),(0,W.jsx)(`button`,{className:`rp-chip`+(j===`changed`?` on`:``),onClick:()=>M(`changed`),children:`有差异`}),(0,W.jsx)(`button`,{className:`rp-chip`+(j===`same`?` on`:``),onClick:()=>M(`same`),children:`一致`}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ie(!0),children:`全选`}),(0,W.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ie(!1),children:`全不选`})]})]}),(0,W.jsx)(`div`,{className:`rp-diff-table-wrap`,children:(0,W.jsxs)(`table`,{className:`rp-diff-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{style:{width:`32px`}}),(0,W.jsx)(`th`,{style:{width:`90px`},children:`状态`}),(0,W.jsx)(`th`,{children:`仓库 key`}),(0,W.jsx)(`th`,{children:`差异字段`})]})}),(0,W.jsxs)(`tbody`,{children:[J.map(e=>(0,W.jsxs)(`tr`,{className:`rp-diff-row `+(G[e.status]?.cls??``),children:[(0,W.jsx)(`td`,{children:(0,W.jsx)(`input`,{type:`checkbox`,disabled:e.status===`same`,checked:!!C[e.key],onChange:t=>w(n=>({...n,[e.key]:t.target.checked}))})}),(0,W.jsx)(`td`,{children:(0,W.jsx)(`span`,{className:`rp-status `+(G[e.status]?.cls??``),children:G[e.status]?.label})}),(0,W.jsxs)(`td`,{className:`mono rp-diff-key`,children:[e.key,e.status===`new`&&e.canClone?(0,W.jsx)(`span`,{className:`rp-can-clone`,title:`导入时可克隆`,children:`可克隆`}):null,e.status===`new`&&e.canClone?(0,W.jsx)(`button`,{className:`btn small ghost rp-clone-btn`,title:`现在就克隆到本地(用这个 key 登记 → 组里的占位自动补齐)`,disabled:F,onClick:()=>Y(e.key,e.incoming?.remote||``),children:`克隆到本地`}):null]}),(0,W.jsx)(`td`,{className:`rp-diff-fields`,children:e.fields.length?e.fields.map(e=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`b`,{children:e.field}),`: `,(0,W.jsx)(`span`,{className:`rp-was`,children:JSON.stringify(e.local)}),` → `,(0,W.jsx)(`span`,{className:`rp-now`,children:JSON.stringify(e.incoming)})]},e.field)):(0,W.jsx)(`span`,{className:`muted`,children:`—`})})]},e.key)),x.missing.map(e=>(0,W.jsxs)(`tr`,{className:`rp-diff-row missing`,children:[(0,W.jsx)(`td`,{}),(0,W.jsx)(`td`,{children:(0,W.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`})}),(0,W.jsx)(`td`,{className:`mono rp-diff-key`,children:e}),(0,W.jsx)(`td`,{className:`rp-diff-fields muted`,children:`文件里被引用,但文件与本地都没有定义`})]},`miss-`+e))]})]})}),x.boards.length?(0,W.jsxs)(`div`,{className:`rp-diff-boards`,children:[(0,W.jsx)(`div`,{className:`rp-full-colhead`,children:(0,W.jsx)(`span`,{children:`看板`})}),x.boards.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!T[e.key],onChange:t=>E(n=>({...n,[e.key]:t.target.checked}))}),(0,W.jsx)(`span`,{className:`rp-status `+(G[e.status]?.cls??``),children:G[e.status]?.label}),(0,W.jsx)(`span`,{children:e.key}),(0,W.jsxs)(`span`,{className:`muted`,children:[`(`,e.incoming.repos.length,` 个成员`,e.missingMembers?.length?`,本地未拥有 ${e.missingMembers.length}`:``,`)`]})]},e.key)),x.boards.flatMap(e=>e.missingMembers||[]).map(e=>(0,W.jsxs)(`div`,{className:`rp-missing-item`,children:[(0,W.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`}),(0,W.jsx)(`span`,{className:`mono rp-missing-key`,children:e.key}),e.remote?(0,W.jsx)(`span`,{className:`muted rp-missing-remote`,title:e.remote,children:e.remote}):null,e.clonable?(0,W.jsx)(`button`,{className:`btn small`,disabled:F,onClick:()=>Y(e.key,e.remote),children:`克隆到本地`}):(0,W.jsx)(`span`,{className:`muted`,title:`没有远程地址 —— 自行创建后用 repo key set 指定同一个 key`,children:`需手工创建`})]},e.key))]}):null]}):(0,W.jsx)(`div`,{className:`muted rp-full-empty`,children:`粘贴或选择一份布局 JSON,点「差异检查」后在这里逐条查看与勾选。`})})]})]})})}var K=10;function q({repo:e,onClose:n,onSaved:r}){let i=z(),o=t(),s=e.getLoop&&typeof e.getLoop==`object`?e.getLoop:null,[c,l]=(0,U.useState)(!!(s&&s.enabled)),[u,d]=(0,U.useState)(s&&s.waitMinutes!==void 0&&s.waitMinutes!==null?String(s.waitMinutes):String(K)),[f,p]=(0,U.useState)(!1),m=e=>{let t=String(e??``).trim();if(t===``)return K;let n=Number(t);return Number.isFinite(n)&&n>=0?Math.min(Math.floor(n),600):K},h=async t=>{p(!0);try{let n=t&&t.enabled!==void 0?t.enabled:c;await T(e.id,{"get-loop":n?`on`:`off`,...n?{"get-loop-minutes":m(u)}:{}});let a=m(u);o(n?`已保存「${e.name}」的持续 get 设置(${a>0?`${a} 分钟阻塞窗口`:`不阻塞,没活立即返回`})`:`已关闭「${e.name}」的持续 get`),i.refreshRepos&&i.refreshRepos(),r&&r()}catch(e){o(String(e.message||e))}finally{p(!1)}},g=async e=>{l(e),await h({enabled:e})};return(0,W.jsx)(a,{title:`持续 get · ${e.name}`,onClose:n,size:`md`,children:(0,W.jsxs)(`div`,{className:`rp-gl`,children:[(0,W.jsxs)(`div`,{className:`rp-gl-head`,children:[(0,W.jsxs)(`div`,{className:`rp-gl-title`,children:[(0,W.jsx)(`span`,{className:`rp-gl-name`,children:`持续 get`}),(0,W.jsx)(`span`,{className:`rp-gl-desc`,children:`无任务时阻塞等待新任务回填(waitgoal)`})]}),(0,W.jsxs)(`button`,{className:`toggle`+(c?` on`:``),onClick:()=>g(!c),disabled:f,children:[(0,W.jsx)(`span`,{className:`dot`}),c?`开`:`关`]})]}),c&&(0,W.jsxs)(`div`,{className:`rp-gl-body`,children:[(0,W.jsxs)(`div`,{className:`rp-gl-row`,children:[(0,W.jsx)(`span`,{children:`阻塞窗口`}),(0,W.jsxs)(`span`,{className:`rp-gl-unit`,children:[(0,W.jsx)(`input`,{className:`rp-gl-min`,value:u,onChange:e=>d(e.target.value),inputMode:`numeric`,title:`0 = 不阻塞:没任务时 get 立即返回 timeout`}),`分钟`]})]}),(0,W.jsx)(`div`,{className:`rp-gl-note`,children:`这里只决定没有任务时 get 最多阻塞多久(0 = 不阻塞,立即返回 timeout)。领到任务后那段「继续 get 直到 timeout」的提示词是全局的,只有一份:要改文案去 设置 → 提示词模板 → 持续 get。`}),(0,W.jsxs)(`div`,{className:`rp-gl-acts`,children:[(0,W.jsx)(`span`,{className:`spacer`}),(0,W.jsx)(O,{variant:`primary`,disabled:f,onClick:()=>h(),children:`保存持续 get 设置`})]})]})]})})}function J({path:e}){let t=String(e||``),n=t.replace(/\\/g,`/`).lastIndexOf(`/`);return n<0?(0,W.jsx)(l,{text:t,title:void 0,children:t}):(0,W.jsxs)(l,{text:t,title:`点击复制完整路径`,children:[(0,W.jsx)(`span`,{className:`anc`,children:t.slice(0,n)}),t.slice(n)]})}function Y({docs:e,onOpen:t}){let n=e&&e.main,r=e&&e.links||[],i=+!!n+r.length,a=n&&n.exists?[n.title,n.summary&&`摘要:${n.summary}`].filter(Boolean).join(`
2
- `):`查看完整文档列表(主篇 / 补充 / reference / 组内),可就地编辑`,o=(e,t)=>e.title||e.desc||`第 ${t+1} 篇`,s=[];return n&&n.exists&&s.push({id:`main`,label:o(n,0),kind:`repo`,main:!0,title:n.title||n.summary||``}),r.forEach((e,t)=>{s.push({id:(e.docId||e.refId||`link`)+`:`+t,label:o(e,t),kind:`repo`,note:e.note||``,title:[e.title||e.desc,e.note&&`备注:${e.note}`].filter(Boolean).join(`
3
- `)})}),(0,W.jsxs)(`div`,{className:`rp-docs-entry`,role:`button`,tabIndex:0,title:a,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&t()},children:[s.length?(0,W.jsx)(V,{items:s,onMore:t}):(0,W.jsx)(`span`,{className:`rp-docs-entry-main ghost`,children:`+ 写项目介绍`}),(0,W.jsx)(`span`,{className:`rp-docs-entry-n`,children:i>0?`${i} 篇 · 查看详情`:`查看详情`})]})}function ie({chips:e,acts:t}){let[n,r]=(0,U.useState)(!1),i=n?e:e.slice(0,4);return(0,W.jsxs)(W.Fragment,{children:[i.map(e=>(0,W.jsx)(`span`,{className:`rp-link-chip rp-link-chip-repo`,children:(0,W.jsxs)(`button`,{className:`rp-link-chip-main`,title:[`本仓库直接绑定的参考仓库`,e.note,`点击跳到这个参考仓库`].filter(Boolean).join(`
4
- `),onClick:()=>t.gotoRefRepo(e.key),children:[(0,W.jsx)(`b`,{children:`自`}),(0,W.jsx)(`span`,{className:`rp-link-chip-name`,children:e.name})]})},e.key)),e.length>4?(0,W.jsx)(`button`,{className:`rp-bind-more`,title:`展开本行全部参考仓库`,onClick:()=>r(e=>!e),children:n?`收起`:`+${e.length-4}`}):null]})}function X({r:e,showRef:t,showGroups:n,filterBoard:r,refRepoChipsByRepo:i,acts:a}){let o=i.get(e.key)||[];return(0,W.jsxs)(`tr`,{id:`rp-row-`+e.key,children:[(0,W.jsxs)(`td`,{className:`rp-name`,children:[(0,W.jsxs)(`strong`,{children:[e.icon?(0,W.jsx)(`span`,{className:`rp-icon`,"aria-hidden":!0,children:e.icon}):null,e.name,e.getLoop&&e.getLoop.enabled?(0,W.jsx)(`span`,{className:`rp-gl-dot`,title:`持续 get 已开启(${Number(e.getLoop.waitMinutes)>0?`${Number(e.getLoop.waitMinutes)} 分钟阻塞窗口`:`不阻塞,没活立即返回`})`,"aria-label":`持续 get 已开启`}):null]}),(0,W.jsx)(`span`,{className:`mono rp-name-path`,children:(0,W.jsx)(J,{path:e.path})})]}),(0,W.jsx)(`td`,{className:`rp-cell-docs`,children:(0,W.jsx)(Y,{docs:e.descDocs,onOpen:()=>a.docs(e)})}),t?(0,W.jsxs)(`td`,{className:`rp-refs`,children:[o.length?(0,W.jsx)(ie,{chips:o,acts:a}):(0,W.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}),(0,W.jsx)(O,{small:!0,className:`rp-ref-bind`,title:`管理这个仓库所属组的参考仓库`,onClick:()=>a.bind(e),children:`绑定`})]}):null,n?(0,W.jsx)(`td`,{className:`rp-cell-groups`,children:(e.boards||[]).length?(0,W.jsx)(B,{moreTitle:`展开本行全部所属分组`,children:(e.boards||[]).map(e=>(0,W.jsx)(`button`,{className:`rp-group-chip`+(r?.id===e.id?` on`:``),title:`只看「${e.name}」${e.note?`\n组内描述:${e.note}`:``}`,onClick:()=>a.filter(e.id),children:e.name},e.id))}):(0,W.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`})}):null,(0,W.jsx)(`td`,{className:`rp-acts`,children:(0,W.jsx)(te,{kind:`repos-row`,renderers:{edit:()=>(0,W.jsx)(O,{small:!0,onClick:()=>a.edit(e),children:`编辑`}),open:()=>(0,W.jsx)(O,{small:!0,title:`在文件管理器中打开`,onClick:()=>a.open(e),children:`打开`}),del:()=>(0,W.jsx)(O,{small:!0,danger:!0,onClick:()=>a.del(e),children:`删除`}),getloop:()=>(0,W.jsx)(O,{small:!0,title:`持续 get(waitgoal)配置`,onClick:()=>a.getloop(e),children:(0,W.jsxs)(`span`,{className:`rp-gl-menu-it`,children:[e.getLoop&&e.getLoop.enabled?(0,W.jsx)(`span`,{className:`rp-gl-dot`,"aria-hidden":!0}):null,`持续 get…`]})}),remote:()=>(0,W.jsx)(O,{small:!0,onClick:()=>a.remote(e),children:`对齐 remote`})},actions:{edit:()=>a.edit(e),open:()=>a.open(e),del:()=>a.del(e),getloop:()=>a.getloop(e),remote:()=>a.remote(e)},titles:{getloop:`持续 get(waitgoal)配置`,remote:`key 与远程 git 地址对齐`,del:`删除仓库登记(磁盘文件不受影响)`}})})]})}function ae({shown:e,devRepos:t,filterBoard:n,refRepoChipsByRepo:r,acts:i,onAddMember:a}){let o=!n,s=!n;return(0,W.jsx)(`div`,{className:`rp-table-wrap`,id:`rp-repos`,children:(0,W.jsxs)(`table`,{className:`rp-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{scope:`col`,style:{width:`16%`},children:`仓库`}),(0,W.jsxs)(`th`,{scope:`col`,style:{width:`36%`},children:[`文档`,(0,W.jsx)(`span`,{className:`rp-th-hint`,children:`主篇标题 · 查看详情打开完整文档列表`})]}),o?(0,W.jsx)(`th`,{scope:`col`,style:{width:`18%`},children:`参考仓库`}):null,s?(0,W.jsx)(`th`,{scope:`col`,style:{width:`14%`},children:`分组`}):null,(0,W.jsx)(`th`,{scope:`col`,style:{width:`250px`},children:`操作`})]})}),(0,W.jsxs)(`tbody`,{children:[e.map(e=>(0,W.jsx)(X,{r:e,showRef:o,showGroups:s,filterBoard:n,refRepoChipsByRepo:r,acts:i},e.id)),e.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:3+ +!!o+ +!!s,className:`muted rp-empty`,children:t.length?(0,W.jsxs)(W.Fragment,{children:[`这个分组还没有成员`,` `,n?(0,W.jsx)(O,{small:!0,onClick:()=>a(n.id),children:`添加成员`}):null]}):`还没有登记开发仓库 —— 点右上「登记仓库」加一条。`})})]})]})})}function oe({boards:e,filter:t,onFilter:n,devCount:r,shownCount:i,q:a,onQ:o,onOpenDocs:s}){return(0,W.jsxs)(`div`,{className:`rp-filters`,"data-testid":`rp-filters`,children:[(0,W.jsxs)(`div`,{className:`rp-filters-main`,children:[(0,W.jsxs)(`button`,{className:`rp-chip`+(t?``:` on`),onClick:()=>n(``),title:`显示全部开发仓库`,children:[`全部 `,(0,W.jsx)(`b`,{children:r})]}),e.map(e=>(0,W.jsxs)(`button`,{className:`rp-chip`+(t===e.id?` on`:``),onClick:()=>n(t===e.id?``:e.id),title:`只看「${e.name}」里的仓库(${(e.repos||[]).length} 个)`,children:[e.name,` `,(0,W.jsx)(`b`,{children:(e.repos||[]).length})]},e.id))]}),(0,W.jsxs)(`div`,{className:`rp-filters-side`,children:[(0,W.jsx)(`input`,{className:`rp-search`,type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:`搜仓库 / 路径 / 分组 / 文档…`,"aria-label":`检索仓库与文档`}),a?(0,W.jsx)(O,{small:!0,onClick:()=>o(``),children:`清空`}):null,(0,W.jsxs)(`span`,{className:`muted rp-search-count`,children:[i,` / `,r]}),(0,W.jsx)(O,{small:!0,title:`按仓库 / 组内 / 分组三档检索文档`,onClick:s,children:`文档检索`})]})]})}function se({filterBoard:e,refRepos:t,checkOf:n,onOpenDoc:r,onOpenRefDocs:i,onAddMember:a,onSync:o,onOpen:s,onLinkNote:c,onUnbind:u}){let d=(0,U.useMemo)(()=>{if(!e)return[];let n=new Map(t.map(e=>[e.key,e]));return(e.refs||[]).map(e=>{let t=n.get(e.id);return t?{...t,boardNote:e.note||``}:null}).filter(e=>e!==null)},[t,e]),[f,p]=(0,U.useState)(null);(0,U.useEffect)(()=>{p(null)},[e?e.id:null]);let m=f===null?d.length<=8:f;return e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`rp-context`,"data-testid":`rp-context`,children:[(0,W.jsx)(`span`,{className:`rp-context-name`,children:e.name}),e.desc?(0,W.jsx)(`span`,{className:`rp-context-desc`,title:e.desc,children:e.desc}):(0,W.jsx)(`span`,{className:`muted rp-context-desc`,children:`还没有领域描述 —— 点「文档列表」新建一篇组介绍:侧重什么、谁配合谁、关键路径与搜索关键词在哪。`}),(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(O,{small:!0,title:`在右侧栏列出这个组的文档(组 → 组内仓库 → 仓库自己)`,onClick:()=>r(e),children:`文档列表`}),(0,W.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(e.id),title:`组页里看这个组的成员与任务`,children:`组页 ↗`}),(0,W.jsx)(O,{small:!0,onClick:()=>a(e.id),children:`添加成员`})]})]}),(0,W.jsxs)(`div`,{className:`rp-ref-mounted`,"data-testid":`rp-board-refs`,children:[(0,W.jsxs)(`div`,{className:`rp-ref-mounted-head`,children:[(0,W.jsxs)(`span`,{className:`rp-ref-mounted-label`,children:[`「`,e.name,`」的参考仓库 `,(0,W.jsx)(`b`,{children:d.length})]}),(0,W.jsx)(`span`,{className:`muted`,children:`绑定在组上:组内所有仓库共享,不区分来源仓库`}),d.length?(0,W.jsx)(O,{small:!0,className:`rp-ref-mounted-toggle`,title:m?`收起这个组的参考仓库清单`:`展开这个组的参考仓库清单`,onClick:()=>p(!m),children:m?`收起`:`展开 ${d.length}`}):null]}),d.length?m?d.map(t=>{let r=n.get(t.id);return(0,W.jsxs)(`div`,{className:`rp-ref-mounted-item`,children:[(0,W.jsx)(`span`,{className:`rp-ref-dot`+(r?r.ok?` ok`:` bad`:``),title:r?r.ok?`检查通过`:(r.issues||[]).join(`
5
- `):`尚未检查`}),(0,W.jsx)(l,{text:t.remote||t.name,title:`点击复制远程地址`,className:`rp-ref-mounted-name`,children:t.name}),(0,W.jsx)(Y,{docs:t.descDocs,onOpen:()=>i(t)}),t.desc?(0,W.jsx)(`span`,{className:`muted rp-ref-mounted-desc`,title:t.desc,children:t.desc}):null,t.boardNote?(0,W.jsx)(`button`,{className:`rp-ref-note-chip`,title:`${t.boardNote}\n点击编辑这条组级描述`,onClick:()=>c(t,e.id,e.name,t.boardNote),children:t.boardNote.split(`
6
- `)[0]}):(0,W.jsx)(O,{small:!0,title:`写「${t.name}」在这个组里参考什么(组级描述)`,onClick:()=>c(t,e.id,e.name,``),children:`写描述`}),(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(O,{small:!0,onClick:()=>o(t),children:`同步`}),(0,W.jsx)(O,{small:!0,onClick:()=>s(t),children:`打开`}),(0,W.jsx)(O,{small:!0,danger:!0,title:`只从本组摘除(不影响其它组)`,onClick:()=>u(t,e.id),children:`移出本组`})]})]},t.id)}):null:(0,W.jsx)(`div`,{className:`muted rp-refs-none`,children:`这个组还没有绑定的参考仓库 —— 在下方参考仓库面板里点「绑定」勾选本组。`})]})]}):null}function ce({boards:e,devRepos:n,refRepos:a,reload:o}){let s=r(),c=t(),{dialog:l,node:u}=i(),d=(0,U.useMemo)(()=>{let t=new Map;for(let e of[...n,...a]){let n=String(e.path||``).split(/[\\/]/).filter(Boolean).pop()||``;for(let r of[e.name,n]){let n=String(r||``).toLowerCase();n&&!t.has(n)&&t.set(n,e)}}let r=[];for(let n of e&&e.boards||[])for(let e of n.repos||[]){if(e.present!==!1)continue;let i=String(e.key||``).split(`/`).filter(Boolean).pop()||``,a=t.get(String(e.name||``).toLowerCase())||t.get(i.toLowerCase())||null;r.push({...e,board:n.name,boardId:n.id,match:a})}return r},[e,n,a]),f=e=>s(async()=>{await k({remote:e.remote,key:e.key,name:e.name||void 0,type:`dev`}),c(`已克隆并登记:${e.name||e.key}`),o.repos(),o.boards()}),p=(e,t)=>s(async()=>{await I({from:e.key,to:t}),c(`已把「${e.name||e.key}」这个位置接到本机仓库`),o.repos(),o.boards()}),m=e=>s(async()=>{let t=await l({title:`把「${e.name||e.key}」接到哪个本机仓库?`,input:!0,placeholder:`本机仓库:id / key / 名称 / 绝对路径`});t&&(await I({from:e.key,to:t}),c(`已重绑——这个位置现在指向本机仓库`),o.repos(),o.boards())}),h=e=>s(async()=>{confirm(`把「${e.name||e.key}」从组「${e.board}」里移除?\n\n只摘这个组里的位置:本机仓库与看板本身都不动。`)&&(await j({key:e.key,board:e.boardId,remove:!0}),c(`已从组「${e.board}」移除`),o.boards())});return d.length?(0,W.jsxs)(`section`,{className:`rp-pending`,"data-testid":`rp-pending-init`,children:[(0,W.jsxs)(`header`,{className:`rp-pending-head`,children:[(0,W.jsxs)(`div`,{className:`rp-pending-head-main`,children:[(0,W.jsxs)(`h3`,{children:[`待初始化`,(0,W.jsx)(`span`,{className:`rp-pending-count`,children:d.length})]}),(0,W.jsx)(`p`,{children:`组里有位置、本机没有登记。接到本机仓库、克隆下来,或者直接移除。`})]}),(0,W.jsx)(O,{small:!0,onClick:()=>s(async()=>{let e=await v({apply:!1});if(!e?.total){c(`没有可清理的占位(有远程地址的那些留着等 clone)`);return}let t=e.items.map(e=>`· ${e.name}(组 ${e.board})`).join(`
7
- `);confirm(`清理 ${e.total} 个无来源占位?\n\n${t}\n\n它们没有远程地址,克隆不回来,只能删。`)&&(await v({apply:!0}),c(`已清理 ${e.total} 个占位`),o.boards())}),children:`清理无来源占位`})]}),(0,W.jsx)(`div`,{className:`rp-pending-list`,children:d.map(e=>(0,W.jsxs)(`article`,{className:`rp-pending-card`,children:[(0,W.jsxs)(`div`,{className:`rp-pending-info`,children:[(0,W.jsxs)(`div`,{className:`rp-pending-title`,children:[(0,W.jsx)(`strong`,{children:e.name||e.key}),(0,W.jsxs)(`span`,{className:`rp-pending-board`,children:[`组 · `,e.board]}),e.remote?null:(0,W.jsx)(`span`,{className:`rp-pending-tag`,children:`无远程地址`})]}),(0,W.jsx)(`code`,{className:`rp-pending-key`,children:e.key}),e.desc?(0,W.jsx)(`p`,{className:`rp-pending-desc`,children:e.desc}):null]}),(0,W.jsxs)(`div`,{className:`rp-pending-acts`,children:[e.match?(0,W.jsxs)(O,{small:!0,title:`把组里这个位置指向本机仓库「${e.match.name}」(仓库身份不变)`,onClick:()=>e.match&&p(e,e.match.id),children:[`绑定到「`,e.match.name,`」`]}):null,e.remote?(0,W.jsx)(O,{small:!0,onClick:()=>f(e),children:`克隆到本地`}):null,(0,W.jsx)(O,{small:!0,onClick:()=>m(e),children:`选本机仓库`}),(0,W.jsx)(O,{small:!0,danger:!0,title:`只从组里摘掉这个位置,本机仓库与看板都不动`,onClick:()=>h(e),children:`移除`})]})]},e.key+`@`+e.boardId))}),u]}):null}function le({refRepos:e,devRepos:n,boardList:i,checkOf:o,refRepoBackLinks:s,refBindOpen:c,onRefBindOpen:f,onClose:p,onSyncOne:m,onUnbind:h,onUnbindRepo:g,onLinkNote:_,onGoBind:v,onDocs:y,onRowAct:x,reload:S}){let C=r(),T=t(),[E,D]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,M]=(0,U.useState)({gitRepoRoot:``,gitDevRoot:``}),[N,P]=(0,U.useState)(!1),[F,I]=(0,U.useState)({url:``,name:``,desc:``,depth:`1`}),[R,z]=(0,U.useState)({}),[B,V]=(0,U.useState)(null),[H,ee]=(0,U.useState)({}),te=(0,U.useCallback)(async()=>{D(await b().catch(()=>null))},[]);(0,U.useEffect)(()=>{te()},[te]);let ne=()=>C(async()=>{let e={};j.gitRepoRoot.trim()&&(e.gitRepoRoot=j.gitRepoRoot.trim()),j.gitDevRoot.trim()&&(e.gitDevRoot=j.gitDevRoot.trim()),Object.keys(e).length&&(D(await d(e)),A(!1),T(`已保存存储根目录`))}),G=()=>C(async()=>{let e=F.url.trim();if(!e)return;let t={url:e,name:F.name.trim()||void 0,desc:F.desc.trim()||void 0,depth:parseInt(F.depth,10)||1,"no-bind":!0},r=n.filter(e=>R[`repo:`+e.id]).map(e=>e.id),a=i.filter(e=>R[`board:`+e.id]).map(e=>e.id);r.length&&(t.bind=r),a.length&&(t.board=a);let o=await L(t);P(!1),I({url:``,name:``,desc:``,depth:`1`}),z({}),T(`已克隆: ${o.name} → ${o.dest||o.path}`),await S.all()}),re=()=>C(async()=>{let e=await u({all:!0}),t=e.results.filter(e=>e.status!==`updated`&&e.status!==`upToDate`);T(`同步 ${e.synced} 个${t.length?`,${t.length} 个有问题(见检查结果)`:`,全部完成`}`),await S.refCheck()}),K=e=>e.key||`board/${e.name}`,q=e=>{let t={};for(let n of i)(n.refs||[]).some(t=>t.id===e.key)&&(t[`board:`+K(n)]=!0);for(let r of n)(r.linked||[]).some(t=>t&&t.kind===`ref`&&String(t.id)===e.key)&&(t[`repo:`+r.key]=!0);ee(t),V(e)};return(0,W.jsxs)(a,{size:`wide`,title:`参考仓库 · ${e.length}`,onClose:p,children:[(0,W.jsx)(`div`,{className:`rp-modal-bar`,children:(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(O,{small:!0,onClick:()=>{z({}),P(!0)},children:`克隆参考仓库`}),(0,W.jsx)(O,{small:!0,onClick:re,children:`同步全部`}),(0,W.jsx)(O,{small:!0,onClick:S.refCheck,children:`检查`}),(0,W.jsx)(O,{small:!0,onClick:()=>{M({gitRepoRoot:E?.gitRepoRoot||``,gitDevRoot:E?.gitDevRoot||``}),A(!0)},children:`存储根`})]})}),E?.gitRepoRoot?null:(0,W.jsx)(`div`,{className:`rp-ref-warn`,children:`存储根未设置 —— 克隆会被拒绝。点「存储根」设一个非 C 盘目录(参考仓库体积不小,别放系统盘)。`}),(0,W.jsx)(`div`,{className:`rp-ref-table-wrap`,children:(0,W.jsxs)(`table`,{className:`rp-ref-table`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{scope:`col`,style:{width:`30px`}}),(0,W.jsx)(`th`,{scope:`col`,style:{width:`17%`},children:`参考仓库`}),(0,W.jsx)(`th`,{scope:`col`,style:{width:`22%`},children:`远程地址`}),(0,W.jsx)(`th`,{scope:`col`,children:`绑定对象(仓库组 / 单独仓库 · 点击跳转)`}),(0,W.jsx)(`th`,{scope:`col`,style:{width:`220px`},children:`操作`})]})}),(0,W.jsxs)(`tbody`,{children:[e.map(e=>{let t=o.get(e.id),n=i.map(t=>{let n=(t.refs||[]).find(t=>t.id===e.key);return n?{board:t,note:n.note||``}:null}).filter(e=>e!==null);return(0,W.jsxs)(`tr`,{id:`rp-refrepo-row-`+e.key,children:[(0,W.jsx)(`td`,{children:(0,W.jsx)(`span`,{className:`rp-ref-dot`+(t?t.ok?` ok`:` bad`:``),title:t?t.ok?`检查通过`:(t.issues||[]).join(`
8
- `):`尚未检查`})}),(0,W.jsxs)(`td`,{className:`rp-ref-cell-name`,children:[(0,W.jsx)(`strong`,{children:e.name}),(0,W.jsx)(Y,{docs:e.descDocs,onOpen:()=>y(e)})]}),(0,W.jsx)(`td`,{className:`mono rp-ref-cell-remote`,children:(0,W.jsx)(l,{text:e.remote||``,title:`点击复制远程地址`,children:e.remote||`(无)`})}),(0,W.jsx)(`td`,{className:`rp-ref-cell-links`,children:(()=>{let t=n,r=s.get(e.key)||[];if(!t.length&&!r.length)return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`muted rp-refs-none`,children:`未绑定`}),(0,W.jsx)(O,{small:!0,className:`rp-ref-bind`,onClick:()=>q(e),children:`绑定…`})]});let i=!!c[e.id],a=i?t:t.slice(0,4),o=i?r:r.slice(0,4),l=t.length>4||r.length>4;return(0,W.jsxs)(W.Fragment,{children:[t.length?(0,W.jsxs)(`div`,{className:`rp-bind-row`,children:[(0,W.jsx)(`span`,{className:`rp-bind-label`,children:`仓库组`}),a.map(t=>(0,W.jsxs)(`span`,{className:`rp-link-chip rp-link-chip-group`,children:[(0,W.jsxs)(`button`,{className:`rp-link-chip-main`,title:[t.note||`点击跳到这个组`,`组级绑定(组内共享)`].join(`
9
- `),onClick:()=>v(`board`,t.board.id),children:[(0,W.jsx)(`b`,{children:`组`}),(0,W.jsx)(`span`,{className:`rp-link-chip-name`,children:t.board.name})]}),(0,W.jsx)(`button`,{className:`rp-link-chip-note-btn`,title:t.note?`编辑组级描述:${t.note}`:`写这条组级描述(这个组里参考什么)`,onClick:()=>_(e,t.board.id,t.board.name,t.note),children:t.note?t.note.split(`
10
- `)[0]:`+`}),(0,W.jsx)(`button`,{className:`rp-link-chip-x`,title:`从本组摘除(不影响其它组、也不动仓库级绑定)`,onClick:()=>h(e,t.board.id),children:`×`})]},`board:`+t.board.id)),!i&&t.length>4?(0,W.jsxs)(`button`,{className:`rp-bind-more`,title:`展开本行全部绑定`,onClick:()=>f(t=>({...t,[e.id]:!0})),children:[`+`,t.length-4]}):null]}):null,r.length?(0,W.jsxs)(`div`,{className:`rp-bind-row`,children:[(0,W.jsx)(`span`,{className:`rp-bind-label`,children:`仓库`}),o.map(t=>(0,W.jsxs)(`span`,{className:`rp-link-chip rp-link-chip-repo`,children:[(0,W.jsxs)(`button`,{className:`rp-link-chip-main`,title:[t.note||`直接绑定到这个仓库(不经过组)`,`仓库 key: ${t.repo.key}`,`点击定位到仓库行`].join(`
11
- `),onClick:()=>v(`repo`,t.repo.key),children:[(0,W.jsx)(`b`,{children:`仓`}),(0,W.jsx)(`span`,{className:`rp-link-chip-name`,children:t.repo.name}),(0,W.jsx)(`span`,{className:`mono rp-link-chip-key`,children:t.repo.key})]}),t.note?(0,W.jsx)(`i`,{className:`rp-link-chip-note`,title:t.note,children:t.note.split(`
12
- `)[0]}):null,(0,W.jsx)(`button`,{className:`rp-link-chip-x`,title:`从这个仓库摘除(不影响组级绑定)`,onClick:()=>g(e,t.repo.key),children:`×`})]},`repo:`+t.repo.key)),!i&&r.length>4?(0,W.jsxs)(`button`,{className:`rp-bind-more`,title:`展开本行全部绑定`,onClick:()=>f(t=>({...t,[e.id]:!0})),children:[`+`,r.length-4]}):null]}):null,l?(0,W.jsx)(`button`,{className:`rp-bind-toggle`,onClick:()=>f(t=>({...t,[e.id]:!i})),children:i?`收起`:`展开全部 ${t.length+r.length}`}):null,(0,W.jsx)(O,{small:!0,className:`rp-ref-bind`,onClick:()=>q(e),children:`绑定…`})]})})()}),(0,W.jsxs)(`td`,{className:`rp-acts`,children:[(0,W.jsx)(O,{small:!0,onClick:()=>m(e),children:`同步`}),(0,W.jsx)(O,{small:!0,onClick:()=>x(`open`,e),children:`打开`}),(0,W.jsx)(O,{small:!0,onClick:()=>x(`edit`,e),children:`编辑`}),(0,W.jsx)(O,{small:!0,danger:!0,onClick:()=>x(`del`,e),children:`删除`})]})]},e.id)}),e.length?null:(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:5,className:`muted rp-empty`,children:`还没有参考仓库 —— 点「克隆参考仓库」抓一个远程仓库下来(或用 CLI: nx-kv repo ref clone <url>)。`})})]})]})}),N?(0,W.jsx)(a,{title:`克隆参考仓库`,onClose:()=>{P(!1),z({})},children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`ref-url`,children:`远程 git 地址 *`}),(0,W.jsx)(`input`,{id:`ref-url`,spellCheck:`false`,placeholder:`git@github.com:lib/x.git 或 https://github.com/lib/x`,value:F.url,onChange:e=>I(t=>({...t,url:e.target.value}))})]}),(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`ref-name`,children:`名称`}),(0,W.jsx)(`input`,{id:`ref-name`,placeholder:`留空则用 URL 末段`,value:F.name,onChange:e=>I(t=>({...t,name:e.target.value}))})]}),(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`ref-desc`,children:`它参考什么`}),(0,W.jsx)(`input`,{id:`ref-desc`,spellCheck:`false`,placeholder:`如:liquid glass 的官方实现参考`,value:F.desc,onChange:e=>I(t=>({...t,desc:e.target.value}))})]}),(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{children:`克隆后绑定到(可多选)`}),(0,W.jsxs)(`div`,{className:`rp-pick-list`,children:[(0,W.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,W.jsx)(`span`,{className:`rp-pick-group-label`,children:`开发仓库`}),n.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!R[`repo:`+e.id],onChange:t=>z(n=>({...n,[`repo:`+e.id]:t.target.checked}))}),(0,W.jsx)(`span`,{title:e.path,children:e.name})]},e.id)),n.length?null:(0,W.jsx)(`span`,{className:`muted`,children:`(还没有开发仓库)`})]}),(0,W.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,W.jsx)(`span`,{className:`rp-pick-group-label`,children:`看板(项目组)`}),i.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!R[`board:`+e.id],onChange:t=>z(n=>({...n,[`board:`+e.id]:t.target.checked}))}),(0,W.jsx)(`span`,{title:e.desc||``,children:e.name})]},e.id)),i.length?null:(0,W.jsx)(`span`,{className:`muted`,children:`(还没有看板)`})]})]}),(0,W.jsx)(`div`,{className:`form-hint`,children:`一个参考可同时服务多个仓库/组;之后随时在「绑定…」里增删。`})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:()=>{P(!1),z({})},children:`取消`}),(0,W.jsx)(O,{disabled:!F.url.trim()||!E?.gitRepoRoot,title:E?.gitRepoRoot?`克隆到 ${E.gitRepoRoot}`:`先在「存储根」设置 gitRepoRoot`,onClick:G,children:`克隆`})]})]})}):null,B?(0,W.jsx)(a,{title:`绑定 · ${B.name}`,onClose:()=>V(null),children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`div`,{className:`form-hint`,children:`两类绑定并存、互不折算:勾「仓库组」= 组内共享(group_refs);勾「开发仓库」= 只绑这一个仓库(仓库级)。 取消勾选 = 摘除该维度(保存时对比差异)。`}),(0,W.jsxs)(`div`,{className:`rp-pick-list`,children:[(0,W.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,W.jsx)(`span`,{className:`rp-pick-group-label`,children:`仓库组`}),i.map(e=>{let t=K(e);return(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!H[`board:`+t],onChange:e=>ee(n=>({...n,[`board:`+t]:e.target.checked}))}),(0,W.jsx)(`span`,{title:e.desc||``,children:e.name})]},e.id)}),i.length?null:(0,W.jsx)(`span`,{className:`muted`,children:`(还没有看板)`})]}),(0,W.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,W.jsx)(`span`,{className:`rp-pick-group-label`,children:`开发仓库(单独绑定)`}),n.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!H[`repo:`+e.key],onChange:t=>ee(n=>({...n,[`repo:`+e.key]:t.target.checked}))}),(0,W.jsx)(`span`,{title:e.path,children:e.name}),(0,W.jsx)(`span`,{className:`muted mono rp-pick-desc`,children:e.key})]},e.id)),n.length?null:(0,W.jsx)(`span`,{className:`muted`,children:`(还没有开发仓库)`})]})]})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:()=>V(null),children:`取消`}),(0,W.jsx)(O,{onClick:()=>C(async()=>{if(!B)return;let e=e=>i.find(t=>K(t)===e.slice(6)),t=new Set([...i.filter(e=>(e.refs||[]).some(e=>e.id===B.key)).map(e=>`board:`+K(e)),...n.filter(e=>(e.linked||[]).some(e=>e&&e.kind===`ref`&&String(e.id)===B.key)).map(e=>`repo:`+e.key)]),r=new Set(Object.keys(H).filter(e=>H[e]));for(let n of r)if(!t.has(n)){if(n.startsWith(`board:`)){let t=e(n);if(!t)continue;await w({id:B.key,board:[t.id]})}else await w({id:B.key,repo:[n.slice(5)]})}for(let n of t)if(!r.has(n)){if(n.startsWith(`board:`)){let t=e(n);if(!t)continue;await w({id:B.key,board:[t.id],remove:!0})}else await w({id:B.key,repo:[n.slice(5)],remove:!0})}V(null),await Promise.all([S.repos(),S.boards(),S.refCheck()])}),children:`保存绑定`})]})]})}):null,k?(0,W.jsx)(a,{title:`参考仓库存储根`,onClose:()=>A(!1),children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`roots-ref`,children:`参考仓库存储根(gitRepoRoot)`}),(0,W.jsx)(`input`,{id:`roots-ref`,spellCheck:`false`,placeholder:`如 D:/gitrepo-ref(非 C 盘)`,value:j.gitRepoRoot,onChange:e=>M(t=>({...t,gitRepoRoot:e.target.value}))}),(0,W.jsx)(`div`,{className:`form-hint`,children:`repo ref clone 的落盘位置。不设 = 克隆被拒绝。`})]}),(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`roots-dev`,children:`开发仓库克隆根(gitDevRoot,可选)`}),(0,W.jsx)(`input`,{id:`roots-dev`,spellCheck:`false`,placeholder:`导入布局时开发仓库克隆到哪里`,value:j.gitDevRoot,onChange:e=>M(t=>({...t,gitDevRoot:e.target.value}))})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:()=>A(!1),children:`取消`}),(0,W.jsx)(O,{onClick:ne,children:`保存`})]})]})}):null]})}function ue({repos:e,boardList:n,onClose:o,onFilter:s,reload:c}){let l=r(),u=t(),{dialog:d,node:f}=i(),{openByDocId:p}=H(),[m,g]=(0,U.useState)([]),[_,v]=(0,U.useState)([]),[y,b]=(0,U.useState)(`all`),[x,S]=(0,U.useState)(``),w=(0,U.useCallback)(async()=>{let[e,t]=await Promise.all([C().catch(()=>null),D().catch(()=>null)]);g(e&&e.docs||[]),v(t&&t.bindings||[])},[]);(0,U.useEffect)(()=>{w()},[w]);let T=(0,U.useMemo)(()=>{let t=new Map,r=t=>e.find(e=>e.key===t)?.name||t,i=e=>n.find(t=>t.id===e||t.key===e||t.name===e||`board/`+t.name===e),a=(e,n,r,i,a)=>{if(!e||!a)return;t.has(e)||t.set(e,[]);let o=t.get(e);o&&(o.some(e=>e.label===r)||o.push({key:e+`|`+r,kind:n,label:r,tip:i||r,target:a}))};for(let e of _)if(e&&e.refId){if(e.type===`repo`){let t=r(e.repoKey);a(e.refId,`repo`,`仓:${t}`,`「${t}」的${e.main?`项目介绍主篇`:`文档`}`,e.repoKey)}else if(e.type===`group`){let t=i(e.repoKey),n=t?t.name:e.repoKey;a(e.refId,`board`,`组:${n}`,`组「${n}」的${e.main?`介绍文档`:`文档`}`,t?t.id:``)}else if(e.type===`group_repo`){let t=i(String(e.groupKey||``)),n=t?t.name:String(e.groupKey||``),o=r(e.repoKey);a(e.refId,`scoped`,`组内:${n} / ${o}`,`「${o}」在组「${n}」里的描述`,t?t.id:``)}}return t},[_,e,n]),E=(0,U.useMemo)(()=>{let e=x.trim().toLowerCase(),t=m.map(e=>({d:e,hosts:T.get(e.refId||``)||[]})).filter(t=>!e||[t.d.title,t.d.desc,t.d.name].some(t=>t&&String(t).toLowerCase().includes(e))||t.hosts.some(t=>t.label.toLowerCase().includes(e)));return y===`orphan`?t.filter(e=>!e.hosts.length):y===`all`?t:t.filter(e=>e.hosts.some(e=>e.kind===y))},[m,T,y,x]),k=(0,U.useMemo)(()=>{let e={all:m.length,repo:0,board:0,scoped:0,orphan:0};for(let t of m){let n=T.get(t.refId||``)||[];n.length||(e.orphan+=1);for(let t of[`repo`,`board`,`scoped`])n.some(e=>e.kind===t)&&(e[t]+=1)}return e},[m,T]),A=(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)},j=e=>A(document.getElementById(e)),M=e=>{if(!e||!e.target)return;if(e.kind===`board`){s(e.target),j(`rp-repos`);return}s(``);let t=document.getElementById(`rp-row-`+e.target);if(!t){j(`rp-repos`);return}A(t,`center`),t.classList.add(`rp-row-flash`),setTimeout(()=>t.classList.remove(`rp-row-flash`),1400)},N=e=>e.title||e.desc||e.name||`未命名文档`,P=e=>l(async()=>{let t=N(e),n=T.get(e.refId||``)||[];await d({message:`删除文档「${t}」?正文与归属会一并删除,不可恢复。`+(n.length?`它正被 ${n.length} 处引用(${n.map(e=>e.label).join(`、`)})。`:``),danger:!0})&&(await h({ref:e.docId}),u(`已删除:${t}`),await Promise.all([w(),c.repos(),c.boards()]))});return(0,W.jsxs)(a,{size:`wide`,title:`文档检索 · ${m.length}`,onClose:o,children:[(0,W.jsxs)(`div`,{className:`rp-modal-bar rp-doc-bar`,children:[(0,W.jsx)(`input`,{className:`rp-search`,type:`search`,value:x,onChange:e=>S(e.target.value),placeholder:`搜标题 / 描述 / 组名 / 仓库名…`,"aria-label":`检索文档`}),x?(0,W.jsx)(O,{small:!0,onClick:()=>S(``),children:`清空`}):null]}),m.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`rp-doc-scopes`,children:[[`all`,`全部`,k.all],[`repo`,`仓库文档`,k.repo],[`scoped`,`组内文档`,k.scoped],[`board`,`分组文档`,k.board],[`orphan`,`未绑定`,k.orphan]].map(([e,t,n])=>(0,W.jsxs)(`button`,{className:`rp-chip`+(y===e?` on`:``),onClick:()=>b(e),children:[t,` `,(0,W.jsx)(`b`,{children:n})]},e))}),(0,W.jsxs)(`div`,{className:`rp-doc-rows rp-doc-rows-modal`,children:[E.map(({d:e,hosts:t})=>(0,W.jsxs)(`div`,{className:`rp-doc-row`,children:[(0,W.jsx)(`button`,{type:`button`,className:`rp-doc-row-title`,title:`打开「${N(e)}」`,onClick:()=>p(e.docId),children:N(e)}),e.desc&&e.title&&e.desc!==e.title?(0,W.jsx)(`span`,{className:`rp-doc-row-desc`,children:e.desc}):null,(0,W.jsx)(`span`,{className:`rp-doc-row-hosts`,children:t.length?t.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`rp-bind-chip `+e.kind,title:`${e.tip}\n点击跳到这个宿主`,onClick:()=>{M(e),o()},children:e.label},e.key)):(0,W.jsx)(`span`,{className:`rp-bind-chip none`,children:`未绑定`})}),(0,W.jsxs)(`span`,{className:`rp-doc-row-acts`,children:[(0,W.jsx)(O,{small:!0,onClick:()=>p(e.docId),children:`打开编辑`}),(0,W.jsx)(O,{small:!0,danger:!0,onClick:()=>P(e),children:`删除`})]})]},e.docId)),E.length?null:(0,W.jsx)(`div`,{className:`rp-board-empty muted`,children:`这一档没有匹配的文档。`})]})]}):(0,W.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有文档 —— 到右侧文档列表点 + 新建(直接写标题与描述); 或在仓库行上点「+ 写项目介绍」。`}),f]})}function de({boardList:e,unassigned:n,onClose:o,onFilter:s,onMembers:c,onOpenDoc:l,reload:u}){let d=r(),f=t(),{dialog:m,node:h}=i(),[g,_]=(0,U.useState)(null),[v,b]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(null),D=()=>d(async()=>{if(!g)return;let e={name:g.name.trim()};e.name&&(g.id||(e.desc=g.desc.trim()||void 0),g.id?await p(encodeURIComponent(g.id),e):await M(e),_(null),await u.boards())}),k=e=>d(async()=>{await m({message:`删看板「${e.name}」?它里面的 ${(e.repos||[]).length} 个仓库**仍留在中心清单里**(只是少了一份归属)。`,danger:!0})&&(await y(encodeURIComponent(e.id)),await Promise.all([u.repos(),u.boards()]))});return(0,W.jsxs)(a,{size:`wide`,title:`分组管理 · ${e.length}`,onClose:o,children:[(0,W.jsxs)(`div`,{className:`rp-modal-bar`,children:[(0,W.jsxs)(`span`,{className:`acts`,children:[(0,W.jsx)(O,{small:!0,onClick:()=>_({id:null,name:``,desc:``}),children:`新建分组`}),(0,W.jsx)(O,{small:!0,title:`粘贴/选择看板 JSON`,onClick:()=>b(!0),children:`导入`}),(0,W.jsx)(O,{small:!0,title:`导出全部看板为 JSON`,onClick:()=>d(async()=>{let e=await E();T(JSON.stringify(e,null,2))}),children:`导出`})]}),(0,W.jsx)(`span`,{className:`muted`,children:`一个分组 = 一个主题;同一个仓库可以同时在多个分组里。`})]}),e.length?(0,W.jsxs)(`div`,{className:`rp-board-admin`,children:[(0,W.jsxs)(`div`,{className:`rp-board-admin-head`,children:[(0,W.jsx)(`span`,{children:`分组`}),(0,W.jsx)(`span`,{children:`成员`}),(0,W.jsx)(`span`,{children:`组介绍`}),(0,W.jsx)(`span`,{children:`操作`})]}),e.map(e=>{let t=(e.repos||[]).filter(e=>e.present!==!1),n=(e.repos||[]).filter(e=>e.present===!1);return(0,W.jsxs)(`div`,{className:`rp-board-admin-row`,children:[(0,W.jsxs)(`span`,{className:`rp-board-admin-name`,children:[e.name,(0,W.jsx)(`button`,{className:`rp-mini-link`,title:`只看「${e.name}」里的仓库`,onClick:()=>{s(e.id),o()},children:`筛选`})]}),(0,W.jsxs)(`span`,{className:`rp-board-admin-members`,children:[t.slice(0,4).map(e=>(0,W.jsx)(`span`,{className:`rp-board-mchip`,title:e.note||e.key,children:e.name||e.key},e.key)),t.length>4?(0,W.jsxs)(`span`,{className:`rp-board-more`,children:[`+`,t.length-4]}):null,n.length?(0,W.jsxs)(`span`,{className:`rp-board-missing`,children:[n.length,` 待初始化`]}):null,(e.repos||[]).length?null:(0,W.jsx)(`span`,{className:`muted`,children:`—`})]}),(0,W.jsxs)(`span`,{className:`rp-board-admin-doc`,children:[(0,W.jsx)(O,{small:!0,title:`在右侧栏列出这个组的文档`,onClick:()=>l(e),children:`文档`}),e.docCount&&e.docCount>1?(0,W.jsxs)(`span`,{className:`muted`,children:[`+`,e.docCount-1]}):null]}),(0,W.jsxs)(`span`,{className:`rp-board-admin-acts`,children:[(0,W.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(e.id),title:`组页:成员与任务`,children:`组页 ↗`}),(0,W.jsx)(O,{small:!0,onClick:()=>c(e.id),children:`成员`}),(0,W.jsx)(O,{small:!0,onClick:()=>_({id:e.id,name:e.name,desc:e.desc||``}),children:`编辑`}),(0,W.jsx)(O,{small:!0,danger:!0,onClick:()=>k(e),children:`删除`})]})]},e.id)}),n?.length?(0,W.jsxs)(`div`,{className:`rp-boards-unassigned`,children:[`未分组 `,(0,W.jsx)(`b`,{children:n.length}),` 个 —— 不属于任何分组,只在「全部」里可见。`]}):null]}):(0,W.jsx)(`div`,{className:`rp-board-empty muted`,children:`还没有分组 —— 点「新建分组」建一个当主题用(如「前端」「AI 工具」),再把仓库点选进去。`}),g?(0,W.jsx)(a,{title:g.id?`编辑看板`:`新建看板`,onClose:()=>_(null),children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`bd-name`,children:`看板名称 *`}),(0,W.jsx)(`input`,{id:`bd-name`,placeholder:`如 前端 / AI 工具`,value:g.name,onChange:e=>_(t=>t&&{...t,name:e.target.value})})]}),g.id?(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{children:`领域描述(文档)`}),(0,W.jsx)(`div`,{className:`rp-docpick`,children:(0,W.jsx)(`button`,{type:`button`,className:`rp-doc`+(g.desc?``:` ghost`),title:`打开右侧栏文档列表(组介绍在里面维护)`,onClick:()=>{let t=e.find(e=>e.id===g?.id);_(null),t&&l(t)},children:g.desc||`未写`})})]}):(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`bd-desc`,children:`初始描述`}),(0,W.jsx)(`textarea`,{id:`bd-desc`,rows:3,spellCheck:`false`,placeholder:`新建时给的介绍正文(之后在组介绍文档里继续维护)。
13
- 如:这组仓库在这个环境里的侧重、配合关系、关键路径与搜索关键词。`,value:g.desc,onChange:e=>_(t=>t&&{...t,desc:e.target.value})})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:()=>_(null),children:`取消`}),(0,W.jsx)(O,{disabled:!g.name.trim(),onClick:D,children:g.id?`保存`:`新建看板`})]})]})}):null,v?(0,W.jsx)(a,{title:`导入看板 JSON`,size:`lg`,onClose:()=>{b(!1),C(``)},children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{htmlFor:`bd-imp`,children:`看板 JSON`}),(0,W.jsxs)(`div`,{className:`form-hint`,children:[`结构 `,`{ boards:[{ name, repos:[{ path|name }] }] }`,` —— 按 path 或 name 匹配已登记仓库,匹配不上的会如实报告`]}),(0,W.jsx)(`input`,{id:`bd-imp-file`,type:`file`,accept:`.json,application/json`,onChange:async e=>{let t=e.target.files?.[0];t&&C(await t.text())}}),(0,W.jsx)(`textarea`,{id:`bd-imp`,rows:10,spellCheck:`false`,placeholder:`{"boards":[{"name":"前端","repos":[{"path":"D:/code/a_js/proj/nx-ft"}]}]}`,value:S,onChange:e=>C(e.target.value)})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:()=>{b(!1),C(``)},children:`取消`}),(0,W.jsx)(O,{disabled:!S.trim(),onClick:()=>d(async()=>{if(!S.trim())return;let e=await x({json:S});b(!1),C(``),f(`已导入:新建 ${e.created} 个看板、合并 ${e.merged} 个、匹配仓库 ${e.matched} 个`+(e.unmatched.length?`;未匹配 ${e.unmatched.length} 条(见 CLI board import 输出)`:``)),await Promise.all([u.repos(),u.boards()])}),children:`导入`})]})]})}):null,w?(0,W.jsx)(a,{title:`看板 JSON(可回灌给导入)`,size:`lg`,onClose:()=>T(null),children:(0,W.jsx)(`textarea`,{className:`bd-exp`,rows:14,readOnly:!0,value:w,spellCheck:`false`})}):null,h]})}function fe({repo:e,refRepos:n,boardList:i,currentRefs:o,onClose:s,onSaved:c}){let l=r(),u=t(),d=i.filter(t=>(t.repos||[]).some(t=>t.key===e.key)),[f,p]=(0,U.useState)(()=>{let e={};for(let t of o||[])e[t.key]=!0;return e});return(0,W.jsx)(a,{title:`「${e.name}」的参考仓库`,onClose:s,children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsxs)(`div`,{className:`form-hint`,children:[`参考仓库绑定在组上,勾选 = 绑到「`,e.name,`」所属的组,组内所有仓库共享。仓库不属于任何组时请先把它加入组。`]}),(0,W.jsx)(`div`,{className:`rp-pick-list`,children:(0,W.jsxs)(`div`,{className:`rp-pick-group`,children:[(0,W.jsx)(`span`,{className:`rp-pick-group-label`,children:`参考仓库`}),n.map(e=>(0,W.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:!!f[e.key],onChange:t=>p(n=>({...n,[e.key]:t.target.checked}))}),(0,W.jsx)(`span`,{title:e.remote||``,children:e.name}),e.desc?(0,W.jsx)(`span`,{className:`muted rp-pick-desc`,children:e.desc}):null]},e.key)),n.length?null:(0,W.jsx)(`span`,{className:`muted`,children:`(还没有参考仓库 —— 先在参考面板里克隆)`})]})}),d.length?(0,W.jsxs)(`div`,{className:`form-hint`,children:[`将写入:`,d.map(e=>e.name).join(`、`)]}):(0,W.jsx)(`div`,{className:`form-hint rp-ref-warn`,children:`这个仓库不属于任何组,保存会被拒绝 —— 先把它加入组。`})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:s,children:`取消`}),(0,W.jsx)(O,{onClick:()=>l(async()=>{if(!d.length){u(`这个仓库不属于任何组 —— 参考绑定挂在组上;先把它加入组`);return}let e=new Set((o||[]).map(e=>e.key)),t=new Set(Object.keys(f).filter(e=>f[e]));for(let n of t)if(!e.has(n))for(let e of d)await w({id:n,board:[e.id]});for(let n of e)if(!t.has(n))for(let e of d)await w({id:n,board:[e.id],remove:!0});s(),await c()}),children:`保存绑定`})]})]})})}function pe({linkNoteFor:e,onClose:n,onSaved:i}){let o=r(),s=t(),{ref:c,groupId:l,groupName:u,note:d}=e,[f,p]=(0,U.useState)(()=>d||``);return(0,W.jsx)(a,{title:`组级绑定描述 · ${c.name} @ 「${u}」`,onClose:n,children:(0,W.jsxs)(`div`,{className:`form-grid`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsxs)(`label`,{htmlFor:`link-note`,children:[`「`,c.name,`」在这个组里参考什么`]}),(0,W.jsx)(`div`,{className:`form-hint`,children:`写这条参考在此处的角色与用法(可多行、可含关键路径/搜索词)。留空保存 = 清除。`}),(0,W.jsx)(`textarea`,{id:`link-note`,rows:5,spellCheck:`false`,placeholder:`如:project-graph 画布交互的实现参考;
14
- 看 src/extensions/ 的注册方式,搜 registerExtension。`,value:f,onChange:e=>p(e.target.value)})]}),(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:n,children:`取消`}),(0,W.jsx)(O,{onClick:()=>o(async()=>{await m({id:c.key,board:l,note:f}),n(),await i(),s(`已保存组级绑定描述`)}),children:`保存`})]})]})})}function me({repo:e,onClose:n,onSaved:i}){let o=r(),s=t(),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(null),f=(0,U.useCallback)(async()=>{try{let t=await S(e.key);if(!t||!Array.isArray(t.remotes))throw Error(`远程地址读取失败`);l(t)}catch(e){s(String(e.message||e)),n()}},[e.key,s,n]);(0,U.useEffect)(()=>{f()},[f]);let p=e=>o(async()=>{c&&(await R({id:c.key,url:e}),n(),s(`已对齐 remote`),await i())}),m=async e=>{let t=c?c.key:``;if(!t){d({url:``,status:`unreachable`,detail:`没有仓库标识`});return}d({url:e||c?.current||``,status:`checking`,detail:`检查中…`});try{let n=await _(t,e);d(n)}catch(t){d({url:e||c?.current||``,status:`unreachable`,detail:String(t.message||t)})}};return c?(0,W.jsx)(a,{title:`对齐 remote · ${c.name}`,onClose:n,children:(0,W.jsxs)(`div`,{className:`form-grid`,"data-testid":`rp-remote-modal`,children:[(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsxs)(`div`,{className:`form-hint`,children:[`当前采纳:`,(0,W.jsx)(`b`,{children:c.current||`(无)`}),`。换一条即对齐(key 随之重算;自定义 key 不动)。`]}),(0,W.jsxs)(`div`,{className:`rp-remote-list`,children:[c.remotes.map(e=>(0,W.jsxs)(`div`,{className:`rp-remote-item`,children:[(0,W.jsx)(`span`,{className:`rp-remote-name`,children:e.name}),(0,W.jsx)(`span`,{className:`mono rp-remote-url`,children:e.url}),(0,W.jsx)(`span`,{className:`rp-remote-kind`,children:e.kind}),e.current?(0,W.jsx)(`span`,{className:`rp-remote-on`,children:`当前`}):null,(0,W.jsxs)(`span`,{className:`acts`,children:[e.current?null:(0,W.jsx)(O,{small:!0,onClick:()=>p(e.url),children:`对齐这条`}),(0,W.jsx)(O,{small:!0,onClick:()=>m(e.url),children:`检查`})]})]},e.name+`|`+e.url)),c.remotes.length?null:(0,W.jsx)(`div`,{className:`muted`,children:`这个仓库没有配置 remote —— 先在 git 里 git remote add`})]})]}),u?(0,W.jsxs)(`div`,{className:`form-field`,children:[(0,W.jsx)(`label`,{children:`存在性检查`}),(0,W.jsxs)(`div`,{className:`rp-remote-check`,children:[(0,W.jsx)(`span`,{className:`rp-status `+(u.status===`exists`?`same`:u.status===`missing`?`new`:u.status===`checking`?`checking`:`missing`),children:u.status===`exists`?`存在`:u.status===`missing`?`不存在`:u.status===`checking`?`检查中`:`不可达`}),(0,W.jsx)(`span`,{className:`mono rp-remote-url`,children:u.url}),(0,W.jsx)(`span`,{className:`muted`,children:u.detail})]})]}):null,(0,W.jsxs)(`div`,{className:`form-acts`,children:[(0,W.jsx)(O,{onClick:n,children:`关闭`}),(0,W.jsx)(O,{onClick:()=>m(``),children:`检查当前 remote`})]})]})}):null}function he(){let e=r(),n=t(),{dialog:a,node:o}=i(),s=z(),[l,d]=(0,U.useState)([]),[p,m]=(0,U.useState)(null),[h,_]=(0,U.useState)(null),v=(0,U.useCallback)(async()=>{d(await g().catch(()=>[])||[])},[]),y=(0,U.useCallback)(async()=>{m(await A().catch(()=>null))},[]),b=(0,U.useCallback)(async()=>{_(await P().catch(()=>null))},[]);(0,U.useEffect)(()=>{v(),y(),b()},[v,y,b]);let x=(0,U.useMemo)(()=>({repos:v,boards:y,refCheck:b,all:async()=>{await Promise.all([v(),y(),b()])}}),[v,y,b]),[S,C]=(0,U.useState)(``),[T,E]=(0,U.useState)(``),[D,O]=(0,U.useState)(void 0),[k,j]=(0,U.useState)(!1),[M,I]=(0,U.useState)(!1),[L,R]=(0,U.useState)(``),[B,V]=(0,U.useState)({}),[H,G]=(0,U.useState)(!1),[K,J]=(0,U.useState)(null),[Y,ie]=(0,U.useState)(!1),[X,he]=(0,U.useState)(null),[ge,_e]=(0,U.useState)(null),[ve,ye]=(0,U.useState)(null),[be,xe]=(0,U.useState)(null);(0,U.useEffect)(()=>{let e=()=>{let e=location.hash.split(`?`)[1]||``;if(!e)return;let t=new URLSearchParams(e),n=t.get(`board`);n&&(C(n),t.get(`add`)&&J(n))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let Z=(0,U.useMemo)(()=>p&&p.boards||[],[p]),Q=(0,U.useMemo)(()=>l.filter(e=>(e.type||`dev`)!==`ref`),[l]),$=(0,U.useMemo)(()=>l.filter(e=>e.type===`ref`),[l]),Se=(0,U.useMemo)(()=>{let e=Q;S&&(e=e.filter(e=>(e.boards||[]).some(e=>e.id===S)));let t=T.trim().toLowerCase();if(!t)return e;let n=e=>{let n=e.descDocs&&e.descDocs.main;return n&&[n.title,n.summary,n.desc].some(e=>e&&String(e).toLowerCase().includes(t))?!0:(e.descDocs&&e.descDocs.links||[]).some(e=>[e.title,e.desc,e.tag,e.note].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))},[Q,S,T]),Ce=(0,U.useMemo)(()=>Z.find(e=>e.id===S)||null,[Z,S]),we=(0,U.useMemo)(()=>Z.find(e=>e.id===K)||null,[Z,K]),Te=(0,U.useMemo)(()=>{let e=new Map;return(h?.refRepos||[]).forEach(t=>e.set(t.id,t)),e},[h]),Ee=(0,U.useMemo)(()=>{let e=new Map,t=new Map($.map(e=>[e.key,e]));for(let n of Z){let r=n.key||`board/${n.name}`;for(let i of(n.repos||[]).map(e=>e.key))for(let a of n.refs||[]){let o=t.get(a.id);if(!o)continue;e.has(i)||e.set(i,[]);let s=e.get(i);if(!s)continue;let c=s.find(e=>e.key===o.key);if(c){c.group&&c.group.name!==n.name&&(c.alsoIn=[...c.alsoIn||[],n.name]);continue}s.push({key:o.key,id:o.id,name:o.name,remote:o.remote||``,note:a.note||``,group:{id:n.id,key:r,name:n.name}})}}return e},[Z,$]),De=(0,U.useMemo)(()=>{let e=new Map,t=new Map($.map(e=>[e.key,e]));for(let n of Q){let r=(n.linked||[]).filter(e=>e&&e.kind===`ref`).map(e=>{let n=t.get(e.id);return n?{key:n.key,name:n.name,note:e.note||``}:null}).filter(e=>e!==null);e.set(n.key,r)}return e},[Q,$]),Oe=(0,U.useMemo)(()=>{let e=new Map;for(let t of Q)for(let n of t.linked||[]){if(!n||n.kind!==`ref`)continue;e.has(n.id)||e.set(n.id,[]);let r=e.get(n.id);r&&r.push({repo:t,note:n.note||``})}return e},[Q]);(0,U.useEffect)(()=>{if(!M||!L)return;let e=null,t=0,n=requestAnimationFrame(()=>{e=document.getElementById(`rp-refrepo-row-`+L),e&&(e.scrollIntoView({block:`center`}),e.classList.add(`rp-row-flash`),t=window.setTimeout(()=>e?.classList.remove(`rp-row-flash`),1600))});return()=>{cancelAnimationFrame(n),clearTimeout(t),e&&e.classList.remove(`rp-row-flash`)}},[M,L]);let ke=t=>e(async()=>{let e=await u({id:t.id});n(e.status===`updated`?`已更新: ${e.name}`:e.status===`upToDate`?`${e.name} 已是最新`:`${e.name}: ${e.status} ${e.output||``}`)}),Ae=(t,n)=>e(async()=>{await w({id:t.key,board:[n],remove:!0}),await Promise.all([v(),y(),b()])}),je=(t,n)=>e(async()=>{await w({id:t.key,repo:[n],remove:!0}),await Promise.all([v(),y(),b()])}),Me=(e,t,n,r)=>{xe({ref:e,groupId:t,groupName:n,note:r||``})},Ne=e=>{let t=s.model;if(!t){n(`工作区不可用,无法打开文档列表`);return}c(t,{component:`refs`,name:`文档列表`,config:{repoKey:e.key||``,repoName:e.name||``,scope:`repo`},location:`right`})},Pe=(t,n)=>e(async()=>{if(t===`open`)await F({id:n.id});else if(t===`del`){if(!await a({message:`删除仓库登记「${n.name}」?(仅移除登记,磁盘文件不受影响;各看板里的归属同步摘除)`,danger:!0}))return;await f(encodeURIComponent(n.id)),await x.all()}}),Fe=e=>{let t=s.model;if(!t){n(`工作区不可用,无法打开文档列表`);return}c(t,{component:`refs`,name:`文档列表`,config:{boardKey:e.key||e.id||``,boardName:e.name||``,scope:`all`},location:`right`})},Ie=(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)},Le=e=>Ie(document.getElementById(e)),Re=e=>{if(!e||!e.target)return;if(e.kind===`board`){C(e.target),Le(`rp-repos`);return}C(``);let t=document.getElementById(`rp-row-`+e.target);if(!t){Le(`rp-repos`);return}Ie(t,`center`),t.classList.add(`rp-row-flash`),setTimeout(()=>t.classList.remove(`rp-row-flash`),1400)},ze=(e,t)=>{I(!1),E(``),setTimeout(()=>Re({kind:e,target:t}),60)},Be={open:e=>Pe(`open`,e),edit:e=>O(e.id),del:e=>Pe(`del`,e),remote:e=>{if(!e.key){n(`这个仓库还没有 key —— 先 nx-kv repo key set <id> <key>`);return}_e(e)},getloop:e=>he(e),docs:e=>{let t=s.model;if(!t){n(`工作区不可用,无法打开文档列表`);return}c(t,{component:`refs`,name:`文档列表`,config:{repoKey:e.key||``,repoName:e.name||``,scope:`repo`},location:`right`})},filter:e=>C(t=>t===e?``:e),gotoRefRepo:e=>{R(e),I(!0)},bind:e=>ye(e)};return p===null?(0,W.jsxs)(`div`,{className:`rp-page`,children:[(0,W.jsx)(ee,{}),(0,W.jsx)(`div`,{className:`muted`,style:{padding:20},children:`读取中…`}),o]}):(0,W.jsxs)(`div`,{className:`rp-page`,children:[(0,W.jsxs)(`div`,{className:`page-head`,children:[(0,W.jsx)(`div`,{className:`title-block`,children:(0,W.jsx)(`h2`,{children:`仓库管理`})}),(0,W.jsx)(`div`,{className:`acts`,children:(0,W.jsx)(te,{kind:`repos`,titles:{add:`登记本机开发仓库`,boards:`分组管理:建组 / 成员 / 组介绍文档`,refs:`参考仓库面板:克隆 / 绑定 / 同步 / 检查 / 存储根`,transfer:`布局与仓库的导入导出(逐条选择 / 冲突方案 / 差异检查)`},actions:{add:()=>O(null),boards:()=>j(!0),refs:()=>I(!0),transfer:()=>ie(!0)}})})]}),(0,W.jsx)(ce,{boards:p,devRepos:Q,refRepos:$,reload:x}),(0,W.jsx)(oe,{boards:Z,filter:S,onFilter:C,devCount:Q.length,shownCount:Se.length,q:T,onQ:E,onOpenDocs:()=>G(!0)}),(0,W.jsx)(se,{filterBoard:Ce,refRepos:$,checkOf:Te,onOpenDoc:Fe,onOpenRefDocs:Ne,onAddMember:J,onSync:ke,onOpen:e=>Pe(`open`,e),onLinkNote:Me,onUnbind:Ae}),(0,W.jsx)(ae,{shown:Se,devRepos:Q,filterBoard:Ce,refRepoChipsByRepo:De,acts:Be,onAddMember:J}),M?(0,W.jsx)(le,{refRepos:$,devRepos:Q,boardList:Z,checkOf:Te,refRepoBackLinks:Oe,refBindOpen:B,onRefBindOpen:V,onClose:()=>I(!1),onSyncOne:ke,onUnbind:Ae,onUnbindRepo:je,onLinkNote:Me,onGoBind:ze,onDocs:Be.docs,onRowAct:Pe,reload:x}):null,H?(0,W.jsx)(ue,{repos:l,boardList:Z,onClose:()=>G(!1),onFilter:C,reload:x}):null,k?(0,W.jsx)(de,{boardList:Z,unassigned:p.unassigned,onClose:()=>j(!1),onFilter:C,onMembers:J,onOpenDoc:Fe,reload:x}):null,D===void 0?null:(0,W.jsx)(N,{editing:D,repos:l,onClose:()=>O(void 0),onSaved:x.all}),we?(0,W.jsx)(ne,{board:we,boards:Z,repos:l,onClose:()=>J(null),onChanged:async()=>{await Promise.all([v(),y()])}}):null,ve?(0,W.jsx)(fe,{repo:ve,refRepos:$,boardList:Z,currentRefs:Ee.get(ve.key)||[],onClose:()=>ye(null),onSaved:x.all}):null,be?(0,W.jsx)(pe,{linkNoteFor:be,onClose:()=>xe(null),onSaved:x.all}):null,Y?(0,W.jsx)(re,{onClose:()=>ie(!1),onChanged:x.all,repos:l,boards:Z}):null,X?(0,W.jsx)(q,{repo:l.find(e=>e.id===X.id)||X,onClose:()=>he(null),onSaved:v}):null,ge?(0,W.jsx)(me,{repo:ge,onClose:()=>_e(null),onSaved:async()=>{await Promise.all([v(),b()])}}):null,o]})}export{he as default};