@markus-global/cli 0.9.0-rc.7 → 0.9.0-rc.8

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 (61) hide show
  1. package/dist/markus.mjs +55 -20
  2. package/dist/web-ui/assets/{CommentInput-TaVC_Fip.js → CommentInput-BJmv0Rha.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-DtcL0FZI.js → ContentRenderer-DJQo68Rq.js} +2 -2
  4. package/dist/web-ui/assets/{Deliverables-C8pzzt4r.js → Deliverables-DCXoaQpj.js} +1 -1
  5. package/dist/web-ui/assets/{Notifications-BqOlKcov.js → Notifications-BTkCe_FT.js} +1 -1
  6. package/dist/web-ui/assets/{Search-MQIbxh2k.js → Search-DJMnvmW4.js} +1 -1
  7. package/dist/web-ui/assets/{Settings-DXRyCb9R.js → Settings-Bo7g6_tg.js} +1 -1
  8. package/dist/web-ui/assets/{Store-Csz6HWC-.js → Store-B_9bFi_v.js} +1 -1
  9. package/dist/web-ui/assets/{Team-Jgmy2XLK.js → Team-Bp5j4tGQ.js} +4 -4
  10. package/dist/web-ui/assets/{Work-D1xxd9Cj.js → Work-CBpfr_rN.js} +1 -1
  11. package/dist/web-ui/assets/{arc-CvlRbL1f.js → arc-FGZKJEo5.js} +1 -1
  12. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-tI_qyItI.js → architectureDiagram-3BPJPVTR-DrHriKKt.js} +1 -1
  13. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-DPlp1wAS.js → blockDiagram-GPEHLZMM-B1KrBMG4.js} +1 -1
  14. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-B4HY_088.js → c4Diagram-AAUBKEIU-CB3d18fE.js} +1 -1
  15. package/dist/web-ui/assets/channel-Dn6ohvAA.js +1 -0
  16. package/dist/web-ui/assets/{chunk-2J33WTMH-CLfRhfYo.js → chunk-2J33WTMH-yhAAZF8B.js} +1 -1
  17. package/dist/web-ui/assets/{chunk-4BX2VUAB-CDx25iZK.js → chunk-4BX2VUAB-DhGfeR_u.js} +1 -1
  18. package/dist/web-ui/assets/{chunk-55IACEB6-BENXIwET.js → chunk-55IACEB6-B4ZyaFdf.js} +1 -1
  19. package/dist/web-ui/assets/{chunk-727SXJPM-CwIpvaPE.js → chunk-727SXJPM-DiEJq1Wh.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-AQP2D5EJ-D-YRf-Fg.js → chunk-AQP2D5EJ-DJgXMRvd.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-FMBD7UC4-Dp_h4d6j.js → chunk-FMBD7UC4-DLzapSRw.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-ND2GUHAM-CUBDxwHR.js → chunk-ND2GUHAM-KaWi6H4E.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-QZHKN3VN-CVAgDt5p.js → chunk-QZHKN3VN-CedM3HE_.js} +1 -1
  24. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BNcvQTsC.js +1 -0
  25. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BNcvQTsC.js +1 -0
  26. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DDrJZ_Lt.js → cose-bilkent-S5V4N54A-DGOMWPFW.js} +1 -1
  27. package/dist/web-ui/assets/{dagre-BM42HDAG-LX7QV3G0.js → dagre-BM42HDAG-CsB6PNx2.js} +1 -1
  28. package/dist/web-ui/assets/{diagram-2AECGRRQ-CK0Esb13.js → diagram-2AECGRRQ-dsKr5CnT.js} +1 -1
  29. package/dist/web-ui/assets/{diagram-5GNKFQAL-Ba2o4U6S.js → diagram-5GNKFQAL-CfKFUiA0.js} +1 -1
  30. package/dist/web-ui/assets/{diagram-KO2AKTUF-DhYIvmyJ.js → diagram-KO2AKTUF-C-iYqWwv.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-LMA3HP47-Cy62pgA6.js → diagram-LMA3HP47-VrnDGieS.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-OG6HWLK6-YVinWnza.js → diagram-OG6HWLK6-2CPw94I0.js} +1 -1
  33. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DZ72-TSc.js → erDiagram-TEJ5UH35-B2CXjopz.js} +1 -1
  34. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-CMllMvlP.js → flowDiagram-I6XJVG4X-uYZBII8i.js} +1 -1
  35. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-DsjTLEpK.js → ganttDiagram-6RSMTGT7-DX__je4a.js} +1 -1
  36. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-Xl_METoZ.js → gitGraphDiagram-PVQCEYII-ClWVZgy5.js} +1 -1
  37. package/dist/web-ui/assets/{index-DO8_O8Vw.js → index-Dgg0L65t.js} +4 -4
  38. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-BxKfEOlz.js → infoDiagram-5YYISTIA-0bE4Z9ff.js} +1 -1
  39. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-ZpSC4-IS.js → ishikawaDiagram-YF4QCWOH-nCIQcUlM.js} +1 -1
  40. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-DlHtkZv8.js → journeyDiagram-JHISSGLW-Bc1umCm3.js} +1 -1
  41. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BreNG-31.js → kanban-definition-UN3LZRKU-BqkpB1pF.js} +1 -1
  42. package/dist/web-ui/assets/{mermaid.core-DvatjXnq.js → mermaid.core-CSfwY1-0.js} +5 -5
  43. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-qveAmQec.js → mindmap-definition-RKZ34NQL-nQyDFxhc.js} +1 -1
  44. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-DX62E3l6.js → pieDiagram-4H26LBE5-5HVdrqjx.js} +1 -1
  45. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-C5dKRXCq.js → quadrantDiagram-W4KKPZXB-NuRh23Sl.js} +1 -1
  46. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-a084_Ugq.js → requirementDiagram-4Y6WPE33-BGztYPcI.js} +1 -1
  47. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-DthKmaYC.js → sankeyDiagram-5OEKKPKP-bjpwDt_z.js} +1 -1
  48. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-DdyLG-Lx.js → sequenceDiagram-3UESZ5HK-DyTeuxtF.js} +1 -1
  49. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-9M6azc5R.js → stateDiagram-AJRCARHV-BHPWZwpF.js} +1 -1
  50. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-56cdLVMt.js +1 -0
  51. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CAZ1B9ki.js → timeline-definition-PNZ67QCA-LPx8DOxK.js} +1 -1
  52. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-C1q-T-PV.js → vennDiagram-CIIHVFJN-Dy6cnqv-.js} +1 -1
  53. package/dist/web-ui/assets/{wardley-L42UT6IY-BUHmrj16.js → wardley-L42UT6IY-BtpmXexA.js} +1 -1
  54. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-C0Y_McWW.js → wardleyDiagram-YWT4CUSO-BsyOd3d4.js} +1 -1
  55. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-Bh5mmFGf.js → xychartDiagram-2RQKCTM6-BcIF0Smp.js} +1 -1
  56. package/dist/web-ui/index.html +1 -1
  57. package/package.json +1 -1
  58. package/dist/web-ui/assets/channel-CTTzbind.js +0 -1
  59. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BOpo-nB5.js +0 -1
  60. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BOpo-nB5.js +0 -1
  61. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DmZSwAmU.js +0 -1
package/dist/markus.mjs CHANGED
@@ -4410,36 +4410,64 @@ var init_config = __esm({
4410
4410
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, createWriteStream } from "node:fs";
4411
4411
  import { join as join2 } from "node:path";
4412
4412
  import { homedir as homedir2 } from "node:os";
4413
- function ensureLogDir() {
4414
- if (!existsSync2(LOG_DIR)) {
4415
- mkdirSync2(LOG_DIR, { recursive: true, mode: 493 });
4413
+ function getLogDir() {
4414
+ return join2(homedir2(), ".markus", "logs");
4415
+ }
4416
+ function ensureLogDir(dir) {
4417
+ if (!existsSync2(dir)) {
4418
+ mkdirSync2(dir, { recursive: true, mode: 493 });
4416
4419
  }
4417
4420
  }
4418
4421
  function getRuntimeLogPath() {
4419
4422
  const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
4420
- return join2(LOG_DIR, `runtime-${date}.log`);
4423
+ return join2(getLogDir(), `runtime-${date}.log`);
4421
4424
  }
4422
4425
  function initRuntimeLogger() {
4423
- if (runtimeLogStream)
4426
+ const path = getRuntimeLogPath();
4427
+ if (runtimeLogStream && runtimeLogPath === path)
4424
4428
  return;
4425
- ensureLogDir();
4426
- runtimeLogStream = createWriteStream(getRuntimeLogPath(), { flags: "a", mode: 420 });
4429
+ if (runtimeLogStream) {
4430
+ runtimeLogStream.end();
4431
+ runtimeLogStream = null;
4432
+ }
4433
+ try {
4434
+ ensureLogDir(getLogDir());
4435
+ runtimeLogStream = createWriteStream(path, { flags: "a", mode: 420 });
4436
+ runtimeLogPath = path;
4437
+ runtimeLogStream.on("error", () => {
4438
+ runtimeLogStream = null;
4439
+ runtimeLogPath = null;
4440
+ });
4441
+ } catch {
4442
+ runtimeLogStream = null;
4443
+ runtimeLogPath = null;
4444
+ }
4427
4445
  }
4428
4446
  function writeToFile(line) {
4429
- if (!runtimeLogStream)
4430
- return;
4431
- runtimeLogStream.write(line + "\n");
4447
+ try {
4448
+ initRuntimeLogger();
4449
+ if (!runtimeLogStream)
4450
+ return;
4451
+ runtimeLogStream.write(line + "\n");
4452
+ } catch {
4453
+ runtimeLogStream = null;
4454
+ runtimeLogPath = null;
4455
+ }
4432
4456
  }
4433
4457
  function createLogger(name, level) {
4434
4458
  return new Logger(name, level ?? process.env["LOG_LEVEL"] ?? "info");
4435
4459
  }
4436
4460
  function closeRuntimeLogger() {
4437
4461
  if (runtimeLogStream) {
4438
- runtimeLogStream.end();
4462
+ try {
4463
+ runtimeLogStream.end();
4464
+ } catch {
4465
+ }
4439
4466
  runtimeLogStream = null;
4467
+ runtimeLogPath = null;
4440
4468
  }
4441
4469
  }
4442
- var LOG_LEVELS, LOG_DIR, runtimeLogStream, Logger;
4470
+ var LOG_LEVELS, runtimeLogStream, runtimeLogPath, Logger;
4443
4471
  var init_logger = __esm({
4444
4472
  "../shared/dist/utils/logger.js"() {
4445
4473
  "use strict";
@@ -4449,8 +4477,8 @@ var init_logger = __esm({
4449
4477
  warn: 2,
4450
4478
  error: 3
4451
4479
  };
4452
- LOG_DIR = join2(homedir2(), ".markus", "logs");
4453
4480
  runtimeLogStream = null;
4481
+ runtimeLogPath = null;
4454
4482
  Logger = class _Logger {
4455
4483
  name;
4456
4484
  minLevel;
@@ -4484,7 +4512,6 @@ var init_logger = __esm({
4484
4512
  const prefix = `[${ts}] [${level.toUpperCase()}] [${this.name}]`;
4485
4513
  const suffix = data ? ` ${JSON.stringify(data)}` : "";
4486
4514
  const line = `${prefix} ${msg}${suffix}`;
4487
- initRuntimeLogger();
4488
4515
  writeToFile(line);
4489
4516
  }
4490
4517
  };
@@ -216860,6 +216887,7 @@ var init_telemetry_service = __esm({
216860
216887
  hubUrl;
216861
216888
  instanceId;
216862
216889
  timer = null;
216890
+ initialTimer = null;
216863
216891
  statsProvider = null;
216864
216892
  constructor(hubUrl, instanceId) {
216865
216893
  this.hubUrl = hubUrl;
@@ -216900,7 +216928,10 @@ var init_telemetry_service = __esm({
216900
216928
  if (this.timer)
216901
216929
  return;
216902
216930
  this.timer = setInterval(() => void this.report(), REPORT_INTERVAL_MS);
216903
- setTimeout(() => void this.report(), 6e4);
216931
+ this.initialTimer = setTimeout(() => {
216932
+ this.initialTimer = null;
216933
+ void this.report();
216934
+ }, 6e4);
216904
216935
  }
216905
216936
  async report() {
216906
216937
  if (!this.enabled || !this.statsProvider)
@@ -216942,6 +216973,10 @@ var init_telemetry_service = __esm({
216942
216973
  clearInterval(this.timer);
216943
216974
  this.timer = null;
216944
216975
  }
216976
+ if (this.initialTimer) {
216977
+ clearTimeout(this.initialTimer);
216978
+ this.initialTimer = null;
216979
+ }
216945
216980
  }
216946
216981
  };
216947
216982
  }
@@ -231667,13 +231702,13 @@ import { createWriteStream as createWriteStream2, existsSync as existsSync41, mk
231667
231702
  import { join as join40 } from "node:path";
231668
231703
  import { homedir as homedir26 } from "node:os";
231669
231704
  function ensureLogDir2() {
231670
- if (!existsSync41(LOG_DIR2)) {
231671
- mkdirSync31(LOG_DIR2, { recursive: true, mode: 493 });
231705
+ if (!existsSync41(LOG_DIR)) {
231706
+ mkdirSync31(LOG_DIR, { recursive: true, mode: 493 });
231672
231707
  }
231673
231708
  }
231674
231709
  function getStartupLogPath() {
231675
231710
  const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
231676
- return join40(LOG_DIR2, `startup-${date}.log`);
231711
+ return join40(LOG_DIR, `startup-${date}.log`);
231677
231712
  }
231678
231713
  function setSuppressConsole(suppress) {
231679
231714
  _suppressConsole = suppress;
@@ -231724,11 +231759,11 @@ function closeStartupLogger() {
231724
231759
  startupLogStream = null;
231725
231760
  }
231726
231761
  }
231727
- var LOG_DIR2, startupLogStream, startupLogPath, _suppressConsole, LEVEL_PREFIX;
231762
+ var LOG_DIR, startupLogStream, startupLogPath, _suppressConsole, LEVEL_PREFIX;
231728
231763
  var init_logger2 = __esm({
231729
231764
  "src/utils/logger.ts"() {
231730
231765
  "use strict";
231731
- LOG_DIR2 = join40(homedir26(), ".markus", "logs");
231766
+ LOG_DIR = join40(homedir26(), ".markus", "logs");
231732
231767
  startupLogStream = null;
231733
231768
  startupLogPath = "";
231734
231769
  _suppressConsole = false;
@@ -1 +1 @@
1
- import{j as t,u as T,r as a,e as ee}from"./index-DO8_O8Vw.js";const te=1920,ne=10*1024*1024,W=5,re=.8;function se(l,u,i){return new Promise((g,f)=>{const y=new Image;y.onload=()=>{let{width:s,height:r}=y;if(s<=u&&r<=u){g(l);return}s>r?(r=Math.round(r*(u/s)),s=u):(s=Math.round(s*(u/r)),r=u);const x=document.createElement("canvas");x.width=s,x.height=r;const b=x.getContext("2d");if(!b){f(new Error("Failed to get canvas context"));return}b.drawImage(y,0,0,s,r),g(x.toDataURL("image/jpeg",i))},y.onerror=()=>f(new Error("Failed to load image")),y.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:g,selectedIndex:f,onIndexChange:y}){const{t:s}=T("common"),[r,x]=a.useState(null),b=a.useRef(null),w=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const h=d.getBoundingClientRect();x({top:h.top+window.scrollY-4,left:h.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!b.current||!r)return;if(b.current.getBoundingClientRect().top<8){const h=i.current;if(!h)return;const c=h.getBoundingClientRect();x({top:c.bottom+window.scrollY+4,left:r.left})}},[r,i]),a.useEffect(()=>{f>=w.length&&y(Math.max(0,w.length-1))},[w.length,f,y]),a.useEffect(()=>{if(!b.current)return;b.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!r||w.length===0?null:ee.createPortal(t.jsxs("div",{ref:b,style:{position:"absolute",top:r.top,left:r.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:s("commentInput.mentionHeading")}),w.map((d,h)=>t.jsxs("button",{"data-selected":h===f,onMouseDown:c=>{c.preventDefault(),g(d)},onMouseEnter:()=>y(h),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${h===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const g=[];let f=0;const y=u.map(r=>r.name).sort((r,x)=>x.length-r.length);let s=0;for(;s<l.length;){const r=l.indexOf("@",s);if(r<0){g.push(t.jsx("span",{children:l.slice(s)},f++));break}if(r>s&&g.push(t.jsx("span",{children:l.slice(s,r)},f++)),l[r+1]==="["){const c=l.indexOf("]",r+2);if(c>r+2){const m=l.slice(r+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),s=c+1;continue}}const x=l.slice(r+1),b=x.toLowerCase(),w=y.find(c=>b.startsWith(c.toLowerCase()));if(w){const c=u.find(m=>m.name.toLowerCase()===w.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",w]},f++)),s=r+1+w.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,h=x.match(d);if(h){const c=h[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),s=r+1+c.length;continue}g.push(t.jsx("span",{children:"@"},f++)),s=r+1}return g.length>0?g:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:g,replyTo:f,onCancelReply:y}){const{t:s}=T("common"),[r,x]=a.useState(""),[b,w]=a.useState(!1),[d,h]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;se(R,te,re).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),G=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),H=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!r.trim()&&N.length===0)){w(!0),h(null),L.current={content:r,mentions:[...C],images:[...N]};try{await i(r,C,[...N],f?.id),x(""),S([]),M([]),L.current=null,y?.()}catch(e){h(String(e instanceof Error?e.message:e)||s("commentInput.sendFailed"))}w(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;w(!0),h(null);try{await i(e,n,o),x(""),S([]),M([]),L.current=null}catch(p){h(String(p instanceof Error?p.message:p)||s("commentInput.sendFailed"))}w(!1)},P=a.useCallback(e=>{x(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{x(e),h(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:G,onDragLeave:H,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:s("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:y,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:r,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:g??s("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:s("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:b,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),s("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:b||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:s("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!r.trim()&&N.length===0||b,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:s(b?"commentInput.sending":"commentInput.submit")})]})]}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:s("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
1
+ import{j as t,u as T,r as a,e as ee}from"./index-Dgg0L65t.js";const te=1920,ne=10*1024*1024,W=5,re=.8;function se(l,u,i){return new Promise((g,f)=>{const y=new Image;y.onload=()=>{let{width:s,height:r}=y;if(s<=u&&r<=u){g(l);return}s>r?(r=Math.round(r*(u/s)),s=u):(s=Math.round(s*(u/r)),r=u);const x=document.createElement("canvas");x.width=s,x.height=r;const b=x.getContext("2d");if(!b){f(new Error("Failed to get canvas context"));return}b.drawImage(y,0,0,s,r),g(x.toDataURL("image/jpeg",i))},y.onerror=()=>f(new Error("Failed to load image")),y.src=l})}function ae({candidates:l,filter:u,anchorRef:i,onSelect:g,selectedIndex:f,onIndexChange:y}){const{t:s}=T("common"),[r,x]=a.useState(null),b=a.useRef(null),w=l.filter(d=>d.name.toLowerCase().includes(u));return a.useEffect(()=>{const d=i.current;if(!d)return;const h=d.getBoundingClientRect();x({top:h.top+window.scrollY-4,left:h.left+window.scrollX+8})},[i,u]),a.useEffect(()=>{if(!b.current||!r)return;if(b.current.getBoundingClientRect().top<8){const h=i.current;if(!h)return;const c=h.getBoundingClientRect();x({top:c.bottom+window.scrollY+4,left:r.left})}},[r,i]),a.useEffect(()=>{f>=w.length&&y(Math.max(0,w.length-1))},[w.length,f,y]),a.useEffect(()=>{if(!b.current)return;b.current.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[f]),!r||w.length===0?null:ee.createPortal(t.jsxs("div",{ref:b,style:{position:"absolute",top:r.top,left:r.left,transform:"translateY(-100%)"},className:"w-60 bg-surface-overlay border border-border-default rounded-lg shadow-xl z-[9999] max-h-48 overflow-y-auto",children:[t.jsx("div",{className:"px-2.5 py-1.5 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default",children:s("commentInput.mentionHeading")}),w.map((d,h)=>t.jsxs("button",{"data-selected":h===f,onMouseDown:c=>{c.preventDefault(),g(d)},onMouseEnter:()=>y(h),className:`w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors ${h===f?"bg-brand-500/15 text-brand-500":"hover:bg-surface-elevated"}`,children:[t.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${d.type==="human"?"bg-green-500/20 text-green-500":"bg-brand-500/20 text-brand-500"}`,children:d.name.slice(0,2).toUpperCase()}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-fg-primary font-medium",children:d.name}),t.jsx("span",{className:"text-fg-tertiary text-[10px] ml-1.5",children:d.subtitle??d.type})]}),d.type==="agent"&&t.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${d.online?"bg-green-400":"bg-gray-500"}`})]},d.id))]}),document.body)}function oe(l){return/^\w+$/.test(l)?`@${l}`:`@[${l}]`}const K=/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu;function ie(l){const u=[];let i;for(K.lastIndex=0;(i=K.exec(l))!==null;)u.push(i[1]??i[2]);return u}function ce(l,u,i){const g=[];let f=0;const y=u.map(r=>r.name).sort((r,x)=>x.length-r.length);let s=0;for(;s<l.length;){const r=l.indexOf("@",s);if(r<0){g.push(t.jsx("span",{children:l.slice(s)},f++));break}if(r>s&&g.push(t.jsx("span",{children:l.slice(s,r)},f++)),l[r+1]==="["){const c=l.indexOf("]",r+2);if(c>r+2){const m=l.slice(r+2,c),j=u.find(k=>k.name.toLowerCase()===m.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&j?"cursor-pointer hover:underline":""}`,onClick:i&&j?k=>i(j,k):void 0,title:j?`${j.name} (${j.role})`:void 0,children:["@",m]},f++)),s=c+1;continue}}const x=l.slice(r+1),b=x.toLowerCase(),w=y.find(c=>b.startsWith(c.toLowerCase()));if(w){const c=u.find(m=>m.name.toLowerCase()===w.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&c?"cursor-pointer hover:underline":""}`,onClick:i&&c?m=>i(c,m):void 0,title:c?`${c.name} (${c.role})`:void 0,children:["@",w]},f++)),s=r+1+w.length;continue}const d=/^([\w\p{L}\p{N}]+)/u,h=x.match(d);if(h){const c=h[1],m=u.find(j=>j.name.toLowerCase()===c.toLowerCase());g.push(t.jsxs("span",{className:`text-brand-500 font-medium ${i&&m?"cursor-pointer hover:underline":""}`,onClick:i&&m?j=>i(m,j):void 0,title:m?`${m.name} (${m.role})`:void 0,children:["@",c]},f++)),s=r+1+c.length;continue}g.push(t.jsx("span",{children:"@"},f++)),s=r+1}return g.length>0?g:[t.jsx("span",{children:l},0)]}function de({agents:l,humans:u,onSubmit:i,placeholder:g,replyTo:f,onCancelReply:y}){const{t:s}=T("common"),[r,x]=a.useState(""),[b,w]=a.useState(!1),[d,h]=a.useState(null),[c,m]=a.useState(!1),[j,k]=a.useState(""),[C,S]=a.useState([]),[B,I]=a.useState(0),[N,M]=a.useState([]),[z,A]=a.useState(!1),F=a.useRef(null),U=a.useRef(null),L=a.useRef(null),$=a.useMemo(()=>{const e=(u??[]).map(n=>({id:n.id,name:n.name,type:"human",subtitle:n.role}));for(const n of l)e.push({id:n.id,name:n.name,type:"agent",subtitle:n.role,online:n.status==="idle"||n.status==="working"});return e},[l,u]),D=$.filter(e=>e.name.toLowerCase().includes(j)),E=a.useCallback(e=>{const n=Array.from(e).filter(o=>o.type.startsWith("image/"));if(n.length!==0)for(const o of n){if(o.size>ne)continue;const p=new FileReader;p.onload=()=>{const R=p.result;se(R,te,re).then(v=>{M(_=>_.length>=W?_:[..._,{id:`img_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,dataUrl:v,name:o.name}])})},p.readAsDataURL(o)}},[]),X=a.useCallback(e=>{M(n=>n.filter(o=>o.id!==e))},[]),Y=a.useCallback(e=>{const n=e.clipboardData?.files;if(n&&n.length>0){const o=Array.from(n).filter(p=>p.type.startsWith("image/"));o.length>0&&(e.preventDefault(),E(o))}},[E]),q=a.useCallback(e=>{e.preventDefault(),A(!1);const n=e.dataTransfer?.files;n&&n.length>0&&E(Array.from(n).filter(o=>o.type.startsWith("image/")))},[E]),G=a.useCallback(e=>{e.preventDefault(),A(!0)},[]),H=a.useCallback(()=>{A(!1)},[]),O=async()=>{if(!(!r.trim()&&N.length===0)){w(!0),h(null),L.current={content:r,mentions:[...C],images:[...N]};try{await i(r,C,[...N],f?.id),x(""),S([]),M([]),L.current=null,y?.()}catch(e){h(String(e instanceof Error?e.message:e)||s("commentInput.sendFailed"))}w(!1)}},Q=async()=>{if(!L.current)return;const{content:e,mentions:n,images:o}=L.current;w(!0),h(null);try{await i(e,n,o),x(""),S([]),M([]),L.current=null}catch(p){h(String(p instanceof Error?p.message:p)||s("commentInput.sendFailed"))}w(!1)},P=a.useCallback(e=>{x(n=>{const o=n.lastIndexOf("@"),p=oe(e.name);return o>=0?n.slice(0,o)+p+" ":n+p+" "}),C.includes(e.id)||S(n=>[...n,e.id]),m(!1),k(""),I(0),F.current?.focus()},[C]),V=e=>{x(e),h(null);const n=e.lastIndexOf("@");if(n>=0&&(n===0||e[n-1]===" ")){const p=e.slice(n+1).toLowerCase();if($.some(v=>v.name.toLowerCase().includes(p))){k(p),m(!0),I(0);return}}m(!1)},Z=e=>{if(c&&D.length>0){const n=e.key==="ArrowUp"||e.ctrlKey&&e.key==="p",o=e.key==="ArrowDown"||e.ctrlKey&&e.key==="n",p=e.key==="Enter"||e.key==="Tab",R=e.key==="Escape";if(n){e.preventDefault(),I(v=>(v-1+D.length)%D.length);return}if(o){e.preventDefault(),I(v=>(v+1)%D.length);return}if(p){e.preventDefault();const v=D[B];v&&P(v);return}if(R){e.preventDefault(),m(!1);return}}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),O())},J=a.useCallback(()=>{setTimeout(()=>m(!1),200)},[]);return t.jsxs("div",{className:"relative",onDragOver:G,onDragLeave:H,onDrop:q,children:[z&&t.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-brand-500/10 rounded-lg border-2 border-dashed border-brand-500",children:t.jsx("span",{className:"text-sm text-brand-500 font-medium",children:s("commentInput.dragDropHint")})}),c&&t.jsx(ae,{candidates:$,filter:j,anchorRef:F,onSelect:P,selectedIndex:B,onIndexChange:I}),t.jsxs("div",{className:"border border-border-default rounded-lg bg-surface-elevated",children:[f&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pt-2 pb-1 border-b border-border-default/50",children:[t.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[t.jsx("span",{className:"text-[10px] font-medium text-brand-500",children:f.authorName}),t.jsx("p",{className:"text-[10px] text-fg-tertiary truncate",children:f.content})]}),t.jsx("button",{onClick:y,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),C.length>0&&t.jsx("div",{className:"flex gap-1 px-2.5 pt-2 flex-wrap",children:C.map(e=>{const n=$.find(o=>o.id===e);return t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded-full ${n?.type==="human"?"bg-green-500/15 text-green-500":"bg-brand-500/15 text-brand-500"}`,children:["@",n?.name??e,t.jsx("button",{onClick:()=>S(o=>o.filter(p=>p!==e)),className:"hover:text-red-400",children:"×"})]},e)})}),t.jsx("textarea",{ref:F,value:r,onChange:e=>V(e.target.value),onKeyDown:Z,onBlur:J,onPaste:Y,placeholder:g??s("commentInput.placeholder"),rows:2,className:"w-full px-2.5 py-2 text-xs bg-transparent text-fg-primary placeholder-fg-tertiary outline-none resize-none"}),N.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 px-2.5 pb-1.5 overflow-x-auto",children:N.map(e=>t.jsxs("div",{className:"relative group/img shrink-0",children:[t.jsx("img",{src:e.dataUrl,alt:e.name,className:"w-12 h-12 rounded-lg object-cover border border-border-default"}),t.jsx("button",{onClick:()=>X(e.id),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-[10px] opacity-0 group-hover/img:opacity-100 transition-opacity",title:s("commentInput.removeImage"),children:"×"})]},e.id))}),d&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-1.5",children:[t.jsx("span",{className:"text-[11px] text-red-400 flex-1 truncate",children:d}),t.jsxs("button",{onClick:Q,disabled:b,className:"text-[11px] text-amber-500 hover:text-amber-400 font-medium transition-colors flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),s("commentInput.retry")]})]}),t.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:b||N.length>=W,className:"p-1 text-fg-tertiary hover:text-brand-500 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:s("commentInput.attachImage"),children:t.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),t.jsx("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&E(e.target.files),e.target.value=""}}),t.jsx("button",{onClick:O,disabled:!r.trim()&&N.length===0||b,className:"px-3 py-1 text-[11px] font-medium bg-brand-500 text-white rounded-md hover:bg-brand-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:s(b?"commentInput.sending":"commentInput.submit")})]})]}),t.jsx("p",{className:"mt-1 text-center text-[10px] text-fg-tertiary/80 select-none",children:s("aiDisclaimer")})]})}export{de as C,ie as p,ce as r};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DO8_O8Vw.js","assets/index-Bsf1pYmq.css"])))=>i.map(i=>d[i]);
2
- import{j as i,r as s,_ as f}from"./index-DO8_O8Vw.js";const b=s.lazy(()=>f(()=>import("./index-DO8_O8Vw.js").then(e=>e.am),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage})));function x(e){switch(e.split(".").pop()?.toLowerCase()){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":return"json";case"csv":case"tsv":return"csv";default:return}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function E(e){if(e.format)return e.format;if(e.reference){const t=x(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return"markdown"}function v({content:e,className:t,onSelection:r}){const c=s.useRef(null),[l,g]=s.useState(null);s.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&g(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dgg0L65t.js","assets/index-Bsf1pYmq.css"])))=>i.map(i=>d[i]);
2
+ import{j as i,r as s,_ as f}from"./index-Dgg0L65t.js";const b=s.lazy(()=>f(()=>import("./index-Dgg0L65t.js").then(e=>e.am),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownMessage})));function x(e){switch(e.split(".").pop()?.toLowerCase()){case"md":case"markdown":return"markdown";case"html":case"htm":return"html";case"json":return"json";case"csv":case"tsv":return"csv";default:return}}function w(e){const t=e.trimStart();if(/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t))return"html";if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(e),"json"}catch{}}function E(e){if(e.format)return e.format;if(e.reference){const t=x(e.reference);if(t)return t}if(e.content){const t=w(e.content);if(t)return t}return"markdown"}function v({content:e,className:t,onSelection:r}){const c=s.useRef(null),[l,g]=s.useState(null);s.useEffect(()=>{const o=d=>{d.data?.type==="__htmlpreview_height"&&typeof d.data.height=="number"&&g(d.data.height),d.data?.type==="__htmlpreview_selection"&&r&&r(d.data)};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r]);const h=`<script>
3
3
  (function(){
4
4
  function getXPath(el){
5
5
  if(!el||el.nodeType!==1)return'';
@@ -1,4 +1,4 @@
1
- import{u as Ke,j as e,r as s,e as ns,A as ot,w as it,f as T,g as rs,k as as,l as qe,a as ls,m as os,o as is,b as cs,p as ds,P as je,M as us,n as We,q as xs}from"./index-DO8_O8Vw.js";import{resolveFormat as fs,ContentRenderer as ms}from"./ContentRenderer-DtcL0FZI.js";import{s as ps,a as hs,g as Wt,f as gs,b as bs,d as ys,c as js,e as vs}from"./ChatHelpers-DDWzuvqW.js";function pe(d){return Array.isArray(d)?d.map(g=>String(g).trim()).filter(Boolean):typeof d=="string"&&d?d.split(",").map(g=>g.trim()).filter(Boolean):[]}function ws(d){return d.files&&typeof d.files=="object"&&!Array.isArray(d.files)?d.files:null}function Ae({label:d,value:g}){return g?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:g})]}):null}function Fe({label:d,value:g,color:p}){if(!g)return null;const r={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${r[p]??r.gray} capitalize inline-block`,children:g})]})}function jt({files:d}){const{t:g}=Ke(["builder","common"]),[p,r]=s.useState(Object.keys(d)[0]??""),j=Object.keys(d);return j.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:g("builder:artifact.files",{count:j.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:j.map(W=>e.jsx("button",{onClick:()=>r(W),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${p===W?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:W},W))}),p&&d[p]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:d[p]})]})]})}function ks({artifact:d,mode:g}){const{t:p}=Ke(["builder","common"]),r=ws(d),j=d.agent,W=d.team,H=d.dependencies,F=d.displayName??d.name;if(g==="agent"){const _=j?.roleName,P=j?.agentRole,M=j?.llmProvider,z=j?.llmModel,A=pe(H?.env),U=pe(H?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[_&&e.jsx(Fe,{label:p("builder:artifact.baseTemplate"),value:_,color:"indigo"}),e.jsx(Fe,{label:p("builder:artifact.agentRole"),value:P,color:P==="manager"?"purple":"cyan"})]}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(S=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:S},S))}),(M||z)&&e.jsxs("div",{className:"flex gap-2",children:[M&&e.jsx(Fe,{label:p("builder:artifact.llmProvider"),value:M,color:"gray"}),z&&e.jsx(Fe,{label:p("builder:artifact.llmModel"),value:z,color:"gray"})]}),A.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:A.map(S=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:S},S))})]}),U.length>0&&e.jsx(Ae,{label:p("builder:artifact.skills"),value:U.join(", ")}),r&&e.jsx(jt,{files:r})]})}if(g==="team"){const P=W?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(Fe,{label:p("builder:artifact.category"),value:d.category,color:"indigo"})}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(M=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:M},M))}),r&&e.jsx(jt,{files:r}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.members",{count:P.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:P.map((M,z)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${M.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:M.role==="manager"?"★":z+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:M.name}),typeof M.roleName=="string"&&M.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:M.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(M.count??1)]})]}),pe(M.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:pe(M.skills).map(A=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:A},A))})]},z))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(Fe,{label:p("builder:artifact.category"),value:d.category,color:"indigo"})}),r&&e.jsx(jt,{files:r}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(_=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:_},_))})]})}const Ft={agent:"🤖",project:"📁",requirement:"📋",task:"✅",deliverable:"📦",workflow:"⚙️"},Ns=["project","requirement","task","deliverable","workflow","agent"];function Ot(d){return d.dataUrl.startsWith("data:image/")}function Ss(d,g){if(Ot({dataUrl:g}))return null;const p=d.split(".").pop()?.toLowerCase()??"";return{pdf:"📄",docx:"📝",doc:"📝",xlsx:"📊",xls:"📊",pptx:"📎",csv:"📊",json:"🔧",xml:"🔧",html:"🌐",epub:"📚"}[p]??"📁"}function Cs({value:d,onChange:g,onSend:p,disabled:r=!1,placeholder:j="",sending:W=!1,onStop:H,contextChips:F,mentionItems:_,pendingFiles:P,onAttach:M,onPaste:z,onDrop:A,onDragOver:U,onRemoveFile:S,replyTo:X,onClearReply:Z,fileInputRef:ce,visionWarning:Le,maxFiles:Ie=5,className:he="",compact:J=!1,onMentionChipsChange:le}){const{t:de}=Ke(["team","common"]),V=s.useRef(null),ee=s.useRef(null);s.useRef(null);const[te,se]=s.useState(!1),[ue,oe]=s.useState(""),[q,K]=s.useState(0),[G,xe]=s.useState(null),[B,ge]=s.useState([]),n=(_??[]).filter(o=>o.name.toLowerCase().includes(ue)),re=(()=>{if(n.length===0)return[];const o=new Map;for(const N of n){const x=N.type??"agent";o.has(x)||o.set(x,[]),o.get(x).push(N)}const i=[];for(const N of Ns){const x=o.get(N);x?.length&&i.push({type:N,items:x})}return i})();s.useEffect(()=>{if(!te||!V.current){xe(null);return}const o=V.current.getBoundingClientRect();xe({left:o.left+16,bottom:window.innerHeight-o.top+4})},[te]);const ve=s.useCallback(()=>{const o=ee.current;o&&(o.style.height="auto",o.style.height=`${Math.min(o.scrollHeight,J?80:120)}px`)},[J]);s.useEffect(()=>{ve()},[d,ve]);const $e=s.useCallback(o=>{if(g(o),!_?.length){se(!1);return}const i=ee.current?.selectionStart??o.length,N=o.slice(0,i),x=N.lastIndexOf("@");if(x>=0){const L=x===0?"":N[x-1];if(x===0||/[\s\n,,。!?!?;;::、()()\[\]【】]/.test(L)){const I=N.slice(x+1);if(!I.includes(" ")&&!I.includes(`
1
+ import{u as Ke,j as e,r as s,e as ns,A as ot,w as it,f as T,g as rs,k as as,l as qe,a as ls,m as os,o as is,b as cs,p as ds,P as je,M as us,n as We,q as xs}from"./index-Dgg0L65t.js";import{resolveFormat as fs,ContentRenderer as ms}from"./ContentRenderer-DJQo68Rq.js";import{s as ps,a as hs,g as Wt,f as gs,b as bs,d as ys,c as js,e as vs}from"./ChatHelpers-DDWzuvqW.js";function pe(d){return Array.isArray(d)?d.map(g=>String(g).trim()).filter(Boolean):typeof d=="string"&&d?d.split(",").map(g=>g.trim()).filter(Boolean):[]}function ws(d){return d.files&&typeof d.files=="object"&&!Array.isArray(d.files)?d.files:null}function Ae({label:d,value:g}){return g?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:g})]}):null}function Fe({label:d,value:g,color:p}){if(!g)return null;const r={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${r[p]??r.gray} capitalize inline-block`,children:g})]})}function jt({files:d}){const{t:g}=Ke(["builder","common"]),[p,r]=s.useState(Object.keys(d)[0]??""),j=Object.keys(d);return j.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:g("builder:artifact.files",{count:j.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:j.map(W=>e.jsx("button",{onClick:()=>r(W),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${p===W?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:W},W))}),p&&d[p]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:d[p]})]})]})}function ks({artifact:d,mode:g}){const{t:p}=Ke(["builder","common"]),r=ws(d),j=d.agent,W=d.team,H=d.dependencies,F=d.displayName??d.name;if(g==="agent"){const _=j?.roleName,P=j?.agentRole,M=j?.llmProvider,z=j?.llmModel,A=pe(H?.env),U=pe(H?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[_&&e.jsx(Fe,{label:p("builder:artifact.baseTemplate"),value:_,color:"indigo"}),e.jsx(Fe,{label:p("builder:artifact.agentRole"),value:P,color:P==="manager"?"purple":"cyan"})]}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(S=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:S},S))}),(M||z)&&e.jsxs("div",{className:"flex gap-2",children:[M&&e.jsx(Fe,{label:p("builder:artifact.llmProvider"),value:M,color:"gray"}),z&&e.jsx(Fe,{label:p("builder:artifact.llmModel"),value:z,color:"gray"})]}),A.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:A.map(S=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:S},S))})]}),U.length>0&&e.jsx(Ae,{label:p("builder:artifact.skills"),value:U.join(", ")}),r&&e.jsx(jt,{files:r})]})}if(g==="team"){const P=W?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(Fe,{label:p("builder:artifact.category"),value:d.category,color:"indigo"})}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(M=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:M},M))}),r&&e.jsx(jt,{files:r}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.members",{count:P.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:P.map((M,z)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${M.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:M.role==="manager"?"★":z+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:M.name}),typeof M.roleName=="string"&&M.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:M.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(M.count??1)]})]}),pe(M.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:pe(M.skills).map(A=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:A},A))})]},z))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(Ae,{label:p("builder:artifact.name"),value:F}),e.jsx(Ae,{label:p("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(Fe,{label:p("builder:artifact.category"),value:d.category,color:"indigo"})}),r&&e.jsx(jt,{files:r}),pe(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:pe(d.tags).map(_=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:_},_))})]})}const Ft={agent:"🤖",project:"📁",requirement:"📋",task:"✅",deliverable:"📦",workflow:"⚙️"},Ns=["project","requirement","task","deliverable","workflow","agent"];function Ot(d){return d.dataUrl.startsWith("data:image/")}function Ss(d,g){if(Ot({dataUrl:g}))return null;const p=d.split(".").pop()?.toLowerCase()??"";return{pdf:"📄",docx:"📝",doc:"📝",xlsx:"📊",xls:"📊",pptx:"📎",csv:"📊",json:"🔧",xml:"🔧",html:"🌐",epub:"📚"}[p]??"📁"}function Cs({value:d,onChange:g,onSend:p,disabled:r=!1,placeholder:j="",sending:W=!1,onStop:H,contextChips:F,mentionItems:_,pendingFiles:P,onAttach:M,onPaste:z,onDrop:A,onDragOver:U,onRemoveFile:S,replyTo:X,onClearReply:Z,fileInputRef:ce,visionWarning:Le,maxFiles:Ie=5,className:he="",compact:J=!1,onMentionChipsChange:le}){const{t:de}=Ke(["team","common"]),V=s.useRef(null),ee=s.useRef(null);s.useRef(null);const[te,se]=s.useState(!1),[ue,oe]=s.useState(""),[q,K]=s.useState(0),[G,xe]=s.useState(null),[B,ge]=s.useState([]),n=(_??[]).filter(o=>o.name.toLowerCase().includes(ue)),re=(()=>{if(n.length===0)return[];const o=new Map;for(const N of n){const x=N.type??"agent";o.has(x)||o.set(x,[]),o.get(x).push(N)}const i=[];for(const N of Ns){const x=o.get(N);x?.length&&i.push({type:N,items:x})}return i})();s.useEffect(()=>{if(!te||!V.current){xe(null);return}const o=V.current.getBoundingClientRect();xe({left:o.left+16,bottom:window.innerHeight-o.top+4})},[te]);const ve=s.useCallback(()=>{const o=ee.current;o&&(o.style.height="auto",o.style.height=`${Math.min(o.scrollHeight,J?80:120)}px`)},[J]);s.useEffect(()=>{ve()},[d,ve]);const $e=s.useCallback(o=>{if(g(o),!_?.length){se(!1);return}const i=ee.current?.selectionStart??o.length,N=o.slice(0,i),x=N.lastIndexOf("@");if(x>=0){const L=x===0?"":N[x-1];if(x===0||/[\s\n,,。!?!?;;::、()()\[\]【】]/.test(L)){const I=N.slice(x+1);if(!I.includes(" ")&&!I.includes(`
2
2
  `)){se(!0),oe(I.toLowerCase()),K(0);return}}}se(!1)},[g,_]),we=s.useCallback(o=>{const i=ee.current?.selectionStart??d.length,x=d.slice(0,i).lastIndexOf("@"),L=d.slice(i),E=d.slice(0,x)+L.replace(/^\s/,"");g(E);const I={id:`mention_${Date.now()}_${o.id}`,entityId:o.id,name:o.name,entityType:o.type},Y=[...B,I];ge(Y),le?.(Y),se(!1),K(0),requestAnimationFrame(()=>{const O=x;ee.current?.setSelectionRange(O,O),ee.current?.focus()})},[d,g,B,le]),ke=s.useCallback(()=>{p(),ge([]),le?.([])},[p,le]),ie=s.useCallback(o=>{if(te&&n.length>0){const i=o.key==="ArrowUp"||o.ctrlKey&&o.key==="p",N=o.key==="ArrowDown"||o.ctrlKey&&o.key==="n",x=o.key==="Enter"||o.key==="Tab",L=o.key==="Escape";if(i){o.preventDefault(),K(E=>(E-1+n.length)%n.length);return}if(N){o.preventDefault(),K(E=>(E+1)%n.length);return}if(x){o.preventDefault();const E=n[q];E&&we(E);return}if(L){o.preventDefault(),se(!1);return}}o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),ke())},[te,n,q,we,ke]),be=P??[],Te=te&&n.length>0&&G&&ns.createPortal(e.jsx("div",{className:"fixed bg-surface-elevated border border-border-default rounded-lg shadow-xl overflow-hidden max-h-64 overflow-y-auto min-w-[220px]",style:{left:G.left,bottom:G.bottom,zIndex:9999},children:(()=>{let o=0;return re.map(i=>{const N=Ft[i.type],x=de(`page.mentionType.${i.type}`);return e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default bg-surface-secondary/50 flex items-center gap-1.5 sticky top-0",children:[e.jsx("span",{children:N}),e.jsx("span",{children:x})]}),i.items.map(L=>{const E=o++;return e.jsxs("button",{ref:I=>{E===q&&I&&I.scrollIntoView({block:"nearest"})},onMouseDown:I=>{I.preventDefault(),we(L)},onMouseEnter:()=>K(E),className:`w-full text-left px-4 py-2 text-sm flex items-center gap-2 transition-colors ${E===q?"bg-brand-500/15 text-brand-500":"text-fg-secondary hover:bg-surface-overlay"}`,children:[L.type==="agent"?e.jsx(ot,{name:L.name,avatarUrl:L.avatarUrl,size:20,bgClass:"bg-brand-500/20 text-brand-500"}):e.jsx("span",{className:"text-xs w-5 h-5 flex items-center justify-center shrink-0",children:N}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:L.name}),L.role&&e.jsx("span",{className:"text-[10px] text-fg-tertiary ml-auto shrink-0",children:L.role})]},L.id)})]},i.type)})})()}),document.body);return e.jsxs("div",{ref:V,className:`relative bg-surface-primary border border-border-default shadow-lg shadow-black/10 rounded-2xl p-3 ${he}`,onDrop:A,onDragOver:U,children:[Te,(F&&F.length>0||B.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[B.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-brand-500/10 border border-brand-500/30 text-xs text-brand-400 max-w-[200px]",children:[e.jsx("span",{className:"shrink-0 text-[10px]",children:Ft[o.entityType]}),e.jsx("span",{className:"truncate font-medium",children:o.name}),e.jsx("button",{onClick:()=>{const i=B.filter(N=>N.id!==o.id);ge(i),le?.(i)},className:"shrink-0 text-brand-400/60 hover:text-red-400 transition-colors",children:e.jsxs("svg",{width:"12",height:"12",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"})]})})]},o.id)),F?.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-surface-elevated border border-border-default text-xs text-fg-secondary max-w-[200px]",children:[e.jsx("span",{className:"truncate",children:o.label}),o.onRemove&&e.jsx("button",{onClick:o.onRemove,className:"shrink-0 text-fg-tertiary hover:text-red-500 transition-colors",children:e.jsxs("svg",{width:"12",height:"12",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"})]})})]},o.id))]}),be.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 overflow-x-auto pb-1",children:[be.map(o=>e.jsxs("div",{className:"relative group/img shrink-0",children:[Ot(o)?e.jsx("img",{src:o.dataUrl,alt:o.name,className:"w-16 h-16 rounded-lg object-cover border border-border-default"}):e.jsxs("div",{className:"w-16 h-16 rounded-lg border border-border-default bg-surface-elevated flex flex-col items-center justify-center gap-0.5",title:o.name,children:[e.jsx("span",{className:"text-xl leading-none",children:Ss(o.name,o.dataUrl)}),e.jsx("span",{className:"text-[9px] text-fg-tertiary truncate max-w-[56px] px-0.5",children:o.name.split(".").pop()?.toUpperCase()})]}),S&&e.jsx("button",{onClick:()=>S(o.id),className:"absolute -top-1.5 -right-1.5 w-5 h-5 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-xs opacity-0 group-hover/img:opacity-100 transition-opacity",children:"×"})]},o.id)),be.length<Ie&&M&&e.jsx("button",{onClick:M,className:"w-16 h-16 rounded-lg border border-dashed border-gray-600 flex items-center justify-center text-fg-tertiary hover:text-fg-secondary hover:border-gray-400 transition-colors shrink-0",title:de("page.addMoreFiles"),children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]}),Le&&e.jsxs("div",{className:"text-[10px] text-amber-500/80 mb-1.5 flex items-center gap-1",children:[e.jsx("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 9v4m0 4h.01M12 2L2 22h20L12 2z",strokeLinecap:"round",strokeLinejoin:"round"})}),de("page.visionWarning")]}),X&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-surface-elevated rounded-lg border border-border-default/50",children:[e.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[e.jsx("span",{className:"text-[11px] font-medium text-brand-500",children:X.sender}),e.jsx("p",{className:"text-[11px] text-fg-tertiary truncate",children:X.text})]}),Z&&e.jsx("button",{onClick:Z,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",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.jsxs("div",{className:"flex gap-2 items-end",children:[M&&e.jsx("button",{onClick:M,disabled:r,className:"px-2.5 py-2.5 text-fg-tertiary hover:text-fg-secondary disabled:opacity-40 transition-colors rounded-xl hover:bg-surface-elevated",title:de("page.attachFilesTitle"),children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("textarea",{ref:ee,value:d,onChange:o=>$e(o.target.value),onKeyDown:ie,onPaste:z,placeholder:j,disabled:r,rows:J?1:2,className:"flex-1 px-4 py-3 bg-transparent rounded-xl text-sm outline-none disabled:opacity-40 transition-colors resize-none overflow-hidden leading-relaxed placeholder:text-fg-secondary",style:{minHeight:J?"36px":"52px",maxHeight:J?"80px":"120px"}}),W&&H&&e.jsx("button",{onClick:H,className:"px-3 py-2.5 bg-red-600 hover:bg-red-500 text-white text-sm rounded-xl transition-colors flex items-center gap-1.5",title:de("page.stopAgent"),children:e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}),e.jsx("button",{onClick:ke,disabled:r||!d.trim()&&be.length===0&&B.length===0,className:"px-5 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:de("common:send")})]})]})}function Ls({agentId:d,sessionId:g,agents:p,authUser:r,onClose:j,contextChips:W,extraMentionItems:H,width:F,className:_=""}){const{t:P}=Ke(["team","common"]),M=p.find(i=>i.id===d),z=M?.name??P("page.fallbackAgent"),A=r?.name??P("page.fallbackYou"),[U,S]=s.useState([]),[X,Z]=s.useState(g??null),[ce,Le]=s.useState(!0),[Ie,he]=s.useState(!1),[J,le]=s.useState(""),[de,V]=s.useState([]),[ee,te]=s.useState([]),se=s.useRef(null),ue=s.useRef(null),oe=s.useRef(null),q=s.useRef(!0),K=s.useRef(X);K.current=X;const G=s.useMemo(()=>({today:P("page.dateToday"),yesterday:P("page.dateYesterday")}),[P]),xe=s.useMemo(()=>{const i=P("page.chatGreetings",{returnObjects:!0});return Array.isArray(i)&&i.length>0?i[Math.floor(Math.random()*i.length)]:""},[P]),B=s.useCallback((i="auto")=>{ue.current?.scrollIntoView({behavior:i})},[]);s.useEffect(()=>{let i=!1;return Le(!0),S([]),(async()=>{try{let x=g??null;if(!x){const{sessions:L}=await T.sessions.listByAgent(d,10);x=L.find(I=>I.isMain)?.id??L[0]?.id??null}if(i)return;if(Z(x),x){const L=await T.sessions.getMessages(x,50);if(i)return;const E=L.messages.map(ys).filter(I=>I.sender!=="agent"||I.text||I.segments&&I.segments.length>0);S(E)}}catch{}i||Le(!1)})(),()=>{i=!0}},[d,g]);const ge=s.useRef(!0);s.useEffect(()=>{ge.current&&!ce&&U.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>B())}),ge.current=ce},[ce,U.length,B]),s.useEffect(()=>{!ce&&q.current&&requestAnimationFrame(()=>B())},[U,B,ce]),s.useEffect(()=>it.on("chat:proactive_message",N=>{const x=N.payload,L=x.agentId??"";if(L!==d)return;const E=x.targetUserId;if(E&&E!==r?.id)return;const I=x.message??"",Y=x.sessionId??"",O=x.messageId??"";if(!I||I==="[cancelled]"||I==="[Stream cancelled]"||Y&&K.current&&Y!==K.current)return;const C=x.metadata??{},Q=C.role==="user",{cleaned:l,priority:w}=ps(I),c=!Q&&(!!C.notifyUser||l!==I),m=typeof C.userText=="string"?C.userText:"",f=typeof C.userMessageId=="string"?C.userMessageId:"",b={id:O||`proactive_${Date.now()}`,sender:Q?"user":"agent",text:l,time:new Date().toLocaleTimeString(),...Q?{}:{agentName:x.agentName??z,agentId:L,...c?{isNotification:!0,notifyPriority:C.priority??w}:{}}};S(v=>{if(v.some(y=>y.id===b.id))return v;let R=v;return!Q&&m&&(R.some(k=>f&&k.id===f||k.sender==="user"&&k.text===m)||(R=[...R,{id:f||`feishu_user_${b.id}`,sender:"user",text:m,time:new Date().toLocaleTimeString()}])),[...R,b]})}),[d,z,r?.id]);const[n,re]=s.useState(!1),ve=s.useCallback(()=>{const i=se.current;if(!i)return;const N=i.scrollHeight-i.scrollTop-i.clientHeight<60;q.current=N,re(!N)},[]),$e=s.useCallback(()=>{oe.current?.abort(),oe.current=null,he(!1),V([]),T.agents.cancelProcessing(d).catch(()=>{})},[d]),we=s.useCallback(async()=>{const i=[];if(ee.length>0&&i.push(ee.map(l=>`@[${l.name}](${l.entityType}:${l.entityId})`).join(" ")),W?.length)for(const l of W)i.push(`[${l.type}: ${l.label}]
3
3
  ${l.content}`);J.trim()&&i.push(J.trim());const N=i.join(`
4
4
 
@@ -1 +1 @@
1
- import{u as l,a,j as e,M as t,N as n}from"./index-DO8_O8Vw.js";function c({authUser:s}){const{t:i}=l("nav"),o=a();return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 h-14",children:[o&&e.jsx(t,{}),e.jsx("h2",{className:"text-base font-bold",children:i("notifications")})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(n,{collapsed:!1,userId:s?.id,embeddedMode:!0})})]})}export{c as NotificationsPage};
1
+ import{u as l,a,j as e,M as t,N as n}from"./index-Dgg0L65t.js";function c({authUser:s}){const{t:i}=l("nav"),o=a();return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 h-14",children:[o&&e.jsx(t,{}),e.jsx("h2",{className:"text-base font-bold",children:i("notifications")})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(n,{collapsed:!1,userId:s?.id,embeddedMode:!0})})]})}export{c as NotificationsPage};
@@ -1 +1 @@
1
- import{u as I,r as i,f as c,j as e,n as d,P as x,A as O}from"./index-DO8_O8Vw.js";function D(){const{t:l}=I(["common","home","work"]),[u,y]=i.useState(""),[r,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,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}b(!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()]),E=N.status==="fulfilled"?N.value.agents.filter(a=>a.name?.toLowerCase().includes(n)||a.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(a=>a.title?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],T=R.status==="fulfilled"?R.value.projects.filter(a=>a.name?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],z=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const a=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of a)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:E,tasks:M,requirements:H,projects:T,deliverables:z,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{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:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${r===s.id?"bg-brand-600 text-white":"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("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:l("common:loading")})}),!h&&w&&!k&&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:noResults",{defaultValue:"没有找到相关结果"})})]}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(r==="all"||r==="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:(r==="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(P,{status:s.status})]},s.id))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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(K,{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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),r==="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&&!w&&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 P({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 K({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";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{D as SearchPage};
1
+ import{u as I,r as i,f as c,j as e,n as d,P as x,A as O}from"./index-Dgg0L65t.js";function D(){const{t:l}=I(["common","home","work"]),[u,y]=i.useState(""),[r,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,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}b(!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()]),E=N.status==="fulfilled"?N.value.agents.filter(a=>a.name?.toLowerCase().includes(n)||a.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(a=>a.title?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],T=R.status==="fulfilled"?R.value.projects.filter(a=>a.name?.toLowerCase().includes(n)||a.description?.toLowerCase().includes(n)):[],z=L.status==="fulfilled"?L.value.results:[],S=[];if(A.status==="fulfilled"){const a=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of a)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:E,tasks:M,requirements:H,projects:T,deliverables:z,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{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:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${r===s.id?"bg-brand-600 text-white":"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("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:l("common:loading")})}),!h&&w&&!k&&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:noResults",{defaultValue:"没有找到相关结果"})})]}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(r==="all"||r==="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:(r==="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(P,{status:s.status})]},s.id))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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(K,{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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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))}),r==="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,")"]})]}),(r==="all"||r==="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:(r==="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.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),r==="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&&!w&&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 P({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 K({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";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{D as SearchPage};