nx-kv 0.42.0 → 0.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.json +1 -1
- package/src/web/frontend/modules/md/styles/shell.css +7 -22
- package/src/web/frontend/page/dir/landing.jsx +80 -80
- package/src/web/frontend/page/repos/repo-table.jsx +10 -4
- package/src/web/public/assets/{Introduction-CGJg0hoV.js → Introduction-CdC8MBfL.js} +1 -1
- package/src/web/public/assets/{bar-5QC796WJ.js → bar-yESbzCxC.js} +1 -1
- package/src/web/public/assets/{cloud-D_N8DSl0.js → cloud-BotRQcvf.js} +1 -1
- package/src/web/public/assets/{composer-panel-n_8TM7hC.js → composer-panel-Xru2qIma.js} +1 -1
- package/src/web/public/assets/dir-D4Q3L20K.js +5 -0
- package/src/web/public/assets/{group-BreSC7Jq.js → group-Csco0TYH.js} +1 -1
- package/src/web/public/assets/{index-BjHbC1Pr.js → index-BrAIkzFc.js} +2 -2
- package/src/web/public/assets/index-CZzMw1zg.css +1 -0
- package/src/web/public/assets/{md-history-XRRcXn6B.js → md-history-DB5forf2.js} +1 -1
- package/src/web/public/assets/{overview-B31mFQ1o.js → overview-J1mQpmJt.js} +1 -1
- package/src/web/public/assets/{refs-BOpaaFX5.js → refs-FI1FMoGi.js} +1 -1
- package/src/web/public/assets/{repos-mvXPWSNa.js → repos-Oaycnb4I.js} +4 -3
- package/src/web/public/assets/{route-crumb-2JmLQxqZ.js → route-crumb-C8JzPIax.js} +1 -1
- package/src/web/public/assets/{settings-0HIgaIQY.js → settings-D5wTGhPD.js} +1 -1
- package/src/web/public/assets/{status-tag-DN6e7yfb.js → status-tag-BoUoKYZK.js} +1 -1
- package/src/web/public/assets/{task-Cl6JZ4-k.js → task-BgubFzHT.js} +1 -1
- package/src/web/public/assets/{task-row-J0w1AAxG.js → task-row-Bc6JBfrE.js} +1 -1
- package/src/web/public/assets/{templates-ChbbmSet.js → templates-6DQdUpiB.js} +1 -1
- package/src/web/public/assets/{tool-bar-BrQ71A9i.js → tool-bar-DGCwnUcn.js} +1 -1
- package/src/web/public/index.html +2 -2
- package/src/web/public/assets/dir-Q57Dyaih.js +0 -5
- package/src/web/public/assets/index-w0VRiX16.css +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import{f as e,g as t,h as n,l as r,m as i,o as a,p as o,y as s}from"./task-status-BnymQMTw.js";import{n as c}from"./app-context-D7HAx67n.js";import{x as l}from"./index-BjHbC1Pr.js";import{t as u}from"./route-crumb-2JmLQxqZ.js";import{i as d,n as f}from"./Introduction-CGJg0hoV.js";import{t as p}from"./bar-5QC796WJ.js";import{t as m}from"./member-picker-BAgkj36N.js";import{t as h}from"./button-Cmo-6aoW.js";var g=s(t(),1),_=n(),v={new:{label:`新增`,cls:`new`},changed:{label:`有差异`,cls:`changed`},same:{label:`一致`,cls:`same`}};function y({onClose:t,onChanged:n,repos:r,boards:a}){let s=e(),c=o(),[l,u]=(0,g.useState)(`import`),[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)({}),[h,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)({}),[O,k]=(0,g.useState)({}),[A,j]=(0,g.useState)(`ours`),[M,ee]=(0,g.useState)(`none`),[N,P]=(0,g.useState)(``),[F,I]=(0,g.useState)(null),[L,R]=(0,g.useState)(!1),z=(0,g.useMemo)(()=>r||[],[r]),B=(0,g.useMemo)(()=>z.map(e=>e.key),[z]),V=(0,g.useMemo)(()=>(a||[]).map(e=>e.name),[a]),H=e=>{let t={};for(let n of B)t[n]=e;f(t)},te=e=>{let t={};for(let n of V)t[n]=e;m(t)},U=()=>{let e={};for(let t of B)e[t]=!d[t];f(e)},W=()=>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!==B.length?e:void 0,boards:t.length&&t.length!==V.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 a=await i(`/api/repos/export`+(r.toString()?`?`+r:``));x(JSON.stringify(a,null,2)),c(`已生成布局:${a.repos.length} 个仓库 / ${a.boards.length} 个看板`)}),G=()=>{if(!b)return;let e=new Blob([b],{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)},K=async e=>{let t=e.target.files?.[0];t&&(C(await t.text()),T(null),I(null))},ne=()=>s(async()=>{if(S.trim()){R(!0);try{let e=await i(`/api/repos/import/diff`,{method:`POST`,body:{json:S}});T(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;D(t);let n={};for(let t of e.boards)n[t.key]=t.status!==`same`;k(n),I(null),c(`差异:新增 ${e.summary.new} · 有差异 ${e.summary.changed} · 一致 ${e.summary.same} · 本地未拥有 ${e.summary.missing}`)}finally{R(!1)}}}),q=()=>s(async()=>{let e=Object.keys(E).filter(e=>E[e]),t=Object.keys(O).filter(e=>O[e]);R(!0);try{let r=await i(`/api/repos/import`,{method:`POST`,body:{json:S,strategy:A,clone:M,selection:e.length?e:void 0,boards:t.length?t:void 0}});I(r),c(`导入完成:新建 ${r.created.length} · 覆盖 ${r.updated.length} · 另存 ${r.duplicated.length}`),await J(),n&&await n()}finally{R(!1)}}),J=(0,g.useCallback)(async()=>{try{let e=await i(`/api/repos/import/diff`,{method:`POST`,body:{json:S}});T(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;D(t)}catch{}},[S]),re=(0,g.useMemo)(()=>w?N?w.repos.filter(e=>e.status===N):w.repos:[],[w,N]),ie=(e,t)=>s(async()=>{if(t){R(!0);try{await i(`/api/repos/clone`,{method:`POST`,body:{remote:t,key:e,type:`ref`,depth:1}}),c(`已克隆: ${e}`),await J(),n&&await n()}finally{R(!1)}}}),ae=e=>{let t={...E};for(let n of re)t[n.key]=e;D(t)};(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopImmediatePropagation(),t())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]);let oe=(0,g.useMemo)(()=>{if(!w)return null;let e={new:0,changed:0,same:0};for(let t of w.repos)e[t.status]=(e[t.status]||0)+1;return e},[w]);return(0,_.jsx)(`div`,{className:`rp-full`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,_.jsxs)(`div`,{className:`rp-full-box`,children:[(0,_.jsxs)(`div`,{className:`rp-full-head`,children:[(0,_.jsxs)(`div`,{className:`rp-full-title`,children:[`导入导出`,(0,_.jsx)(`span`,{className:`muted`,children:`以全局 key 为身份 · 不含本地路径 · 逐条选择与冲突方案`})]}),(0,_.jsxs)(`div`,{className:`rp-full-tabs`,children:[(0,_.jsx)(`button`,{className:`rp-tab`+(l===`import`?` on`:``),onClick:()=>u(`import`),children:`导入`}),(0,_.jsx)(`button`,{className:`rp-tab`+(l===`export`?` on`:``),onClick:()=>u(`export`),children:`导出`})]}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:t,children:`关闭`})]}),l===`export`?(0,_.jsxs)(`div`,{className:`rp-full-body`,children:[(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,_.jsx)(`span`,{children:`导出范围`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>H(!0),children:`全选仓库`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>H(!1),children:`全不选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:U,children:`反选`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-sel`,children:[z.map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!d[e.key],onChange:t=>f(n=>({...n,[e.key]:t.target.checked}))}),(0,_.jsx)(`span`,{className:e.type===`ref`?`rp-full-tag-ref`:``,children:e.name}),(0,_.jsx)(`span`,{className:`muted rp-full-key`,title:e.key,children:e.key})]},e.key)),z.length?null:(0,_.jsx)(`div`,{className:`muted`,children:`还没有仓库`})]}),(0,_.jsxs)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:[(0,_.jsx)(`span`,{children:`看板`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>te(!0),children:`全选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>te(!1),children:`全不选`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-sel`,children:[(a||[]).map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!p[e.name],onChange:t=>m(n=>({...n,[e.name]:t.target.checked}))}),(0,_.jsx)(`span`,{children:e.name})]},e.name)),a?.length?null:(0,_.jsx)(`div`,{className:`muted`,children:`还没有看板`})]}),(0,_.jsxs)(`label`,{className:`rp-pick-item`,style:{marginTop:10},children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>y(e.target.checked)}),(0,_.jsx)(`span`,{children:`不带未分组的仓库`})]}),(0,_.jsxs)(`div`,{className:`form-acts`,children:[(0,_.jsx)(`button`,{className:`btn`,onClick:W,children:`生成布局`}),(0,_.jsx)(`button`,{className:`btn ghost`,disabled:!b,onClick:G,children:`下载 JSON`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`导出结果`})}),(0,_.jsx)(`textarea`,{className:`rp-full-out`,readOnly:!0,value:b,spellCheck:`false`,placeholder:`点「生成布局」后在这里预览 JSON(可直接复制或下载)`})]})]}):(0,_.jsxs)(`div`,{className:`rp-full-body`,children:[(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`导入来源`})}),(0,_.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:K}),(0,_.jsx)(`textarea`,{className:`rp-full-input`,rows:7,spellCheck:`false`,placeholder:`粘贴布局 JSON,或选一个 .json 文件`,value:S,onChange:e=>{C(e.target.value),T(null)}}),(0,_.jsx)(`div`,{className:`form-hint`,children:`每个仓库的 key 必须有:文件里已写 key 就直接用;只写了远程地址就按 host/owner/repo 归一化; 两样都没有会在差异检查阶段直接报错(不会按名字猜 key)。要改 key 就改上面的 JSON 再检查。`}),(0,_.jsx)(`div`,{className:`form-acts`,children:(0,_.jsx)(`button`,{className:`btn`,disabled:!S.trim()||L,onClick:ne,children:`差异检查`})}),w?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:12},children:(0,_.jsx)(`span`,{children:`冲突方案`})}),(0,_.jsx)(`div`,{className:`rp-strategy`,children:[[`ours`,`保留本地`,`本地已有的不动,只新建缺失的`],[`overwrite`,`强制覆盖`,`用导入文件覆盖本地字段(key 不变)`],[`duplicate`,`另存新 key`,`为冲突项新建 key-import-1/2/3,两条并存`]].map(([e,t,n])=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,title:n,children:[(0,_.jsx)(`input`,{type:`radio`,name:`strategy`,checked:A===e,onChange:()=>j(e)}),(0,_.jsx)(`span`,{children:t})]},e))}),(0,_.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:(0,_.jsx)(`span`,{children:`克隆`})}),(0,_.jsxs)(`select`,{value:M,onChange:e=>ee(e.target.value),children:[(0,_.jsx)(`option`,{value:`none`,children:`不克隆,只登记`}),(0,_.jsx)(`option`,{value:`ref`,children:`克隆参考仓库`}),(0,_.jsx)(`option`,{value:`dev`,children:`克隆开发仓库`}),(0,_.jsx)(`option`,{value:`all`,children:`全部克隆`})]}),(0,_.jsx)(`div`,{className:`form-acts`,children:(0,_.jsxs)(`button`,{className:`btn`,disabled:L,onClick:q,children:[`执行导入(已选 `,Object.values(E).filter(Boolean).length,`)`]})})]}):null,F?(0,_.jsxs)(`div`,{className:`rp-import-result`,children:[(0,_.jsxs)(`div`,{children:[`新建 `,F.created.length,` · 覆盖 `,F.updated.length,` · 另存 `,F.duplicated.length,` · 跳过 `,F.skipped.length]}),(0,_.jsxs)(`div`,{className:`muted`,children:[`看板 新建 `,F.boardsCreated,` / 合并 `,F.boardsMerged,` · 参考关系 `,F.links]}),F.cloned.length?(0,_.jsxs)(`div`,{children:[`克隆 `,F.cloned.length,` 个`]}):null,F.unmatched.length?(0,_.jsxs)(`div`,{className:`rp-layout-warn`,children:[`本地未拥有 `,F.unmatched.length,` 条(见下方差异表)`]}):null]}):null]}),(0,_.jsx)(`div`,{className:`rp-full-col rp-full-col-wide`,children:w?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,_.jsxs)(`span`,{children:[`差异(新增 `,oe.new,` · 有差异 `,oe.changed,` · 一致 `,oe.same,w.summary.missing?` · 本地未拥有 ${w.summary.missing}`:``,`)`]}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`rp-chip`+(N===``?` on`:``),onClick:()=>P(``),children:`全部`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`new`?` on`:``),onClick:()=>P(`new`),children:`新增`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`changed`?` on`:``),onClick:()=>P(`changed`),children:`有差异`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`same`?` on`:``),onClick:()=>P(`same`),children:`一致`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ae(!0),children:`全选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ae(!1),children:`全不选`})]})]}),(0,_.jsx)(`div`,{className:`rp-diff-table-wrap`,children:(0,_.jsxs)(`table`,{className:`rp-diff-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{style:{width:`32px`}}),(0,_.jsx)(`th`,{style:{width:`90px`},children:`状态`}),(0,_.jsx)(`th`,{children:`仓库 key`}),(0,_.jsx)(`th`,{children:`差异字段`})]})}),(0,_.jsxs)(`tbody`,{children:[re.map(e=>(0,_.jsxs)(`tr`,{className:`rp-diff-row `+v[e.status]?.cls,children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(`input`,{type:`checkbox`,disabled:e.status===`same`,checked:!!E[e.key],onChange:t=>D(n=>({...n,[e.key]:t.target.checked}))})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(`span`,{className:`rp-status `+v[e.status]?.cls,children:v[e.status]?.label})}),(0,_.jsxs)(`td`,{className:`mono rp-diff-key`,children:[e.key,e.status===`new`&&e.canClone?(0,_.jsx)(`span`,{className:`rp-can-clone`,title:`导入时可克隆`,children:`可克隆`}):null,e.status===`new`&&e.canClone?(0,_.jsx)(`button`,{className:`btn small ghost rp-clone-btn`,title:`现在就克隆到本地(用这个 key 登记 → 组里的占位自动补齐)`,disabled:L,onClick:()=>ie(e.key,e.incoming?.remote||``),children:`克隆到本地`}):null]}),(0,_.jsx)(`td`,{className:`rp-diff-fields`,children:e.fields.length?e.fields.map(e=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`b`,{children:e.field}),`: `,(0,_.jsx)(`span`,{className:`rp-was`,children:JSON.stringify(e.local)}),` → `,(0,_.jsx)(`span`,{className:`rp-now`,children:JSON.stringify(e.incoming)})]},e.field)):(0,_.jsx)(`span`,{className:`muted`,children:`—`})})]},e.key)),w.missing.map(e=>(0,_.jsxs)(`tr`,{className:`rp-diff-row missing`,children:[(0,_.jsx)(`td`,{}),(0,_.jsx)(`td`,{children:(0,_.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`})}),(0,_.jsx)(`td`,{className:`mono rp-diff-key`,children:e}),(0,_.jsx)(`td`,{className:`rp-diff-fields muted`,children:`文件里被引用,但文件与本地都没有定义`})]},`miss-`+e))]})]})}),w.boards.length?(0,_.jsxs)(`div`,{className:`rp-diff-boards`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`看板`})}),w.boards.map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!O[e.key],onChange:t=>k(n=>({...n,[e.key]:t.target.checked}))}),(0,_.jsx)(`span`,{className:`rp-status `+v[e.status]?.cls,children:v[e.status]?.label}),(0,_.jsx)(`span`,{children:e.key}),(0,_.jsxs)(`span`,{className:`muted`,children:[`(`,e.incoming.repos.length,` 个成员`,e.missingMembers.length?`,本地未拥有 ${e.missingMembers.length}`:``,`)`]})]},e.key)),w.boards.flatMap(e=>e.missingMembers||[]).map(e=>(0,_.jsxs)(`div`,{className:`rp-missing-item`,children:[(0,_.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`}),(0,_.jsx)(`span`,{className:`mono rp-missing-key`,children:e.key}),e.remote?(0,_.jsx)(`span`,{className:`muted rp-missing-remote`,title:e.remote,children:e.remote}):null,e.clonable?(0,_.jsx)(`button`,{className:`btn small`,disabled:L,onClick:()=>ie(e.key,e.remote),children:`克隆到本地`}):(0,_.jsx)(`span`,{className:`muted`,title:`没有远程地址 —— 自行创建后用 repo key set 指定同一个 key`,children:`需手工创建`})]},e.key))]}):null]}):(0,_.jsx)(`div`,{className:`muted rp-full-empty`,children:`粘贴或选择一份布局 JSON,点「差异检查」后在这里逐条查看与勾选。`})})]})]})})}function b(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 x({value:e,onChange:t,placeholder:n,rows:r=3,hint:i=``}){return(0,_.jsxs)(`div`,{className:`pp-field`,children:[(0,_.jsx)(`textarea`,{className:`pp-field-ta mono`,rows:r,value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value)}),i?(0,_.jsx)(`div`,{className:`pp-field-hint`,children:i}):null]})}function S({items:e,onChange:t,disabled:n=!1,placeholder:r,rows:i=3,accordion:a=!1,openIndex:o,onOpenChange:s}){let[c,l]=(0,g.useState)(-1),u=o===void 0?c:o,d=e=>{l(e),s&&s(e)},f=(n,r)=>t(e.map((e,t)=>t===n?r:e)),p=n=>{t(e.filter((e,t)=>t!==n)),d(e=>e===n?-1:e>n?e-1:e)};return a?(0,_.jsx)(`div`,{className:`pp-items`,children:e.map((e,t)=>{let a=u===t,o=b(e.split(`
|
|
2
|
-
`)[0]);return(0,_.jsx)(`div`,{className:`pp-items-item`,children:a?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`div`,{className:`pp-items-body`,children:(0,_.jsx)(x,{value:e,onChange:e=>f(t,e),placeholder:r,rows:i})}),(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>p(t),title:`删除第 ${t+1} 条`,children:`删除`})]}):(0,_.jsxs)(`button`,{type:`button`,className:`pp-items-row`,disabled:n,title:`点击展开编辑`,onClick:()=>d(t),children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`span`,{className:`pp-items-title`,children:o||`(空)`}),(0,_.jsxs)(`span`,{className:`pp-items-len`,children:[String(e).length,` 字`]})]})},t)})}):(0,_.jsx)(_.Fragment,{children:e.map((e,t)=>(0,_.jsxs)(`div`,{className:`pp-items-item`,children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`div`,{className:`pp-items-body`,children:(0,_.jsx)(x,{value:e,onChange:e=>f(t,e),placeholder:r,rows:i})}),(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>p(t),title:`删除第 ${t+1} 条`,children:`删除`})]},t))})}var C=10,w=2e3,T=`不要直接结束本轮:完成上面的任务(%s)之后,继续调用 nx-kv localtask get(带 --summary 当前现状)领取下一条任务,直到 get 返回 timeout 为止。`;function E({repo:e,onClose:t,onSaved:n}){let r=c()||{},s=o(),l=e.getLoop&&typeof e.getLoop==`object`?e.getLoop:null,[u,d]=(0,g.useState)(!!(l&&l.enabled)),[f,p]=(0,g.useState)(String(l&&l.waitMinutes||10)),[m,v]=(0,g.useState)(()=>{let e=l&&l.template;return(Array.isArray(e)?e:e==null?[]:[e]).map(e=>String(e??``).trim()).filter(Boolean).map(e=>e.replaceAll(`{{task.id}}`,`%s`))}),[y,b]=(0,g.useState)(-1),[x,E]=(0,g.useState)(``),[D,O]=(0,g.useState)(!1),k=async t=>{O(!0);try{let a=t&&t.enabled!==void 0?t.enabled:u,o=m.map(e=>String(e??``).trim().replaceAll(`%s`,`{{task.id}}`)).filter(Boolean).slice(0,C);await i(`/api/repos/`+encodeURIComponent(e.id),{method:`PATCH`,body:{getLoop:{enabled:a,...a?{waitMinutes:Number(f)||10,template:o}:{}}}}),s(a?`已保存「${e.name}」的持续 get 设置(模板 ${o.length} 条)`:`已关闭「${e.name}」的持续 get`),r.refreshRepos&&r.refreshRepos(),n&&n()}catch(e){s(String(e.message||e))}finally{O(!1)}},A=async e=>{d(e),await k({enabled:e})},j=()=>{let e=x.trim();!e||m.length>=C||(v([...m,e.slice(0,w)]),b(m.length),E(``))};return(0,_.jsx)(a,{title:`持续 get · ${e.name}`,onClose:t,size:`md`,children:(0,_.jsxs)(`div`,{className:`rp-gl`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-head`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-title`,children:[(0,_.jsx)(`span`,{className:`rp-gl-name`,children:`持续 get`}),(0,_.jsx)(`span`,{className:`rp-gl-desc`,children:`无任务时阻塞等待新任务回填(waitgoal)`})]}),(0,_.jsxs)(`button`,{className:`toggle`+(u?` on`:``),onClick:()=>A(!u),disabled:D,children:[(0,_.jsx)(`span`,{className:`dot`}),u?`开`:`关`]})]}),u&&(0,_.jsxs)(`div`,{className:`rp-gl-body`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-row`,children:[(0,_.jsx)(`span`,{children:`阻塞窗口`}),(0,_.jsxs)(`span`,{className:`rp-gl-unit`,children:[(0,_.jsx)(`input`,{className:`rp-gl-min`,value:f,onChange:e=>p(e.target.value),inputMode:`numeric`}),`分钟`]})]}),(0,_.jsxs)(`div`,{className:`rp-gl-tpl`,children:[(0,_.jsx)(`div`,{className:`rp-gl-h`,children:`收尾模板`}),(0,_.jsxs)(`div`,{className:`rp-gl-oneline`,children:[(0,_.jsx)(h,{variant:`secondary`,title:`填入内置默认(继续 get 直到 timeout)`,onClick:()=>E(T),children:`填入内置默认`}),(0,_.jsx)(`input`,{className:`rp-gl-oneline-input`,value:x,placeholder:`一句话(%s = 任务编号)`,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()}}),(0,_.jsx)(h,{variant:`secondary`,disabled:D||!x.trim(),onClick:j,children:`添加`})]}),m.length?(0,_.jsx)(S,{items:m,onChange:v,disabled:D,placeholder:`一句话(%s = 任务编号)`,accordion:!0,openIndex:y,onOpenChange:b}):(0,_.jsx)(`div`,{className:`rp-gl-note`,children:`未配置模板 —— 用默认「完成后续调 localtask get;没活时每轮最多阻塞 {{getloop.waitMinutes}} 分钟,直到 timeout」。`})]}),(0,_.jsxs)(`div`,{className:`rp-gl-acts`,children:[(0,_.jsx)(h,{variant:`secondary`,disabled:D||m.length>=C,title:m.length>=C?`最多 ${C} 条`:`新增一条「继续 get」指令`,onClick:()=>{v([...m,``]),b(m.length)},children:`添加一条…`}),(0,_.jsx)(`span`,{className:`spacer`}),(0,_.jsx)(h,{variant:`primary`,disabled:D,onClick:()=>k(),children:`保存持续 get 设置`})]})]})]})})}function D({path:e}){let t=String(e||``),n=t.replace(/\\/g,`/`).lastIndexOf(`/`);return n<0?(0,_.jsx)(l,{text:t,children:t}):(0,_.jsxs)(l,{text:t,title:`点击复制完整路径`,children:[(0,_.jsx)(`span`,{className:`anc`,children:t.slice(0,n)}),t.slice(n)]})}function O({docs:e,onOpen:t}){let n=e&&e.main,r=e&&e.links||[],i=+!!n+r.length
|
|
1
|
+
import{f as e,g as t,h as n,l as r,m as i,o as a,p as o,y as s}from"./task-status-BnymQMTw.js";import{n as c}from"./app-context-D7HAx67n.js";import{x as l}from"./index-BrAIkzFc.js";import{t as u}from"./route-crumb-C8JzPIax.js";import{i as d,n as f}from"./Introduction-CdC8MBfL.js";import{t as p}from"./bar-yESbzCxC.js";import{t as m}from"./member-picker-BAgkj36N.js";import{t as h}from"./button-Cmo-6aoW.js";var g=s(t(),1),_=n(),v={new:{label:`新增`,cls:`new`},changed:{label:`有差异`,cls:`changed`},same:{label:`一致`,cls:`same`}};function y({onClose:t,onChanged:n,repos:r,boards:a}){let s=e(),c=o(),[l,u]=(0,g.useState)(`import`),[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)({}),[h,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)({}),[O,k]=(0,g.useState)({}),[A,j]=(0,g.useState)(`ours`),[M,ee]=(0,g.useState)(`none`),[N,P]=(0,g.useState)(``),[F,I]=(0,g.useState)(null),[L,R]=(0,g.useState)(!1),z=(0,g.useMemo)(()=>r||[],[r]),B=(0,g.useMemo)(()=>z.map(e=>e.key),[z]),V=(0,g.useMemo)(()=>(a||[]).map(e=>e.name),[a]),H=e=>{let t={};for(let n of B)t[n]=e;f(t)},te=e=>{let t={};for(let n of V)t[n]=e;m(t)},U=()=>{let e={};for(let t of B)e[t]=!d[t];f(e)},W=()=>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!==B.length?e:void 0,boards:t.length&&t.length!==V.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 a=await i(`/api/repos/export`+(r.toString()?`?`+r:``));x(JSON.stringify(a,null,2)),c(`已生成布局:${a.repos.length} 个仓库 / ${a.boards.length} 个看板`)}),G=()=>{if(!b)return;let e=new Blob([b],{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)},K=async e=>{let t=e.target.files?.[0];t&&(C(await t.text()),T(null),I(null))},ne=()=>s(async()=>{if(S.trim()){R(!0);try{let e=await i(`/api/repos/import/diff`,{method:`POST`,body:{json:S}});T(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;D(t);let n={};for(let t of e.boards)n[t.key]=t.status!==`same`;k(n),I(null),c(`差异:新增 ${e.summary.new} · 有差异 ${e.summary.changed} · 一致 ${e.summary.same} · 本地未拥有 ${e.summary.missing}`)}finally{R(!1)}}}),q=()=>s(async()=>{let e=Object.keys(E).filter(e=>E[e]),t=Object.keys(O).filter(e=>O[e]);R(!0);try{let r=await i(`/api/repos/import`,{method:`POST`,body:{json:S,strategy:A,clone:M,selection:e.length?e:void 0,boards:t.length?t:void 0}});I(r),c(`导入完成:新建 ${r.created.length} · 覆盖 ${r.updated.length} · 另存 ${r.duplicated.length}`),await J(),n&&await n()}finally{R(!1)}}),J=(0,g.useCallback)(async()=>{try{let e=await i(`/api/repos/import/diff`,{method:`POST`,body:{json:S}});T(e);let t={};for(let n of e.repos)t[n.key]=n.status!==`same`;D(t)}catch{}},[S]),re=(0,g.useMemo)(()=>w?N?w.repos.filter(e=>e.status===N):w.repos:[],[w,N]),ie=(e,t)=>s(async()=>{if(t){R(!0);try{await i(`/api/repos/clone`,{method:`POST`,body:{remote:t,key:e,type:`ref`,depth:1}}),c(`已克隆: ${e}`),await J(),n&&await n()}finally{R(!1)}}}),ae=e=>{let t={...E};for(let n of re)t[n.key]=e;D(t)};(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopImmediatePropagation(),t())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]);let oe=(0,g.useMemo)(()=>{if(!w)return null;let e={new:0,changed:0,same:0};for(let t of w.repos)e[t.status]=(e[t.status]||0)+1;return e},[w]);return(0,_.jsx)(`div`,{className:`rp-full`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,_.jsxs)(`div`,{className:`rp-full-box`,children:[(0,_.jsxs)(`div`,{className:`rp-full-head`,children:[(0,_.jsxs)(`div`,{className:`rp-full-title`,children:[`导入导出`,(0,_.jsx)(`span`,{className:`muted`,children:`以全局 key 为身份 · 不含本地路径 · 逐条选择与冲突方案`})]}),(0,_.jsxs)(`div`,{className:`rp-full-tabs`,children:[(0,_.jsx)(`button`,{className:`rp-tab`+(l===`import`?` on`:``),onClick:()=>u(`import`),children:`导入`}),(0,_.jsx)(`button`,{className:`rp-tab`+(l===`export`?` on`:``),onClick:()=>u(`export`),children:`导出`})]}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:t,children:`关闭`})]}),l===`export`?(0,_.jsxs)(`div`,{className:`rp-full-body`,children:[(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,_.jsx)(`span`,{children:`导出范围`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>H(!0),children:`全选仓库`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>H(!1),children:`全不选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:U,children:`反选`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-sel`,children:[z.map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!d[e.key],onChange:t=>f(n=>({...n,[e.key]:t.target.checked}))}),(0,_.jsx)(`span`,{className:e.type===`ref`?`rp-full-tag-ref`:``,children:e.name}),(0,_.jsx)(`span`,{className:`muted rp-full-key`,title:e.key,children:e.key})]},e.key)),z.length?null:(0,_.jsx)(`div`,{className:`muted`,children:`还没有仓库`})]}),(0,_.jsxs)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:[(0,_.jsx)(`span`,{children:`看板`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>te(!0),children:`全选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>te(!1),children:`全不选`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-sel`,children:[(a||[]).map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!p[e.name],onChange:t=>m(n=>({...n,[e.name]:t.target.checked}))}),(0,_.jsx)(`span`,{children:e.name})]},e.name)),a?.length?null:(0,_.jsx)(`div`,{className:`muted`,children:`还没有看板`})]}),(0,_.jsxs)(`label`,{className:`rp-pick-item`,style:{marginTop:10},children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>y(e.target.checked)}),(0,_.jsx)(`span`,{children:`不带未分组的仓库`})]}),(0,_.jsxs)(`div`,{className:`form-acts`,children:[(0,_.jsx)(`button`,{className:`btn`,onClick:W,children:`生成布局`}),(0,_.jsx)(`button`,{className:`btn ghost`,disabled:!b,onClick:G,children:`下载 JSON`})]})]}),(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`导出结果`})}),(0,_.jsx)(`textarea`,{className:`rp-full-out`,readOnly:!0,value:b,spellCheck:`false`,placeholder:`点「生成布局」后在这里预览 JSON(可直接复制或下载)`})]})]}):(0,_.jsxs)(`div`,{className:`rp-full-body`,children:[(0,_.jsxs)(`div`,{className:`rp-full-col`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`导入来源`})}),(0,_.jsx)(`input`,{type:`file`,accept:`.json,application/json`,onChange:K}),(0,_.jsx)(`textarea`,{className:`rp-full-input`,rows:7,spellCheck:`false`,placeholder:`粘贴布局 JSON,或选一个 .json 文件`,value:S,onChange:e=>{C(e.target.value),T(null)}}),(0,_.jsx)(`div`,{className:`form-hint`,children:`每个仓库的 key 必须有:文件里已写 key 就直接用;只写了远程地址就按 host/owner/repo 归一化; 两样都没有会在差异检查阶段直接报错(不会按名字猜 key)。要改 key 就改上面的 JSON 再检查。`}),(0,_.jsx)(`div`,{className:`form-acts`,children:(0,_.jsx)(`button`,{className:`btn`,disabled:!S.trim()||L,onClick:ne,children:`差异检查`})}),w?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:12},children:(0,_.jsx)(`span`,{children:`冲突方案`})}),(0,_.jsx)(`div`,{className:`rp-strategy`,children:[[`ours`,`保留本地`,`本地已有的不动,只新建缺失的`],[`overwrite`,`强制覆盖`,`用导入文件覆盖本地字段(key 不变)`],[`duplicate`,`另存新 key`,`为冲突项新建 key-import-1/2/3,两条并存`]].map(([e,t,n])=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,title:n,children:[(0,_.jsx)(`input`,{type:`radio`,name:`strategy`,checked:A===e,onChange:()=>j(e)}),(0,_.jsx)(`span`,{children:t})]},e))}),(0,_.jsx)(`div`,{className:`rp-full-colhead`,style:{marginTop:10},children:(0,_.jsx)(`span`,{children:`克隆`})}),(0,_.jsxs)(`select`,{value:M,onChange:e=>ee(e.target.value),children:[(0,_.jsx)(`option`,{value:`none`,children:`不克隆,只登记`}),(0,_.jsx)(`option`,{value:`ref`,children:`克隆参考仓库`}),(0,_.jsx)(`option`,{value:`dev`,children:`克隆开发仓库`}),(0,_.jsx)(`option`,{value:`all`,children:`全部克隆`})]}),(0,_.jsx)(`div`,{className:`form-acts`,children:(0,_.jsxs)(`button`,{className:`btn`,disabled:L,onClick:q,children:[`执行导入(已选 `,Object.values(E).filter(Boolean).length,`)`]})})]}):null,F?(0,_.jsxs)(`div`,{className:`rp-import-result`,children:[(0,_.jsxs)(`div`,{children:[`新建 `,F.created.length,` · 覆盖 `,F.updated.length,` · 另存 `,F.duplicated.length,` · 跳过 `,F.skipped.length]}),(0,_.jsxs)(`div`,{className:`muted`,children:[`看板 新建 `,F.boardsCreated,` / 合并 `,F.boardsMerged,` · 参考关系 `,F.links]}),F.cloned.length?(0,_.jsxs)(`div`,{children:[`克隆 `,F.cloned.length,` 个`]}):null,F.unmatched.length?(0,_.jsxs)(`div`,{className:`rp-layout-warn`,children:[`本地未拥有 `,F.unmatched.length,` 条(见下方差异表)`]}):null]}):null]}),(0,_.jsx)(`div`,{className:`rp-full-col rp-full-col-wide`,children:w?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`rp-full-colhead`,children:[(0,_.jsxs)(`span`,{children:[`差异(新增 `,oe.new,` · 有差异 `,oe.changed,` · 一致 `,oe.same,w.summary.missing?` · 本地未拥有 ${w.summary.missing}`:``,`)`]}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(`button`,{className:`rp-chip`+(N===``?` on`:``),onClick:()=>P(``),children:`全部`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`new`?` on`:``),onClick:()=>P(`new`),children:`新增`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`changed`?` on`:``),onClick:()=>P(`changed`),children:`有差异`}),(0,_.jsx)(`button`,{className:`rp-chip`+(N===`same`?` on`:``),onClick:()=>P(`same`),children:`一致`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ae(!0),children:`全选`}),(0,_.jsx)(`button`,{className:`btn small ghost`,onClick:()=>ae(!1),children:`全不选`})]})]}),(0,_.jsx)(`div`,{className:`rp-diff-table-wrap`,children:(0,_.jsxs)(`table`,{className:`rp-diff-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{style:{width:`32px`}}),(0,_.jsx)(`th`,{style:{width:`90px`},children:`状态`}),(0,_.jsx)(`th`,{children:`仓库 key`}),(0,_.jsx)(`th`,{children:`差异字段`})]})}),(0,_.jsxs)(`tbody`,{children:[re.map(e=>(0,_.jsxs)(`tr`,{className:`rp-diff-row `+v[e.status]?.cls,children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(`input`,{type:`checkbox`,disabled:e.status===`same`,checked:!!E[e.key],onChange:t=>D(n=>({...n,[e.key]:t.target.checked}))})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(`span`,{className:`rp-status `+v[e.status]?.cls,children:v[e.status]?.label})}),(0,_.jsxs)(`td`,{className:`mono rp-diff-key`,children:[e.key,e.status===`new`&&e.canClone?(0,_.jsx)(`span`,{className:`rp-can-clone`,title:`导入时可克隆`,children:`可克隆`}):null,e.status===`new`&&e.canClone?(0,_.jsx)(`button`,{className:`btn small ghost rp-clone-btn`,title:`现在就克隆到本地(用这个 key 登记 → 组里的占位自动补齐)`,disabled:L,onClick:()=>ie(e.key,e.incoming?.remote||``),children:`克隆到本地`}):null]}),(0,_.jsx)(`td`,{className:`rp-diff-fields`,children:e.fields.length?e.fields.map(e=>(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`b`,{children:e.field}),`: `,(0,_.jsx)(`span`,{className:`rp-was`,children:JSON.stringify(e.local)}),` → `,(0,_.jsx)(`span`,{className:`rp-now`,children:JSON.stringify(e.incoming)})]},e.field)):(0,_.jsx)(`span`,{className:`muted`,children:`—`})})]},e.key)),w.missing.map(e=>(0,_.jsxs)(`tr`,{className:`rp-diff-row missing`,children:[(0,_.jsx)(`td`,{}),(0,_.jsx)(`td`,{children:(0,_.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`})}),(0,_.jsx)(`td`,{className:`mono rp-diff-key`,children:e}),(0,_.jsx)(`td`,{className:`rp-diff-fields muted`,children:`文件里被引用,但文件与本地都没有定义`})]},`miss-`+e))]})]})}),w.boards.length?(0,_.jsxs)(`div`,{className:`rp-diff-boards`,children:[(0,_.jsx)(`div`,{className:`rp-full-colhead`,children:(0,_.jsx)(`span`,{children:`看板`})}),w.boards.map(e=>(0,_.jsxs)(`label`,{className:`rp-pick-item`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:!!O[e.key],onChange:t=>k(n=>({...n,[e.key]:t.target.checked}))}),(0,_.jsx)(`span`,{className:`rp-status `+v[e.status]?.cls,children:v[e.status]?.label}),(0,_.jsx)(`span`,{children:e.key}),(0,_.jsxs)(`span`,{className:`muted`,children:[`(`,e.incoming.repos.length,` 个成员`,e.missingMembers.length?`,本地未拥有 ${e.missingMembers.length}`:``,`)`]})]},e.key)),w.boards.flatMap(e=>e.missingMembers||[]).map(e=>(0,_.jsxs)(`div`,{className:`rp-missing-item`,children:[(0,_.jsx)(`span`,{className:`rp-status missing`,children:`本地未拥有`}),(0,_.jsx)(`span`,{className:`mono rp-missing-key`,children:e.key}),e.remote?(0,_.jsx)(`span`,{className:`muted rp-missing-remote`,title:e.remote,children:e.remote}):null,e.clonable?(0,_.jsx)(`button`,{className:`btn small`,disabled:L,onClick:()=>ie(e.key,e.remote),children:`克隆到本地`}):(0,_.jsx)(`span`,{className:`muted`,title:`没有远程地址 —— 自行创建后用 repo key set 指定同一个 key`,children:`需手工创建`})]},e.key))]}):null]}):(0,_.jsx)(`div`,{className:`muted rp-full-empty`,children:`粘贴或选择一份布局 JSON,点「差异检查」后在这里逐条查看与勾选。`})})]})]})})}function b(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 x({value:e,onChange:t,placeholder:n,rows:r=3,hint:i=``}){return(0,_.jsxs)(`div`,{className:`pp-field`,children:[(0,_.jsx)(`textarea`,{className:`pp-field-ta mono`,rows:r,value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value)}),i?(0,_.jsx)(`div`,{className:`pp-field-hint`,children:i}):null]})}function S({items:e,onChange:t,disabled:n=!1,placeholder:r,rows:i=3,accordion:a=!1,openIndex:o,onOpenChange:s}){let[c,l]=(0,g.useState)(-1),u=o===void 0?c:o,d=e=>{l(e),s&&s(e)},f=(n,r)=>t(e.map((e,t)=>t===n?r:e)),p=n=>{t(e.filter((e,t)=>t!==n)),d(e=>e===n?-1:e>n?e-1:e)};return a?(0,_.jsx)(`div`,{className:`pp-items`,children:e.map((e,t)=>{let a=u===t,o=b(e.split(`
|
|
2
|
+
`)[0]);return(0,_.jsx)(`div`,{className:`pp-items-item`,children:a?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`div`,{className:`pp-items-body`,children:(0,_.jsx)(x,{value:e,onChange:e=>f(t,e),placeholder:r,rows:i})}),(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>p(t),title:`删除第 ${t+1} 条`,children:`删除`})]}):(0,_.jsxs)(`button`,{type:`button`,className:`pp-items-row`,disabled:n,title:`点击展开编辑`,onClick:()=>d(t),children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`span`,{className:`pp-items-title`,children:o||`(空)`}),(0,_.jsxs)(`span`,{className:`pp-items-len`,children:[String(e).length,` 字`]})]})},t)})}):(0,_.jsx)(_.Fragment,{children:e.map((e,t)=>(0,_.jsxs)(`div`,{className:`pp-items-item`,children:[(0,_.jsx)(`span`,{className:`pp-items-no`,children:t+1}),(0,_.jsx)(`div`,{className:`pp-items-body`,children:(0,_.jsx)(x,{value:e,onChange:e=>f(t,e),placeholder:r,rows:i})}),(0,_.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:n,onClick:()=>p(t),title:`删除第 ${t+1} 条`,children:`删除`})]},t))})}var C=10,w=2e3,T=`不要直接结束本轮:完成上面的任务(%s)之后,继续调用 nx-kv localtask get(带 --summary 当前现状)领取下一条任务,直到 get 返回 timeout 为止。`;function E({repo:e,onClose:t,onSaved:n}){let r=c()||{},s=o(),l=e.getLoop&&typeof e.getLoop==`object`?e.getLoop:null,[u,d]=(0,g.useState)(!!(l&&l.enabled)),[f,p]=(0,g.useState)(String(l&&l.waitMinutes||10)),[m,v]=(0,g.useState)(()=>{let e=l&&l.template;return(Array.isArray(e)?e:e==null?[]:[e]).map(e=>String(e??``).trim()).filter(Boolean).map(e=>e.replaceAll(`{{task.id}}`,`%s`))}),[y,b]=(0,g.useState)(-1),[x,E]=(0,g.useState)(``),[D,O]=(0,g.useState)(!1),k=async t=>{O(!0);try{let a=t&&t.enabled!==void 0?t.enabled:u,o=m.map(e=>String(e??``).trim().replaceAll(`%s`,`{{task.id}}`)).filter(Boolean).slice(0,C);await i(`/api/repos/`+encodeURIComponent(e.id),{method:`PATCH`,body:{getLoop:{enabled:a,...a?{waitMinutes:Number(f)||10,template:o}:{}}}}),s(a?`已保存「${e.name}」的持续 get 设置(模板 ${o.length} 条)`:`已关闭「${e.name}」的持续 get`),r.refreshRepos&&r.refreshRepos(),n&&n()}catch(e){s(String(e.message||e))}finally{O(!1)}},A=async e=>{d(e),await k({enabled:e})},j=()=>{let e=x.trim();!e||m.length>=C||(v([...m,e.slice(0,w)]),b(m.length),E(``))};return(0,_.jsx)(a,{title:`持续 get · ${e.name}`,onClose:t,size:`md`,children:(0,_.jsxs)(`div`,{className:`rp-gl`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-head`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-title`,children:[(0,_.jsx)(`span`,{className:`rp-gl-name`,children:`持续 get`}),(0,_.jsx)(`span`,{className:`rp-gl-desc`,children:`无任务时阻塞等待新任务回填(waitgoal)`})]}),(0,_.jsxs)(`button`,{className:`toggle`+(u?` on`:``),onClick:()=>A(!u),disabled:D,children:[(0,_.jsx)(`span`,{className:`dot`}),u?`开`:`关`]})]}),u&&(0,_.jsxs)(`div`,{className:`rp-gl-body`,children:[(0,_.jsxs)(`div`,{className:`rp-gl-row`,children:[(0,_.jsx)(`span`,{children:`阻塞窗口`}),(0,_.jsxs)(`span`,{className:`rp-gl-unit`,children:[(0,_.jsx)(`input`,{className:`rp-gl-min`,value:f,onChange:e=>p(e.target.value),inputMode:`numeric`}),`分钟`]})]}),(0,_.jsxs)(`div`,{className:`rp-gl-tpl`,children:[(0,_.jsx)(`div`,{className:`rp-gl-h`,children:`收尾模板`}),(0,_.jsxs)(`div`,{className:`rp-gl-oneline`,children:[(0,_.jsx)(h,{variant:`secondary`,title:`填入内置默认(继续 get 直到 timeout)`,onClick:()=>E(T),children:`填入内置默认`}),(0,_.jsx)(`input`,{className:`rp-gl-oneline-input`,value:x,placeholder:`一句话(%s = 任务编号)`,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()}}),(0,_.jsx)(h,{variant:`secondary`,disabled:D||!x.trim(),onClick:j,children:`添加`})]}),m.length?(0,_.jsx)(S,{items:m,onChange:v,disabled:D,placeholder:`一句话(%s = 任务编号)`,accordion:!0,openIndex:y,onOpenChange:b}):(0,_.jsx)(`div`,{className:`rp-gl-note`,children:`未配置模板 —— 用默认「完成后续调 localtask get;没活时每轮最多阻塞 {{getloop.waitMinutes}} 分钟,直到 timeout」。`})]}),(0,_.jsxs)(`div`,{className:`rp-gl-acts`,children:[(0,_.jsx)(h,{variant:`secondary`,disabled:D||m.length>=C,title:m.length>=C?`最多 ${C} 条`:`新增一条「继续 get」指令`,onClick:()=>{v([...m,``]),b(m.length)},children:`添加一条…`}),(0,_.jsx)(`span`,{className:`spacer`}),(0,_.jsx)(h,{variant:`primary`,disabled:D,onClick:()=>k(),children:`保存持续 get 设置`})]})]})]})})}function D({path:e}){let t=String(e||``),n=t.replace(/\\/g,`/`).lastIndexOf(`/`);return n<0?(0,_.jsx)(l,{text:t,children:t}):(0,_.jsxs)(l,{text:t,title:`点击复制完整路径`,children:[(0,_.jsx)(`span`,{className:`anc`,children:t.slice(0,n)}),t.slice(n)]})}function O({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(`
|
|
3
|
+
`):`查看完整文档列表(主篇 / 补充 / reference / 组内),可就地编辑`;return(0,_.jsxs)(`button`,{type:`button`,className:`rp-docs-entry`,title:a,onClick:t,children:[(0,_.jsx)(`span`,{className:`rp-docs-entry-main`+(n&&n.exists?``:` ghost`),children:n&&n.exists?n.title||n.summary||`未命名`:`+ 写项目介绍`}),(0,_.jsx)(`span`,{className:`rp-docs-entry-n`,children:i>0?`${i} 篇 · 查看详情`:`查看详情`})]})}function k({chips:e,boardId:t,acts:n}){let[r,i]=(0,g.useState)(!1),a=r?e:e.slice(0,4);return(0,_.jsxs)(_.Fragment,{children:[a.map(e=>(0,_.jsx)(`span`,{className:`rp-link-chip rp-link-chip-`+(e.source===`group`?`group`:`repo`),children:(0,_.jsxs)(`button`,{className:`rp-link-chip-main`,title:e.source===`group`?[`组「${e.groupName}」共享的参考仓库`,e.note].filter(Boolean).join(`
|
|
3
4
|
`):[`本仓库直接绑定的参考仓库`,e.note,`点击跳到这个参考仓库`].filter(Boolean).join(`
|
|
4
|
-
`),onClick:()=>e.source===`group`?n.keepFilter(t):n.gotoRefRepo(e.key),children:[(0,_.jsx)(`b`,{children:e.source===`group`?`组`:`自`}),(0,_.jsx)(`span`,{className:`rp-link-chip-name`,children:e.name})]})},e.source+`:`+e.key)),e.length>4?(0,_.jsx)(`button`,{className:`rp-bind-more`,title:`展开本行全部参考仓库`,onClick:()=>i(e=>!e),children:r?`收起`:`+${e.length-4}`}):null]})}function A({r:e,filterBoard:t,groupRefRepoCounts:n,refRepoChipsByRepo:r,acts:i}){let a=n.get(e.key)||[],o=t?r.get(e.key)||[]:null;return(0,_.jsxs)(`tr`,{id:`rp-row-`+e.key,children:[(0,_.jsxs)(`td`,{className:`rp-name`,children:[(0,_.jsxs)(`strong`,{children:[e.icon?(0,_.jsx)(`span`,{className:`rp-icon`,"aria-hidden":!0,children:e.icon}):null,e.name,e.getLoop&&e.getLoop.enabled?(0,_.jsx)(`span`,{className:`rp-gl-dot`,title:`持续 get 已开启(${Number(e.getLoop.waitMinutes)||10} 分钟阻塞窗口)`,"aria-label":`持续 get 已开启`}):null]}),(0,_.jsx)(`span`,{className:`mono rp-name-path`,children:(0,_.jsx)(D,{path:e.path})})]}),(0,_.jsx)(`td`,{className:`rp-cell-docs`,children:(0,_.jsx)(O,{docs:e.descDocs,onOpen:()=>i.docs(e)})}),(0,_.jsxs)(`td`,{className:`rp-refs`,children:[t?o&&o.length?(0,_.jsx)(k,{chips:o,boardId:t.id,acts:i}):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}):a.length?a.map(e=>(0,_.jsxs)(`button`,{className:`rp-group-chip`+(t&&t.id===e.id?` on`:``),title:`组「${e.name}」绑定 ${e.count} 个参考仓库(组内共享)\n点击只看这个组`,onClick:()=>i.filter(e.id),children:[e.name,` `,(0,_.jsx)(`b`,{children:e.count})]},e.id)):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}),(0,_.jsx)(h,{small:!0,className:`rp-ref-bind`,title:`管理这个仓库所属组的参考仓库`,onClick:()=>i.bind(e),children:`绑定`})]}),(0,_.jsx)(`td`,{className:`rp-cell-groups`,children:(e.boards||[]).length?e.boards.map(e=>(0,_.jsx)(`button`,{className:`rp-group-chip`+(t&&t.id===e.id?` on`:``),title:`只看「${e.name}」${e.note?`\n组内描述:${e.note}`:``}`,onClick:()=>i.filter(e.id),children:e.name},e.id)):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`})}),(0,_.jsx)(`td`,{className:`rp-acts`,children:(0,_.jsx)(p,{kind:`repos-row`,renderers:{edit:()=>(0,_.jsx)(h,{small:!0,onClick:()=>i.edit(e),children:`编辑`}),open:()=>(0,_.jsx)(h,{small:!0,title:`在文件管理器中打开`,onClick:()=>i.open(e),children:`打开`}),del:()=>(0,_.jsx)(h,{small:!0,danger:!0,onClick:()=>i.del(e),children:`删除`}),getloop:()=>(0,_.jsx)(h,{small:!0,title:`持续 get(waitgoal)配置`,onClick:()=>i.getloop(e),children:(0,_.jsxs)(`span`,{className:`rp-gl-menu-it`,children:[e.getLoop&&e.getLoop.enabled?(0,_.jsx)(`span`,{className:`rp-gl-dot`,"aria-hidden":!0}):null,`持续 get…`]})}),remote:()=>(0,_.jsx)(h,{small:!0,onClick:()=>i.remote(e),children:`对齐 remote`})},actions:{edit:()=>i.edit(e),open:()=>i.open(e),del:()=>i.del(e),getloop:()=>i.getloop(e),remote:()=>i.remote(e)},titles:{getloop:`持续 get(waitgoal)配置`,remote:`key 与远程 git 地址对齐`,del:`删除仓库登记(磁盘文件不受影响)`}})})]})}function j({shown:e,devRepos:t,filterBoard:n,groupRefRepoCounts:r,refRepoChipsByRepo:i,acts:a,onAddMember:o}){return(0,_.jsx)(`div`,{className:`rp-table-wrap`,id:`rp-repos`,children:(0,_.jsxs)(`table`,{className:`rp-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{scope:`col`,style:{width:`16%`},children:`仓库`}),(0,_.jsxs)(`th`,{scope:`col`,style:{width:`36%`},children:[`文档`,(0,_.jsx)(`span`,{className:`rp-th-hint`,children
|
|
5
|
+
`),onClick:()=>e.source===`group`?n.keepFilter(t):n.gotoRefRepo(e.key),children:[(0,_.jsx)(`b`,{children:e.source===`group`?`组`:`自`}),(0,_.jsx)(`span`,{className:`rp-link-chip-name`,children:e.name})]})},e.source+`:`+e.key)),e.length>4?(0,_.jsx)(`button`,{className:`rp-bind-more`,title:`展开本行全部参考仓库`,onClick:()=>i(e=>!e),children:r?`收起`:`+${e.length-4}`}):null]})}function A({r:e,filterBoard:t,groupRefRepoCounts:n,refRepoChipsByRepo:r,acts:i}){let a=n.get(e.key)||[],o=t?r.get(e.key)||[]:null;return(0,_.jsxs)(`tr`,{id:`rp-row-`+e.key,children:[(0,_.jsxs)(`td`,{className:`rp-name`,children:[(0,_.jsxs)(`strong`,{children:[e.icon?(0,_.jsx)(`span`,{className:`rp-icon`,"aria-hidden":!0,children:e.icon}):null,e.name,e.getLoop&&e.getLoop.enabled?(0,_.jsx)(`span`,{className:`rp-gl-dot`,title:`持续 get 已开启(${Number(e.getLoop.waitMinutes)||10} 分钟阻塞窗口)`,"aria-label":`持续 get 已开启`}):null]}),(0,_.jsx)(`span`,{className:`mono rp-name-path`,children:(0,_.jsx)(D,{path:e.path})})]}),(0,_.jsx)(`td`,{className:`rp-cell-docs`,children:(0,_.jsx)(O,{docs:e.descDocs,onOpen:()=>i.docs(e)})}),(0,_.jsxs)(`td`,{className:`rp-refs`,children:[t?o&&o.length?(0,_.jsx)(k,{chips:o,boardId:t.id,acts:i}):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}):a.length?a.map(e=>(0,_.jsxs)(`button`,{className:`rp-group-chip`+(t&&t.id===e.id?` on`:``),title:`组「${e.name}」绑定 ${e.count} 个参考仓库(组内共享)\n点击只看这个组`,onClick:()=>i.filter(e.id),children:[e.name,` `,(0,_.jsx)(`b`,{children:e.count})]},e.id)):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`}),(0,_.jsx)(h,{small:!0,className:`rp-ref-bind`,title:`管理这个仓库所属组的参考仓库`,onClick:()=>i.bind(e),children:`绑定`})]}),(0,_.jsx)(`td`,{className:`rp-cell-groups`,children:(e.boards||[]).length?e.boards.map(e=>(0,_.jsx)(`button`,{className:`rp-group-chip`+(t&&t.id===e.id?` on`:``),title:`只看「${e.name}」${e.note?`\n组内描述:${e.note}`:``}`,onClick:()=>i.filter(e.id),children:e.name},e.id)):(0,_.jsx)(`span`,{className:`muted rp-refs-none`,children:`—`})}),(0,_.jsx)(`td`,{className:`rp-acts`,children:(0,_.jsx)(p,{kind:`repos-row`,renderers:{edit:()=>(0,_.jsx)(h,{small:!0,onClick:()=>i.edit(e),children:`编辑`}),open:()=>(0,_.jsx)(h,{small:!0,title:`在文件管理器中打开`,onClick:()=>i.open(e),children:`打开`}),del:()=>(0,_.jsx)(h,{small:!0,danger:!0,onClick:()=>i.del(e),children:`删除`}),getloop:()=>(0,_.jsx)(h,{small:!0,title:`持续 get(waitgoal)配置`,onClick:()=>i.getloop(e),children:(0,_.jsxs)(`span`,{className:`rp-gl-menu-it`,children:[e.getLoop&&e.getLoop.enabled?(0,_.jsx)(`span`,{className:`rp-gl-dot`,"aria-hidden":!0}):null,`持续 get…`]})}),remote:()=>(0,_.jsx)(h,{small:!0,onClick:()=>i.remote(e),children:`对齐 remote`})},actions:{edit:()=>i.edit(e),open:()=>i.open(e),del:()=>i.del(e),getloop:()=>i.getloop(e),remote:()=>i.remote(e)},titles:{getloop:`持续 get(waitgoal)配置`,remote:`key 与远程 git 地址对齐`,del:`删除仓库登记(磁盘文件不受影响)`}})})]})}function j({shown:e,devRepos:t,filterBoard:n,groupRefRepoCounts:r,refRepoChipsByRepo:i,acts:a,onAddMember:o}){return(0,_.jsx)(`div`,{className:`rp-table-wrap`,id:`rp-repos`,children:(0,_.jsxs)(`table`,{className:`rp-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{scope:`col`,style:{width:`16%`},children:`仓库`}),(0,_.jsxs)(`th`,{scope:`col`,style:{width:`36%`},children:[`文档`,(0,_.jsx)(`span`,{className:`rp-th-hint`,children:`主篇标题 · 查看详情打开完整文档列表`})]}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`18%`},children:`参考仓库`}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`14%`},children:`分组`}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`250px`},children:`操作`})]})}),(0,_.jsxs)(`tbody`,{children:[e.map(e=>(0,_.jsx)(A,{r:e,filterBoard:n,groupRefRepoCounts:r,refRepoChipsByRepo:i,acts:a},e.id)),e.length?null:(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:`5`,className:`muted rp-empty`,children:t.length?(0,_.jsxs)(_.Fragment,{children:[`这个分组还没有成员`,` `,n?(0,_.jsx)(h,{small:!0,onClick:()=>o(n.id),children:`添加成员`}):null]}):`还没有登记开发仓库 —— 点右上「登记仓库」加一条。`})})]})]})})}function M({boards:e,filter:t,onFilter:n,devCount:r,shownCount:i,q:a,onQ:o,onOpenDocs:s}){return(0,_.jsxs)(`div`,{className:`rp-filters`,"data-testid":`rp-filters`,children:[(0,_.jsxs)(`div`,{className:`rp-filters-main`,children:[(0,_.jsxs)(`button`,{className:`rp-chip`+(t?``:` on`),onClick:()=>n(``),title:`显示全部开发仓库`,children:[`全部 `,(0,_.jsx)(`b`,{children:r})]}),e.map(e=>(0,_.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,_.jsx)(`b`,{children:e.repos.length})]},e.id))]}),(0,_.jsxs)(`div`,{className:`rp-filters-side`,children:[(0,_.jsx)(`input`,{className:`rp-search`,type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:`搜仓库 / 路径 / 分组 / 文档…`,"aria-label":`检索仓库与文档`}),a?(0,_.jsx)(h,{small:!0,onClick:()=>o(``),children:`清空`}):null,(0,_.jsxs)(`span`,{className:`muted rp-search-count`,children:[i,` / `,r]}),(0,_.jsx)(h,{small:!0,title:`按仓库 / 组内 / 分组三档检索文档`,onClick:s,children:`文档检索`})]})]})}function ee({filterBoard:e,refRepos:t,checkOf:n,onOpenDoc:r,onAddMember:i,onSync:a,onOpen:o,onLinkNote:s,onUnbind:c}){let u=(0,g.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(Boolean)},[t,e]),[d,f]=(0,g.useState)(null);(0,g.useEffect)(()=>{f(null)},[e?e.id:null]);let p=d===null?u.length<=8:d;return e?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`rp-context`,"data-testid":`rp-context`,children:[(0,_.jsx)(`span`,{className:`rp-context-name`,children:e.name}),e.desc?(0,_.jsx)(`span`,{className:`rp-context-desc`,title:e.desc,children:e.desc}):(0,_.jsx)(`span`,{className:`muted rp-context-desc`,children:`还没有领域描述 —— 点「组介绍文档」补一段:侧重什么、谁配合谁、关键路径与搜索关键词在哪。`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(h,{small:!0,title:`打开这个分组的组介绍文档`,onClick:()=>r(e),children:`组介绍文档 ✎`}),(0,_.jsx)(`a`,{className:`btn small ghost`,href:`#/group/`+encodeURIComponent(e.id),title:`组页里看这个组的成员与任务`,children:`组页 ↗`}),(0,_.jsx)(h,{small:!0,onClick:()=>i(e.id),children:`添加成员`})]})]}),(0,_.jsxs)(`div`,{className:`rp-ref-mounted`,"data-testid":`rp-board-refs`,children:[(0,_.jsxs)(`div`,{className:`rp-ref-mounted-head`,children:[(0,_.jsxs)(`span`,{className:`rp-ref-mounted-label`,children:[`「`,e.name,`」的参考仓库 `,(0,_.jsx)(`b`,{children:u.length})]}),(0,_.jsx)(`span`,{className:`muted`,children:`绑定在组上:组内所有仓库共享,不区分来源仓库`}),u.length?(0,_.jsx)(h,{small:!0,className:`rp-ref-mounted-toggle`,title:p?`收起这个组的参考仓库清单`:`展开这个组的参考仓库清单`,onClick:()=>f(!p),children:p?`收起`:`展开 ${u.length}`}):null]}),u.length?p?u.map(t=>{let r=n.get(t.id);return(0,_.jsxs)(`div`,{className:`rp-ref-mounted-item`,children:[(0,_.jsx)(`span`,{className:`rp-ref-dot`+(r?r.ok?` ok`:` bad`:``),title:r?r.ok?`检查通过`:r.issues.join(`
|
|
5
6
|
`):`尚未检查`}),(0,_.jsx)(l,{text:t.remote||t.name,title:`点击复制远程地址`,className:`rp-ref-mounted-name`,children:t.name}),t.desc?(0,_.jsx)(`span`,{className:`muted rp-ref-mounted-desc`,title:t.desc,children:t.desc}):null,t.boardNote?(0,_.jsx)(`button`,{className:`rp-ref-note-chip`,title:`${t.boardNote}\n点击编辑这条组级描述`,onClick:()=>s(t,e.id,e.name,t.boardNote),children:t.boardNote.split(`
|
|
6
7
|
`)[0]}):(0,_.jsx)(h,{small:!0,title:`写「${t.name}」在这个组里参考什么(组级描述)`,onClick:()=>s(t,e.id,e.name,``),children:`写描述`}),(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(h,{small:!0,onClick:()=>a(t),children:`同步`}),(0,_.jsx)(h,{small:!0,onClick:()=>o(t),children:`打开`}),(0,_.jsx)(h,{small:!0,danger:!0,title:`只从本组摘除(不影响其它组)`,onClick:()=>c(t,e.id),children:`移出本组`})]})]},t.id)}):null:(0,_.jsx)(`div`,{className:`muted rp-refs-none`,children:`这个组还没有绑定的参考仓库 —— 在下方参考仓库面板里点「绑定」勾选本组。`})]})]}):null}function N({boards:t,devRepos:n,refRepos:a,reload:s}){let c=e(),l=o(),{dialog:u,node:d}=r(),f=(0,g.useMemo)(()=>{let e=new Map;for(let t of[...n,...a]){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 r=[];for(let n of t&&t.boards||[])for(let t of n.repos||[]){if(t.present!==!1)continue;let i=String(t.key||``).split(`/`).filter(Boolean).pop()||``,a=e.get(String(t.name||``).toLowerCase())||e.get(i.toLowerCase())||null;r.push({...t,board:n.name,boardId:n.id,match:a})}return r},[t,n,a]),p=e=>c(async()=>{await i(`/api/repos/clone`,{method:`POST`,body:{remote:e.remote,key:e.key,name:e.name||void 0,type:`dev`}}),l(`已克隆并登记:${e.name||e.key}`),s.repos(),s.boards()}),m=(e,t)=>c(async()=>{await i(`/api/boards/rekey`,{method:`POST`,body:{from:e.key,to:t}}),l(`已把「${e.name||e.key}」这个位置接到本机仓库`),s.repos(),s.boards()}),v=e=>c(async()=>{let t=await u({title:`把「${e.name||e.key}」接到哪个本机仓库?`,input:!0,placeholder:`本机仓库:id / key / 名称 / 绝对路径`});t&&(await i(`/api/boards/rekey`,{method:`POST`,body:{from:e.key,to:t}}),l(`已重绑——这个位置现在指向本机仓库`),s.repos(),s.boards())}),y=e=>c(async()=>{confirm(`把「${e.name||e.key}」从组「${e.board}」里移除?\n\n只摘这个组里的位置:本机仓库与看板本身都不动。`)&&(await i(`/api/boards/assign`,{method:`POST`,body:{key:e.key,board:e.boardId,remove:!0}}),l(`已从组「${e.board}」移除`),s.boards())});return f.length?(0,_.jsxs)(`section`,{className:`rp-pending`,"data-testid":`rp-pending-init`,children:[(0,_.jsxs)(`header`,{className:`rp-pending-head`,children:[(0,_.jsxs)(`div`,{className:`rp-pending-head-main`,children:[(0,_.jsxs)(`h3`,{children:[`待初始化`,(0,_.jsx)(`span`,{className:`rp-pending-count`,children:f.length})]}),(0,_.jsx)(`p`,{children:`组里有位置、本机没有登记。接到本机仓库、克隆下来,或者直接移除。`})]}),(0,_.jsx)(h,{small:!0,onClick:()=>c(async()=>{let e=await i(`/api/boards/prune`,{method:`POST`,body:{apply:!1}});if(!e?.total){l(`没有可清理的占位(有远程地址的那些留着等 clone)`);return}let t=e.items.map(e=>`· ${e.name}(组 ${e.board})`).join(`
|
|
7
8
|
`);confirm(`清理 ${e.total} 个无来源占位?\n\n${t}\n\n它们没有远程地址,克隆不回来,只能删。`)&&(await i(`/api/boards/prune`,{method:`POST`,body:{apply:!0}}),l(`已清理 ${e.total} 个占位`),s.boards())}),children:`清理无来源占位`})]}),(0,_.jsx)(`div`,{className:`rp-pending-list`,children:f.map(e=>(0,_.jsxs)(`article`,{className:`rp-pending-card`,children:[(0,_.jsxs)(`div`,{className:`rp-pending-info`,children:[(0,_.jsxs)(`div`,{className:`rp-pending-title`,children:[(0,_.jsx)(`strong`,{children:e.name||e.key}),(0,_.jsxs)(`span`,{className:`rp-pending-board`,children:[`组 · `,e.board]}),e.remote?null:(0,_.jsx)(`span`,{className:`rp-pending-tag`,children:`无远程地址`})]}),(0,_.jsx)(`code`,{className:`rp-pending-key`,children:e.key}),e.desc?(0,_.jsx)(`p`,{className:`rp-pending-desc`,children:e.desc}):null]}),(0,_.jsxs)(`div`,{className:`rp-pending-acts`,children:[e.match?(0,_.jsxs)(h,{small:!0,title:`把组里这个位置指向本机仓库「${e.match.name}」(仓库身份不变)`,onClick:()=>m(e,e.match.id),children:[`绑定到「`,e.match.name,`」`]}):null,e.remote?(0,_.jsx)(h,{small:!0,onClick:()=>p(e),children:`克隆到本地`}):null,(0,_.jsx)(h,{small:!0,onClick:()=>v(e),children:`选本机仓库`}),(0,_.jsx)(h,{small:!0,danger:!0,title:`只从组里摘掉这个位置,本机仓库与看板都不动`,onClick:()=>y(e),children:`移除`})]})]},e.key+`@`+e.boardId))}),d]}):null}function P({refRepos:t,devRepos:n,boardList:r,checkOf:s,refRepoBackLinks:c,refBindOpen:u,onRefBindOpen:d,onClose:f,onSyncOne:p,onUnbind:m,onUnbindRepo:v,onLinkNote:y,onGoBind:b,onDocs:x,onRowAct:S,reload:C}){let w=e(),T=o(),[E,D]=(0,g.useState)(null),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)({gitRepoRoot:``,gitDevRoot:``}),[ee,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)({url:``,name:``,desc:``,depth:`1`}),[I,L]=(0,g.useState)({}),[R,z]=(0,g.useState)(null),[B,V]=(0,g.useState)({}),H=(0,g.useCallback)(async()=>{D(await i(`/api/setting`).catch(()=>null))},[]);(0,g.useEffect)(()=>{H()},[H]);let te=()=>w(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 i(`/api/setting`,{method:`POST`,body:e})),A(!1),T(`已保存存储根目录`))}),U=()=>w(async()=>{let e=P.url.trim();if(!e)return;let t={url:e,name:P.name.trim()||void 0,desc:P.desc.trim()||void 0,depth:parseInt(P.depth,10)||1,"no-bind":!0},a=n.filter(e=>I[`repo:`+e.id]).map(e=>e.id),o=r.filter(e=>I[`board:`+e.id]).map(e=>e.id);a.length&&(t.bind=a),o.length&&(t.board=o);let s=await i(`/api/repos/ref/clone`,{method:`POST`,body:t});N(!1),F({url:``,name:``,desc:``,depth:`1`}),L({}),T(`已克隆: ${s.name} → ${s.dest||s.path}`),await C.all()}),W=()=>w(async()=>{let e=await i(`/api/repos/ref/sync`,{method:`POST`,body:{all:!0}}),t=e.results.filter(e=>e.status!==`updated`&&e.status!==`upToDate`);T(`同步 ${e.synced} 个${t.length?`,${t.length} 个有问题(见检查结果)`:`,全部完成`}`),await C.refCheck()}),G=e=>e.key||`board/${e.name}`,K=e=>{let t={};for(let n of r)(n.refs||[]).some(t=>t.id===e.key)&&(t[`board:`+G(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);V(t),z(e)};return(0,_.jsxs)(a,{size:`wide`,title:`参考仓库 · ${t.length}`,onClose:f,children:[(0,_.jsx)(`div`,{className:`rp-modal-bar`,children:(0,_.jsxs)(`span`,{className:`acts`,children:[(0,_.jsx)(h,{small:!0,onClick:()=>{L({}),N(!0)},children:`克隆参考仓库`}),(0,_.jsx)(h,{small:!0,onClick:W,children:`同步全部`}),(0,_.jsx)(h,{small:!0,onClick:C.refCheck,children:`检查`}),(0,_.jsx)(h,{small:!0,onClick:()=>{M({gitRepoRoot:E?.gitRepoRoot||``,gitDevRoot:E?.gitDevRoot||``}),A(!0)},children:`存储根`})]})}),E?.gitRepoRoot?null:(0,_.jsx)(`div`,{className:`rp-ref-warn`,children:`存储根未设置 —— 克隆会被拒绝。点「存储根」设一个非 C 盘目录(参考仓库体积不小,别放系统盘)。`}),(0,_.jsx)(`div`,{className:`rp-ref-table-wrap`,children:(0,_.jsxs)(`table`,{className:`rp-ref-table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{scope:`col`,style:{width:`30px`}}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`17%`},children:`参考仓库`}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`22%`},children:`远程地址`}),(0,_.jsx)(`th`,{scope:`col`,children:`绑定对象(仓库组 / 单独仓库 · 点击跳转)`}),(0,_.jsx)(`th`,{scope:`col`,style:{width:`220px`},children:`操作`})]})}),(0,_.jsxs)(`tbody`,{children:[t.map(e=>{let t=s.get(e.id),n=r.map(t=>{let n=(t.refs||[]).find(t=>t.id===e.key);return n?{board:t,note:n.note||``}:null}).filter(Boolean);return(0,_.jsxs)(`tr`,{id:`rp-refrepo-row-`+e.key,children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(`span`,{className:`rp-ref-dot`+(t?t.ok?` ok`:` bad`:``),title:t?t.ok?`检查通过`:t.issues.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,y as n}from"./task-status-BnymQMTw.js";import{n as r}from"./app-context-D7HAx67n.js";import{n as i}from"./board-view-CZKZsyk-.js";import{t as a}from"./index-
|
|
1
|
+
import{g as e,h as t,y as n}from"./task-status-BnymQMTw.js";import{n as r}from"./app-context-D7HAx67n.js";import{n as i}from"./board-view-CZKZsyk-.js";import{t as a}from"./index-BrAIkzFc.js";var o=n(e(),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 r=(n.boards||[]).find(t=>t.id===e.key);if(e.view===`group`&&e.task){let a=i(t,n.boards||[],e.key,e.task);return{boardName:a.board&&a.board.name||r&&r.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:r&&r.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=r()||{},t=e.route||{},n=e.rows||[],i=e.repoData||{},f=(0,o.useMemo)(()=>l(t,n,i),[t,n,i]);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{g as e,h as t,l as n,m as r,p as i,u as a,y as o}from"./task-status-BnymQMTw.js";import{n as s}from"./app-context-D7HAx67n.js";import{n as c,o as l}from"./index-
|
|
1
|
+
import{g as e,h as t,l as n,m as r,p as i,u as a,y as o}from"./task-status-BnymQMTw.js";import{n as s}from"./app-context-D7HAx67n.js";import{n as c,o as l}from"./index-BrAIkzFc.js";import{t as u}from"./button-Cmo-6aoW.js";var d=o(e(),1),f=Object.freeze([{id:`xml`,label:`XML 区块(默认)`,desc:`每段系统内容包进独立标签,agent 一眼分清任务原文与系统规则`},{id:`plain`,label:`正文直追加`,desc:`不包标签,按空行拼接(与改造前的 instruction 逐字一致)`}]),p=8e3,m=`builtin`,h=`系统内置`,g=`{{#if repo}},{{#if repo.intro}},〔项目介绍 · {{repo.name}}〕({{repo.introPath}}):,{{repo.intro}},{{/if}},{{#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}}{{#if path}}({{path}}){{/if}},{{/each}},{{/if}},{{#if group.docs}},组绑定参考文件(可直接读取):,{{#each group.docs}}, - {{path}}{{#if tag}} [{{tag}}]{{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/if}},{{/if}},{{#if refRepos.count}},参考仓库(可直接读取,共 {{refRepos.count}} 个):,{{#each refRepos.list}}, - {{name}}{{#if path}}({{path}}){{/if}}{{#if note}} # {{note}}{{/if}},{{/each}},{{/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}}{{#if note}} # {{note}}{{/if}}`,`{{/each}}`,``,`取用方式:`,`{{#each attach.list}}`,` - {{kindLabel}} 《{{name}}》:{{usage}}`,`{{/each}}`,`{{#if attach.syncSummary}}`,`同步情况:{{attach.syncSummary.text}}`,`{{/if}}`,`{{#each attach.list}}{{#if ref}}{{#if ref.content}}〔文档原文 · {{ref.title}}〕({{ref.relPath}}):`,``,`{{ref.content}}`,``,`{{/if}}{{/if}}{{/each}}`,`{{/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{h as e}from"./task-status-BnymQMTw.js";import{b as t,v as n,y as r}from"./index-
|
|
1
|
+
import{h as e}from"./task-status-BnymQMTw.js";import{b as t,v as n,y as r}from"./index-BrAIkzFc.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{g as e,h as t,l as n,m as r,o as i,p as a,u as o,y as s}from"./task-status-BnymQMTw.js";import{r as c,t as l,v as u}from"./workspace-C_5X2gIr.js";import{n as d}from"./app-context-D7HAx67n.js";import{n as f,r as p,t as m}from"./frontmatter-QvrjUNzF.js";import{a as h,g,h as _,i as v,m as y,n as b,p as x,r as S,t as C,u as w,v as T}from"./md-history-
|
|
1
|
+
import{g as e,h as t,l as n,m as r,o as i,p as a,u as o,y as s}from"./task-status-BnymQMTw.js";import{r as c,t as l,v as u}from"./workspace-C_5X2gIr.js";import{n as d}from"./app-context-D7HAx67n.js";import{n as f,r as p,t as m}from"./frontmatter-QvrjUNzF.js";import{a as h,g,h as _,i as v,m as y,n as b,p as x,r as S,t as C,u as w,v as T}from"./md-history-DB5forf2.js";import{a as E,r as D}from"./md-parse-awNLHAzO.js";import{n as O,t as k}from"./board-view-CZKZsyk-.js";import{c as A,d as j,f as M,h as N,l as P,m as F,p as I,s as L,u as R}from"./index-BrAIkzFc.js";import{t as z}from"./status-tag-BoUoKYZK.js";import{a as B,i as V,n as ee,o as H}from"./composer-launch-Bf4rXhLs.js";import{t as te}from"./route-crumb-C8JzPIax.js";import{i as ne,n as U,r as W,t as G}from"./reopen-text-BylkngqC.js";import{n as re,u as K}from"./tool-bar-DGCwnUcn.js";var q=s(e(),1),J=/^>\s*\[![A-Za-z][\w-]*\][ \t]*(.*)$/,Y=/完成总结/,ie=/反馈/,ae=/第\s*(\d+)\s*轮/;function oe(e){let t=String(e??``).split(`
|
|
2
2
|
`),n=t.length&&String(t[0]).match(J);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 se(e){let t=y(String(e??``));if(!t.length)return[];let n=[],r=null,i=``;return t.forEach((e,t)=>{let a=String(e||``).trim(),o=oe(a);if(o&&Y.test(o.title)){let e=Number((o.title.match(ae)||[])[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&&ie.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{h as e,u as t}from"./task-status-BnymQMTw.js";import{n}from"./model-DzdWfp14.js";import{t as r}from"./status-tag-
|
|
1
|
+
import{h as e,u as t}from"./task-status-BnymQMTw.js";import{n}from"./model-DzdWfp14.js";import{t as r}from"./status-tag-BoUoKYZK.js";var i=e();function a({icon:e=`list`,title:n,pendingCount:r=0,historyCount:a=0,headerExtra:o=null,historyOpen:s=!1,onToggleHistory:c,children:l=null,emptyText:u=``,history:d=null}){return(0,i.jsxs)(`div`,{className:`rp-tasks`,children:[(0,i.jsxs)(`div`,{className:`rp-tasks-h`,children:[(0,i.jsx)(t,{name:e,size:13}),` `,n,(0,i.jsxs)(`span`,{className:`rp-chip-count`,children:[r,` 待领取`]}),a>0&&(0,i.jsxs)(`span`,{className:`rp-chip-count`,children:[`已领取 `,a]}),o]}),l,!l&&u?(0,i.jsx)(`div`,{className:`rp-proj-none muted`,children:u}):null,a>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`button`,{type:`button`,className:`rp-done-toggle`,onClick:c,children:[(0,i.jsx)(`span`,{className:`tri`+(s?` open`:``),children:`▸`}),` 已领取 `,a]}),s&&d]})]})}function o(e){let t=String(e||``).trim();if(!t)return`—`;let n=t.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2})/);return n?`${n[1].slice(5)} ${n[2]}`:t.slice(0,16)}function s({t:e,projectTag:a=``,projectTitle:s=``,selectable:c=!1,picked:l=!1,onTogglePick:u,draggable:d=!1,dragHandlers:f=null,dragVisual:p,onOpen:m,showTimes:h=!1,downs:g=[],history:_=!1,ops:v=null}){let y=`rp-proj-row`+(p?.dragging?` dragging`:``)+(p?.drop?` drop-`+p.drop:``),b=e.status===`pending`&&e.ready===!1;return(0,i.jsxs)(`div`,{className:y,...f?{onDragOver:f.onDragOver,onDragLeave:f.onDragLeave,onDrop:f.onDrop}:{},children:[d?(0,i.jsx)(`span`,{className:`rp-drag-handle`,draggable:!0,title:`拖动调整队列内顺序`,"aria-label":`拖动排序`,onDragStart:f?.onDragStart,onDragEnd:f?.onDragEnd,onClick:e=>e.stopPropagation(),children:(0,i.jsx)(t,{name:`grip`,size:12})}):(0,i.jsx)(`span`,{className:`rp-drag-handle off`,"aria-hidden":`true`}),c?(0,i.jsx)(`span`,{className:`rp-proj-pick`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:(0,i.jsx)(`input`,{type:`checkbox`,checked:l,onChange:()=>u?.(e.id),"aria-label":`选择任务 #${e.id}`})}):null,(0,i.jsxs)(`div`,{className:`rp-proj-task`+(_?` done`:``),role:`button`,tabIndex:0,title:`打开这条任务`,onClick:()=>m?.(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m?.(e))},children:[(0,i.jsxs)(`span`,{className:`mono`,children:[`#`,e.id]}),a?(0,i.jsx)(`span`,{className:`rp-ptag`,title:`归属项目:${s||a}`,children:a}):null,(0,i.jsx)(`span`,{className:`rp-proj-task-tx`,children:n(e)}),e.timegoal&&(0,i.jsxs)(`span`,{className:`rp-proj-goal`,title:`时间目标 ${e.timegoal.duration}:领取即计时,未到点不许标完成`,children:[(0,i.jsx)(t,{name:`clock`,size:11}),` `,e.timegoal.duration]}),e.blocksFollowing&&(0,i.jsxs)(`span`,{className:`rp-tgate`,title:g.length?`闸门:未完成前挡住 ${g.length} 个后续任务(#${g.join(`, #`)})`:`闸门:未完成前挡住队列里排在后面的待领取任务`,children:[`闸门`,g.length?`×${g.length}`:``]}),b&&(0,i.jsx)(`span`,{className:`rp-tlock`,title:e.blockBy?.length?`等待依赖完成:#${e.blockBy.join(`, #`)}`:`被前方闸门挡住`,children:`锁定`}),h&&(0,i.jsxs)(`span`,{className:`rp-proj-times mono`,title:`创建 ${e.createdAt||`—`}${e.consumedAt?` · 领取 ${e.consumedAt}`:``}`,children:[o(e.createdAt),e.consumedAt?` → ${o(e.consumedAt)}`:``]}),(0,i.jsx)(r,{t:e}),v?(0,i.jsx)(`span`,{className:`rp-proj-ops`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:v}):null]})]})}export{a as n,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,p as n,y as r}from"./task-status-BnymQMTw.js";import{n as i,v as a}from"./workspace-C_5X2gIr.js";import{n as o}from"./app-context-D7HAx67n.js";import{a as s,i as c,n as l,r as u,t as d,v as f}from"./md-history-
|
|
1
|
+
import{g as e,h as t,p as n,y as r}from"./task-status-BnymQMTw.js";import{n as i,v as a}from"./workspace-C_5X2gIr.js";import{n as o}from"./app-context-D7HAx67n.js";import{a as s,i as c,n as l,r as u,t as d,v as f}from"./md-history-DB5forf2.js";import{i as p,t as m}from"./index-BrAIkzFc.js";import{t as h}from"./route-crumb-C8JzPIax.js";var g=r(e(),1),_=t(),v=e=>`tpl:${e||`new`}`;function y({templateId:e,initialName:t,initialBody:r,isNew:i,onSave:a,onClose:o,busy:p}){let m=n(),[y,b]=(0,g.useState)(t||``),[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(i?`new`:e),A=(0,g.useMemo)(()=>f(x||``),[x]),j=(e,t,n=`typing`)=>{l(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=c(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},F=()=>{let e=u(O.current,k,{title:y,body:x});e&&(b(e.title||``),S(e.body||``),E(!0))},I=async()=>{if(!(y||``).trim()){m(`模板名不能为空(标题即名称)`);return}await a({name:y.trim(),body:x}),d(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)(h,{}),(0,_.jsxs)(`div`,{className:`mdw-head`,children:[(0,_.jsx)(`div`,{className:`mdw-title`,children:i?`新建模板`:`编辑模板`}),(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:p,onClick:o,children:`关闭`}),(0,_.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:p||!T,onClick:I,children:i?`创建`:`保存`})]})]}),(0,_.jsx)(s,{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:t,tabId:r}){let s=o()||{},c=s.tpl,l=n(),[u,d]=(0,g.useState)(!1),f=e||{},v=(f.mode||(f.id?`edit`:``))===`new`,b=f.id||``,x=()=>{let e=m();if(e&&s.onNavigate){s.onNavigate(e);return}if(s.onNavigate){s.onNavigate(`#/overview`);return}if(t&&r)try{t.doAction(a.deleteTab(r))}catch{}};if(!c)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(h,{}),(0,_.jsx)(`div`,{className:`pad muted`,children:`模板服务未就绪 —— 面板还在装载。`})]});if(!v&&!b)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(h,{}),(0,_.jsxs)(`div`,{className:`pad stack`,children:[(0,_.jsx)(`div`,{children:`模板在「设置 → 任务模板」管理;这里只承载全屏编辑。`}),(0,_.jsx)(`div`,{children:(0,_.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>{t&&i(t,{component:`settings`,name:`设置`,config:{}}),x()},children:`打开设置`})})]})]});let S=v?null:(c.templates||[]).find(e=>e.id===b);if(!v&&!S)return(0,_.jsxs)(`div`,{className:`mdw-tpl-panel`,children:[(0,_.jsx)(h,{}),(0,_.jsxs)(`div`,{className:`pad muted`,children:[`找不到模板「`,b,`」——可能已删除。`]})]});let C=async({name:e,body:t})=>{d(!0);try{if(v){let n={};Array.isArray(f.scope)&&(n.scope=f.scope),f.topic&&(n.topic=f.topic),await c.add(e,t,!1,n),l(`已创建模板`)}else await c.update(b,{name:e,body:t}),l(`已保存模板`);x()}catch(e){l(String(e.message||e))}finally{d(!1)}},w=v?f.name||``:S.name,T=v?``:p(S.body||``,S.values||{});return(0,_.jsx)(y,{templateId:b,initialName:w,initialBody:T,isNew:v,busy:u,onSave:C,onClose:x},v?`new:${f.topic||``}:${(f.scope||[]).join(`,`)}`:b)}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,o as n,p as r,y as i}from"./task-status-BnymQMTw.js";import{w as a}from"./workspace-C_5X2gIr.js";import{c as o,d as s,f as c,l,o as u,s as d}from"./md-history-XRRcXn6B.js";import{n as f,o as p}from"./upload-BIMbGcCB.js";var m=i(e(),1),h=t(),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:t,hostKey:i,hostCwd:a,refId:o,allow:l={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=r(),[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)(()=>s(e,{hostId:t,hostKey:i,hostCwd:a,refId:o}),[e,t,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(c))}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:[d.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:[d.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)(u,{open:N,host:e,hostId:t,hostKey:i,hostCwd:a,refId:o,allow:l,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`?l(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:o(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:l(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,h.jsx)(`a`,{className:`att-act`,href:l(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:`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{g as e,h as t,o as n,p as r,y as i}from"./task-status-BnymQMTw.js";import{w as a}from"./workspace-C_5X2gIr.js";import{c as o,d as s,f as c,l,o as u,s as d}from"./md-history-DB5forf2.js";import{n as f,o as p}from"./upload-BIMbGcCB.js";var m=i(e(),1),h=t(),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:t,hostKey:i,hostCwd:a,refId:o,allow:l={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=r(),[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)(()=>s(e,{hostId:t,hostKey:i,hostCwd:a,refId:o}),[e,t,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(c))}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:[d.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:[d.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)(u,{open:N,host:e,hostId:t,hostKey:i,hostCwd:a,refId:o,allow:l,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`?l(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:o(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:l(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,h.jsx)(`a`,{className:`att-act`,href:l(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:`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-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-BrAIkzFc.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/task-status-BnymQMTw.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/workspace-C_5X2gIr.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/app-context-D7HAx67n.js">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/board-view-CZKZsyk-.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/model-DzdWfp14.js">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/task-status-BZrdOH46.css">
|
|
24
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CZzMw1zg.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
27
27
|
<div id="root"></div>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{c as e,g as t,h as n,l as r,m as i,o as a,p as o,s,u as c,y as l}from"./task-status-BnymQMTw.js";import{r as u,u as d}from"./workspace-C_5X2gIr.js";import{n as f}from"./app-context-D7HAx67n.js";import{a as p,n as m}from"./md-parse-awNLHAzO.js";import{o as h,r as g,t as _}from"./board-view-CZKZsyk-.js";import{n as v}from"./model-DzdWfp14.js";import{_ as y,a as b,g as x,i as S,m as C,o as w,p as T,r as ee,s as E,u as D}from"./index-BjHbC1Pr.js";import{t as O}from"./route-crumb-2JmLQxqZ.js";import{t as k}from"./graph-DM-zDRdL.js";import{n as te,r as A,t as ne}from"./reopen-text-BylkngqC.js";import{t as j}from"./Introduction-CGJg0hoV.js";import{t as re}from"./bar-5QC796WJ.js";import{n as ie,t as M}from"./task-row-J0w1AAxG.js";var N=l(t(),1),P=n();function F({isGlobal:t,topic:n,repo:r=null,model:i=null,tasks:a=[],taskCount:o=0,pendingCount:s=0,page:l=0,pageCount:u=1,onPage:d,onNew:f,onOpenTask:p,onDeleteTask:m,onDeleteTasks:h,onCancelTasks:g,onCompleteTasks:_,onReopenTask:y,onTplMenu:b,onImport:S,onProg:C,onMoveTask:w,onOpenDag:T,onOpenFlow:ee,onToggleGate:E,downstreamOf:D,onDeleted:k,onRefs:te,deletedCount:A=0}){let ne=t?`全局池`:n?.name||`目录`,F=t?`共享池(无固定目录)`:n?.cwd||`—`,I=String(n?.summary||``).trim(),L=(0,N.useRef)(null),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(null),[H,U]=(0,N.useState)(()=>new Set);(0,N.useEffect)(()=>{U(new Set)},[l]);let W=a.map(e=>Number(e.id)),G=W.length>0&&W.every(e=>H.has(e)),K=a.filter(e=>H.has(Number(e.id))),q=K.filter(e=>e.status===`pending`&&!e.migratedTo&&!e.deletedAt),J=e=>{let t=Number(e);U(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},ae=()=>{U(e=>{let t=new Set(e);return G?W.forEach(e=>t.delete(e)):W.forEach(e=>t.add(e)),t})},Y=async e=>{let t=[...H],n=e===`cancel`?g:e===`complete`?_:h;t.length&&n&&await n(t)&&U(new Set)},X=e=>e.status===`pending`&&!e.migratedTo&&!e.deletedAt,Z=(e,t)=>{let n=t.getBoundingClientRect();return e.clientY<n.top+n.height/2?`before`:`after`},oe=(e,t)=>{L.current={id:Number(t.id)},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,`task:`+t.id),z(Number(t.id))},Q=(e,t)=>{L.current&&X(t)&&Number(t.id)!==L.current.id&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,V({id:Number(t.id),zone:Z(e,e.currentTarget)}))},$=e=>{e.currentTarget.contains(e.relatedTarget)||V(null)},se=(e,t)=>{e.preventDefault();let n=Z(e,e.currentTarget),r=L.current;L.current=null,z(null),V(null),r&&X(t)&&Number(t.id)!==r.id&&w&&w({id:r.id},t.id,n)},ce=()=>{L.current=null,z(null),V(null)};return(0,P.jsxs)(`div`,{className:`mdw-land`,children:[(0,P.jsx)(O,{}),(0,P.jsxs)(`div`,{className:`mdw-land-head`,children:[(0,P.jsx)(`div`,{className:`mdw-land-name`,children:ne}),(0,P.jsx)(`div`,{className:`mdw-land-path mono`,title:F,children:F}),I?(0,P.jsxs)(`div`,{className:`mdw-land-status-line`,title:I,children:[(0,P.jsx)(`span`,{className:`mdw-land-lab`,children:`现状`}),(0,P.jsx)(`span`,{className:`mdw-land-status`,children:I})]}):null]}),!t&&r?(0,P.jsx)(j,{kind:`repo`,owner:r,model:i}):null,(0,P.jsxs)(`div`,{className:`mdw-land-acts`,children:[(0,P.jsx)(re,{kind:`dir`,className:`mdw-land-ta`,labels:{more:A>0?`更多 (${A})`:`更多`,deleted:A>0?`已删除任务(${A})`:`已删除任务`},titles:{new:`按默认模板新建一页(▾ 选模板)`,import:`把一个 .md 文件导入成任务`,progress:`打开这个目录的进程面板`,more:A>0?`更多操作(含 ${A} 条已删除任务)`:`更多操作`,deleted:`查看并恢复已删除任务`,refs:`查看文档 / reference 列表`},renderers:{new:()=>(0,P.jsx)(`span`,{className:`rp-newtask`,children:(0,P.jsxs)(`button`,{type:`button`,className:`btn small primary`,title:`按默认模板新建一页(▾ 选模板)`,onClick:()=>f(),children:[`+ 新建页`,(0,P.jsx)(`span`,{role:`button`,tabIndex:0,"aria-label":`选择模板新建一页`,"aria-haspopup":`menu`,className:`rp-newtask-caret`,title:`选择模板新建一页`,onClick:e=>{e.stopPropagation(),b?.(e)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),b?.(e))},children:(0,P.jsx)(c,{name:`chevron`,size:11})})]})})},actions:{new:f,import:S,progress:C,orch:ee,deleted:k,refs:te}}),(0,P.jsxs)(`span`,{className:`mdw-land-count`,children:[s>0&&(0,P.jsxs)(`b`,{className:`mdw-land-pending`,children:[s,` 待领取`]}),` `,o,` 个任务`]})]}),K.length>0&&(0,P.jsxs)(`div`,{className:`mdw-land-batch`,children:[(0,P.jsxs)(`span`,{className:`mdw-land-batch-count`,children:[`已选 `,K.length,` 条`]}),_&&(0,P.jsxs)(`button`,{type:`button`,className:`btn ghost sm`,disabled:!q.length,title:q.length?`把选中的待领取任务标为已完成(补一条完成记录,原文留档)`:`只有待领取任务可以直接标为完成`,onClick:()=>Y(`complete`),children:[`标为完成选中`,q.length?` (${q.length})`:``]}),g&&(0,P.jsxs)(`button`,{type:`button`,className:`btn ghost sm`,disabled:!q.length,title:q.length?`把选中的待领取任务标为已取消(终态,原文留档)`:`只有待领取任务可以取消`,onClick:()=>Y(`cancel`),children:[`取消选中`,q.length?` (${q.length})`:``]}),h&&(0,P.jsxs)(`button`,{type:`button`,className:`btn ghost sm danger`,onClick:()=>Y(`delete`),children:[`删除选中 (`,K.length,`)`]}),(0,P.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>U(new Set),children:`清空`})]}),(0,P.jsx)(ie,{title:t?`全局池任务`:`任务`,pendingCount:s,headerExtra:a.length?(0,P.jsxs)(`label`,{className:`rp-proj-pickall`,title:`全选/取消全选当前页`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:G,onChange:ae,"aria-label":`全选当前页任务`}),`全选本页`]}):null,emptyText:`还没有页面:点「+ 新建页」写第一篇,或让 agent 往${t?`全局池`:`这个目录`}投递任务。`,children:a.map(t=>{let n=X(t),r=D&&D[t.id]||[];return(0,P.jsx)(M,{t,selectable:!0,picked:H.has(Number(t.id)),onTogglePick:J,draggable:n,dragHandlers:n?{onDragStart:e=>oe(e,t),onDragOver:e=>Q(e,t),onDragLeave:$,onDrop:e=>se(e,t),onDragEnd:ce}:null,dragVisual:{dragging:R===Number(t.id),drop:B&&B.id===Number(t.id)?B.zone:null},showTimes:!0,downs:r,onOpen:e=>p(e.id),ops:(0,P.jsxs)(P.Fragment,{children:[n&&(T||E)&&(0,P.jsx)(e,{items:[{label:`编排依赖…`,onPick:()=>T&&T(t)},{label:t.blocksFollowing?`取消闸门(不再挡后续)`:`设为闸门(挡住后续)`,onPick:()=>E&&E(t)}]}),y&&t.status!==`cancelled`&&!t.childCount&&(t.status===`claimed`||t.status===`done`||t.completedAt)&&(0,P.jsx)(`span`,{className:`op`,role:`button`,tabIndex:-1,title:t.completedAt?`反馈:新开一条任务(原任务不动)`:`反馈修改:回写本任务并记入任务链`,"aria-label":`反馈 ${v(t)}`,onClick:()=>y(t),children:(0,P.jsx)(c,{name:`refresh`,size:12})}),m&&(0,P.jsx)(`span`,{className:`op danger`,role:`button`,tabIndex:-1,title:`删除此任务(软删除,CLI 可恢复)`,"aria-label":`删除 ${v(t)}`,onClick:()=>m(t),children:(0,P.jsx)(c,{name:`x`,size:12})})]})},t.id)})}),o>0&&(0,P.jsx)(`div`,{className:`mdw-land-pager`,children:(0,P.jsx)(x,{page:l,pageCount:u,total:o,onPage:d,unit:`个任务`})})]})}var I=(e,t,n)=>k(e=>n.get(e)||[],e,t);function L({task:e,tasks:t,onClose:n,onSave:r}){let i=e=>Number(e.id),o=i(e),s=t.filter(e=>i(e)!==o),[c,l]=(0,N.useState)(!!e.blocksFollowing),[u,d]=(0,N.useState)(()=>new Set((e.blockBy||[]).map(Number))),[f,m]=(0,N.useState)(()=>new Set(s.filter(e=>(e.blockBy||[]).map(Number).includes(o)).map(i))),[h,g]=(0,N.useState)(!1),_=t.findIndex(e=>i(e)===o),v=t.slice(_+1).map(i),y=new Map(t.map(e=>[i(e),i(e)===o?[...u]:(e.blockBy||[]).map(Number)])),b=e=>c||!u.has(i(e))&&I(i(e),o,y),x=e=>!f.has(i(e))&&I(o,i(e),y),S=e=>t=>e(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}),C=()=>l(e=>(e||d(new Set),!e)),w=async()=>{g(!0);try{let e=[{id:o,gate:c,blockBy:[...u]}];if(!c)for(let t of s){let n=i(t),r=f.has(n),a=(t.blockBy||[]).map(Number);r!==a.includes(o)&&e.push({id:n,blockBy:r?[...a,o]:a.filter(e=>e!==o)})}await r(e),n()}catch{}finally{g(!1)}},T=(e,t,n,r)=>{let a=p(e.text)||`#${i(e)}`;return(0,P.jsxs)(`label`,{className:`mdw-dag-item`,title:n&&!h?`会造成循环依赖或与闸门约束冲突,已禁用`:void 0,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:t,disabled:h||n,onChange:()=>r(i(e))}),(0,P.jsxs)(`span`,{className:`mono faint`,children:[`#`,i(e)]}),(0,P.jsx)(`span`,{className:`mdw-dag-name`,children:a})]},i(e))};return(0,P.jsx)(a,{title:`编排 · #${o} ${p(e.text)||``}`,onClose:n,busy:h,size:`md`,footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:h,onClick:n,children:`取消`}),(0,P.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:h,onClick:w,children:h?`保存中…`:`保存编排`})]}),children:(0,P.jsxs)(`div`,{className:`mdw-dag`,children:[(0,P.jsxs)(`label`,{className:`mdw-dag-item mdw-dag-gate`,title:`闸门:本任务未完成前,队列里排在后面的全部待领取任务都不能被领取`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:c,disabled:h,onChange:C}),(0,P.jsx)(`b`,{children:`闸门`}),(0,P.jsx)(`span`,{className:`mdw-dag-hint`,children:`挡住队列里所有排在后面的待领取任务(闸门不声明上游依赖)`})]}),c?(0,P.jsxs)(`div`,{className:`mdw-dag-note`,children:[`开启时自动挡住 `,v.length,` 个后续任务`,v.length?`:${v.map(e=>`#${e}`).join(`, `)}`:`(后面已没有待领取任务)`]}):null,(0,P.jsxs)(`div`,{className:`mdw-dag-sec`,children:[`上游依赖(我等谁完成)`,c?(0,P.jsx)(`span`,{className:`mdw-dag-hint`,children:`—— 闸门开启时不声明上游,保存后已清空`}):null]}),(0,P.jsx)(`div`,{className:`mdw-dag-list`+(c?` dim`:``),children:s.length?s.map(e=>T(e,u.has(i(e)),b(e),S(d))):(0,P.jsx)(`div`,{className:`mdw-dag-note`,children:`队列里没有其他待领取任务`})}),(0,P.jsxs)(`div`,{className:`mdw-dag-sec`,children:[`下游任务(谁被我挡)`,c?(0,P.jsx)(`span`,{className:`mdw-dag-hint`,children:`—— 闸门开启时此表不生效,自动挡住全部后续`}):null]}),(0,P.jsx)(`div`,{className:`mdw-dag-list`+(c?` dim`:``),children:s.length?s.map(e=>T(e,f.has(i(e)),c||x(e),S(m))):(0,P.jsx)(`div`,{className:`mdw-dag-note`,children:`队列里没有其他待领取任务`})}),(0,P.jsx)(`div`,{className:`mdw-dag-note`,children:`保存会同时改写相关任务的依赖(逐条落盘);勾选会成环的组合会被禁用。`})]})})}function R(e){let t=String(e||``).trim();if(!t)return`—`;let n=t.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2})/);return n?`${n[1].slice(5)} ${n[2]}`:t.slice(0,16)}function z({tasks:e=[],onClose:t,onRestore:n,onPurge:r}){return(0,P.jsx)(a,{title:`已删除任务(${e.length})`,onClose:t,children:e.length===0?(0,P.jsx)(`div`,{className:`mdw-del-empty`,children:`这个目录没有已删除的任务。`}):(0,P.jsx)(`table`,{className:`mdw-del-list`,children:(0,P.jsx)(`tbody`,{children:e.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsxs)(`td`,{className:`mdw-del-id mono`,children:[`#`,e.id]}),(0,P.jsx)(`td`,{className:`mdw-del-title`,title:p(e.text),children:p(e.text)||`—`}),(0,P.jsx)(`td`,{className:`mdw-del-time mono`,children:R(e.deletedAt)}),(0,P.jsxs)(`td`,{className:`mdw-del-ops`,children:[(0,P.jsx)(`button`,{type:`button`,className:`btn sm ghost`,title:`恢复到队列原位置`,onClick:()=>n?.(e),children:`恢复`}),(0,P.jsx)(`button`,{type:`button`,className:`btn sm danger`,title:`彻底删除(不可恢复)`,onClick:()=>r?.(e),children:`彻底删除`})]})]},e.id))})})})}var B=20;function V({dirKey:e}){let{dialog:t,node:n}=r(),a=f()||{},c=o(),l=a.rows||[],p=a.refreshLocal,v=a.tpl,x=a.model,O=a.repoData&&a.repoData.repos||[],k=!e||e===`__GLOBAL__`,[j,re]=(0,N.useState)(null),[ie,M]=(0,N.useState)(!1),[I,R]=(0,N.useState)(null),V=(0,N.useRef)(null),H=(0,N.useMemo)(()=>k?l.find(e=>e.isGlobal)||null:l.find(t=>t.key===e)||null,[l,e,k]),U=(0,N.useMemo)(()=>{if(!H||k)return null;let e=H.repo&&H.repo.key;if(e){let t=O.find(t=>t.key===e);if(t)return t}let t=String(H.cwd||``).replace(/\\/g,`/`).toLowerCase();return t&&O.find(e=>String(e.path||``).replace(/\\/g,`/`).toLowerCase()===t)||null},[H,O,k]),W=(0,N.useMemo)(()=>h((H?.tasks||[]).filter(e=>!e.deletedAt&&!g(e))),[H]),G=y(W,B),K=(0,N.useMemo)(()=>W.filter(e=>e.status===`pending`&&!e.migratedTo).length,[W]),q=e=>e().catch(e=>c(String(e.message||e))),J=()=>k?{key:_}:{cwd:H.cwd},ae=(e,t,n)=>{q(async()=>{await i(`/api/localtasks/reorder`,{method:`PATCH`,body:{...J(),id:e.id,...n===`before`?{beforeId:t}:{afterId:t}}}),p()})},Y=e=>{q(async()=>{await i(`/api/localtasks/item`,{method:`PATCH`,body:{...J(),id:e.id,gate:!e.blocksFollowing}}),c(e.blocksFollowing?`#${e.id} 闸门已取消`:`#${e.id} 已设为闸门——挡住所有后续待领取任务`),p()})},X=async e=>{try{for(let t of e)await i(`/api/localtasks/item`,{method:`PATCH`,body:{...J(),...t}});c(`编排已保存`),p()}catch(e){throw c(String(e.message||e)),e}},Z=(0,N.useMemo)(()=>{let e={},t=W.filter(e=>e.status===`pending`&&!e.migratedTo&&!e.deletedAt);return t.forEach((n,r)=>{n.blocksFollowing&&(e[n.id]=t.slice(r+1).map(e=>e.id))}),e},[W]),oe=(0,N.useMemo)(()=>W.filter(e=>e.status===`pending`&&!e.migratedTo&&!e.deletedAt),[W]),Q=t=>{a.openPage&&a.openPage({dirKey:e,task:String(t),name:`#${t}`})},$=t=>{let n=D();T(E(C(e),n),{title:``,body:t}),a.openPage&&a.openPage({dirKey:e,task:n,name:`新任务`})},se=()=>{x&&b(x)},ce=()=>{x&&u(x,{component:`progress`,name:`进程`,config:{dirKey:e||`__GLOBAL__`},location:`right`})},le=k?_:e,ue=ee(le).templates||v&&v.templates||[],de=()=>{if(!x){c(`工作区未就绪`);return}w(x,{mode:`new`,topic:le,scope:k?[]:[`topic:${le}`],name:``})},fe=[...ue.length?ue.map(e=>({label:(e.id===v?.defaultId?`✓ `:``)+e.name,icon:`list`,onClick:()=>$(S(e.body,{...m,...e.values||{}}))})):[{label:`按默认模板新建一页`,icon:`list`,onClick:()=>$(v?v.defaultBody():``)}],`sep`,{label:`为本${k?`全局池`:`目录`}新建模板…`,icon:`plus`,onClick:de},{label:`管理模板…`,icon:`gear`,onClick:se}],pe=async e=>{if(e==null)return null;let t=k?`key=${encodeURIComponent(_)}&id=${Number(e.id)}`:`cwd=${encodeURIComponent(H?.cwd||``)}&id=${Number(e.id)}`;return i(`/api/localtasks/item?${t}`).catch(()=>null)},me=n=>{if(!n)return;let r=(n.text||``).split(`
|
|
2
|
-
`).find(e=>e.trim())||`#${n.id}`;q(async()=>{let a=!!n.completedAt,o=await t({title:a?`反馈 · #${n.id}`:`反馈修改 · #${n.id}`,input:!0,placeholder:a?`写下反馈(将新开一条任务,原任务不动)`:`写下要改的地方(留空 = 只重开,不改正文)`});if(o==null)return;let s=String(o).trim(),l=await pe(n),u=String(l?.text??``).trim()||String(n.text||``).trim(),d=a&&(l?.roundSummary||n.roundSummary)||``;if(!s&&!a&&!u){c(`拿不到任务当前正文,已取消(防止丢内容)`);return}if(a){let t=s?ne({base:u,feedback:s,ackSummary:d,feedbackHeading:te,bold:!0}):``;if(!t){c(`写一下反馈`);return}let a=await i(`/api/localtasks`,{method:`POST`,body:k?{global:!0,text:t,forkOf:String(n.id),forkKind:`reopen`}:{cwd:H.cwd,text:t,forkOf:String(n.id),forkKind:`reopen`}}),o=String(a?.task?.id??a?.id??``),l=a?.key||e;o&&T(E(C(l),o),{body:t}),c(`已反馈「${r.replace(/^#\s*/,``)}」→ 新任务 #${o||`?`}`),p();return}let f=await i(`/api/localtasks/reopen`,{method:`POST`,body:{...J(),id:n.id,kind:`reopen`,...s?{feedback:s,feedbackHeading:A,feedbackBold:!1}:{}}}),m=f?.key||e,h=String(f?.task?.id??n.id),g=String(f?.task?.text??``);g&&T(E(C(m),h),{body:g}),c(`已回写「${r.replace(/^#\s*/,``)}」#${h}`+(f?.moved&&f.name?`;归属迁到「${f.name}」`:``)),p()})},he=async n=>{if(!n)return;let r=(n.text||``).split(`
|
|
3
|
-
`).find(e=>e.trim())||`#${n.id}`;await t({title:`删除任务「${r.replace(/^#\s*/,``)}」`,message:`软删除:CLI localtask task restore 可恢复。`,danger:!0,okText:`删除`})&&q(async()=>{if(await i(`/api/localtasks/item`,{method:`DELETE`,body:k?{key:_,id:n.id}:{cwd:H.cwd,id:n.id}}),c(`已删除「${r.replace(/^#\s*/,``)}」`),x){let t=d(x,`page`,{dirKey:e,task:String(n.id)});t&&a.closePanel&&a.closePanel(t.getId())}p()})},ge=async e=>{let n=(e||[]).map(Number).filter(e=>Number.isFinite(e)&&e>0);return!n.length||!await t({title:`删除选中的 ${n.length} 条任务`,message:`软删除:CLI localtask task restore 可恢复。`,danger:!0,okText:`删除`})?!1:q(async()=>{let e=await i(`/api/localtasks/items`,{method:`DELETE`,body:{...J(),ids:n}});return c(`已删除 ${e?.count??n.length} 条任务`),p(),!0})},_e=async e=>{let n=(e||[]).map(Number).filter(e=>Number.isFinite(e)&&e>0);return!n.length||!await t({title:`取消选中的 ${n.length} 条待领取任务`,message:`只处理待领取任务;已领取/已交付/已取消会跳过。取消为终态,原文留档。`,okText:`取消任务`})?!1:q(async()=>{let e=await i(`/api/localtasks/items/cancel`,{method:`POST`,body:{...J(),ids:n}}),t=e?.skipped?.length||0;return c(`已取消 ${e?.count??0} 条任务${t?`,跳过 ${t} 条`:``}`),p(),!0})},ve=async e=>{let n=(e||[]).map(Number).filter(e=>Number.isFinite(e)&&e>0);return!n.length||!await t({title:`把选中的 ${n.length} 条待领取任务标为完成`,message:`只处理待领取任务;已领取/已交付/已取消会跳过。完成会补一条完成记录,原文留档。`,okText:`标为完成`})?!1:q(async()=>{let e=await i(`/api/localtasks/items/close`,{method:`POST`,body:{...J(),ids:n,status:`done`}}),t=e?.skipped?.length||0;return c(`已标为完成 ${e?.count??0} 条任务${t?`,跳过 ${t} 条`:``}`),p(),!0})},ye=(0,N.useMemo)(()=>(H?.tasks||[]).filter(e=>e.deletedAt).slice().reverse(),[H]),be=e=>{e&&q(async()=>{await i(`/api/localtasks/tasks/restore`,{method:`POST`,body:k?{key:_,id:e.id}:{cwd:H.cwd,id:e.id}}),c(`已恢复 #${e.id}「${(e.text||``).split(`
|
|
4
|
-
`).find(e=>e.trim())?.replace(/^#\s*/,``)||``}」`),p()})},xe=async e=>{if(!e)return;let n=(e.text||``).split(`
|
|
5
|
-
`).find(e=>e.trim())||`#${e.id}`;await t({title:`彻底删除「${n.replace(/^#\s*/,``)}」`,message:`彻底删除后不可恢复(行从队列里真正摘除)。`,danger:!0,okText:`彻底删除`})&&q(async()=>{await i(`/api/localtasks/item`,{method:`DELETE`,body:{...k?{key:_}:{cwd:H.cwd},id:e.id,purge:!0}}),c(`已彻底删除 #${e.id}`),p()})},Se=()=>M(!0),Ce=()=>{if(k||!U){c(`全局池没有项目文档列表`);return}if(!x)return;let e=U.key||H.repo&&H.repo.key||``;if(!e){c(`这个项目还没有仓库标识(key),无法定位文档列表`);return}u(x,{component:`refs`,name:`文档列表`,config:{repoKey:e},location:`right`})},we=async e=>{let t=await e.text(),n=e.name.replace(/\.md$/i,``);await q(async()=>{let r=t.startsWith(`#`)?t:`# ${n}\n\n${t}`,a=await i(`/api/localtasks`,{method:`POST`,body:k?{global:!0,text:r}:{cwd:H.cwd,text:r}});c(`已导入:${e.name}`),p();let o=a?.task?.id??a?.id;o!=null&&Q(o)})};return!H&&!k?(0,P.jsx)(`div`,{className:`mdw`,children:(0,P.jsx)(`div`,{className:`mdw-main`,children:(0,P.jsx)(`div`,{className:`mdw-top`,children:(0,P.jsxs)(`div`,{className:`mdw-head`,children:[(0,P.jsx)(`div`,{className:`mdw-title`,children:`目录不存在`}),(0,P.jsx)(`div`,{className:`mdw-path`,children:`—`})]})})})}):(0,P.jsxs)(`div`,{className:`mdw`,children:[(0,P.jsx)(`div`,{className:`mdw-main`,children:(0,P.jsx)(F,{isGlobal:k,topic:H,repo:U,model:x,tasks:G.items,taskCount:G.total,pendingCount:K,page:G.page,pageCount:G.pageCount,onPage:G.setPage,onNew:()=>$(v?v.defaultBody():``),onOpenTask:Q,onDeleteTask:he,onDeleteTasks:ge,onCancelTasks:_e,onCompleteTasks:ve,onReopenTask:me,onTplMenu:e=>re({x:e.clientX,y:e.clientY}),onImport:()=>V.current?.click(),onProg:ce,onMoveTask:ae,onOpenDag:R,onOpenFlow:()=>x&&u(x,{component:`dag`,name:`编排`,config:{dirKey:e}}),onToggleGate:Y,downstreamOf:Z,onDeleted:Se,onRefs:Ce,deletedCount:ye.length})}),I&&(0,P.jsx)(L,{task:I,tasks:oe,onClose:()=>R(null),onSave:X}),ie&&(0,P.jsx)(z,{tasks:ye,onClose:()=>M(!1),onRestore:be,onPurge:xe}),j&&(0,P.jsx)(s,{x:j.x,y:j.y,items:fe,onClose:()=>re(null)}),(0,P.jsx)(`input`,{ref:V,type:`file`,accept:`.md,text/markdown,text/plain`,hidden:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&we(t)}}),n]})}export{V as default};
|