@wandox/sdk 0.1.37 → 0.1.39

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 (109) hide show
  1. package/dist/{V1Workbench-UL6m_GSU.cjs → V1Workbench-BL9TCe-h.cjs} +3 -3
  2. package/dist/{V1Workbench-CqWNz8eg.js → V1Workbench-GjmMHW_z.js} +5 -6
  3. package/dist/V2Workbench-C0Ak3rdn.cjs +2 -0
  4. package/dist/V2Workbench-C4uOgIer.js +2694 -0
  5. package/dist/{WorkbenchRuntime-kI4h_Boi.js → WorkbenchRuntime-ButbDrvB.js} +4 -4
  6. package/dist/{WorkbenchRuntime-BPjLWyHy.cjs → WorkbenchRuntime-jXXGAqkE.cjs} +2 -2
  7. package/dist/{arc-B5N4v9Jv.cjs → arc-BK_aujia.cjs} +1 -1
  8. package/dist/{arc-BRgfV2vT.js → arc-CE1S54RP.js} +1 -1
  9. package/dist/{architectureDiagram-3BPJPVTR-DjM6oFEx.cjs → architectureDiagram-3BPJPVTR-CCe2Qwas.cjs} +1 -1
  10. package/dist/{architectureDiagram-3BPJPVTR-DUgD63Rt.js → architectureDiagram-3BPJPVTR-mquQ4A04.js} +3 -3
  11. package/dist/{blockDiagram-GPEHLZMM-6EI7pONG.js → blockDiagram-GPEHLZMM-DnZ4oEXt.js} +3 -3
  12. package/dist/{blockDiagram-GPEHLZMM-Bbk0DebD.cjs → blockDiagram-GPEHLZMM-Dr9swVG2.cjs} +1 -1
  13. package/dist/{c4Diagram-AAUBKEIU-CPATCWpo.js → c4Diagram-AAUBKEIU-DTz0ipr3.js} +2 -2
  14. package/dist/{c4Diagram-AAUBKEIU-UW4tUuYO.cjs → c4Diagram-AAUBKEIU-DtaJYesx.cjs} +1 -1
  15. package/dist/{channel-BOuHczM9.js → channel-BeVy-ZIF.js} +1 -1
  16. package/dist/{channel-BPVKsQR4.cjs → channel-CDc0Yn2X.cjs} +1 -1
  17. package/dist/{chunk-2J33WTMH-JkZNZ2FQ.cjs → chunk-2J33WTMH-2Z5D00s4.cjs} +1 -1
  18. package/dist/{chunk-2J33WTMH-BMA-WoY7.js → chunk-2J33WTMH-lCahilst.js} +1 -1
  19. package/dist/{chunk-4BX2VUAB-CoubCo12.js → chunk-4BX2VUAB-BfG82Y4D.js} +1 -1
  20. package/dist/{chunk-4BX2VUAB-DJjQ2iym.cjs → chunk-4BX2VUAB-C9W5QDsy.cjs} +1 -1
  21. package/dist/{chunk-55IACEB6-B8_bbLHJ.js → chunk-55IACEB6-DDuaa7-s.js} +1 -1
  22. package/dist/{chunk-55IACEB6-k8m2Tb0O.cjs → chunk-55IACEB6-F1nM7WdQ.cjs} +1 -1
  23. package/dist/{chunk-727SXJPM-Dk4Qx6Cj.cjs → chunk-727SXJPM-D9vGz_R5.cjs} +1 -1
  24. package/dist/{chunk-727SXJPM-w5uqNLUJ.js → chunk-727SXJPM-DCpsumhn.js} +5 -5
  25. package/dist/{chunk-AQP2D5EJ-BC_iX9X6.js → chunk-AQP2D5EJ-BiJG2fDP.js} +3 -3
  26. package/dist/{chunk-AQP2D5EJ-rJ3mY-t4.cjs → chunk-AQP2D5EJ-DBFNgb2V.cjs} +1 -1
  27. package/dist/{chunk-FMBD7UC4-C_CgBQVs.cjs → chunk-FMBD7UC4-BhyGm-GT.cjs} +1 -1
  28. package/dist/{chunk-FMBD7UC4-DZlFTSR3.js → chunk-FMBD7UC4-cWskSZrE.js} +1 -1
  29. package/dist/{chunk-ND2GUHAM-SOVIggp_.js → chunk-ND2GUHAM-DGIC-ZW-.js} +1 -1
  30. package/dist/{chunk-ND2GUHAM-rYKw1ewI.cjs → chunk-ND2GUHAM-DRY6nzyy.cjs} +1 -1
  31. package/dist/{chunk-QZHKN3VN-D_n03X4c.cjs → chunk-QZHKN3VN-C7JxoAX-.cjs} +1 -1
  32. package/dist/{chunk-QZHKN3VN-BzYA6_MS.js → chunk-QZHKN3VN-HwaVssHs.js} +1 -1
  33. package/dist/{classDiagram-4FO5ZUOK-Cus7V0-B.cjs → classDiagram-4FO5ZUOK-CygibmXb.cjs} +1 -1
  34. package/dist/{classDiagram-4FO5ZUOK-yY-LWEE5.js → classDiagram-4FO5ZUOK-mzJYvOZu.js} +2 -2
  35. package/dist/{classDiagram-v2-Q7XG4LA2-D_2oVIAG.js → classDiagram-v2-Q7XG4LA2-B1YHuxBu.js} +2 -2
  36. package/dist/{classDiagram-v2-Q7XG4LA2-Cus7V0-B.cjs → classDiagram-v2-Q7XG4LA2-CygibmXb.cjs} +1 -1
  37. package/dist/{cose-bilkent-S5V4N54A-DtK_d2nt.js → cose-bilkent-S5V4N54A-D8IZat0h.js} +2 -2
  38. package/dist/{cose-bilkent-S5V4N54A-C8A50UJc.cjs → cose-bilkent-S5V4N54A-Rhluulxd.cjs} +1 -1
  39. package/dist/{dagre-BM42HDAG-CctSzO0L.cjs → dagre-BM42HDAG-Bvc4ohUU.cjs} +1 -1
  40. package/dist/{dagre-BM42HDAG-B9o52kSq.js → dagre-BM42HDAG-C9fviEf-.js} +1 -1
  41. package/dist/{diagram-2AECGRRQ-DeefcALf.cjs → diagram-2AECGRRQ-CkQq6ZGh.cjs} +1 -1
  42. package/dist/{diagram-2AECGRRQ-DEOJdLIi.js → diagram-2AECGRRQ-paI55ZVp.js} +2 -2
  43. package/dist/{diagram-5GNKFQAL-DyxjjnMI.js → diagram-5GNKFQAL-CDMHctmr.js} +3 -3
  44. package/dist/{diagram-5GNKFQAL-C9cD2jn6.cjs → diagram-5GNKFQAL-DWCFHwPd.cjs} +1 -1
  45. package/dist/{diagram-KO2AKTUF-4juRrpvB.js → diagram-KO2AKTUF-BWWzWP62.js} +2 -2
  46. package/dist/{diagram-KO2AKTUF-Mo7XhFrv.cjs → diagram-KO2AKTUF-spfSwB_X.cjs} +1 -1
  47. package/dist/{diagram-LMA3HP47-CxL8EBEI.js → diagram-LMA3HP47-BT-BShmi.js} +2 -2
  48. package/dist/{diagram-LMA3HP47-BFs_xRRv.cjs → diagram-LMA3HP47-RAfpkFKr.cjs} +1 -1
  49. package/dist/{diagram-OG6HWLK6-BX-585Ye.js → diagram-OG6HWLK6-CIN-4ftA.js} +3 -3
  50. package/dist/{diagram-OG6HWLK6-CB1fsChK.cjs → diagram-OG6HWLK6-CqDudF-0.cjs} +1 -1
  51. package/dist/{erDiagram-TEJ5UH35-DC0Ho0nI.js → erDiagram-TEJ5UH35-D0fhsTuc.js} +4 -4
  52. package/dist/{erDiagram-TEJ5UH35-vPdDZRYq.cjs → erDiagram-TEJ5UH35-TOCz7Y2q.cjs} +1 -1
  53. package/dist/{flowDiagram-I6XJVG4X-7BW5uO8c.js → flowDiagram-I6XJVG4X-4f3A04iK.js} +6 -6
  54. package/dist/{flowDiagram-I6XJVG4X-BiRLUlz2.cjs → flowDiagram-I6XJVG4X-BInalcH7.cjs} +1 -1
  55. package/dist/{ganttDiagram-6RSMTGT7-Bhohg83R.js → ganttDiagram-6RSMTGT7-C8ScPSHu.js} +3 -3
  56. package/dist/{ganttDiagram-6RSMTGT7-BMrijLIp.cjs → ganttDiagram-6RSMTGT7-DEF_FmRR.cjs} +1 -1
  57. package/dist/{gitGraphDiagram-PVQCEYII-CwSJFsFx.js → gitGraphDiagram-PVQCEYII-CnKH0PHp.js} +3 -3
  58. package/dist/{gitGraphDiagram-PVQCEYII-Bq_8mOSi.cjs → gitGraphDiagram-PVQCEYII-DBwXskFh.cjs} +1 -1
  59. package/dist/index-DGyUqlaQ.cjs +1 -0
  60. package/dist/{index-dISfYziG.cjs → index-DeLd859U.cjs} +24 -24
  61. package/dist/{index-Dhd78ysx.js → index-NXlUEMwG.js} +1464 -1440
  62. package/dist/index-pGTHB93u.js +2820 -0
  63. package/dist/{infoDiagram-5YYISTIA-BNytnCXI.js → infoDiagram-5YYISTIA-D79y7lhu.js} +1 -1
  64. package/dist/{infoDiagram-5YYISTIA-B-PYR74F.cjs → infoDiagram-5YYISTIA-DOOxpQu0.cjs} +1 -1
  65. package/dist/{ishikawaDiagram-YF4QCWOH-4OKBUv_s.cjs → ishikawaDiagram-YF4QCWOH-3amMX1JK.cjs} +1 -1
  66. package/dist/{ishikawaDiagram-YF4QCWOH-BG80wXBr.js → ishikawaDiagram-YF4QCWOH-D7ka4Dej.js} +1 -1
  67. package/dist/{journeyDiagram-JHISSGLW-yt60VGMo.cjs → journeyDiagram-JHISSGLW-BARqx_B3.cjs} +1 -1
  68. package/dist/{journeyDiagram-JHISSGLW-g82mk2Fe.js → journeyDiagram-JHISSGLW-EBn4X8-a.js} +4 -4
  69. package/dist/{kanban-definition-UN3LZRKU-BmK56MSs.js → kanban-definition-UN3LZRKU-CBAKDyvM.js} +2 -2
  70. package/dist/{kanban-definition-UN3LZRKU-BFH_hAyY.cjs → kanban-definition-UN3LZRKU-D8iz27bT.cjs} +1 -1
  71. package/dist/{linear-BpsU0HcQ.js → linear-B2QSw8ao.js} +1 -1
  72. package/dist/{linear-zILWiTVq.cjs → linear-Fv7CLeZq.cjs} +1 -1
  73. package/dist/{mermaid.core-NivSZeQG.js → mermaid.core-ChK_QlLI.js} +35 -35
  74. package/dist/{mermaid.core-BvN-J_AM.cjs → mermaid.core-HBdKo8dE.cjs} +3 -3
  75. package/dist/{mindmap-definition-RKZ34NQL-BXoEIZmG.js → mindmap-definition-RKZ34NQL-C3uHES2i.js} +3 -3
  76. package/dist/{mindmap-definition-RKZ34NQL-C3LWrNPx.cjs → mindmap-definition-RKZ34NQL-PqVfSh0o.cjs} +1 -1
  77. package/dist/{pieDiagram-4H26LBE5-y5XnB67r.js → pieDiagram-4H26LBE5-aJvbTpKH.js} +3 -3
  78. package/dist/{pieDiagram-4H26LBE5-CN01uXEU.cjs → pieDiagram-4H26LBE5-slbguXAu.cjs} +1 -1
  79. package/dist/{quadrantDiagram-W4KKPZXB-DoHOsDDM.js → quadrantDiagram-W4KKPZXB-B1BYMfPp.js} +2 -2
  80. package/dist/{quadrantDiagram-W4KKPZXB-BdWRtxg8.cjs → quadrantDiagram-W4KKPZXB-Cqvftrp-.cjs} +1 -1
  81. package/dist/{requirementDiagram-4Y6WPE33-B6ltwG99.cjs → requirementDiagram-4Y6WPE33-CgVm8oUv.cjs} +1 -1
  82. package/dist/{requirementDiagram-4Y6WPE33-BUqcv09v.js → requirementDiagram-4Y6WPE33-Cn7GQxPf.js} +3 -3
  83. package/dist/{sankeyDiagram-5OEKKPKP-Dw_I3L5w.cjs → sankeyDiagram-5OEKKPKP-D7Lkmywe.cjs} +1 -1
  84. package/dist/{sankeyDiagram-5OEKKPKP-D3yaTkog.js → sankeyDiagram-5OEKKPKP-aWGj-ZP4.js} +1 -1
  85. package/dist/{sequenceDiagram-3UESZ5HK-Dlw7AYVR.js → sequenceDiagram-3UESZ5HK-CLsU-4UM.js} +3 -3
  86. package/dist/{sequenceDiagram-3UESZ5HK-Dw-Oo3gQ.cjs → sequenceDiagram-3UESZ5HK-PwX7e0rY.cjs} +1 -1
  87. package/dist/{stateDiagram-AJRCARHV-G5aGpm4h.js → stateDiagram-AJRCARHV-CqgrATuU.js} +2 -2
  88. package/dist/{stateDiagram-AJRCARHV-RlkILcfR.cjs → stateDiagram-AJRCARHV-vGqcl-KV.cjs} +1 -1
  89. package/dist/{stateDiagram-v2-BHNVJYJU-B5MqneJj.cjs → stateDiagram-v2-BHNVJYJU-HtcVKaju.cjs} +1 -1
  90. package/dist/{stateDiagram-v2-BHNVJYJU-U7btkN-c.js → stateDiagram-v2-BHNVJYJU-i2ltnCUr.js} +2 -2
  91. package/dist/{timeline-definition-PNZ67QCA-DZWO25QG.cjs → timeline-definition-PNZ67QCA-BK6Um61-.cjs} +1 -1
  92. package/dist/{timeline-definition-PNZ67QCA-I1bAZF32.js → timeline-definition-PNZ67QCA-CcAR4rsb.js} +2 -2
  93. package/dist/{vennDiagram-CIIHVFJN-OMVDPAYS.cjs → vennDiagram-CIIHVFJN-Cm13ds7X.cjs} +1 -1
  94. package/dist/{vennDiagram-CIIHVFJN-GqC6bKPW.js → vennDiagram-CIIHVFJN-Cp8snzHu.js} +1 -1
  95. package/dist/wandox.cjs +1 -1
  96. package/dist/wandox.css +1 -1
  97. package/dist/wandox.js +1 -1
  98. package/dist/wandox.umd.js +637 -637
  99. package/dist/{wardleyDiagram-YWT4CUSO-B_ri0S8_.js → wardleyDiagram-YWT4CUSO-CSbrbJrc.js} +2 -2
  100. package/dist/{wardleyDiagram-YWT4CUSO-BS6EQ76K.cjs → wardleyDiagram-YWT4CUSO-D9nb2LzZ.cjs} +1 -1
  101. package/dist/{xychartDiagram-2RQKCTM6-BIi1O5Px.cjs → xychartDiagram-2RQKCTM6-6BlgLg2e.cjs} +1 -1
  102. package/dist/{xychartDiagram-2RQKCTM6-VaspgPkc.js → xychartDiagram-2RQKCTM6-DpAMV2MM.js} +2 -2
  103. package/package.json +1 -1
  104. package/dist/V2Workbench-a7fIKHSI.js +0 -2352
  105. package/dist/V2Workbench-tUL0KmKo.cjs +0 -2
  106. package/dist/index-Bl0cgfIz.cjs +0 -1
  107. package/dist/index-BygO8jcH.cjs +0 -1
  108. package/dist/index-CQYJcpLn.js +0 -2520
  109. package/dist/index-RmIugmM4.js +0 -307
@@ -0,0 +1,2694 @@
1
+ import { dt as a, af as js, d0 as e, a_ as ta, ai as ks, a$ as ms, aR as ca, bL as la, b0 as Za, d_ as ia, K as Qs, aa as Xa, a9 as hs, d6 as Ys, Q as en, P as sn, a6 as an, a4 as nn, T as on, da as ra, dG as N, ci as tn, S as cn, J as xs, c_ as ln, cO as rn, dO as dn, cd as un, cH as mn, cG as hn, as as xn, ap as pn, o as _n, m as bn, v as fn, b1 as da, b2 as wn, bC as ps, aO as yn, b3 as _s, n as gn, ar as jn, A as kn, aq as vn, bz as Nn, bB as Cn, i as Xe, aA as Sn, y as Rn, cI as In, cJ as $n, aE as Js, b4 as En, aZ as An, b5 as Zs, b6 as Pn, b7 as Tn, b8 as Mn, b9 as Ln, ek as Dn } from "./index-NXlUEMwG.js";
2
+ import { n as Fn, A as On, l as es, m as bs, p as Vn, h as ua, R as fs, c as ma, a as ha, d as xa, e as Xs, Q as Bn, i as zn, f as qn, u as Wn, j as Hn, o as ea, b as Un, S as Kn } from "./WorkbenchRuntime-ButbDrvB.js";
3
+ import { Drawer as Gn, Divider as Qn } from "./index-pGTHB93u.js";
4
+ var Yn = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z" } }] }, name: "appstore", theme: "filled" };
5
+ function ws() {
6
+ return ws = Object.assign ? Object.assign.bind() : function(o) {
7
+ for (var i = 1; i < arguments.length; i++) {
8
+ var h = arguments[i];
9
+ for (var m in h)
10
+ Object.prototype.hasOwnProperty.call(h, m) && (o[m] = h[m]);
11
+ }
12
+ return o;
13
+ }, ws.apply(this, arguments);
14
+ }
15
+ const Jn = (o, i) => /* @__PURE__ */ a.createElement(js, ws({}, o, {
16
+ ref: i,
17
+ icon: Yn
18
+ })), Zn = /* @__PURE__ */ a.forwardRef(Jn);
19
+ var Xn = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M320 224h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-60 508h-80V292h80v440zm644-436h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-60 364h-80V364h80v296zM612 404h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8zm-60 145a3 3 0 01-3 3h-74a3 3 0 01-3-3v-74a3 3 0 013-3h74a3 3 0 013 3v74z" } }] }, name: "sliders", theme: "outlined" };
20
+ function ys() {
21
+ return ys = Object.assign ? Object.assign.bind() : function(o) {
22
+ for (var i = 1; i < arguments.length; i++) {
23
+ var h = arguments[i];
24
+ for (var m in h)
25
+ Object.prototype.hasOwnProperty.call(h, m) && (o[m] = h[m]);
26
+ }
27
+ return o;
28
+ }, ys.apply(this, arguments);
29
+ }
30
+ const eo = (o, i) => /* @__PURE__ */ a.createElement(js, ys({}, o, {
31
+ ref: i,
32
+ icon: Xn
33
+ })), pa = /* @__PURE__ */ a.forwardRef(eo);
34
+ var so = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, name: "unordered-list", theme: "outlined" };
35
+ function gs() {
36
+ return gs = Object.assign ? Object.assign.bind() : function(o) {
37
+ for (var i = 1; i < arguments.length; i++) {
38
+ var h = arguments[i];
39
+ for (var m in h)
40
+ Object.prototype.hasOwnProperty.call(h, m) && (o[m] = h[m]);
41
+ }
42
+ return o;
43
+ }, gs.apply(this, arguments);
44
+ }
45
+ const ao = (o, i) => /* @__PURE__ */ a.createElement(js, gs({}, o, {
46
+ ref: i,
47
+ icon: so
48
+ })), no = /* @__PURE__ */ a.forwardRef(ao);
49
+ function _a(o) {
50
+ return {
51
+ category: null,
52
+ description: o.desc,
53
+ domain: "",
54
+ id: 0,
55
+ name: o.title,
56
+ playbook_id: o.playbook_id,
57
+ scope: "",
58
+ status: "",
59
+ sub_category: null,
60
+ tags: null,
61
+ type: "",
62
+ version: "",
63
+ video_url: o.video_url,
64
+ video_duration: o.video_duration,
65
+ view_count: o.view_count
66
+ };
67
+ }
68
+ function ba(o) {
69
+ if (!o || o <= 0) return "0:00";
70
+ const i = Math.floor(o / 60), h = String(Math.floor(o % 60)).padStart(2, "0");
71
+ return `${i}:${h}`;
72
+ }
73
+ const ds = "__all__", sa = "__my__", us = "__library_all__", oo = "__library__:", to = [
74
+ { key: "all", label: "全部场景" },
75
+ { key: "my", label: "我的场景" },
76
+ { key: "map", label: "使用地图" }
77
+ ];
78
+ function co(o) {
79
+ return o === "map" ? "搜索当前地图下的场景" : o === "my" ? "搜索我的场景" : "搜索全部场景";
80
+ }
81
+ function lo({
82
+ open: o,
83
+ source: i,
84
+ categories: h,
85
+ categoryKey: m,
86
+ search: p,
87
+ cards: j,
88
+ executing: A,
89
+ loadingPlaybookId: _,
90
+ onClose: S,
91
+ onSourceChange: D,
92
+ onCategoryChange: ne,
93
+ onSearchChange: Y,
94
+ onSelectScene: le
95
+ }) {
96
+ const [R, H] = a.useState(null), P = a.useMemo(
97
+ () => R ? _a(R) : null,
98
+ [R]
99
+ ), C = a.useCallback((u, F) => {
100
+ u.stopPropagation(), H(F);
101
+ }, []);
102
+ return /* @__PURE__ */ e.jsxs(
103
+ Gn,
104
+ {
105
+ open: o,
106
+ onClose: S,
107
+ placement: "bottom",
108
+ height: "min(82vh, 780px)",
109
+ destroyOnClose: !1,
110
+ styles: {
111
+ body: { padding: 0, background: "var(--wc-bg)" },
112
+ header: { display: "none" }
113
+ },
114
+ getContainer: !1,
115
+ title: null,
116
+ closeIcon: null,
117
+ push: !1,
118
+ children: [
119
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer", children: [
120
+ /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-chat__drawer-top", children: [
121
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-title", children: /* @__PURE__ */ e.jsx(
122
+ "nav",
123
+ {
124
+ className: "wandox-console-chat__drawer-tabs",
125
+ "aria-label": "场景来源",
126
+ children: to.map((u) => /* @__PURE__ */ e.jsx(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ className: i === u.key ? "is-active" : "",
131
+ onClick: () => D(u.key),
132
+ children: u.label
133
+ },
134
+ u.key
135
+ ))
136
+ }
137
+ ) }),
138
+ /* @__PURE__ */ e.jsx(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ className: "wandox-console-chat__drawer-close",
143
+ onClick: S,
144
+ "aria-label": "关闭",
145
+ children: /* @__PURE__ */ e.jsx(ta, {})
146
+ }
147
+ )
148
+ ] }),
149
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer-middle", children: [
150
+ i !== "my" && /* @__PURE__ */ e.jsxs("aside", { className: "wandox-console-chat__drawer-cats", children: [
151
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-catslabel", children: "场景分类" }),
152
+ h.map((u) => {
153
+ const F = u.key === m;
154
+ return /* @__PURE__ */ e.jsxs(
155
+ "button",
156
+ {
157
+ type: "button",
158
+ className: `wandox-console-chat__drawer-cat${F ? " wandox-console-chat__drawer-cat--active" : ""}`,
159
+ onClick: () => ne(u.key),
160
+ children: [
161
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__drawer-cat-name", children: u.name }),
162
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__drawer-cat-count", children: u.count })
163
+ ]
164
+ },
165
+ u.key
166
+ );
167
+ })
168
+ ] }),
169
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer-body", children: [
170
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-toolbar", children: /* @__PURE__ */ e.jsx(
171
+ ks,
172
+ {
173
+ allowClear: !0,
174
+ prefix: /* @__PURE__ */ e.jsx(ms, {}),
175
+ placeholder: co(i),
176
+ value: p,
177
+ onChange: (u) => Y(u.target.value)
178
+ }
179
+ ) }),
180
+ j.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-empty", children: p ? "没有匹配的场景" : "暂无可用场景" }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes", children: j.map((u) => {
181
+ const F = _ === u.playbook_id;
182
+ return /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene-wrap", children: [
183
+ /* @__PURE__ */ e.jsx(
184
+ "button",
185
+ {
186
+ type: "button",
187
+ className: "wandox-console-scene",
188
+ disabled: A || !!_,
189
+ "aria-busy": F,
190
+ onClick: () => void le(u),
191
+ children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__body", children: [
192
+ /* @__PURE__ */ e.jsx("strong", { title: u.title, children: u.title }),
193
+ u.desc && /* @__PURE__ */ e.jsx(
194
+ "span",
195
+ {
196
+ className: "wandox-console-scene__desc",
197
+ title: u.desc,
198
+ children: u.desc
199
+ }
200
+ ),
201
+ F && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-scene__loading", children: "正在读取场景..." })
202
+ ] })
203
+ }
204
+ ),
205
+ u.video_url && /* @__PURE__ */ e.jsxs(
206
+ "button",
207
+ {
208
+ type: "button",
209
+ className: "wandox-console-scene__video",
210
+ "aria-label": `播放${u.title}演示视频`,
211
+ onClick: (ie) => C(ie, u),
212
+ children: [
213
+ "▶ ",
214
+ ba(u.video_duration),
215
+ " 演示"
216
+ ]
217
+ }
218
+ )
219
+ ] }, u.key);
220
+ }) })
221
+ ] })
222
+ ] })
223
+ ] }),
224
+ /* @__PURE__ */ e.jsx(
225
+ ca,
226
+ {
227
+ playbook: P,
228
+ onClose: () => H(null)
229
+ }
230
+ )
231
+ ]
232
+ }
233
+ );
234
+ }
235
+ const io = (o) => {
236
+ const { onError: i } = o;
237
+ i == null || i(new Error("该场景暂不支持文件上传"));
238
+ };
239
+ function fa({
240
+ field: o,
241
+ value: i,
242
+ uploading: h,
243
+ fileNameMap: m,
244
+ getOptionState: p,
245
+ onChange: j,
246
+ onUpload: A
247
+ }) {
248
+ const _ = Fn(o.type), S = A ?? ((D, ne) => io);
249
+ return /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-field", children: [
250
+ /* @__PURE__ */ e.jsxs("label", { htmlFor: `wc-param-${o.name}`, children: [
251
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__label-text", children: o.label || o.name }),
252
+ o.description || o.hint ? /* @__PURE__ */ e.jsx(la, { title: o.description || o.hint, children: /* @__PURE__ */ e.jsx(
253
+ Za,
254
+ {
255
+ "aria-label": `${o.label || o.name}说明`
256
+ }
257
+ ) }) : null,
258
+ o.required && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__required", children: "必填" }),
259
+ _ && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__required", children: "多值" })
260
+ ] }),
261
+ /* @__PURE__ */ e.jsx(
262
+ On,
263
+ {
264
+ field: o,
265
+ value: i,
266
+ uploading: h,
267
+ fileNameMap: m,
268
+ getOptionState: p,
269
+ onChange: j,
270
+ onUpload: S,
271
+ onDownloadTemplate: (D) => window.open(D.path, "_blank", "noopener,noreferrer")
272
+ }
273
+ )
274
+ ] });
275
+ }
276
+ function ro(o) {
277
+ if (Array.isArray(o)) return o;
278
+ const i = o;
279
+ return Array.isArray(i == null ? void 0 : i.user_playbooks) ? i.user_playbooks : [];
280
+ }
281
+ function uo({
282
+ agentId: o,
283
+ agentName: i,
284
+ playbookId: h,
285
+ playbookParams: m,
286
+ initialMessage: p,
287
+ initialAttachments: j,
288
+ useMapCards: A = [],
289
+ useMapCategories: _ = [],
290
+ playbooks: S = [],
291
+ userPlaybooks: D = [],
292
+ agents: ne = [],
293
+ onChangeAgent: Y,
294
+ onBack: le,
295
+ onSelectScene: R,
296
+ onReady: H
297
+ }) {
298
+ const P = localStorage.getItem("sso_token") || "", C = localStorage.getItem("sso_domain") || "maiduo", u = localStorage.getItem("sso_company") || "", F = a.useRef(null), ie = a.useRef(!1), [O, $] = a.useState(!1), [U, oe] = a.useState(""), [te, K] = a.useState(""), [V, G] = a.useState("map"), [J, re] = a.useState(ds), [I, B] = a.useState(null), ge = a.useRef(null), xe = a.useRef(null), [de, we] = a.useState(!1), [pe, Re] = a.useState([]), [Z, je] = a.useState("");
299
+ a.useEffect(() => {
300
+ if (!I || O) return;
301
+ const s = setTimeout(() => {
302
+ var n;
303
+ (n = ge.current) == null || n.focus();
304
+ }, 120);
305
+ return () => clearTimeout(s);
306
+ }, [I, O]), a.useEffect(() => {
307
+ if (!I || O) return;
308
+ const s = (n) => {
309
+ const c = xe.current, l = n.target;
310
+ !c || !(l instanceof Node) || c.contains(l) || l instanceof Element && l.closest(
311
+ ".ant-select-dropdown, .ant-picker-dropdown, .ant-tooltip, .ant-dropdown, .ant-popover, .ant-modal-wrap, .ant-drawer-content-wrapper, .ant-message, .ant-notification"
312
+ ) || (B(null), ce([]), q({}));
313
+ };
314
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
315
+ }, [I, O]);
316
+ const [X, ce] = a.useState([]), [T, q] = a.useState({}), E = ia(
317
+ X,
318
+ T,
319
+ q
320
+ ), ke = a.useMemo(
321
+ () => es(X, T).filter(
322
+ (s) => s.required && bs(T[s.name])
323
+ ),
324
+ [X, T]
325
+ ), [se, x] = a.useState("chat"), [k, ye] = a.useState([]), [z, ve] = a.useState(null), [ue, Ae] = a.useState("results"), [ss, Ie] = a.useState(!1), [ee, t] = a.useState([]), [f, y] = a.useState(!1), [b, v] = a.useState([]), [me, Ne] = a.useState([]), [W, Q] = a.useState({}), [$e, Ce] = a.useState(!1), [M, Pe] = a.useState(null), [Ve, Ee] = a.useState(void 0), [Be, ze] = a.useState(!1), [wa, vs] = a.useState(!1);
326
+ a.useEffect(() => {
327
+ H == null || H({
328
+ showInspectionResults: (s) => {
329
+ x("robot"), Ae("results"), ve(s || null);
330
+ }
331
+ });
332
+ }, [H]);
333
+ const [Te, ya] = a.useState([]), [Me, Se] = a.useState(!1), [qe, ga] = a.useState(void 0), [Ns, Cs] = a.useState([]), [as, Ss] = a.useState(""), [ns, ja] = a.useState(
334
+ "map"
335
+ ), [ka, Le] = a.useState(void 0), We = a.useRef(0), De = a.useRef(0), [He, Rs] = a.useState(
336
+ Qs
337
+ ), [os, Is] = a.useState({}), [Ue, $s] = a.useState(
338
+ () => /* @__PURE__ */ new Set()
339
+ ), ts = a.useCallback(
340
+ (s, n, c) => ({
341
+ key: `${n}-${s.playbook_id}`,
342
+ title: s.name || "未命名场景",
343
+ desc: s.description || "",
344
+ reason: c,
345
+ tags: [],
346
+ playbook_id: s.playbook_id,
347
+ input_fields: s.input_fields || [],
348
+ categoryKey: n,
349
+ video_url: s.video_url,
350
+ video_duration: s.video_duration,
351
+ view_count: s.view_count
352
+ }),
353
+ []
354
+ ), Fe = a.useMemo(() => {
355
+ const s = D.map(
356
+ (d) => ts(d, sa, "我的场景")
357
+ ), n = /* @__PURE__ */ new Map();
358
+ for (const d of S) {
359
+ const g = d.category_name || d.category || d.type || "默认场景", w = `${oo}${g}`, fe = n.get(w) || [];
360
+ fe.push(ts(d, w, g)), n.set(w, fe);
361
+ }
362
+ const c = Array.from(n.values()).flat(), l = [
363
+ {
364
+ key: us,
365
+ name: "全部场景",
366
+ count: c.length,
367
+ cards: c
368
+ },
369
+ ...Array.from(n, ([d, g]) => {
370
+ var w;
371
+ return {
372
+ key: d,
373
+ name: ((w = g[0]) == null ? void 0 : w.reason) || "默认场景",
374
+ count: g.length,
375
+ cards: g
376
+ };
377
+ })
378
+ ], r = [
379
+ {
380
+ key: ds,
381
+ name: "全部场景",
382
+ count: A.length,
383
+ cards: A
384
+ },
385
+ ..._.map((d) => ({
386
+ key: d.key,
387
+ name: d.name,
388
+ count: d.count,
389
+ cards: A.filter((g) => g.categoryKey === d.key)
390
+ }))
391
+ ];
392
+ return { allCategories: l, mapCategories: r, myCards: s };
393
+ }, [
394
+ i,
395
+ S,
396
+ ts,
397
+ A,
398
+ _,
399
+ D
400
+ ]), cs = a.useMemo(() => V === "all" ? Fe.allCategories : V === "map" ? Fe.mapCategories : [], [Fe, V]), Ke = a.useMemo(
401
+ () => A.map(
402
+ (s) => ({
403
+ category: null,
404
+ category_name: s.reason,
405
+ description: s.desc,
406
+ domain: "",
407
+ id: 0,
408
+ name: s.title,
409
+ playbook_id: s.playbook_id,
410
+ scope: "usemap",
411
+ status: "available",
412
+ sub_category: null,
413
+ tags: s.tags.map((n) => n.name),
414
+ input_fields: s.input_fields,
415
+ video_url: s.video_url,
416
+ video_duration: s.video_duration,
417
+ view_count: s.view_count,
418
+ type: "",
419
+ version: ""
420
+ })
421
+ ),
422
+ [A]
423
+ ), va = a.useMemo(() => {
424
+ const s = /* @__PURE__ */ new Map();
425
+ for (const n of [
426
+ ...S,
427
+ ...D,
428
+ ...Ke
429
+ ])
430
+ n.playbook_id && s.set(n.playbook_id, n);
431
+ return Array.from(s.values());
432
+ }, [S, D, Ke]), Na = a.useMemo(() => {
433
+ const s = /* @__PURE__ */ new Map();
434
+ for (const n of S) {
435
+ const c = n.category_name || n.category || n.type || "默认场景", l = s.get(c) || [];
436
+ l.push(n), s.set(c, l);
437
+ }
438
+ return [
439
+ { key: "__my__", label: "我的场景", playbooks: [] },
440
+ ...Array.from(s, ([n, c]) => ({
441
+ key: `all:${n}`,
442
+ label: n,
443
+ playbooks: c
444
+ }))
445
+ ];
446
+ }, [S]), Ca = a.useMemo(() => {
447
+ const s = new Map(
448
+ Ke.map((n) => [
449
+ n.playbook_id,
450
+ n
451
+ ])
452
+ );
453
+ return _.map((n) => ({
454
+ key: `map:${n.key}`,
455
+ label: n.name,
456
+ playbooks: A.filter((c) => c.categoryKey === n.key).map((c) => s.get(c.playbook_id)).filter((c) => !!c)
457
+ }));
458
+ }, [A, _, Ke]), Sa = ns === "map" ? Ca : Na, Ra = a.useMemo(() => {
459
+ var c;
460
+ const s = te.trim().toLowerCase(), n = V === "my" ? Fe.myCards : ((c = cs.find((l) => l.key === J)) == null ? void 0 : c.cards) || [];
461
+ return s ? n.filter(
462
+ (l) => l.title.toLowerCase().includes(s) || l.desc.toLowerCase().includes(s)
463
+ ) : n;
464
+ }, [
465
+ cs,
466
+ J,
467
+ Fe.myCards,
468
+ V,
469
+ te
470
+ ]), Ia = a.useCallback((s) => {
471
+ const n = Array.isArray(s) ? s : [];
472
+ ya(n), Se(n.length > 0);
473
+ }, []), he = a.useMemo(
474
+ () => ne.find((s) => s.id === o),
475
+ [ne, o]
476
+ ), { messageData: $a, executing: L, stopping: Ea, actions: Aa } = Vn({
477
+ activeAgent: o,
478
+ ssoToken: P,
479
+ ssoDomain: C,
480
+ ssoCompany: u,
481
+ onRecommendationsUpdate: Ia
482
+ }), {
483
+ sendMessage: Ge,
484
+ executePlaybook: Es,
485
+ respondToProposal: As,
486
+ stopCurrent: Pa,
487
+ retrigger: Ps
488
+ } = Aa, {
489
+ messages: _e,
490
+ messagesTotal: Ts,
491
+ loading: Ms,
492
+ loadMessages: Ls,
493
+ loadMoreMessages: Ds
494
+ } = $a, Qe = a.useMemo(() => {
495
+ for (let s = _e.length - 1; s >= 0; s--)
496
+ if (_e[s].role === "assistant") return _e[s].id;
497
+ }, [_e]), Ye = a.useCallback(async () => {
498
+ if (!o || !P) {
499
+ Cs([]);
500
+ return;
501
+ }
502
+ try {
503
+ const s = await Xa({
504
+ agent_id: o,
505
+ limit: 8
506
+ });
507
+ Cs(Array.isArray(s.data) ? s.data : []);
508
+ } catch {
509
+ }
510
+ }, [o, P]);
511
+ a.useEffect(() => {
512
+ Ye();
513
+ }, [Ye]);
514
+ const ae = a.useCallback(
515
+ async (s) => {
516
+ await Es(s), Ye();
517
+ },
518
+ [Es, Ye]
519
+ ), Fs = a.useCallback(async (s) => {
520
+ const n = String(s.playbook_id || "").trim();
521
+ if (!n) throw new Error("场景缺少 playbook_id");
522
+ const { data: c } = await hs({
523
+ playbook_id: n
524
+ });
525
+ return Ys(s, c);
526
+ }, []);
527
+ a.useEffect(() => {
528
+ ie.current || (ie.current = !0, (async () => {
529
+ if (await Ls(), h) {
530
+ const s = (p == null ? void 0 : p.trim()) || "执行场景";
531
+ ae({
532
+ message: s,
533
+ playbook_id: h,
534
+ playbook_params: m || {}
535
+ });
536
+ } else p != null && p.trim() && Ge(p.trim(), void 0, j);
537
+ })());
538
+ }, [
539
+ h,
540
+ p,
541
+ j,
542
+ m,
543
+ ae,
544
+ Ls,
545
+ Ge
546
+ ]), a.useEffect(() => {
547
+ if (!o) return;
548
+ let s = !1;
549
+ return (async () => {
550
+ try {
551
+ const { data: n } = await en({ agent_id: o });
552
+ if (s) return;
553
+ const c = (n == null ? void 0 : n.children) || [];
554
+ ye(c), ve(null);
555
+ } catch {
556
+ ye([]);
557
+ }
558
+ })(), () => {
559
+ s = !0;
560
+ };
561
+ }, [o]), a.useEffect(() => {
562
+ Qe && Qe !== qe && ga(Qe);
563
+ }, [Qe, qe]), a.useEffect(() => {
564
+ if (se !== "robot" || ue !== "history" || !z) {
565
+ t([]);
566
+ return;
567
+ }
568
+ const s = k.find((c) => c.name === z);
569
+ if (!s) return;
570
+ let n = !1;
571
+ return Ie(!0), (async () => {
572
+ try {
573
+ const c = await sn({
574
+ agent_id: s.agent_id,
575
+ limit: 50
576
+ });
577
+ if (n) return;
578
+ const r = (Array.isArray(c == null ? void 0 : c.data) ? c.data : []).map(
579
+ (d, g) => ({
580
+ id: d.id || d.execute_id || `record_${g}`,
581
+ action_name: d.action_name || d.display_name || "未知动作",
582
+ status: d.status || "pending",
583
+ created_at: d.created_at || "",
584
+ completed_at: d.completed_at,
585
+ output_data: d.output_data,
586
+ error: d.error
587
+ })
588
+ );
589
+ t(r);
590
+ } catch {
591
+ t([]);
592
+ } finally {
593
+ n || Ie(!1);
594
+ }
595
+ })(), () => {
596
+ n = !0;
597
+ };
598
+ }, [se, ue, z, k]);
599
+ const Os = a.useCallback(async () => {
600
+ try {
601
+ const s = await an({});
602
+ Array.isArray(s == null ? void 0 : s.data) && Ne(
603
+ s.data.map((n) => ({
604
+ webhook_id: n.webhook_id || "",
605
+ name: n.name || "未命名渠道",
606
+ platform: n.platform || ""
607
+ }))
608
+ );
609
+ } catch {
610
+ }
611
+ }, []), Je = a.useCallback(async () => {
612
+ try {
613
+ const s = {};
614
+ await Promise.all(
615
+ k.map(async (n) => {
616
+ var c;
617
+ try {
618
+ const l = await nn(
619
+ n.agent_id,
620
+ {}
621
+ ), r = (c = l == null ? void 0 : l.data) == null ? void 0 : c.webhook_id;
622
+ r && (s[n.agent_id] = r);
623
+ } catch {
624
+ }
625
+ })
626
+ ), Q(s);
627
+ } catch {
628
+ }
629
+ }, [k]), Vs = a.useCallback(async () => {
630
+ if (o) {
631
+ y(!0);
632
+ try {
633
+ const s = await on({
634
+ agent_id: o,
635
+ limit: 20,
636
+ use_cache: !1
637
+ }), c = (Array.isArray(s == null ? void 0 : s.data) ? s.data : []).map((l) => {
638
+ const r = l.ui_payload || l.outputs || void 0;
639
+ return {
640
+ id: l.inbox_id || l.id || "",
641
+ title: l.title || "巡检结果",
642
+ summary: l.summary || "",
643
+ priority: l.priority || "medium",
644
+ timestamp: l.created_at || "",
645
+ ui_payload: r,
646
+ agent_name: l.agent_name || l.agent_id || ""
647
+ };
648
+ }).sort(
649
+ (l, r) => new Date(r.timestamp || 0).getTime() - new Date(l.timestamp || 0).getTime()
650
+ );
651
+ v(c);
652
+ } catch {
653
+ v([]);
654
+ } finally {
655
+ y(!1);
656
+ }
657
+ }
658
+ }, [o]);
659
+ a.useEffect(() => {
660
+ Os(), k.length > 0 && Je();
661
+ }, [k, Os, Je]), a.useEffect(() => {
662
+ se === "robot" && ue === "results" && Vs();
663
+ }, [se, ue, Vs]);
664
+ const Ta = (s) => {
665
+ Pe(s), Ee(W[s.agent_id]), Ce(!0);
666
+ }, Ma = async () => {
667
+ if (!M || !Ve) {
668
+ N.warning("请选择通知渠道");
669
+ return;
670
+ }
671
+ try {
672
+ ze(!0), await Sn(
673
+ {},
674
+ {
675
+ agent_id: M.agent_id,
676
+ webhook_id: Ve
677
+ }
678
+ ), N.success("绑定成功"), Ce(!1), await Je();
679
+ } catch (s) {
680
+ N.error((s == null ? void 0 : s.message) || "绑定失败");
681
+ } finally {
682
+ ze(!1);
683
+ }
684
+ }, La = async () => {
685
+ if (M)
686
+ try {
687
+ ze(!0), await Rn(
688
+ M.agent_id,
689
+ {}
690
+ ), N.success("解绑成功"), Ce(!1), Ee(void 0), await Je();
691
+ } catch (s) {
692
+ N.error((s == null ? void 0 : s.message) || "解绑失败");
693
+ } finally {
694
+ ze(!1);
695
+ }
696
+ }, ls = a.useMemo(() => z ? b.filter((s) => {
697
+ var l;
698
+ const n = (l = s.title) == null ? void 0 : l.match(/^(.+?)\s*巡检结果$/);
699
+ return (n ? n[1] : s.agent_name) === z;
700
+ }) : b, [b, z]), Da = (s) => {
701
+ if (!s) return "";
702
+ try {
703
+ return new Date(s).toLocaleString("zh-CN", {
704
+ month: "2-digit",
705
+ day: "2-digit",
706
+ hour: "2-digit",
707
+ minute: "2-digit"
708
+ });
709
+ } catch {
710
+ return s;
711
+ }
712
+ }, is = a.useCallback(
713
+ (s, n, c) => {
714
+ if (Se(!1), n) {
715
+ ae({
716
+ message: s,
717
+ playbook_id: n
718
+ });
719
+ return;
720
+ }
721
+ Ge(s, void 0, c);
722
+ },
723
+ [ae, Ge]
724
+ ), Fa = a.useCallback((s) => {
725
+ G(s), re(
726
+ s === "all" ? us : s === "map" ? ds : sa
727
+ ), K(""), B(null), ce([]), q({});
728
+ }, []), Oa = a.useCallback(() => {
729
+ G("all"), re(us), K(""), B(null), ce([]), q({}), $(!0);
730
+ }, []), Va = a.useCallback(() => {
731
+ $(!1), B(null), ce([]), q({});
732
+ }, []), be = a.useCallback(
733
+ (s, n = {}) => {
734
+ B({
735
+ key: s.playbook_id,
736
+ playbook_id: s.playbook_id,
737
+ title: s.name,
738
+ desc: s.description ?? "",
739
+ reason: "",
740
+ tags: [],
741
+ categoryKey: "",
742
+ input_fields: s.input_fields || []
743
+ });
744
+ const c = ra(s.input_fields || []);
745
+ ce(c), q(ua(c, n));
746
+ },
747
+ []
748
+ ), Ba = a.useCallback(
749
+ async (s) => {
750
+ var c;
751
+ if (L || U) return;
752
+ const n = String(s.playbook_id || "").trim();
753
+ if (!n) {
754
+ N.error("场景缺少 playbook_id");
755
+ return;
756
+ }
757
+ oe(n);
758
+ try {
759
+ const l = {
760
+ category: null,
761
+ category_name: s.reason || void 0,
762
+ description: s.desc,
763
+ domain: "",
764
+ id: 0,
765
+ name: s.title,
766
+ playbook_id: n,
767
+ scope: "",
768
+ status: "available",
769
+ sub_category: null,
770
+ tags: s.tags.map((g) => g.name),
771
+ type: "",
772
+ version: "",
773
+ input_fields: s.input_fields,
774
+ video_url: s.video_url,
775
+ video_duration: s.video_duration,
776
+ view_count: s.view_count
777
+ }, { data: r } = await hs({
778
+ playbook_id: n
779
+ });
780
+ if (!r || typeof r != "object" || Array.isArray(r))
781
+ throw new Error("场景详情为空");
782
+ const d = Ys(l, r);
783
+ if ($(!1), (c = d.input_fields) != null && c.length) {
784
+ be(d);
785
+ return;
786
+ }
787
+ is(d.name, d.playbook_id), R == null || R(s);
788
+ } catch (l) {
789
+ const r = l instanceof Error ? l.message : "场景加载失败";
790
+ N.error(r);
791
+ } finally {
792
+ oe("");
793
+ }
794
+ },
795
+ [
796
+ L,
797
+ be,
798
+ is,
799
+ R,
800
+ U
801
+ ]
802
+ ), Bs = a.useCallback(
803
+ async (s) => {
804
+ if (!L) {
805
+ if (Se(!1), s.input_fields && s.input_fields.length > 0) {
806
+ be(s);
807
+ return;
808
+ }
809
+ try {
810
+ await ae({
811
+ message: s.name,
812
+ playbook_id: s.playbook_id
813
+ });
814
+ } catch (n) {
815
+ const c = n instanceof Error ? n.message : "执行失败";
816
+ N.error(c);
817
+ }
818
+ }
819
+ },
820
+ [L, ae, be]
821
+ ), za = a.useCallback(
822
+ async (s) => {
823
+ var c;
824
+ if (L || as) return;
825
+ const n = String(s.playbook_id || "").trim();
826
+ if (n) {
827
+ Ss(n), Se(!1);
828
+ try {
829
+ const l = tn(s), r = await Fs(s);
830
+ if ((c = r.input_fields) != null && c.length) {
831
+ be(r, l);
832
+ return;
833
+ }
834
+ await ae({
835
+ message: r.name,
836
+ playbook_id: r.playbook_id
837
+ });
838
+ } catch (l) {
839
+ const r = l instanceof Error ? l.message : "场景参数加载失败";
840
+ N.error(r);
841
+ } finally {
842
+ Ss("");
843
+ }
844
+ }
845
+ },
846
+ [
847
+ L,
848
+ ae,
849
+ be,
850
+ Fs,
851
+ as
852
+ ]
853
+ ), qa = a.useCallback(async () => {
854
+ if (!I || L) return;
855
+ const n = es(X, T).filter(
856
+ (r) => r.required && bs(T[r.name])
857
+ );
858
+ if (n.length > 0) {
859
+ N.warning(`请先填写 ${n.length} 项必填参数`);
860
+ return;
861
+ }
862
+ $(!1), Se(!1);
863
+ const c = I, l = T;
864
+ B(null), ce([]), q({});
865
+ try {
866
+ const r = c.title || (p == null ? void 0 : p.trim()) || "执行场景";
867
+ await ae({
868
+ message: r,
869
+ playbook_id: c.playbook_id,
870
+ playbook_params: l
871
+ }), R == null || R(c);
872
+ } catch (r) {
873
+ const d = r instanceof Error ? r.message : "执行失败";
874
+ N.error(d);
875
+ }
876
+ }, [
877
+ I,
878
+ X,
879
+ T,
880
+ L,
881
+ ae,
882
+ p,
883
+ R
884
+ ]), Wa = a.useCallback((s) => {
885
+ De.current += 1, Le({
886
+ requestId: ++We.current,
887
+ playbooks: s
888
+ });
889
+ }, []), Ha = a.useCallback(() => {
890
+ const s = ++De.current;
891
+ Le({
892
+ requestId: ++We.current,
893
+ playbooks: [],
894
+ loading: !0
895
+ }), (async () => {
896
+ await new Promise((n) => {
897
+ window.requestAnimationFrame(() => n());
898
+ });
899
+ try {
900
+ const { data: n } = await cn({
901
+ agent_id: o
902
+ });
903
+ if (s !== De.current) return;
904
+ Le({
905
+ requestId: ++We.current,
906
+ playbooks: ro(n)
907
+ });
908
+ } catch {
909
+ if (s !== De.current) return;
910
+ N.error("我的场景加载失败"), Le({
911
+ requestId: ++We.current,
912
+ playbooks: []
913
+ });
914
+ }
915
+ })();
916
+ }, [o]), Ua = a.useCallback((s) => {
917
+ Le(
918
+ (n) => (n == null ? void 0 : n.requestId) === s ? void 0 : n
919
+ );
920
+ }, []), Ka = /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__scene-quick", children: [
921
+ /* @__PURE__ */ e.jsx(
922
+ xs,
923
+ {
924
+ menu: {
925
+ selectedKeys: [ns],
926
+ items: [
927
+ { key: "all", label: "全部场景" },
928
+ { key: "map", label: "使用地图" }
929
+ ],
930
+ onClick: ({ key: s }) => {
931
+ De.current += 1, ja(s);
932
+ }
933
+ },
934
+ trigger: ["click"],
935
+ placement: "topLeft",
936
+ children: /* @__PURE__ */ e.jsxs(
937
+ "button",
938
+ {
939
+ type: "button",
940
+ className: "wandox-console-chat__scene-source",
941
+ disabled: L,
942
+ children: [
943
+ /* @__PURE__ */ e.jsx("span", { children: ns === "map" ? "使用地图" : "全部场景" }),
944
+ /* @__PURE__ */ e.jsx(
945
+ "svg",
946
+ {
947
+ className: "wandox-console-chat__scene-source-arrow",
948
+ width: "12",
949
+ height: "12",
950
+ viewBox: "0 0 24 24",
951
+ fill: "currentColor",
952
+ "aria-hidden": "true",
953
+ focusable: "false",
954
+ children: /* @__PURE__ */ e.jsx("path", { d: "M8.413 0.963a2 2 0 0 1 2.738.712l4.872 8.301a4 4 0 0 1 0 4.049l-4.872 8.3a2 2 0 1 1-3.45-2.025L12.574 12 7.701 3.7A2 2 0 0 1 8.413.963Z" })
955
+ }
956
+ )
957
+ ]
958
+ }
959
+ )
960
+ }
961
+ ),
962
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__scene-separator", "aria-hidden": !0, children: "|" }),
963
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__scene-categories", children: Sa.map((s) => /* @__PURE__ */ e.jsx(
964
+ "button",
965
+ {
966
+ type: "button",
967
+ className: "wandox-console-chat__choose-scene",
968
+ disabled: L,
969
+ onClick: () => s.key === "__my__" ? Ha() : Wa(s.playbooks),
970
+ children: s.label
971
+ },
972
+ s.key
973
+ )) })
974
+ ] }), zs = a.useCallback(async (s) => {
975
+ var d;
976
+ const n = (d = s.meta_content) != null && d.playbook_id ? "数据报表" : "对话内容", c = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
977
+ if (ln(s)) {
978
+ const g = rn(s);
979
+ if (!g) {
980
+ N.warning("没有可导出的表格数据");
981
+ return;
982
+ }
983
+ const w = g.fields.map((rs) => rs.label).join(","), fe = g.rows.map(
984
+ (rs) => g.fields.map((Ja) => dn(rs[Ja.name])).join(",")
985
+ ), Ya = `\uFEFF${[w, ...fe].join(`
986
+ `)}`;
987
+ un(
988
+ new Blob([Ya], { type: "text/csv;charset=utf-8;" }),
989
+ `${n}_${c}.csv`
990
+ );
991
+ return;
992
+ }
993
+ const l = document.querySelector(
994
+ `[data-message-id="${s.message_id || s.id}"] .wandox-message-content`
995
+ );
996
+ if (!l) {
997
+ N.warning("无法定位消息内容");
998
+ return;
999
+ }
1000
+ const r = window.open("", "_blank");
1001
+ if (!r) {
1002
+ N.warning("请允许弹出窗口");
1003
+ return;
1004
+ }
1005
+ r.document.write(
1006
+ `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${n}_${c}</title><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;padding:20px;color:#333}table{border-collapse:collapse;width:100%}th,td{border:1px solid #d9d9d9;padding:6px 8px;font-size:13px;text-align:left}th{background:#fafafa}img{max-width:100%}pre{white-space:pre-wrap;word-break:break-all;font-size:12px;background:#f5f5f5;padding:12px;border-radius:4px}button,.ant-btn,.ant-tooltip-open{display:none!important}</style></head><body>${l.innerHTML}</body></html>`
1007
+ ), r.document.close(), r.onload = () => {
1008
+ r.print(), r.close();
1009
+ };
1010
+ }, []), qs = a.useCallback(
1011
+ (s) => {
1012
+ var r, d, g;
1013
+ const n = _e.find(
1014
+ (w) => w.message_id === s || w.id === s
1015
+ ), c = mn(n);
1016
+ if (!c) {
1017
+ N.warning("缺少场景 ID,无法配置定时触发");
1018
+ return;
1019
+ }
1020
+ const l = ((d = (r = n == null ? void 0 : n.actions) == null ? void 0 : r.find((w) => w.playbook_id === c)) == null ? void 0 : d.display_name) || ((g = n == null ? void 0 : n.meta_content) == null ? void 0 : g.playbook_name) || c;
1021
+ Rs({
1022
+ visible: !0,
1023
+ messageId: s,
1024
+ agentId: o,
1025
+ playbookId: c,
1026
+ playbookName: l
1027
+ });
1028
+ },
1029
+ [o, _e]
1030
+ ), Ga = a.useCallback(() => {
1031
+ Rs(Qs);
1032
+ }, []), Ze = a.useCallback(
1033
+ (s) => {
1034
+ const n = s.message_id;
1035
+ return n && Object.prototype.hasOwnProperty.call(os, n) ? os[n] : hn(s);
1036
+ },
1037
+ [os]
1038
+ ), Ws = a.useCallback(
1039
+ async (s, n, c) => {
1040
+ var g;
1041
+ const l = s.message_id;
1042
+ if (!l || Ue.has(l)) return !1;
1043
+ const r = Ze(s), d = In(
1044
+ r,
1045
+ n
1046
+ );
1047
+ Is((w) => ({
1048
+ ...w,
1049
+ [l]: d
1050
+ })), $s((w) => new Set(w).add(l));
1051
+ try {
1052
+ const w = await xn(
1053
+ { domain: C },
1054
+ {
1055
+ message_id: l,
1056
+ rating: d,
1057
+ tags: (g = c == null ? void 0 : c.tags) != null && g.length ? c.tags : void 0,
1058
+ text: (c == null ? void 0 : c.text) || void 0
1059
+ }
1060
+ );
1061
+ if ((w == null ? void 0 : w.success) === !1)
1062
+ throw new Error(w.message || "反馈提交失败");
1063
+ return !0;
1064
+ } catch (w) {
1065
+ return Is((fe) => ({
1066
+ ...fe,
1067
+ [l]: r
1068
+ })), N.error(
1069
+ w instanceof Error ? w.message : "反馈提交失败,请稍后重试"
1070
+ ), !1;
1071
+ } finally {
1072
+ $s((w) => {
1073
+ const fe = new Set(w);
1074
+ return fe.delete(l), fe;
1075
+ });
1076
+ }
1077
+ },
1078
+ [Ue, Ze, C]
1079
+ ), Hs = a.useCallback(
1080
+ async (s) => {
1081
+ Se(!1);
1082
+ try {
1083
+ await Ps(s);
1084
+ } catch (n) {
1085
+ const c = n instanceof Error ? n.message : "重新生成失败";
1086
+ N.error(c);
1087
+ }
1088
+ },
1089
+ [Ps]
1090
+ ), Us = a.useCallback(() => {
1091
+ Se((s) => !s);
1092
+ }, []), Ks = a.useCallback(
1093
+ (s, n) => {
1094
+ if (s.role !== "assistant" || s.execution_status === "executing") return null;
1095
+ const l = n && s.id === qe && Te.length > 0, r = Me ? "隐藏推荐" : l ? `显示推荐(${Te.length})` : "推荐";
1096
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1097
+ /* @__PURE__ */ e.jsx(
1098
+ pn,
1099
+ {
1100
+ msg: s,
1101
+ domain: C,
1102
+ onExportMessage: zs,
1103
+ exportIcon: "copy",
1104
+ showSolidify: !1,
1105
+ onOpenScheduleDialog: qs,
1106
+ onRetrigger: Hs,
1107
+ feedbackRating: Ze(s),
1108
+ feedbackPending: !!s.message_id && Ue.has(s.message_id),
1109
+ onFeedback: Ws,
1110
+ extraActions: l ? /* @__PURE__ */ e.jsx(la, { title: r, children: /* @__PURE__ */ e.jsxs(
1111
+ "button",
1112
+ {
1113
+ type: "button",
1114
+ className: `wandox-console-chat__toolbar-toggle${Me ? " is-active" : ""}`,
1115
+ "aria-label": r,
1116
+ "aria-expanded": Me,
1117
+ onClick: Us,
1118
+ children: [
1119
+ /* @__PURE__ */ e.jsx(no, {}),
1120
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__toolbar-toggle-count", children: Te.length })
1121
+ ]
1122
+ }
1123
+ ) }) : null
1124
+ }
1125
+ ),
1126
+ l && Me && /* @__PURE__ */ e.jsx(
1127
+ "ul",
1128
+ {
1129
+ className: "wandox-console-chat__recommendations",
1130
+ "aria-label": "推荐场景",
1131
+ children: Te.map((d, g) => /* @__PURE__ */ e.jsx(
1132
+ "li",
1133
+ {
1134
+ className: "wandox-console-chat__recommendations-item",
1135
+ children: /* @__PURE__ */ e.jsxs(
1136
+ "button",
1137
+ {
1138
+ type: "button",
1139
+ className: "wandox-console-chat__recommendations-pill",
1140
+ disabled: L,
1141
+ onClick: () => {
1142
+ Bs(d);
1143
+ },
1144
+ title: d.description || d.name,
1145
+ children: [
1146
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__recommendations-pill-label", children: d.name }),
1147
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__recommendations-pill-arrow", children: /* @__PURE__ */ e.jsx(fs, {}) })
1148
+ ]
1149
+ }
1150
+ )
1151
+ },
1152
+ `${d.playbook_id || d.name}-${g}`
1153
+ ))
1154
+ }
1155
+ )
1156
+ ] });
1157
+ },
1158
+ [
1159
+ L,
1160
+ Ue,
1161
+ Ze,
1162
+ Bs,
1163
+ zs,
1164
+ Ws,
1165
+ qs,
1166
+ Hs,
1167
+ Te,
1168
+ qe,
1169
+ Me,
1170
+ C,
1171
+ Us
1172
+ ]
1173
+ ), Gs = a.useCallback(
1174
+ (s, n) => {
1175
+ je(s), Re(n), we(!0);
1176
+ },
1177
+ []
1178
+ ), Qa = a.useMemo(
1179
+ () => /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__body", children: [
1180
+ /* @__PURE__ */ e.jsx(
1181
+ _n,
1182
+ {
1183
+ messages: _e,
1184
+ executing: L,
1185
+ ssoToken: P,
1186
+ ssoDomain: C,
1187
+ ssoCompany: u,
1188
+ onExecutePlaybook: ae,
1189
+ onFillPlaybookParams: (s) => be(
1190
+ {
1191
+ category: null,
1192
+ domain: "",
1193
+ id: 0,
1194
+ name: s.playbookName,
1195
+ playbook_id: s.playbookId,
1196
+ scope: "",
1197
+ status: "available",
1198
+ sub_category: null,
1199
+ tags: null,
1200
+ type: "",
1201
+ version: "",
1202
+ input_fields: s.inputFields,
1203
+ playbook_type: s.playbookType
1204
+ },
1205
+ s.initialParams ?? {}
1206
+ ),
1207
+ onRespondToProposal: As,
1208
+ containerRef: F,
1209
+ messagesTotal: Ts,
1210
+ loadMoreMessages: Ds,
1211
+ loading: Ms,
1212
+ initialLoadingContent: /* @__PURE__ */ e.jsx(bn, {}),
1213
+ conversationKey: o,
1214
+ messageToolbar: Ks,
1215
+ onOpenActionDrawer: Gs
1216
+ }
1217
+ ),
1218
+ /* @__PURE__ */ e.jsx(
1219
+ fn,
1220
+ {
1221
+ messages: _e,
1222
+ scrollContainerRef: F,
1223
+ mode: "deepseek"
1224
+ }
1225
+ )
1226
+ ] }),
1227
+ [
1228
+ o,
1229
+ ae,
1230
+ L,
1231
+ be,
1232
+ Ds,
1233
+ _e,
1234
+ Ms,
1235
+ Ts,
1236
+ Gs,
1237
+ Ks,
1238
+ As,
1239
+ u,
1240
+ C,
1241
+ P
1242
+ ]
1243
+ );
1244
+ return (
1245
+ // wandox-root:Assistant 组件的 CSS 变量(--wandox-*)作用域
1246
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-root wandox-console-chat", children: [
1247
+ /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-chat__top", children: [
1248
+ /* @__PURE__ */ e.jsxs(
1249
+ "button",
1250
+ {
1251
+ type: "button",
1252
+ className: "wandox-console-chat__back",
1253
+ onClick: le,
1254
+ children: [
1255
+ /* @__PURE__ */ e.jsx(ma, {}),
1256
+ /* @__PURE__ */ e.jsx("span", { children: "返回" })
1257
+ ]
1258
+ }
1259
+ ),
1260
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__agent-selector", children: /* @__PURE__ */ e.jsx(
1261
+ xs,
1262
+ {
1263
+ menu: {
1264
+ items: ne.map((s) => ({
1265
+ key: s.id,
1266
+ disabled: s.id === o,
1267
+ label: /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-agent-menu-item", children: [
1268
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__icon", children: s.icon }),
1269
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__name", children: s.name }),
1270
+ s.id === o && /* @__PURE__ */ e.jsx(wn, { className: "wandox-console-agent-menu-item__check" })
1271
+ ] })
1272
+ })),
1273
+ onClick: ({ key: s }) => Y == null ? void 0 : Y(s)
1274
+ },
1275
+ trigger: ["click"],
1276
+ placement: "bottomLeft",
1277
+ children: /* @__PURE__ */ e.jsxs(
1278
+ "button",
1279
+ {
1280
+ type: "button",
1281
+ className: "wandox-console-chat__title",
1282
+ "aria-label": "切换智能体",
1283
+ title: "切换智能体",
1284
+ children: [
1285
+ (he == null ? void 0 : he.icon) && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__title-icon", children: he.icon }),
1286
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__title-name", children: i || (he == null ? void 0 : he.name) || "智能体" }),
1287
+ /* @__PURE__ */ e.jsx(da, { className: "wandox-console-chat__title-arrow" })
1288
+ ]
1289
+ }
1290
+ )
1291
+ }
1292
+ ) }),
1293
+ /* @__PURE__ */ e.jsxs(
1294
+ "button",
1295
+ {
1296
+ type: "button",
1297
+ className: "wandox-console-chat__all-scenes",
1298
+ disabled: L,
1299
+ onClick: Oa,
1300
+ children: [
1301
+ /* @__PURE__ */ e.jsx(Zn, {}),
1302
+ /* @__PURE__ */ e.jsx("span", { children: "全部场景" })
1303
+ ]
1304
+ }
1305
+ ),
1306
+ /* @__PURE__ */ e.jsx(ha, { benefit: he == null ? void 0 : he.packageBenefit })
1307
+ ] }),
1308
+ /* @__PURE__ */ e.jsxs("nav", { className: "wandox-console-chat__topbar", children: [
1309
+ /* @__PURE__ */ e.jsx(
1310
+ "button",
1311
+ {
1312
+ type: "button",
1313
+ className: `wandox-console-chat__topbar-tab ${se === "chat" ? "active" : ""}`,
1314
+ onClick: () => x("chat"),
1315
+ children: "智能体会话"
1316
+ }
1317
+ ),
1318
+ /* @__PURE__ */ e.jsx(
1319
+ "button",
1320
+ {
1321
+ type: "button",
1322
+ className: `wandox-console-chat__topbar-tab ${se === "robot" ? "active" : ""}`,
1323
+ onClick: () => {
1324
+ x("robot"), ve(null);
1325
+ },
1326
+ children: /* @__PURE__ */ e.jsx("span", { children: "巡检机器人" })
1327
+ }
1328
+ )
1329
+ ] }),
1330
+ se === "chat" ? Qa : /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot", children: [
1331
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-chips", children: k.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty", children: "该智能体暂无巡检机器人" }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1332
+ k.length > 0 && /* @__PURE__ */ e.jsx(
1333
+ "button",
1334
+ {
1335
+ type: "button",
1336
+ className: `wandox-console-chat__robot-chip ${z === null ? "active" : ""}`,
1337
+ onClick: () => ve(null),
1338
+ children: "全部"
1339
+ }
1340
+ ),
1341
+ k.map((s) => {
1342
+ const n = !!W[s.agent_id];
1343
+ return /* @__PURE__ */ e.jsxs(
1344
+ "div",
1345
+ {
1346
+ className: `wandox-console-chat__robot-chip-compound ${z === s.name ? "active" : ""}`,
1347
+ children: [
1348
+ /* @__PURE__ */ e.jsx(
1349
+ "button",
1350
+ {
1351
+ type: "button",
1352
+ className: "wandox-console-chat__robot-chip-name",
1353
+ onClick: () => ve(s.name),
1354
+ children: s.name
1355
+ }
1356
+ ),
1357
+ /* @__PURE__ */ e.jsx(
1358
+ "button",
1359
+ {
1360
+ type: "button",
1361
+ className: `wandox-console-chat__robot-chip-bind ${n ? "bound" : ""}`,
1362
+ onClick: () => Ta(s),
1363
+ title: n ? "已绑定通知渠道,点击修改" : "绑定通知渠道",
1364
+ children: n ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1365
+ /* @__PURE__ */ e.jsx(
1366
+ "span",
1367
+ {
1368
+ className: "wandox-console-chat__robot-chip-bind-dot",
1369
+ "aria-hidden": "true"
1370
+ }
1371
+ ),
1372
+ /* @__PURE__ */ e.jsx("span", { children: "已通知" })
1373
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1374
+ /* @__PURE__ */ e.jsx(xa, {}),
1375
+ /* @__PURE__ */ e.jsx("span", { children: "通知" })
1376
+ ] })
1377
+ }
1378
+ )
1379
+ ]
1380
+ },
1381
+ s.agent_id
1382
+ );
1383
+ })
1384
+ ] }) }),
1385
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-tabs", children: [
1386
+ /* @__PURE__ */ e.jsx(
1387
+ "button",
1388
+ {
1389
+ type: "button",
1390
+ className: `wandox-console-chat__robot-tab ${ue === "results" ? "active" : ""}`,
1391
+ onClick: () => Ae("results"),
1392
+ children: "巡检结果"
1393
+ }
1394
+ ),
1395
+ /* @__PURE__ */ e.jsxs(
1396
+ "button",
1397
+ {
1398
+ type: "button",
1399
+ className: `wandox-console-chat__robot-tab ${ue === "history" ? "active" : ""}`,
1400
+ onClick: () => Ae("history"),
1401
+ children: [
1402
+ "执行记录",
1403
+ ue === "history" && z && ee.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-tab-badge", children: ee.length })
1404
+ ]
1405
+ }
1406
+ )
1407
+ ] }),
1408
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-content", children: ue === "results" ? f ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-loading", children: [
1409
+ /* @__PURE__ */ e.jsx(ps, { size: "small" }),
1410
+ /* @__PURE__ */ e.jsx("span", { children: "加载中..." })
1411
+ ] }) : ls.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-empty", children: [
1412
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-icon", children: /* @__PURE__ */ e.jsx(Xs, {}) }),
1413
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: z ? `${z} 暂无巡检结果` : "暂无巡检结果" }),
1414
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-desc", children: "巡检结果会在机器人执行后展示在这里" })
1415
+ ] }) : /* @__PURE__ */ e.jsx("ul", { className: "wandox-console-chat__robot-timeline", children: ls.map((s, n) => {
1416
+ const c = {
1417
+ high: "#ff4d4f",
1418
+ medium: "#faad14",
1419
+ low: "#52c41a"
1420
+ }, l = n === ls.length - 1;
1421
+ return /* @__PURE__ */ e.jsxs(
1422
+ "li",
1423
+ {
1424
+ className: "wandox-console-chat__robot-timeline-item",
1425
+ children: [
1426
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-timeline-axis", children: [
1427
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-timeline-time", children: Da(s.timestamp) }),
1428
+ /* @__PURE__ */ e.jsx(
1429
+ "span",
1430
+ {
1431
+ className: "wandox-console-chat__robot-timeline-dot",
1432
+ style: {
1433
+ background: c[s.priority]
1434
+ }
1435
+ }
1436
+ ),
1437
+ !l && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-timeline-line" })
1438
+ ] }),
1439
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-timeline-card", children: [
1440
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-timeline-title", children: s.title }),
1441
+ s.summary && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-timeline-summary", children: s.summary }),
1442
+ s.ui_payload && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-timeline-content wandox-markdown-content", children: /* @__PURE__ */ e.jsx(yn, { payload: s.ui_payload }) })
1443
+ ] })
1444
+ ]
1445
+ },
1446
+ s.id || `result_${n}`
1447
+ );
1448
+ }) }) : z ? ss ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-loading", children: [
1449
+ /* @__PURE__ */ e.jsx(ps, { size: "small" }),
1450
+ /* @__PURE__ */ e.jsx("span", { children: "加载中..." })
1451
+ ] }) : ee.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: "暂无执行记录" }) }) : /* @__PURE__ */ e.jsx("ul", { className: "wandox-console-chat__robot-history", children: ee.map((s) => /* @__PURE__ */ e.jsxs(
1452
+ "li",
1453
+ {
1454
+ className: `wandox-console-chat__robot-history-item wandox-console-chat__robot-history-item--${s.status}`,
1455
+ children: [
1456
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-history-info", children: [
1457
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-history-name", children: s.action_name }),
1458
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-history-time", children: s.created_at ? new Date(s.created_at).toLocaleString(
1459
+ "zh-CN",
1460
+ {
1461
+ month: "2-digit",
1462
+ day: "2-digit",
1463
+ hour: "2-digit",
1464
+ minute: "2-digit"
1465
+ }
1466
+ ) : "" })
1467
+ ] }),
1468
+ /* @__PURE__ */ e.jsx(
1469
+ "span",
1470
+ {
1471
+ className: `wandox-console-chat__robot-history-status wandox-console-chat__robot-history-status--${s.status}`,
1472
+ children: {
1473
+ pending: "等待中",
1474
+ running: "执行中",
1475
+ success: "成功",
1476
+ failed: "失败"
1477
+ }[s.status] || s.status
1478
+ }
1479
+ )
1480
+ ]
1481
+ },
1482
+ s.id
1483
+ )) }) : /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-empty", children: [
1484
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-icon", children: /* @__PURE__ */ e.jsx(Xs, {}) }),
1485
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: "请先选择机器人" }),
1486
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-desc", children: "在上方选择机器人以查看其执行记录" })
1487
+ ] }) })
1488
+ ] }),
1489
+ se === "chat" && Ns.length > 0 && !(I && !O) && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__recent", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__recent-bar", children: Ns.map((s, n) => /* @__PURE__ */ e.jsx(
1490
+ "button",
1491
+ {
1492
+ type: "button",
1493
+ className: "wandox-console-chat__recent-chip",
1494
+ disabled: L || !!as,
1495
+ title: s.description || s.name,
1496
+ onClick: () => {
1497
+ za(s);
1498
+ },
1499
+ children: s.name
1500
+ },
1501
+ `${s.playbook_id || s.name}-${n}`
1502
+ )) }) }),
1503
+ se === "chat" && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__input", children: I && !O ? /* @__PURE__ */ e.jsxs(
1504
+ "div",
1505
+ {
1506
+ ref: xe,
1507
+ className: "wandox-console-input-playbook wandox-console-prompt",
1508
+ children: [
1509
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__head", children: [
1510
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenechoice", children: [
1511
+ /* @__PURE__ */ e.jsx("span", { children: "已选择场景" }),
1512
+ /* @__PURE__ */ e.jsx("strong", { children: I.title })
1513
+ ] }),
1514
+ /* @__PURE__ */ e.jsx(
1515
+ "button",
1516
+ {
1517
+ type: "button",
1518
+ className: "wandox-console-changescene",
1519
+ onClick: () => {
1520
+ B(null), ce([]), q({});
1521
+ },
1522
+ children: "重新选择"
1523
+ }
1524
+ )
1525
+ ] }),
1526
+ /* @__PURE__ */ e.jsx(
1527
+ "div",
1528
+ {
1529
+ ref: ge,
1530
+ tabIndex: -1,
1531
+ className: "wandox-console-taskarea wandox-console-taskarea--static",
1532
+ children: I.desc || I.title
1533
+ }
1534
+ ),
1535
+ X.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea", children: [
1536
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramhead", children: [
1537
+ /* @__PURE__ */ e.jsx(pa, {}),
1538
+ /* @__PURE__ */ e.jsx("strong", { children: "确认分析范围" }),
1539
+ /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-paramhead__status", children: [
1540
+ /* @__PURE__ */ e.jsx(_s, {}),
1541
+ " ",
1542
+ ke.length > 0 ? `待填 ${ke.length} 项必填参数` : "参数已就绪"
1543
+ ] })
1544
+ ] }),
1545
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-params", children: es(
1546
+ X,
1547
+ T
1548
+ ).map((s) => /* @__PURE__ */ e.jsx(
1549
+ fa,
1550
+ {
1551
+ field: s,
1552
+ value: T[s.name],
1553
+ uploading: !1,
1554
+ fileNameMap: {},
1555
+ getOptionState: E.getFieldState,
1556
+ onChange: (n, c) => q((l) => ({
1557
+ ...l,
1558
+ [n]: c
1559
+ }))
1560
+ },
1561
+ s.name
1562
+ )) })
1563
+ ] }),
1564
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__foot", children: [
1565
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-input-playbook__tip", children: "· 已继承当前上下文" }),
1566
+ /* @__PURE__ */ e.jsxs(
1567
+ "button",
1568
+ {
1569
+ type: "button",
1570
+ className: "wandox-console-start",
1571
+ disabled: !I || L || ke.length > 0,
1572
+ onClick: qa,
1573
+ children: [
1574
+ "开始执行",
1575
+ /* @__PURE__ */ e.jsx(fs, {})
1576
+ ]
1577
+ }
1578
+ )
1579
+ ] })
1580
+ ]
1581
+ }
1582
+ ) : /* @__PURE__ */ e.jsx(
1583
+ gn,
1584
+ {
1585
+ onSend: is,
1586
+ executing: L,
1587
+ stopping: Ea,
1588
+ onStop: Pa,
1589
+ placeholder: " / 快速调用场景",
1590
+ ssoToken: P,
1591
+ ssoDomain: C,
1592
+ ssoCompany: u,
1593
+ leadingActions: Ka,
1594
+ uploadButtonAsLeading: !0,
1595
+ uploadButtonLabel: "添加文件",
1596
+ mentionTriggerChar: "/",
1597
+ mentionListRequest: ka,
1598
+ onMentionListRequestHandled: Ua,
1599
+ autoFocusInput: !I,
1600
+ playbooks: va,
1601
+ onRequestPlaybookParams: be
1602
+ }
1603
+ ) }),
1604
+ /* @__PURE__ */ e.jsx(
1605
+ lo,
1606
+ {
1607
+ open: O,
1608
+ source: V,
1609
+ categories: cs,
1610
+ categoryKey: J,
1611
+ search: te,
1612
+ cards: Ra,
1613
+ executing: L,
1614
+ loadingPlaybookId: U,
1615
+ onClose: Va,
1616
+ onSourceChange: Fa,
1617
+ onCategoryChange: re,
1618
+ onSearchChange: K,
1619
+ onSelectScene: Ba
1620
+ }
1621
+ ),
1622
+ /* @__PURE__ */ e.jsx(
1623
+ jn,
1624
+ {
1625
+ open: He.visible,
1626
+ agentId: He.agentId,
1627
+ playbookId: He.playbookId,
1628
+ playbookName: He.playbookName,
1629
+ onClose: Ga
1630
+ }
1631
+ ),
1632
+ P && C && u && /* @__PURE__ */ e.jsx(
1633
+ kn,
1634
+ {
1635
+ open: de,
1636
+ title: Z,
1637
+ actions: pe,
1638
+ ssoToken: P,
1639
+ ssoDomain: C,
1640
+ ssoCompany: u,
1641
+ onClose: () => we(!1)
1642
+ }
1643
+ ),
1644
+ /* @__PURE__ */ e.jsx(
1645
+ vn,
1646
+ {
1647
+ title: "配置通知渠道",
1648
+ open: $e,
1649
+ onCancel: () => {
1650
+ Ce(!1), Pe(null), Ee(void 0);
1651
+ },
1652
+ width: 520,
1653
+ centered: !0,
1654
+ footer: [
1655
+ W[(M == null ? void 0 : M.agent_id) || ""] ? /* @__PURE__ */ e.jsx(
1656
+ Xe,
1657
+ {
1658
+ danger: !0,
1659
+ loading: Be,
1660
+ style: { marginRight: "auto" },
1661
+ onClick: La,
1662
+ children: "解除绑定"
1663
+ },
1664
+ "unbind"
1665
+ ) : null,
1666
+ /* @__PURE__ */ e.jsx(
1667
+ Xe,
1668
+ {
1669
+ disabled: Be,
1670
+ onClick: () => {
1671
+ Ce(!1), Pe(null), Ee(void 0);
1672
+ },
1673
+ children: "取消"
1674
+ },
1675
+ "cancel"
1676
+ ),
1677
+ /* @__PURE__ */ e.jsx(
1678
+ Xe,
1679
+ {
1680
+ type: "primary",
1681
+ loading: Be,
1682
+ disabled: !Ve,
1683
+ onClick: Ma,
1684
+ children: "保存"
1685
+ },
1686
+ "ok"
1687
+ )
1688
+ ],
1689
+ children: /* @__PURE__ */ e.jsxs("div", { style: { padding: "8px 0" }, children: [
1690
+ /* @__PURE__ */ e.jsxs(
1691
+ "div",
1692
+ {
1693
+ style: {
1694
+ marginBottom: 16,
1695
+ padding: "12px 16px",
1696
+ background: "#f5f7fa",
1697
+ borderRadius: 8,
1698
+ display: "flex",
1699
+ alignItems: "center",
1700
+ justifyContent: "space-between"
1701
+ },
1702
+ children: [
1703
+ /* @__PURE__ */ e.jsx("div", { style: { fontSize: 13, color: "#666" }, children: "巡检机器人" }),
1704
+ /* @__PURE__ */ e.jsx(
1705
+ "div",
1706
+ {
1707
+ style: {
1708
+ fontSize: 15,
1709
+ color: "#1a1a1a",
1710
+ fontWeight: 500
1711
+ },
1712
+ children: M == null ? void 0 : M.name
1713
+ }
1714
+ )
1715
+ ]
1716
+ }
1717
+ ),
1718
+ /* @__PURE__ */ e.jsx(
1719
+ "div",
1720
+ {
1721
+ style: {
1722
+ marginBottom: 8,
1723
+ fontSize: 14,
1724
+ color: "#333",
1725
+ fontWeight: 500
1726
+ },
1727
+ children: "选择通知渠道"
1728
+ }
1729
+ ),
1730
+ /* @__PURE__ */ e.jsx(
1731
+ Nn,
1732
+ {
1733
+ style: { width: "100%" },
1734
+ placeholder: "请选择通知渠道",
1735
+ value: Ve,
1736
+ onChange: Ee,
1737
+ disabled: Be,
1738
+ options: me.map((s) => ({
1739
+ label: `${s.name}(${s.platform === "dingtalk" ? "钉钉" : s.platform === "feishu" ? "飞书" : "企业微信"})`,
1740
+ value: s.webhook_id
1741
+ })),
1742
+ popupRender: (s) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1743
+ s,
1744
+ /* @__PURE__ */ e.jsx(Qn, { style: { margin: "8px 0" } }),
1745
+ /* @__PURE__ */ e.jsx(Cn, { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ e.jsx(
1746
+ Xe,
1747
+ {
1748
+ type: "text",
1749
+ icon: /* @__PURE__ */ e.jsx("span", { children: "+" }),
1750
+ onClick: () => vs(!0),
1751
+ children: "添加新的通知渠道"
1752
+ }
1753
+ ) })
1754
+ ] })
1755
+ }
1756
+ ),
1757
+ me.length === 0 && /* @__PURE__ */ e.jsx(
1758
+ "div",
1759
+ {
1760
+ style: {
1761
+ marginTop: 8,
1762
+ padding: "8px 12px",
1763
+ background: "#fff7e6",
1764
+ border: "1px solid #ffd591",
1765
+ borderRadius: 4,
1766
+ fontSize: 13,
1767
+ color: "#d46b08"
1768
+ },
1769
+ children: "暂无可用的通知渠道,请先在「通知配置」中创建"
1770
+ }
1771
+ )
1772
+ ] })
1773
+ }
1774
+ ),
1775
+ /* @__PURE__ */ e.jsx(
1776
+ Bn,
1777
+ {
1778
+ open: wa,
1779
+ onClose: () => vs(!1),
1780
+ onSuccess: (s) => {
1781
+ Ne((n) => [...n, s]), Ee(s.webhook_id);
1782
+ }
1783
+ }
1784
+ )
1785
+ ] })
1786
+ );
1787
+ }
1788
+ const { TextArea: mo } = ks;
1789
+ function ho({
1790
+ useMapCards: o,
1791
+ useMapCategories: i,
1792
+ playbooks: h = [],
1793
+ selectedCategoryKey: m,
1794
+ onCategorySelect: p,
1795
+ loading: j,
1796
+ useMapError: A,
1797
+ onRetry: _,
1798
+ onStartAnalysis: S,
1799
+ agents: D,
1800
+ selectedAgentId: ne,
1801
+ onAgentSelect: Y,
1802
+ onOpenAgentChat: le
1803
+ }) {
1804
+ const [R, H] = a.useState(""), [P, C] = a.useState(""), [u, F] = a.useState(null), ie = a.useRef(null), [O, $] = a.useState([]), [U, oe] = a.useState(!1), [te, K] = a.useState(""), V = a.useRef(0), [G, J] = a.useState({}), [re, I] = a.useState({}), [B, ge] = a.useState({}), [xe, de] = a.useState([]), [we, pe] = a.useState(!1), Re = a.useRef(null), Z = a.useMemo(
1805
+ () => o.length > 0 ? o : zn(h),
1806
+ [o, h]
1807
+ ), je = a.useMemo(() => m ? Z.filter((t) => t.categoryKey === m) : Z, [Z, m]), X = a.useMemo(() => {
1808
+ const t = P.trim().toLowerCase();
1809
+ return t ? je.filter(
1810
+ (f) => f.title.toLowerCase().includes(t) || f.desc.toLowerCase().includes(t)
1811
+ ) : je;
1812
+ }, [je, P]), ce = j || A && Z.length === 0 || X.length > 0, [T, q] = a.useState("");
1813
+ a.useEffect(() => {
1814
+ V.current += 1, q(""), H(""), $([]), J({}), oe(!1), K("");
1815
+ }, [m]), a.useEffect(() => {
1816
+ T && !Z.some((t) => t.playbook_id === T) && (V.current += 1, q(""), H(""), $([]), J({}), oe(!1), K(""));
1817
+ }, [T, Z]);
1818
+ const E = a.useMemo(
1819
+ () => Z.find((t) => t.playbook_id === T) ?? null,
1820
+ [Z, T]
1821
+ ), ke = a.useMemo(
1822
+ () => u ? _a(u) : null,
1823
+ [u]
1824
+ ), se = a.useCallback((t, f) => {
1825
+ t.stopPropagation(), F(f);
1826
+ }, []);
1827
+ a.useEffect(() => {
1828
+ if (j || E) return;
1829
+ const t = window.setTimeout(() => {
1830
+ var y, b;
1831
+ const f = (b = (y = ie.current) == null ? void 0 : y.resizableTextArea) == null ? void 0 : b.textArea;
1832
+ f == null || f.focus();
1833
+ }, 0);
1834
+ return () => window.clearTimeout(t);
1835
+ }, [j, E]);
1836
+ const x = a.useCallback(async (t) => {
1837
+ const f = String(t.playbook_id || "").trim();
1838
+ if (!f) {
1839
+ N.error("场景缺少 playbook_id");
1840
+ return;
1841
+ }
1842
+ const y = ++V.current;
1843
+ q(f), $([]), J({}), I({}), ge({}), oe(!0), K("");
1844
+ try {
1845
+ const { data: b } = await hs({
1846
+ playbook_id: f
1847
+ });
1848
+ if (y !== V.current) return;
1849
+ if (!b || typeof b != "object" || Array.isArray(b))
1850
+ throw new Error("场景详情为空");
1851
+ const v = ra(
1852
+ $n(b)
1853
+ );
1854
+ $(v), J(ua(v));
1855
+ } catch (b) {
1856
+ if (y !== V.current) return;
1857
+ const v = b instanceof Error ? b.message : "场景参数加载失败";
1858
+ K(v), N.error("场景参数加载失败,请稍后重试");
1859
+ } finally {
1860
+ y === V.current && oe(!1);
1861
+ }
1862
+ }, []), k = () => {
1863
+ V.current += 1, q(""), H(""), $([]), J({}), oe(!1), K("");
1864
+ }, ye = ia(O, G, J), z = a.useMemo(
1865
+ () => es(O, G),
1866
+ [O, G]
1867
+ ), ve = a.useCallback((t, f) => {
1868
+ J((y) => ({ ...y, [t]: f }));
1869
+ }, []), ue = a.useCallback(
1870
+ (t, f) => async ({ file: y, onSuccess: b, onError: v }) => {
1871
+ var me, Ne;
1872
+ I((W) => ({ ...W, [t]: !0 }));
1873
+ try {
1874
+ const W = y, Q = await Js(W), $e = (me = Q == null ? void 0 : Q.data) == null ? void 0 : me.url, Ce = ((Ne = Q == null ? void 0 : Q.data) == null ? void 0 : Ne.name) || W.name;
1875
+ if (!$e) throw new Error("上传结果缺少文件地址");
1876
+ ge((M) => ({ ...M, [$e]: Ce })), J((M) => {
1877
+ if (f <= 1) return { ...M, [t]: $e };
1878
+ const Pe = Array.isArray(M[t]) ? M[t] : M[t] ? [M[t]] : [];
1879
+ return { ...M, [t]: [...Pe, $e] };
1880
+ }), b == null || b(Q), N.success("上传成功");
1881
+ } catch (W) {
1882
+ const Q = W instanceof Error ? W : new Error("上传失败");
1883
+ v == null || v(Q), N.error(Q.message);
1884
+ } finally {
1885
+ I((W) => ({ ...W, [t]: !1 }));
1886
+ }
1887
+ },
1888
+ []
1889
+ ), Ae = a.useCallback(
1890
+ async (t) => {
1891
+ const f = Array.from(t.target.files ?? []);
1892
+ if (t.target.value = "", f.length !== 0) {
1893
+ pe(!0);
1894
+ try {
1895
+ const y = await Promise.all(
1896
+ f.map(async (b) => {
1897
+ var W, Q;
1898
+ const v = await Js(b), me = (W = v == null ? void 0 : v.data) == null ? void 0 : W.url, Ne = ((Q = v == null ? void 0 : v.data) == null ? void 0 : Q.name) || b.name;
1899
+ if (!me) throw new Error("上传结果缺少文件地址");
1900
+ return {
1901
+ type: b.type.startsWith("image/") ? "image" : "file",
1902
+ url: me,
1903
+ name: Ne,
1904
+ mime_type: b.type
1905
+ };
1906
+ })
1907
+ );
1908
+ de((b) => [...b, ...y]), N.success(`已添加 ${y.length} 个附件`);
1909
+ } catch (y) {
1910
+ N.error(y instanceof Error ? y.message : "上传失败");
1911
+ } finally {
1912
+ pe(!1);
1913
+ }
1914
+ }
1915
+ },
1916
+ []
1917
+ ), ss = a.useCallback((t) => {
1918
+ de((f) => f.filter((y) => y.url !== t));
1919
+ }, []), Ie = a.useMemo(
1920
+ () => z.filter(
1921
+ (t) => t.required && bs(G[t.name])
1922
+ ),
1923
+ [z, G]
1924
+ ), ee = a.useMemo(
1925
+ () => D.find((t) => t.id === ne) ?? D.find((t) => t.current) ?? D[0],
1926
+ [D, ne]
1927
+ );
1928
+ return /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-view", children: [
1929
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-homecenter", children: [
1930
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-homecenter-hero", children: [
1931
+ ee && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header", children: [
1932
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__agent", children: [
1933
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-home-header__avatar", children: ee.icon }),
1934
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__identity", children: [
1935
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__selector-row", children: [
1936
+ /* @__PURE__ */ e.jsx(
1937
+ xs,
1938
+ {
1939
+ menu: {
1940
+ items: D.map((t) => ({
1941
+ key: t.id,
1942
+ disabled: t.id === ee.id,
1943
+ label: /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-agent-menu-item", children: [
1944
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__icon", children: t.icon }),
1945
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__name", children: t.name }),
1946
+ t.id === ee.id && /* @__PURE__ */ e.jsx(_s, { className: "wandox-console-agent-menu-item__check" })
1947
+ ] })
1948
+ })),
1949
+ onClick: ({ key: t }) => Y == null ? void 0 : Y(t)
1950
+ },
1951
+ trigger: ["click"],
1952
+ placement: "bottomLeft",
1953
+ children: /* @__PURE__ */ e.jsxs(
1954
+ "button",
1955
+ {
1956
+ type: "button",
1957
+ className: "wandox-console-home-header__selector",
1958
+ "aria-label": "切换智能体",
1959
+ children: [
1960
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-home-header__name", children: ee.name }),
1961
+ /* @__PURE__ */ e.jsx(da, { className: "wandox-console-home-header__arrow" })
1962
+ ]
1963
+ }
1964
+ )
1965
+ }
1966
+ ),
1967
+ /* @__PURE__ */ e.jsx(ha, { benefit: ee.packageBenefit })
1968
+ ] }),
1969
+ ee.desc && /* @__PURE__ */ e.jsx(
1970
+ "p",
1971
+ {
1972
+ className: "wandox-console-home-header__description",
1973
+ title: ee.desc,
1974
+ children: ee.desc
1975
+ }
1976
+ )
1977
+ ] })
1978
+ ] }),
1979
+ /* @__PURE__ */ e.jsxs(
1980
+ "button",
1981
+ {
1982
+ type: "button",
1983
+ className: "wandox-console-home-header__history",
1984
+ onClick: () => le == null ? void 0 : le(),
1985
+ children: [
1986
+ /* @__PURE__ */ e.jsx("span", { children: "会话记录" }),
1987
+ /* @__PURE__ */ e.jsx(En, { className: "wandox-console-home-header__history-arrow" })
1988
+ ]
1989
+ }
1990
+ )
1991
+ ] }),
1992
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt", children: [
1993
+ E && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__head", children: [
1994
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenechoice", children: [
1995
+ /* @__PURE__ */ e.jsx("span", { children: "已选择场景" }),
1996
+ /* @__PURE__ */ e.jsx("strong", { children: E.title })
1997
+ ] }),
1998
+ /* @__PURE__ */ e.jsx(
1999
+ "button",
2000
+ {
2001
+ type: "button",
2002
+ className: "wandox-console-changescene",
2003
+ onClick: k,
2004
+ children: "重新选择"
2005
+ }
2006
+ )
2007
+ ] }),
2008
+ E ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-taskarea wandox-console-taskarea--static", children: E.desc || E.title }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-taskarea", children: /* @__PURE__ */ e.jsx(
2009
+ mo,
2010
+ {
2011
+ ref: ie,
2012
+ value: R,
2013
+ onChange: (t) => H(t.target.value),
2014
+ autoSize: { minRows: 2 },
2015
+ variant: "borderless",
2016
+ placeholder: "直接描述你的问题,或选择一个场景开始"
2017
+ }
2018
+ ) }),
2019
+ E && U && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea wandox-console-paramarea--state", children: [
2020
+ /* @__PURE__ */ e.jsx(An, {}),
2021
+ /* @__PURE__ */ e.jsx("span", { children: "正在读取场景参数..." })
2022
+ ] }),
2023
+ E && !U && te && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea wandox-console-paramarea--state", children: [
2024
+ /* @__PURE__ */ e.jsx("span", { children: "场景参数加载失败" }),
2025
+ /* @__PURE__ */ e.jsxs(
2026
+ "button",
2027
+ {
2028
+ type: "button",
2029
+ className: "wandox-console-paramarea__retry",
2030
+ onClick: () => void x(E),
2031
+ children: [
2032
+ /* @__PURE__ */ e.jsx(Zs, {}),
2033
+ "重试"
2034
+ ]
2035
+ }
2036
+ )
2037
+ ] }),
2038
+ E && !U && !te && z.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea", children: [
2039
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramhead", children: [
2040
+ /* @__PURE__ */ e.jsx(pa, {}),
2041
+ /* @__PURE__ */ e.jsx("strong", { children: "确认分析范围" }),
2042
+ /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-paramhead__status", children: [
2043
+ /* @__PURE__ */ e.jsx(_s, {}),
2044
+ " ",
2045
+ Ie.length > 0 ? `待填 ${Ie.length} 项必填参数` : "参数已就绪"
2046
+ ] })
2047
+ ] }),
2048
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-params", children: z.map((t) => /* @__PURE__ */ e.jsx(
2049
+ fa,
2050
+ {
2051
+ field: t,
2052
+ value: G[t.name],
2053
+ uploading: !!re[t.name],
2054
+ fileNameMap: B,
2055
+ getOptionState: ye.getFieldState,
2056
+ onChange: ve,
2057
+ onUpload: ue
2058
+ },
2059
+ t.name
2060
+ )) })
2061
+ ] }),
2062
+ /* @__PURE__ */ e.jsxs(
2063
+ "div",
2064
+ {
2065
+ className: `wandox-console-prompt__foot${E ? " wandox-console-prompt__foot--scene" : ""}`,
2066
+ children: [
2067
+ !E && /* @__PURE__ */ e.jsx(
2068
+ "button",
2069
+ {
2070
+ type: "button",
2071
+ className: "wandox-console-attach",
2072
+ onClick: () => {
2073
+ var t;
2074
+ return (t = Re.current) == null ? void 0 : t.click();
2075
+ },
2076
+ disabled: we,
2077
+ title: we ? "上传中…" : "附件",
2078
+ children: /* @__PURE__ */ e.jsx(Pn, {})
2079
+ }
2080
+ ),
2081
+ /* @__PURE__ */ e.jsx(
2082
+ "input",
2083
+ {
2084
+ ref: Re,
2085
+ type: "file",
2086
+ multiple: !0,
2087
+ accept: "image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.zip",
2088
+ hidden: !0,
2089
+ onChange: Ae
2090
+ }
2091
+ ),
2092
+ E ? /* @__PURE__ */ e.jsxs(
2093
+ "button",
2094
+ {
2095
+ type: "button",
2096
+ className: "wandox-console-start",
2097
+ disabled: U || !!te || Ie.length > 0,
2098
+ onClick: () => {
2099
+ S == null || S({
2100
+ playbookId: E.playbook_id,
2101
+ playbookParams: G,
2102
+ message: E.title,
2103
+ attachments: xe
2104
+ });
2105
+ },
2106
+ children: [
2107
+ "开始执行",
2108
+ /* @__PURE__ */ e.jsx(fs, {})
2109
+ ]
2110
+ }
2111
+ ) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-prompt__foot-right", children: /* @__PURE__ */ e.jsx(
2112
+ "button",
2113
+ {
2114
+ type: "button",
2115
+ className: "wandox-console-prompt__send",
2116
+ disabled: !R.trim(),
2117
+ onClick: () => {
2118
+ S == null || S({
2119
+ playbookParams: {},
2120
+ message: R.trim(),
2121
+ attachments: xe
2122
+ });
2123
+ },
2124
+ "aria-label": "发送",
2125
+ children: /* @__PURE__ */ e.jsx(Tn, {})
2126
+ }
2127
+ ) })
2128
+ ]
2129
+ }
2130
+ )
2131
+ ] }),
2132
+ xe.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-attachments", children: xe.map((t) => /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-attach-item", children: [
2133
+ t.type === "image" ? /* @__PURE__ */ e.jsx(
2134
+ "img",
2135
+ {
2136
+ src: t.url,
2137
+ alt: t.name,
2138
+ className: "wandox-console-attach-item__thumb"
2139
+ }
2140
+ ) : /* @__PURE__ */ e.jsx(Mn, { className: "wandox-console-attach-item__icon" }),
2141
+ /* @__PURE__ */ e.jsx(
2142
+ "span",
2143
+ {
2144
+ className: "wandox-console-attach-item__name",
2145
+ title: t.name,
2146
+ children: t.name
2147
+ }
2148
+ ),
2149
+ /* @__PURE__ */ e.jsx(
2150
+ "button",
2151
+ {
2152
+ type: "button",
2153
+ className: "wandox-console-attach-item__remove",
2154
+ "aria-label": "移除附件",
2155
+ onClick: () => ss(t.url),
2156
+ children: /* @__PURE__ */ e.jsx(ta, {})
2157
+ }
2158
+ )
2159
+ ] }, t.url)) }),
2160
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenehead", children: [
2161
+ /* @__PURE__ */ e.jsx(
2162
+ "div",
2163
+ {
2164
+ className: "wandox-console-chips",
2165
+ role: "tablist",
2166
+ "aria-label": "场景分类",
2167
+ children: i.slice(0, 5).map((t) => /* @__PURE__ */ e.jsx(
2168
+ "button",
2169
+ {
2170
+ type: "button",
2171
+ role: "tab",
2172
+ "aria-selected": m === t.key,
2173
+ className: `wandox-console-chip${m === t.key ? " wandox-console-chip--active" : ""}`,
2174
+ onClick: () => p == null ? void 0 : p(t.key),
2175
+ children: /* @__PURE__ */ e.jsx("span", { children: t.name })
2176
+ },
2177
+ t.key
2178
+ ))
2179
+ }
2180
+ ),
2181
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenesearch", children: /* @__PURE__ */ e.jsx(
2182
+ ks,
2183
+ {
2184
+ allowClear: !0,
2185
+ prefix: /* @__PURE__ */ e.jsx(ms, {}),
2186
+ placeholder: "搜索当前地图下的场景",
2187
+ value: P,
2188
+ onChange: (t) => C(t.target.value)
2189
+ }
2190
+ ) })
2191
+ ] })
2192
+ ] }),
2193
+ ce && /* @__PURE__ */ e.jsxs(
2194
+ "section",
2195
+ {
2196
+ className: "wandox-console-scene-section",
2197
+ "aria-label": "个性化场景",
2198
+ children: [
2199
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scene-section__header", children: /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx("h2", { children: "为你推荐" }) }) }),
2200
+ j ? /* @__PURE__ */ e.jsxs(
2201
+ "div",
2202
+ {
2203
+ className: "wandox-console-agents__loading",
2204
+ style: { justifyContent: "center", padding: "40px 0" },
2205
+ children: [
2206
+ /* @__PURE__ */ e.jsx(ps, { size: "small" }),
2207
+ /* @__PURE__ */ e.jsx("span", { children: "正在加载场景..." })
2208
+ ]
2209
+ }
2210
+ ) : A && Z.length === 0 ? /* @__PURE__ */ e.jsxs(
2211
+ "div",
2212
+ {
2213
+ className: "wandox-console-agents__error",
2214
+ style: { alignItems: "center", padding: "32px 0" },
2215
+ children: [
2216
+ /* @__PURE__ */ e.jsx("span", { children: A }),
2217
+ /* @__PURE__ */ e.jsxs("button", { type: "button", onClick: _, children: [
2218
+ /* @__PURE__ */ e.jsx(Zs, {}),
2219
+ "重试"
2220
+ ] })
2221
+ ]
2222
+ }
2223
+ ) : X.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene-section__empty", children: [
2224
+ /* @__PURE__ */ e.jsx(ms, {}),
2225
+ /* @__PURE__ */ e.jsx("span", { children: P ? "没有匹配的场景" : "当前分类暂无场景" })
2226
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes-wrap", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes", children: X.map((t) => {
2227
+ const f = po(t), y = xo(t), b = _o(t.tags);
2228
+ return /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene-wrap", children: [
2229
+ /* @__PURE__ */ e.jsx(
2230
+ "button",
2231
+ {
2232
+ type: "button",
2233
+ className: `wandox-console-scene${y ? " wandox-console-scene--featured" : ""}${T === t.playbook_id ? " wandox-console-scene--selected" : ""}`,
2234
+ onClick: () => x(t),
2235
+ children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__body", children: [
2236
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__head", children: [
2237
+ /* @__PURE__ */ e.jsx("strong", { title: t.title, children: t.title }),
2238
+ f && /* @__PURE__ */ e.jsx(
2239
+ "span",
2240
+ {
2241
+ className: `wandox-console-scene__badge wandox-console-scene__badge--${f.kind}`,
2242
+ children: f.text
2243
+ }
2244
+ )
2245
+ ] }),
2246
+ t.desc && /* @__PURE__ */ e.jsx(
2247
+ "span",
2248
+ {
2249
+ className: "wandox-console-scene__desc",
2250
+ title: t.desc,
2251
+ children: t.desc
2252
+ }
2253
+ ),
2254
+ (y || b.length > 0) && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__tags", children: [
2255
+ y && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-scene__tag wandox-console-scene__tag--featured", children: "精品" }),
2256
+ b.map((v, me) => /* @__PURE__ */ e.jsx(
2257
+ "span",
2258
+ {
2259
+ className: "wandox-console-scene__tag",
2260
+ style: bo(v),
2261
+ children: v.name
2262
+ },
2263
+ `${v.name}-${me}`
2264
+ ))
2265
+ ] })
2266
+ ] })
2267
+ }
2268
+ ),
2269
+ t.video_url && /* @__PURE__ */ e.jsxs(
2270
+ "button",
2271
+ {
2272
+ type: "button",
2273
+ className: "wandox-console-scene__video",
2274
+ "aria-label": `播放${t.title}演示视频`,
2275
+ onClick: (v) => se(v, t),
2276
+ children: [
2277
+ "▶ ",
2278
+ ba(t.video_duration),
2279
+ " 演示"
2280
+ ]
2281
+ }
2282
+ )
2283
+ ] }, t.key);
2284
+ }) }) })
2285
+ ]
2286
+ }
2287
+ )
2288
+ ] }),
2289
+ /* @__PURE__ */ e.jsx(
2290
+ ca,
2291
+ {
2292
+ playbook: ke,
2293
+ onClose: () => F(null)
2294
+ }
2295
+ )
2296
+ ] });
2297
+ }
2298
+ function xo(o) {
2299
+ return o.is_featured === !0 || o.badge === "featured";
2300
+ }
2301
+ function po(o) {
2302
+ return o.badge === "recommend" ? { text: "推荐", kind: "recommend" } : o.badge === "new" ? { text: "New", kind: "new" } : null;
2303
+ }
2304
+ function _o(o) {
2305
+ return Array.isArray(o) ? o.filter(
2306
+ (i) => typeof (i == null ? void 0 : i.name) == "string" && i.name.trim() !== ""
2307
+ ) : [];
2308
+ }
2309
+ function bo(o) {
2310
+ if (!(o.variant !== "soft" || !o.color))
2311
+ return {
2312
+ color: o.color,
2313
+ borderColor: aa(o.color, 0.28),
2314
+ backgroundColor: aa(o.color, 0.08)
2315
+ };
2316
+ }
2317
+ function aa(o, i) {
2318
+ const h = o.trim().replace("#", "");
2319
+ if (!/^[0-9a-fA-F]{6}$/.test(h)) return o;
2320
+ const m = Number.parseInt(h.slice(0, 2), 16), p = Number.parseInt(h.slice(2, 4), 16), j = Number.parseInt(h.slice(4, 6), 16);
2321
+ return `rgba(${m}, ${p}, ${j}, ${i})`;
2322
+ }
2323
+ const fo = [
2324
+ {
2325
+ id: "conversation",
2326
+ title: "智能体",
2327
+ desc: "与智能体自由对话或选择场景执行任务",
2328
+ icon: /* @__PURE__ */ e.jsx(qn, {}),
2329
+ accent: "#4f46e5"
2330
+ },
2331
+ {
2332
+ id: "automation",
2333
+ title: "自动化",
2334
+ desc: "管理与执行自动化流程、定时任务与驾驶舱",
2335
+ icon: /* @__PURE__ */ e.jsx(Ln, {}),
2336
+ accent: "#4f46e5"
2337
+ }
2338
+ ], Oe = {
2339
+ id: "notification",
2340
+ title: "通知配置",
2341
+ icon: /* @__PURE__ */ e.jsx(xa, {}),
2342
+ accent: "#e0730c"
2343
+ };
2344
+ function wo({
2345
+ features: o,
2346
+ onOpenFeature: i,
2347
+ activeId: h
2348
+ }) {
2349
+ return /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-topnav", "aria-label": "控制台顶部导航", children: [
2350
+ /* @__PURE__ */ e.jsx("nav", { className: "wandox-console-topnav__pill", "aria-label": "工作台", children: o.map((m) => {
2351
+ const p = h === m.id;
2352
+ return /* @__PURE__ */ e.jsxs(
2353
+ "button",
2354
+ {
2355
+ type: "button",
2356
+ className: `wandox-console-topnav__pill-btn${p ? " wandox-console-topnav__pill-btn--active" : ""}`,
2357
+ title: m.title,
2358
+ "aria-label": m.title,
2359
+ "aria-current": p ? "page" : void 0,
2360
+ onClick: () => i(m.id),
2361
+ children: [
2362
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__pill-icon", children: m.icon }),
2363
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__pill-text", children: m.title })
2364
+ ]
2365
+ },
2366
+ m.id
2367
+ );
2368
+ }) }),
2369
+ /* @__PURE__ */ e.jsx(
2370
+ "button",
2371
+ {
2372
+ type: "button",
2373
+ className: "wandox-console-topnav__notify",
2374
+ style: {
2375
+ "--notify-accent": Oe.accent
2376
+ },
2377
+ title: Oe.title,
2378
+ "aria-label": Oe.title,
2379
+ onClick: () => i(Oe.id),
2380
+ children: /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__notify-icon", children: Oe.icon })
2381
+ }
2382
+ )
2383
+ ] });
2384
+ }
2385
+ function yo({
2386
+ className: o = "",
2387
+ state: i = "idle"
2388
+ }) {
2389
+ return /* @__PURE__ */ e.jsx(
2390
+ "img",
2391
+ {
2392
+ className: `wandox-console-companion${o ? ` ${o}` : ""}`,
2393
+ "data-state": i,
2394
+ src: Dn,
2395
+ alt: "",
2396
+ "aria-hidden": "true"
2397
+ }
2398
+ );
2399
+ }
2400
+ function na({ fading: o }) {
2401
+ return /* @__PURE__ */ e.jsxs(
2402
+ "div",
2403
+ {
2404
+ className: `wandox-console-init${o ? " wandox-console-init--fading" : ""}`,
2405
+ "aria-hidden": !0,
2406
+ children: [
2407
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__halo wandox-console-init__halo--a" }),
2408
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__halo wandox-console-init__halo--b" }),
2409
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-init__inner", children: [
2410
+ /* @__PURE__ */ e.jsx(
2411
+ yo,
2412
+ {
2413
+ className: "wandox-console-init__companion",
2414
+ state: "thinking"
2415
+ }
2416
+ ),
2417
+ /* @__PURE__ */ e.jsxs("div", { children: [
2418
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__title", children: "正在准备你的控制台" }),
2419
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__subtitle", children: "正在加载智能体与场景数据…" })
2420
+ ] }),
2421
+ /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-init__dots", "aria-hidden": !0, children: [
2422
+ /* @__PURE__ */ e.jsx("span", {}),
2423
+ /* @__PURE__ */ e.jsx("span", {}),
2424
+ /* @__PURE__ */ e.jsx("span", {}),
2425
+ /* @__PURE__ */ e.jsx("span", {}),
2426
+ /* @__PURE__ */ e.jsx("span", {})
2427
+ ] })
2428
+ ] }),
2429
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__footnote", children: "由 Wandox AI 提供动力" })
2430
+ ]
2431
+ }
2432
+ );
2433
+ }
2434
+ function oa({
2435
+ title: o,
2436
+ onBack: i,
2437
+ hideHeader: h = !1,
2438
+ className: m,
2439
+ children: p
2440
+ }) {
2441
+ return /* @__PURE__ */ e.jsxs(
2442
+ "div",
2443
+ {
2444
+ className: `wandox-console-featureview${m ? ` ${m}` : ""}`,
2445
+ children: [
2446
+ !h && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-featureview__bar", children: [
2447
+ /* @__PURE__ */ e.jsxs(
2448
+ "button",
2449
+ {
2450
+ type: "button",
2451
+ className: "wandox-console-featureview__back",
2452
+ onClick: i,
2453
+ children: [
2454
+ /* @__PURE__ */ e.jsx(ma, {}),
2455
+ "返回控制台"
2456
+ ]
2457
+ }
2458
+ ),
2459
+ /* @__PURE__ */ e.jsx("span", { className: "wandox-console-featureview__title", children: o })
2460
+ ] }),
2461
+ /* @__PURE__ */ e.jsx("div", { className: "wandox-console-featureview__body", children: p })
2462
+ ]
2463
+ }
2464
+ );
2465
+ }
2466
+ function vo({
2467
+ agents: o,
2468
+ initialAgentId: i,
2469
+ initialPlaybookId: h,
2470
+ initialPlaybookParams: m,
2471
+ onReady: p
2472
+ } = {}) {
2473
+ const {
2474
+ agents: j,
2475
+ agentLoading: A,
2476
+ selectedAgentId: _,
2477
+ selectedAgent: S,
2478
+ selectAgent: D,
2479
+ ...ne
2480
+ } = Wn({ presetAgents: o, initialAgentId: i }), [Y, le] = a.useState(null), R = a.useRef(null), H = a.useRef(!1), [P, C] = a.useState("home"), [u, F] = a.useState(
2481
+ null
2482
+ ), [ie, O] = a.useState(!1), [$, U] = a.useState(null), [oe, te] = a.useState(""), K = S == null ? void 0 : S.name, V = a.useCallback((x) => {
2483
+ if (R.current) {
2484
+ R.current.showInspectionResults(x);
2485
+ return;
2486
+ }
2487
+ le({ robotName: x });
2488
+ }, []);
2489
+ a.useEffect(() => {
2490
+ p == null || p({ showInspectionResults: V });
2491
+ }, [V, p]), a.useEffect(() => {
2492
+ !Y || R.current || !_ || P === "chat" || (U({
2493
+ agentId: _,
2494
+ agentName: K,
2495
+ playbookParams: {},
2496
+ message: ""
2497
+ }), C("chat"));
2498
+ }, [P, Y, _, K]), a.useEffect(() => {
2499
+ te("");
2500
+ }, [_]);
2501
+ const {
2502
+ playbooks: G,
2503
+ userPlaybooks: J,
2504
+ useMapCategories: re,
2505
+ useMapCards: I,
2506
+ sceneLoading: B,
2507
+ useMapError: ge,
2508
+ reload: xe
2509
+ } = ne, de = a.useMemo(
2510
+ () => re.length > 0 ? re : Hn(G),
2511
+ [re, G]
2512
+ );
2513
+ a.useEffect(() => {
2514
+ if (de.length === 0) return;
2515
+ de.some(
2516
+ (k) => k.key === oe
2517
+ ) || te(de[0].key);
2518
+ }, [de]);
2519
+ const we = a.useRef(!1);
2520
+ a.useEffect(() => {
2521
+ if (we.current || !h || !_ || B)
2522
+ return;
2523
+ const x = j.find(
2524
+ (k) => k.id === _ && ea(k, i)
2525
+ );
2526
+ x && (we.current = !0, U({
2527
+ agentId: _,
2528
+ agentName: x.name,
2529
+ playbookId: h,
2530
+ playbookParams: m || {},
2531
+ message: ""
2532
+ }), C("chat"));
2533
+ }, [
2534
+ B,
2535
+ j,
2536
+ i,
2537
+ h,
2538
+ m,
2539
+ _,
2540
+ K
2541
+ ]), a.useEffect(() => {
2542
+ if (H.current || !i || h || !_ || B)
2543
+ return;
2544
+ const x = j.find(
2545
+ (k) => k.id === _ && ea(k, i)
2546
+ );
2547
+ x && (H.current = !0, U({
2548
+ agentId: x.id,
2549
+ agentName: x.name,
2550
+ playbookParams: {},
2551
+ message: ""
2552
+ }), C("chat"));
2553
+ }, [j, B, i, h, _]);
2554
+ const [pe, Re] = a.useState(!0), [Z, je] = a.useState(!1);
2555
+ a.useEffect(() => {
2556
+ if (!pe || !(!A && j.length > 0 && !!_ && !B)) return;
2557
+ je(!0);
2558
+ const ye = setTimeout(() => Re(!1), 280);
2559
+ return () => clearTimeout(ye);
2560
+ }, [A, j.length, _, B, pe]);
2561
+ const X = a.useCallback(() => {
2562
+ C("home"), F(null), O(!1);
2563
+ }, []), ce = a.useCallback(
2564
+ (x) => {
2565
+ if (x === "conversation") {
2566
+ X();
2567
+ return;
2568
+ }
2569
+ O(!1), F(x);
2570
+ },
2571
+ [X]
2572
+ ), T = (x) => {
2573
+ D(x), C("home");
2574
+ }, q = (x) => {
2575
+ if (x === _) return;
2576
+ const k = j.find((ye) => ye.id === x);
2577
+ D(x), U({
2578
+ agentId: x,
2579
+ agentName: k == null ? void 0 : k.name,
2580
+ playbookParams: {},
2581
+ message: ""
2582
+ });
2583
+ }, E = () => {
2584
+ _ && (U({
2585
+ agentId: _,
2586
+ agentName: K,
2587
+ playbookParams: {},
2588
+ message: ""
2589
+ }), C("chat"));
2590
+ }, ke = (x) => {
2591
+ U({
2592
+ agentId: _,
2593
+ agentName: K,
2594
+ playbookId: x.playbookId,
2595
+ playbookParams: x.playbookParams,
2596
+ message: x.message,
2597
+ attachments: x.attachments
2598
+ }), C("chat");
2599
+ };
2600
+ return P === "chat" && $ ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat-shell", children: [
2601
+ /* @__PURE__ */ e.jsx(
2602
+ uo,
2603
+ {
2604
+ agentId: $.agentId,
2605
+ agentName: $.agentName,
2606
+ playbookId: $.playbookId,
2607
+ playbookParams: $.playbookParams,
2608
+ initialMessage: $.message,
2609
+ initialAttachments: $.attachments,
2610
+ useMapCards: I,
2611
+ useMapCategories: re,
2612
+ playbooks: G,
2613
+ userPlaybooks: J,
2614
+ agents: j,
2615
+ onReady: (x) => {
2616
+ R.current = x, Y && (x.showInspectionResults(Y.robotName), le(null));
2617
+ },
2618
+ onChangeAgent: q,
2619
+ onBack: () => {
2620
+ R.current = null, C("home");
2621
+ },
2622
+ onSelectScene: () => {
2623
+ }
2624
+ },
2625
+ `${$.agentId}:${$.playbookId || "free-chat"}`
2626
+ ),
2627
+ pe && /* @__PURE__ */ e.jsx(na, { fading: Z })
2628
+ ] }) : /* @__PURE__ */ e.jsxs(
2629
+ "div",
2630
+ {
2631
+ className: `wandox-console${ie ? " wandox-console--secondary" : ""}`,
2632
+ children: [
2633
+ pe && /* @__PURE__ */ e.jsx(na, { fading: Z }),
2634
+ !ie && /* @__PURE__ */ e.jsx(
2635
+ wo,
2636
+ {
2637
+ features: fo,
2638
+ activeId: u ?? "conversation",
2639
+ onOpenFeature: ce
2640
+ }
2641
+ ),
2642
+ /* @__PURE__ */ e.jsxs("main", { className: "wandox-console-main", children: [
2643
+ u === "automation" && /* @__PURE__ */ e.jsx(
2644
+ oa,
2645
+ {
2646
+ title: "自动化",
2647
+ onBack: () => F(null),
2648
+ hideHeader: !0,
2649
+ className: "wandox-console-featureview--automation",
2650
+ children: /* @__PURE__ */ e.jsx(
2651
+ Un,
2652
+ {
2653
+ onCockpitEnter: () => O(!0),
2654
+ onCockpitExit: () => O(!1),
2655
+ onInboxEnter: () => O(!0)
2656
+ }
2657
+ )
2658
+ }
2659
+ ),
2660
+ u === "notification" && /* @__PURE__ */ e.jsx(
2661
+ oa,
2662
+ {
2663
+ title: "通知配置",
2664
+ onBack: () => F(null),
2665
+ hideHeader: !0,
2666
+ children: /* @__PURE__ */ e.jsx(Kn, {})
2667
+ }
2668
+ ),
2669
+ !u && /* @__PURE__ */ e.jsx(
2670
+ ho,
2671
+ {
2672
+ useMapCards: I,
2673
+ useMapCategories: de,
2674
+ playbooks: G,
2675
+ selectedCategoryKey: oe,
2676
+ onCategorySelect: te,
2677
+ loading: B,
2678
+ useMapError: ge,
2679
+ onRetry: xe,
2680
+ onStartAnalysis: ke,
2681
+ agents: j,
2682
+ selectedAgentId: _,
2683
+ onAgentSelect: T,
2684
+ onOpenAgentChat: E
2685
+ }
2686
+ )
2687
+ ] })
2688
+ ]
2689
+ }
2690
+ );
2691
+ }
2692
+ export {
2693
+ vo as default
2694
+ };