@wandox/sdk 0.1.39 → 0.1.41

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