@markus-global/cli 0.12.5-rc.2 → 0.12.5-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/web-ui/assets/{AsyncState-BCS9C43h.js → AsyncState-BBjWt0U4.js} +1 -1
  2. package/dist/web-ui/assets/{ChatComponents-B4gMEEQr.js → ChatComponents-BM9ia4hU.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-iGJdjFvn.js → ContentRenderer-qTQ3LGXo.js} +2 -2
  4. package/dist/web-ui/assets/{DeliverableShareModal-CY0_wqDC.js → DeliverableShareModal-DvipfOxG.js} +1 -1
  5. package/dist/web-ui/assets/{Deliverables-oCzunom7.js → Deliverables-BPy0ggqv.js} +1 -1
  6. package/dist/web-ui/assets/{MarkdownMessage-B-9NMrYX.js → MarkdownMessage-CRj69Rnh.js} +1 -1
  7. package/dist/web-ui/assets/{Search-Badheo3V.js → Search-C46Sjd5C.js} +1 -1
  8. package/dist/web-ui/assets/{SendToChat-X-3sK9Ph.js → SendToChat-LdFPpuOR.js} +1 -1
  9. package/dist/web-ui/assets/{Settings-B05tnigv.js → Settings-AG1s3e8i.js} +1 -1
  10. package/dist/web-ui/assets/{Store-B4hpcTFJ.js → Store-DO5KoBp1.js} +1 -1
  11. package/dist/web-ui/assets/{Switch-BgdJa330.js → Switch-BZ1GkhRR.js} +1 -1
  12. package/dist/web-ui/assets/{Team-Dfz_Jkoy.js → Team-D5iZnF6B.js} +4 -4
  13. package/dist/web-ui/assets/{Work-DqxE8g_Q.js → Work-Drx3sVyM.js} +1 -1
  14. package/dist/web-ui/assets/{arc-Dns31Tc9.js → arc-Eq03OxxX.js} +1 -1
  15. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-C0MbQViF.js → architectureDiagram-3BPJPVTR-BBdoQyhl.js} +1 -1
  16. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-DRAhpfjQ.js → blockDiagram-GPEHLZMM-CiHhkXz1.js} +1 -1
  17. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-DVAnq8L5.js → c4Diagram-AAUBKEIU-BNuNa7JZ.js} +1 -1
  18. package/dist/web-ui/assets/channel-h2PMJJlX.js +1 -0
  19. package/dist/web-ui/assets/{chunk-2J33WTMH-CNZ1Di5i.js → chunk-2J33WTMH-CHUGrp-l.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-4BX2VUAB-BfZWR2ax.js → chunk-4BX2VUAB-d_lgDORf.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-55IACEB6-CLvm88GS.js → chunk-55IACEB6-D3qv6MEj.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-727SXJPM-YptrHhiQ.js → chunk-727SXJPM-zcDvjE2C.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-AQP2D5EJ-Bht-7eQm.js → chunk-AQP2D5EJ-Cu6Z10dm.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-FMBD7UC4-CXoaPK-Q.js → chunk-FMBD7UC4-CIFOVD2g.js} +1 -1
  25. package/dist/web-ui/assets/{chunk-ND2GUHAM-Bor_8TtZ.js → chunk-ND2GUHAM-tQ2G7DnL.js} +1 -1
  26. package/dist/web-ui/assets/{chunk-QZHKN3VN-BWVZxTBv.js → chunk-QZHKN3VN-C-cdIAYv.js} +1 -1
  27. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-D1AgiP6_.js +1 -0
  28. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-D1AgiP6_.js +1 -0
  29. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-Dc0GRajy.js → cose-bilkent-S5V4N54A-DmSgdwYx.js} +1 -1
  30. package/dist/web-ui/assets/{dagre-BM42HDAG-CTnRRUJj.js → dagre-BM42HDAG-wjgriNhd.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-2AECGRRQ-BJpt589H.js → diagram-2AECGRRQ-a-NcMwjk.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-5GNKFQAL-Wonl9ScH.js → diagram-5GNKFQAL-SpkaU5yE.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-KO2AKTUF-DYlCFdL8.js → diagram-KO2AKTUF-CUgGNLiQ.js} +1 -1
  34. package/dist/web-ui/assets/{diagram-LMA3HP47-0bqbxPqr.js → diagram-LMA3HP47-B8fsKgAc.js} +1 -1
  35. package/dist/web-ui/assets/{diagram-OG6HWLK6-CCgq0GqI.js → diagram-OG6HWLK6-BzlaeBBK.js} +1 -1
  36. package/dist/web-ui/assets/{docx-preview-BvKeUHJr.js → docx-preview-BCuJY_I2.js} +1 -1
  37. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CLUiZPDr.js → erDiagram-TEJ5UH35-BbKnb5vg.js} +1 -1
  38. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-f6pN4cw1.js → flowDiagram-I6XJVG4X-v-NewzE2.js} +1 -1
  39. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-BwJkS7mo.js → ganttDiagram-6RSMTGT7-B2AU3vrG.js} +1 -1
  40. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-DI2zMknR.js → gitGraphDiagram-PVQCEYII-Dwxnlf1q.js} +1 -1
  41. package/dist/web-ui/assets/{index-Dc1HlaXE.js → index-D5uPD4Tz.js} +6 -6
  42. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-oD_kael7.js → infoDiagram-5YYISTIA-BdzCNxZz.js} +1 -1
  43. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-CU8h8XWC.js → ishikawaDiagram-YF4QCWOH-CLyFQ2jy.js} +1 -1
  44. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-0RIRYcwi.js → journeyDiagram-JHISSGLW-B3LiOP2U.js} +1 -1
  45. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BbjHZ91H.js → kanban-definition-UN3LZRKU-B8Oj05-K.js} +1 -1
  46. package/dist/web-ui/assets/{mermaid.core-BlPZWkyC.js → mermaid.core-DMZzuUz0.js} +5 -5
  47. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-BvaY6iLy.js → mindmap-definition-RKZ34NQL-VJJ6L2az.js} +1 -1
  48. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CHAkMEBP.js → pieDiagram-4H26LBE5-DS0GmvNe.js} +1 -1
  49. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-BLmxZKSH.js → quadrantDiagram-W4KKPZXB-B5zgEbvf.js} +1 -1
  50. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-CszQubly.js → requirementDiagram-4Y6WPE33-BC9P_pkc.js} +1 -1
  51. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-ovwXJ_-9.js → sankeyDiagram-5OEKKPKP-DWJUUU8z.js} +1 -1
  52. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-C5biPL1f.js → sequenceDiagram-3UESZ5HK-CwDKp_Kn.js} +1 -1
  53. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-B_H8A-zE.js → stateDiagram-AJRCARHV-D3xJAfNC.js} +1 -1
  54. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DMjww8Bc.js +1 -0
  55. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-DxHkO_i6.js → timeline-definition-PNZ67QCA-Bs2r0u8I.js} +1 -1
  56. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-XuByI13m.js → vennDiagram-CIIHVFJN-Dn7ElyME.js} +1 -1
  57. package/dist/web-ui/assets/{wardley-L42UT6IY-DEu5IbdV.js → wardley-L42UT6IY-DzsSSCmk.js} +1 -1
  58. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-Coe77zhN.js → wardleyDiagram-YWT4CUSO-CQAHS6du.js} +1 -1
  59. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-vMLEL3LK.js → xychartDiagram-2RQKCTM6-a8vJ9G8_.js} +1 -1
  60. package/dist/web-ui/index.html +1 -1
  61. package/package.json +1 -1
  62. package/dist/web-ui/assets/channel-Dll32qm6.js +0 -1
  63. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BAXna0Rk.js +0 -1
  64. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BAXna0Rk.js +0 -1
  65. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BHZhFie0.js +0 -1
@@ -1,4 +1,4 @@
1
- import{u as S,r as i,j as e,c as z,m as p,o as H,E as A,M,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-Dc1HlaXE.js";const P="markus-copy-typography",L={fontFamily:"default",fontSize:15,headingScale:"standard"};function I(){try{const t=localStorage.getItem(P);if(t)return{...L,...JSON.parse(t)}}catch{}return L}function ne(t){localStorage.setItem(P,JSON.stringify(t))}function se(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},s={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:s[t.headingScale]??s.standard}}function ae({onClose:t}){const{t:r}=S("common"),[s,n]=i.useState(I);i.useEffect(()=>{ne(s)},[s]);const c=i.useCallback((a,x)=>{n(d=>({...d,[a]:x}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:s.fontFamily,onChange:a=>c("fontFamily",a.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",s.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:s.fontSize,onChange:a=>c("fontSize",Number(a.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(a=>e.jsx("button",{onClick:()=>c("headingScale",a),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${s.headingScale===a?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${a.charAt(0).toUpperCase()+a.slice(1)}`)},a))})]})]})}const E=[B,O,G],T=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function R(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const s=W(t);return K(s)?s:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let s=t.replace(oe,(n,c)=>{const a=c.trim();return a&&r.push(a),""});return s=s.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:s.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,s]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const n=window.matchMedia(`(max-width: ${t-1}px)`),c=a=>s(a.matches);return n.addEventListener("change",c),s(n.matches),()=>n.removeEventListener("change",c)},[t]),r}function me({content:t,contentRef:r,variant:s}){const{t:n}=S("common"),[c,a]=i.useState(!1),[x,d]=i.useState(!1),[v,m]=i.useState(!1),[u,w]=i.useState(null),f=i.useRef(null),g=de();i.useEffect(()=>{if(!c)return;const l=o=>{f.current&&!f.current.contains(o.target)&&(a(!1),d(!1),m(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[c]);const y=i.useCallback(l=>{w(l),setTimeout(()=>w(null),1500)},[]),j=async()=>{const l=await te(t);y(n(l?"markdown.copied":"markdown.failed")),a(!1)},k=async l=>{const o=r.current?.firstElementChild;if(!o)return;const b=I(),N=se(b),C=await re(o,l,t,{fontFamily:N.fontFamily,fontSize:N.fontSize,headingScales:N.headingScales}),F=n(l==="light"?"markdown.themeLight":"markdown.themeDark");y(C.ok?C.method==="html"?n("markdown.htmlCopied",{theme:F}):n("markdown.textCopied"):n("markdown.failed")),a(!1)},h=le[s];return e.jsxs("div",{className:h.wrapper,ref:f,"data-copy-variant":s,children:[u&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:u}),e.jsxs("button",{onClick:()=>a(l=>!l),className:h.button,title:n("markdown.copyContent"),children:[e.jsx("svg",{className:h.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),h.labelled&&e.jsx("span",{className:"leading-none",children:n("markdown.copy")})]}),c&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:v?e.jsx(ae,{onClose:()=>m(!1)}):x?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:n("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:n("markdown.mdAbbrev")})," — ",n("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",n("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",n("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:n("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>m(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:j,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:n("markdown.mdAbbrev")}),n(g?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>k("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),n(g?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>k("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),n(g?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:s="",onMentionClick:n,knownNames:c,basePath:a,copyVariant:x="inline"}){const{t:d}=S("common"),{thinking:v,rest:m}=ie(r),u=i.useRef(null),[w,f]=i.useState(null),g=z(),y=i.useCallback(l=>{let o=p(l,V);return o=p(o,Y),o=p(o,J),o=p(o,Q),o=p(o,X),o=p(o,b=>Z(b,c)),o=p(o,ee),o},[c]),j=i.useMemo(()=>y(m),[m,y]),k=ce[x],h=H({onMentionClick:n,basePath:a,onImagePreview:f,contentRef:u,hostAvailable:g?.hostAvailable,openRightPanel:g?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:u,variant:x}),e.jsx("div",{ref:u,children:e.jsx(A,{resetKeys:[j],fallback:e.jsx("div",{className:`prose prose-sm max-w-none msg-break-anywhere whitespace-pre-wrap ${k} text-fg-secondary ${s}`,children:m}),children:e.jsxs("div",{className:`prose prose-sm max-w-none msg-break-anywhere ${k} text-fg-secondary ${s}`,children:[v.length>0&&(()=>{const l=v.join(`
1
+ import{u as S,r as i,j as e,c as z,m as p,o as H,E as A,M,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-D5uPD4Tz.js";const P="markus-copy-typography",L={fontFamily:"default",fontSize:15,headingScale:"standard"};function I(){try{const t=localStorage.getItem(P);if(t)return{...L,...JSON.parse(t)}}catch{}return L}function ne(t){localStorage.setItem(P,JSON.stringify(t))}function se(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},s={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:s[t.headingScale]??s.standard}}function ae({onClose:t}){const{t:r}=S("common"),[s,n]=i.useState(I);i.useEffect(()=>{ne(s)},[s]);const c=i.useCallback((a,x)=>{n(d=>({...d,[a]:x}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:s.fontFamily,onChange:a=>c("fontFamily",a.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",s.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:s.fontSize,onChange:a=>c("fontSize",Number(a.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(a=>e.jsx("button",{onClick:()=>c("headingScale",a),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${s.headingScale===a?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${a.charAt(0).toUpperCase()+a.slice(1)}`)},a))})]})]})}const E=[B,O,G],T=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function R(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const s=W(t);return K(s)?s:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let s=t.replace(oe,(n,c)=>{const a=c.trim();return a&&r.push(a),""});return s=s.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:s.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,s]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const n=window.matchMedia(`(max-width: ${t-1}px)`),c=a=>s(a.matches);return n.addEventListener("change",c),s(n.matches),()=>n.removeEventListener("change",c)},[t]),r}function me({content:t,contentRef:r,variant:s}){const{t:n}=S("common"),[c,a]=i.useState(!1),[x,d]=i.useState(!1),[v,m]=i.useState(!1),[u,w]=i.useState(null),f=i.useRef(null),g=de();i.useEffect(()=>{if(!c)return;const l=o=>{f.current&&!f.current.contains(o.target)&&(a(!1),d(!1),m(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[c]);const y=i.useCallback(l=>{w(l),setTimeout(()=>w(null),1500)},[]),j=async()=>{const l=await te(t);y(n(l?"markdown.copied":"markdown.failed")),a(!1)},k=async l=>{const o=r.current?.firstElementChild;if(!o)return;const b=I(),N=se(b),C=await re(o,l,t,{fontFamily:N.fontFamily,fontSize:N.fontSize,headingScales:N.headingScales}),F=n(l==="light"?"markdown.themeLight":"markdown.themeDark");y(C.ok?C.method==="html"?n("markdown.htmlCopied",{theme:F}):n("markdown.textCopied"):n("markdown.failed")),a(!1)},h=le[s];return e.jsxs("div",{className:h.wrapper,ref:f,"data-copy-variant":s,children:[u&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:u}),e.jsxs("button",{onClick:()=>a(l=>!l),className:h.button,title:n("markdown.copyContent"),children:[e.jsx("svg",{className:h.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),h.labelled&&e.jsx("span",{className:"leading-none",children:n("markdown.copy")})]}),c&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:v?e.jsx(ae,{onClose:()=>m(!1)}):x?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:n("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:n("markdown.mdAbbrev")})," — ",n("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",n("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",n("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:n("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>m(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:j,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:n("markdown.mdAbbrev")}),n(g?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>k("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),n(g?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>k("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),n(g?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:s="",onMentionClick:n,knownNames:c,basePath:a,copyVariant:x="inline"}){const{t:d}=S("common"),{thinking:v,rest:m}=ie(r),u=i.useRef(null),[w,f]=i.useState(null),g=z(),y=i.useCallback(l=>{let o=p(l,V);return o=p(o,Y),o=p(o,J),o=p(o,Q),o=p(o,X),o=p(o,b=>Z(b,c)),o=p(o,ee),o},[c]),j=i.useMemo(()=>y(m),[m,y]),k=ce[x],h=H({onMentionClick:n,basePath:a,onImagePreview:f,contentRef:u,hostAvailable:g?.hostAvailable,openRightPanel:g?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:u,variant:x}),e.jsx("div",{ref:u,children:e.jsx(A,{resetKeys:[j],fallback:e.jsx("div",{className:`prose prose-sm max-w-none msg-break-anywhere whitespace-pre-wrap ${k} text-fg-secondary ${s}`,children:m}),children:e.jsxs("div",{className:`prose prose-sm max-w-none msg-break-anywhere ${k} text-fg-secondary ${s}`,children:[v.length>0&&(()=>{const l=v.join(`
2
2
 
3
3
  `),o=l.split(`
4
4
  `)[0]??"",b=o.length>80?o.slice(0,80)+"…":o;return e.jsxs("details",{className:"mb-3 rounded-lg bg-surface-elevated/60 border border-border-default/50 overflow-hidden group/think",children:[e.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-secondary hover:text-fg-secondary transition-colors flex items-center gap-1.5 min-w-0",children:[e.jsx("svg",{className:"w-3 h-3 shrink-0 transition-transform group-open/think:rotate-90",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),e.jsx("span",{className:"shrink-0",children:d("execution.thinking")}),e.jsx("span",{className:"truncate text-fg-tertiary ml-1 group-open/think:hidden",children:b})]}),e.jsx("div",{className:"px-3 pb-3 border-t border-border-default/50",children:e.jsx("div",{className:"mt-2 pl-3 border-l-2 border-brand-500/40 text-xs text-fg-secondary leading-relaxed",children:e.jsx(M,{remarkPlugins:E,rehypePlugins:T,components:h,urlTransform:R,children:y(l)})})})]})})(),e.jsx(M,{remarkPlugins:E,rehypePlugins:T,components:h,urlTransform:R,children:j})]})})}),w&&e.jsx($,{src:w,onClose:()=>f(null)})]})},(t,r)=>t.content===r.content&&t.className===r.className&&t.basePath===r.basePath&&t.copyVariant===r.copyVariant&&t.onMentionClick===r.onMentionClick&&he(t.knownNames,r.knownNames));function he(t,r){if(t===r)return!0;if(!t||!r||t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==r[s])return!1;return!0}export{$ as ImagePreviewModal,xe as MarkdownMessage,R as chatUrlTransform};
@@ -1 +1 @@
1
- import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-Dc1HlaXE.js";import{P as $,E as D}from"./AsyncState-BCS9C43h.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,w]=i.useState(!1),[b,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}w(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,R,L,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],T=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=R.status==="fulfilled"?R.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:M,requirements:T,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{w(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&b&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:l("searchResults.workflowMeta",{n:s.stepCount,version:s.version})})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!b&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
1
+ import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-D5uPD4Tz.js";import{P as $,E as D}from"./AsyncState-BBjWt0U4.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,w]=i.useState(!1),[b,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}w(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,R,L,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],T=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=R.status==="fulfilled"?R.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:M,requirements:T,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{w(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&b&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:l("searchResults.workflowMeta",{n:s.stepCount,version:s.version})})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!b&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
@@ -1 +1 @@
1
- import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-Dc1HlaXE.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};
1
+ import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-D5uPD4Tz.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};