wi-chat 0.6.2 → 0.7.1

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 (79) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.d.ts +12 -0
  3. package/dist/core/index.js +921 -342
  4. package/dist/core/useAnswerActions.d.ts +61 -0
  5. package/dist/core/useChat.d.ts +29 -3
  6. package/dist/core/useChatAuth.d.ts +175 -0
  7. package/dist/core/useChatRooms.d.ts +66 -0
  8. package/dist/core/useKeepAlive.d.ts +41 -0
  9. package/dist/core/useLlm.d.ts +73 -0
  10. package/dist/core/useRunningGroups.d.ts +58 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +119 -108
  14. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
  15. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  16. package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
  17. package/dist/parser/answerCom/generic/types.d.ts +75 -0
  18. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
  19. package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
  20. package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
  21. package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
  22. package/dist/parser/answerMeta.d.ts +71 -0
  23. package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
  24. package/dist/parser/history/history.d.ts +9 -0
  25. package/dist/parser/history/index.d.ts +1 -1
  26. package/dist/parser/index.cjs +6 -2
  27. package/dist/parser/index.d.ts +11 -2
  28. package/dist/parser/index.js +591 -366
  29. package/dist/parser/message.d.ts +9 -0
  30. package/dist/parser/runTime.d.ts +29 -0
  31. package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
  32. package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
  33. package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
  34. package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
  35. package/dist/renderers/answerConfig.d.ts +33 -0
  36. package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
  37. package/dist/renderers/index.cjs +6 -1
  38. package/dist/renderers/index.d.ts +14 -0
  39. package/dist/renderers/index.js +1485 -574
  40. package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
  41. package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
  42. package/dist/renderers/outputFile/localFile.d.ts +46 -0
  43. package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
  44. package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
  45. package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
  46. package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
  47. package/dist/renderers/style.css +1 -1
  48. package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
  49. package/dist/request/api.d.ts +121 -1
  50. package/dist/request/client.d.ts +12 -0
  51. package/dist/request/index.cjs +4 -2
  52. package/dist/request/index.d.ts +6 -4
  53. package/dist/request/index.js +780 -179
  54. package/dist/request/login.d.ts +36 -0
  55. package/dist/request/ws.d.ts +11 -86
  56. package/dist/request/wsCore.d.ts +104 -0
  57. package/dist/request/wsSession.d.ts +353 -0
  58. package/dist/right-panel/RightPanelTabs.vue.d.ts +4 -0
  59. package/dist/right-panel/index.cjs +1 -1
  60. package/dist/right-panel/index.d.ts +1 -1
  61. package/dist/right-panel/index.js +598 -499
  62. package/dist/right-panel/style.css +1 -1
  63. package/dist/right-panel/types.d.ts +10 -0
  64. package/dist/tools/index.cjs +5 -5
  65. package/dist/tools/index.d.ts +2 -2
  66. package/dist/tools/index.js +323 -208
  67. package/dist/tools/markdown/index.d.ts +2 -0
  68. package/dist/tools/markdown/interactions.d.ts +39 -0
  69. package/dist/tools/markdown/sanitize.d.ts +6 -0
  70. package/dist/tools/style.css +1 -1
  71. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +1 -1
  72. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  73. package/dist/web-ui/chat/ChatContainer.vue.d.ts +5 -5
  74. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +1 -1
  75. package/dist/web-ui/index.cjs +1 -1
  76. package/dist/web-ui/index.js +1 -1
  77. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +5 -5
  78. package/dist/web-ui/style.css +1 -1
  79. package/package.json +2 -2
@@ -1,150 +1,266 @@
1
1
  import "wi-chat/style.css";
2
- import { defineAsyncComponent as H, defineComponent as j, computed as I, openBlock as i, createElementBlock as u, createElementVNode as e, Fragment as M, renderList as B, createBlock as Z, resolveDynamicComponent as ye, createCommentVNode as V, createTextVNode as me, unref as l, toDisplayString as f, withDirectives as he, vShow as be, getCurrentInstance as ae, inject as re, toValue as z, ref as U, watch as le, onBeforeUnmount as ge, provide as ie, withKeys as se, withModifiers as Q, normalizeClass as D, Teleport as ke, createVNode as xe, Transition as Se, withCtx as $e, reactive as Ie, normalizeStyle as Ce } from "vue";
3
- import { knowledgeStreamParser as Ee, iframePageParser as Oe, outputFileParser as Te, collectClarificationsParser as Ve, hostActionParser as Pe, formatFileSize as Ue, IFRAME_RESIZER_CHILD_SCRIPT as Me, submitClarification as Le, cancelClarification as je } from "wi-chat/parser";
4
- import { createStyleScope as ue, renderMarkdown as ce, downloadTableAsExcel as Ne } from "wi-chat/tools";
5
- import ne from "@iframe-resizer/vue/iframe-resizer.vue";
6
- const Re = [
7
- { ...Ee, component: H(() => Promise.resolve().then(() => at)) },
8
- { ...Oe, component: H(() => Promise.resolve().then(() => es)) },
9
- { ...Te, component: H(() => Promise.resolve().then(() => qt)) },
2
+ import { defineAsyncComponent as Y, defineComponent as D, computed as b, openBlock as n, createElementBlock as l, createElementVNode as t, Fragment as T, renderList as j, createBlock as J, resolveDynamicComponent as Me, createCommentVNode as I, createTextVNode as Ee, ref as q, watch as ae, onBeforeUnmount as le, unref as y, toDisplayString as k, withDirectives as ve, vShow as qe, onMounted as Re, getCurrentInstance as Ie, inject as fe, toValue as ee, provide as ye, withKeys as ie, withModifiers as Q, normalizeClass as X, Teleport as Be, createVNode as ze, Transition as De, withCtx as He, reactive as Ke, normalizeStyle as Ae, vModelText as Oe, renderSlot as We, createStaticVNode as Xe } from "vue";
3
+ import { knowledgeStreamParser as Ge, iframePageParser as Ye, outputFileParser as Ze, presentFilesParser as Je, collectClarificationsParser as Qe, hostActionParser as et, textParser as tt, recordsetParser as st, sqlQueryParser as nt, deviceLastValueParser as at, videoParser as lt, wavParser as ot, cameraParser as rt, scriptParser as it, formatFileSize as ut, OUTPUT_FILE_ANSWER_TYPE as ct, IFRAME_RESIZER_CHILD_SCRIPT as dt, submitClarification as _t, cancelClarification as pt, readAnswerMeta as vt, isValidDuration as ft, formatDuration as yt } from "wi-chat/parser";
4
+ import { bindMarkdownInteractions as me, createStyleScope as we, renderMarkdown as he, MarkdownContent as Te } from "wi-chat/tools";
5
+ import ge from "@iframe-resizer/vue/iframe-resizer.vue";
6
+ const oe = Y(() => Promise.resolve().then(() => Da)), mt = [
7
+ { ...Ge, component: Y(() => Promise.resolve().then(() => Ut)) },
8
+ { ...Ye, component: Y(() => Promise.resolve().then(() => Ks)) },
9
+ { ...Ze, component: Y(() => Promise.resolve().then(() => Ts)) },
10
+ // present_files:一组文件,每个文件复用一张 OutputFile 卡片(共用 provideOutputFileConfig)
11
+ { ...Je, component: Y(() => Promise.resolve().then(() => Vs)) },
10
12
  // 确认卡片(front_reply + action_execute + executor=agent + collect_clarifications):
11
13
  // 解析由内置 collectClarificationsParser 完成,提交/取消经 wi-chat/parser 回传 wait_reply
12
- { ...Ve, component: H(() => Promise.resolve().then(() => Ns)) },
14
+ { ...Qe, component: Y(() => Promise.resolve().then(() => An)) },
13
15
  // 宿主执行过程(front_reply + action_execute + executor=host):宿主执行、进度卡片
14
- { ...Pe, component: H(() => Promise.resolve().then(() => Xs)) }
15
- ], Ae = (r) => {
16
- const a = (c) => {
17
- const t = {};
18
- for (const o of c)
19
- !o.answerType || !o.component || (t[o.answerType] = o.component);
20
- return t;
16
+ { ...et, component: Y(() => Promise.resolve().then(() => qn)) },
17
+ // 新版 reports 中直接下发的通用类型(原生实现,不依赖 Element Plus / ECharts)
18
+ { ...tt, component: Y(() => import("./TextAnswer-PQwV3K7v.js")) },
19
+ { ...st, component: Y(() => Promise.resolve().then(() => oa)) },
20
+ { ...nt, component: Y(() => Promise.resolve().then(() => wa)) },
21
+ { ...at, component: Y(() => Promise.resolve().then(() => Oa)) },
22
+ { ...lt, component: oe },
23
+ { ...ot, component: oe },
24
+ { ...rt, component: oe },
25
+ { ...it, component: oe }
26
+ ], Pe = (o) => {
27
+ const s = (r) => {
28
+ const e = {};
29
+ for (const a of r)
30
+ !a.answerType || !a.component || (e[a.answerType] = a.component);
31
+ return e;
21
32
  };
22
- return { ...a(Re), ...a(r ?? []) };
23
- }, Fe = { class: "flex justify-start" }, De = { class: "ai-answer-bubble" }, Be = {
33
+ return { ...s(mt), ...s(o ?? []) };
34
+ }, wt = { class: "flex justify-start" }, ht = { class: "ai-answer-bubble" }, gt = {
24
35
  key: 0,
25
36
  class: "ai-answer-bubble__error"
26
- }, ze = { class: "ai-answer-bubble__body" }, qe = {
37
+ }, bt = { class: "ai-answer-bubble__body" }, kt = {
27
38
  key: 0,
28
39
  class: "ai-answer-bubble__status"
29
- }, He = {
40
+ }, $t = {
30
41
  key: 2,
31
42
  class: "ai-answer-bubble__status"
32
- }, Ke = {
43
+ }, xt = {
33
44
  key: 3,
34
45
  class: "ai-answer-bubble__loading"
35
- }, Xe = /* @__PURE__ */ j({
46
+ }, St = /* @__PURE__ */ D({
36
47
  __name: "AiAnswerBubble",
37
48
  props: {
38
49
  answer: {},
39
50
  error: { type: Boolean, default: !1 },
40
51
  stopped: { type: Boolean, default: !1 },
41
- contentMap: { default: () => Ae() }
52
+ contentMap: { default: () => Pe() }
42
53
  },
43
- setup(r) {
44
- const a = r, c = I(() => {
45
- var o, d;
46
- return ((d = (o = a.answer) == null ? void 0 : o.answer) == null ? void 0 : d.reports) ?? [];
47
- }), t = I(() => c.value.filter((o) => a.contentMap[o.answer_type]));
48
- return (o, d) => (i(), u("div", Fe, [
49
- e("div", De, [
50
- r.error ? (i(), u("div", Be, "回答加载失败")) : t.value.length ? (i(), u(M, { key: 1 }, [
51
- e("div", ze, [
52
- (i(!0), u(M, null, B(t.value, (v, S) => (i(), Z(ye(r.contentMap[v.answer_type]), {
53
- key: S,
54
- report: v
54
+ setup(o) {
55
+ const s = o, r = b(() => {
56
+ var a, c;
57
+ return ((c = (a = s.answer) == null ? void 0 : a.answer) == null ? void 0 : c.reports) ?? [];
58
+ }), e = b(() => r.value.filter((a) => s.contentMap[a.answer_type]));
59
+ return (a, c) => (n(), l("div", wt, [
60
+ t("div", ht, [
61
+ o.error ? (n(), l("div", gt, "回答加载失败")) : e.value.length ? (n(), l(T, { key: 1 }, [
62
+ t("div", bt, [
63
+ (n(!0), l(T, null, j(e.value, (p, f) => (n(), J(Me(o.contentMap[p.answer_type]), {
64
+ key: f,
65
+ report: p
55
66
  }, null, 8, ["report"]))), 128))
56
67
  ]),
57
- r.stopped ? (i(), u("div", qe, "回答已停止")) : V("", !0)
58
- ], 64)) : r.stopped ? (i(), u("div", He, "回答已停止")) : c.value.length ? V("", !0) : (i(), u("div", Ke, [...d[0] || (d[0] = [
59
- e("span", { class: "ai-answer-bubble__pulse" }, null, -1),
60
- me("正在思考...", -1)
68
+ o.stopped ? (n(), l("div", kt, "回答已停止")) : I("", !0)
69
+ ], 64)) : o.stopped ? (n(), l("div", $t, "回答已停止")) : r.value.length ? I("", !0) : (n(), l("div", xt, [...c[0] || (c[0] = [
70
+ t("span", { class: "ai-answer-bubble__pulse" }, null, -1),
71
+ Ee("正在思考...", -1)
61
72
  ])]))
62
73
  ])
63
74
  ]));
64
75
  }
65
- }), N = (r, a) => {
66
- const c = r.__vccOpts || r;
67
- for (const [t, o] of a)
68
- c[t] = o;
69
- return c;
70
- }, Qs = /* @__PURE__ */ N(Xe, [["__scopeId", "data-v-efad55c8"]]), Ge = ["data-wi-md-scope"], We = ["aria-expanded"], Ye = { class: "deep-thinking__count" }, Je = { class: "deep-thinking__list" }, Ze = { class: "deep-thinking__index" }, Qe = ["innerHTML"], et = /* @__PURE__ */ j({
76
+ }), H = (o, s) => {
77
+ const r = o.__vccOpts || o;
78
+ for (const [e, a] of s)
79
+ r[e] = a;
80
+ return r;
81
+ }, hl = /* @__PURE__ */ H(St, [["__scopeId", "data-v-efad55c8"]]), Ct = ["data-wi-md-scope"], Mt = ["aria-expanded"], Et = { class: "deep-thinking__count" }, It = { class: "deep-thinking__list" }, At = { class: "deep-thinking__index" }, Ot = ["innerHTML"], Tt = /* @__PURE__ */ D({
71
82
  __name: "DeepThinkingSteps",
72
83
  props: {
73
84
  steps: {},
74
85
  expanded: { type: Boolean }
75
86
  },
76
87
  emits: ["update:expanded"],
77
- setup(r, { emit: a }) {
78
- const c = r, t = a, o = { imageDownload: !1, tableDownload: !1 }, d = ue(), v = { ...o, styleScope: d.selector }, S = /* @__PURE__ */ new Map(), g = (h) => {
79
- let w = S.get(h);
80
- return w === void 0 && (S.size > 500 && S.clear(), w = ce(h, v), S.set(h, w)), w;
81
- }, k = I(() => c.steps.map(g));
82
- return (h, w) => k.value.length ? (i(), u("div", {
88
+ setup(o, { emit: s }) {
89
+ const r = o, e = s, a = { imageDownload: !1, tableDownload: !1 }, c = q();
90
+ let p;
91
+ ae(c, (v) => {
92
+ p == null || p(), p = me(v);
93
+ }), le(() => p == null ? void 0 : p());
94
+ const f = we(), x = { ...a, styleScope: f.selector }, _ = /* @__PURE__ */ new Map(), w = (v) => {
95
+ let d = _.get(v);
96
+ return d === void 0 && (_.size > 500 && _.clear(), d = he(v, x), _.set(v, d)), d;
97
+ }, m = b(() => r.steps.map(w));
98
+ return (v, d) => m.value.length ? (n(), l("div", {
83
99
  key: 0,
100
+ ref_key: "rootEl",
101
+ ref: c,
84
102
  class: "deep-thinking",
85
- "data-wi-md-scope": l(d).id
103
+ "data-wi-md-scope": y(f).id
86
104
  }, [
87
- e("button", {
105
+ t("button", {
88
106
  type: "button",
89
107
  class: "deep-thinking__header",
90
- "aria-expanded": r.expanded,
91
- onClick: w[0] || (w[0] = (x) => t("update:expanded", !r.expanded))
108
+ "aria-expanded": o.expanded,
109
+ onClick: d[0] || (d[0] = ($) => e("update:expanded", !o.expanded))
92
110
  }, [
93
- w[1] || (w[1] = e("span", { class: "deep-thinking__title" }, "深度思考", -1)),
94
- e("span", Ye, f(k.value.length), 1),
95
- e("span", null, f(r.expanded ? "收起" : "展开"), 1)
96
- ], 8, We),
97
- he(e("div", Je, [
98
- (i(!0), u(M, null, B(k.value, (x, O) => (i(), u("div", {
99
- key: O,
111
+ d[1] || (d[1] = t("span", { class: "deep-thinking__title" }, "深度思考", -1)),
112
+ t("span", Et, k(m.value.length), 1),
113
+ t("span", null, k(o.expanded ? "收起" : "展开"), 1)
114
+ ], 8, Mt),
115
+ ve(t("div", It, [
116
+ (n(!0), l(T, null, j(m.value, ($, U) => (n(), l("div", {
117
+ key: U,
100
118
  class: "deep-thinking__item"
101
119
  }, [
102
- e("span", Ze, f(O + 1), 1),
103
- e("div", {
104
- class: "markdown-it",
105
- innerHTML: x
106
- }, null, 8, Qe)
120
+ t("span", At, k(U + 1), 1),
121
+ t("div", {
122
+ class: "markdown-it wi-markdown wi-markdown--muted",
123
+ innerHTML: $
124
+ }, null, 8, Ot)
107
125
  ]))), 128))
108
126
  ], 512), [
109
- [be, r.expanded]
127
+ [qe, o.expanded]
110
128
  ])
111
- ], 8, Ge)) : V("", !0);
129
+ ], 8, Ct)) : I("", !0);
112
130
  }
113
- }), en = /* @__PURE__ */ N(et, [["__scopeId", "data-v-de333356"]]), tt = ["data-wi-md-scope"], st = ["innerHTML"], nt = /* @__PURE__ */ j({
131
+ }), gl = /* @__PURE__ */ H(Tt, [["__scopeId", "data-v-6ce85bcf"]]), Pt = ["data-wi-md-scope"], Lt = ["innerHTML"], jt = /* @__PURE__ */ D({
114
132
  __name: "KnowledgeStreamResult",
115
133
  props: {
116
134
  report: {}
117
135
  },
118
- setup(r) {
119
- const a = r, c = { imageDownload: !1, tableDownload: !0 }, t = ue(), o = { ...c, styleScope: t.selector }, d = (k) => {
120
- var O;
121
- const w = k.target.closest(".wi-md-table-download");
122
- if (!w) return;
123
- k.preventDefault(), k.stopPropagation();
124
- const x = (O = w.closest(".wi-md-table-wrap")) == null ? void 0 : O.querySelector("table");
125
- x && Ne(x);
126
- }, v = /* @__PURE__ */ new Map(), S = (k) => {
127
- let h = v.get(k);
128
- return h === void 0 && (v.size > 300 && v.clear(), h = ce(k, o), v.set(k, h)), h;
129
- }, g = I(() => (a.report.values || []).map((k) => S(k.answer || "")));
130
- return (k, h) => (i(), u("div", {
136
+ setup(o) {
137
+ const s = o, r = {}, e = we(), a = { ...r, styleScope: e.selector }, c = q();
138
+ let p;
139
+ Re(() => {
140
+ p = me(c.value);
141
+ }), le(() => p == null ? void 0 : p());
142
+ const f = /* @__PURE__ */ new Map(), x = (w) => {
143
+ let m = f.get(w);
144
+ return m === void 0 && (f.size > 300 && f.clear(), m = he(w, a), f.set(w, m)), m;
145
+ }, _ = b(() => (s.report.values || []).map((w) => x(w.answer || "")));
146
+ return (w, m) => (n(), l("div", {
147
+ ref_key: "rootEl",
148
+ ref: c,
131
149
  class: "knowledge-result",
132
- "data-wi-md-scope": l(t).id,
133
- onClick: d
150
+ "data-wi-md-scope": y(e).id
134
151
  }, [
135
- (i(!0), u(M, null, B(g.value, (w, x) => (i(), u("div", {
136
- key: x,
137
- class: "markdown-it",
138
- innerHTML: w
139
- }, null, 8, st))), 128))
140
- ], 8, tt));
152
+ (n(!0), l(T, null, j(_.value, (v, d) => (n(), l("div", {
153
+ key: d,
154
+ class: "markdown-it wi-markdown",
155
+ innerHTML: v
156
+ }, null, 8, Lt))), 128))
157
+ ], 8, Pt));
141
158
  }
142
- }), ot = /* @__PURE__ */ N(nt, [["__scopeId", "data-v-857bc0d2"]]), at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
159
+ }), Vt = /* @__PURE__ */ H(jt, [["__scopeId", "data-v-8d14c026"]]), Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
143
160
  __proto__: null,
144
- default: ot
145
- }, Symbol.toStringTag, { value: "Module" })), de = Symbol("wi-chat-output-file-config"), tn = (r) => {
146
- ie(de, r);
147
- }, rt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), lt = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), it = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), ut = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), ct = /* @__PURE__ */ new Set(["html", "htm"]), dt = /* @__PURE__ */ new Set([
161
+ default: Vt
162
+ }, Symbol.toStringTag, { value: "Module" })), Ft = /^(?:[a-z][a-z\d+.-]*:|\/\/|#|data:|blob:|about:)/i, be = (o) => {
163
+ const s = o.trim();
164
+ return s ? /^[a-zA-Z]:[\\/]/.test(s) ? !0 : !Ft.test(s) : !1;
165
+ }, Nt = (o) => {
166
+ var r;
167
+ const s = ((r = o == null ? void 0 : o.values) == null ? void 0 : r.file_path) ?? (o == null ? void 0 : o.file_path);
168
+ return typeof s == "string" ? s : "";
169
+ }, ke = (o, s) => {
170
+ const r = o.split(/[?#]/)[0], e = r.replace(/\\/g, "/");
171
+ if (/^[a-zA-Z]:[\\/]/.test(r) || /^~\//.test(e)) return r;
172
+ if (/^\/\/[^/]/.test(e) || /^\/[^/]/.test(e) || e === "/") return e;
173
+ const a = s.replace(/[\\/]+/g, "/"), c = a.lastIndexOf("/"), p = c > 0 ? a.slice(0, c) : c === 0 ? "/" : "", f = (p ? `${p}/${e}` : e).replace(/[\\/]+/g, "/"), x = f.match(/^([a-zA-Z]:\/|\/\/[^/]+\/?|\/)/), _ = x ? x[0] : "", w = f.slice(_.length), m = [];
174
+ for (const v of w.split("/"))
175
+ !v || v === "." || (v === ".." ? m.length && m.pop() : m.push(v));
176
+ return _ + m.join("/");
177
+ }, re = (o, s) => {
178
+ const r = o.match(new RegExp(`\\b${s}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"));
179
+ return r ? r[1] ?? r[2] ?? r[3] ?? "" : void 0;
180
+ }, qt = (o) => {
181
+ const s = [];
182
+ for (const r of o.matchAll(/<script\b[^>]*>/gi)) {
183
+ const e = r[0], a = re(e, "src");
184
+ a && s.push({ match: e, url: a, kind: "script" });
185
+ }
186
+ for (const r of o.matchAll(/<link\b[^>]*>/gi)) {
187
+ const e = r[0], a = (re(e, "rel") ?? "").toLowerCase(), c = re(e, "href");
188
+ c && (a === "stylesheet" || !a ? s.push({ match: e, url: c, kind: "style" }) : a.includes("icon") && s.push({ match: e, url: c, kind: "image" }));
189
+ }
190
+ for (const r of o.matchAll(/<img\b[^>]*>/gi)) {
191
+ const e = r[0], a = re(e, "src");
192
+ a && s.push({ match: e, url: a, kind: "image" });
193
+ }
194
+ return s;
195
+ }, Rt = (o, s) => s === "script" ? o.replace(/<\/script/gi, "<\\/script") : o.replace(/<\/style/gi, "<\\/style"), $e = async (o, s) => {
196
+ const r = await o.arrayBuffer(), e = new Uint8Array(r);
197
+ let a = "";
198
+ const c = 32768;
199
+ for (let f = 0; f < e.length; f += c)
200
+ a += String.fromCharCode(...e.subarray(f, f + c));
201
+ return `data:${s};base64,${(typeof btoa == "function" ? btoa : (f) => Buffer.from(f, "binary").toString("base64"))(a)}`;
202
+ }, xe = (o) => {
203
+ var e;
204
+ const s = ((e = o.split(/[?#]/)[0].split(".").pop()) == null ? void 0 : e.toLowerCase()) ?? "";
205
+ return {
206
+ png: "image/png",
207
+ jpg: "image/jpeg",
208
+ jpeg: "image/jpeg",
209
+ gif: "image/gif",
210
+ webp: "image/webp",
211
+ bmp: "image/bmp",
212
+ svg: "image/svg+xml",
213
+ ico: "image/x-icon",
214
+ avif: "image/avif",
215
+ css: "text/css",
216
+ js: "text/javascript",
217
+ mjs: "text/javascript",
218
+ woff: "font/woff",
219
+ woff2: "font/woff2",
220
+ ttf: "font/ttf"
221
+ }[s] ?? "application/octet-stream";
222
+ }, Bt = async (o, s, r) => {
223
+ const e = await s(o);
224
+ if (!r) return e;
225
+ let a = await e.blob.text();
226
+ const c = qt(a).filter((_) => be(_.url)), p = /* @__PURE__ */ new Map(), f = (_) => {
227
+ let w = p.get(_);
228
+ return w || (w = s(_, o).catch(() => null), p.set(_, w)), w;
229
+ }, x = async (_, w) => {
230
+ let m = _;
231
+ const v = [..._.matchAll(/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*?))\s*\)/gi)];
232
+ for (const d of v) {
233
+ const $ = d[1] ?? d[2] ?? d[3] ?? "";
234
+ if (!$.trim() || !be($)) continue;
235
+ const U = ke($.trim(), w), M = await f(U);
236
+ if (!M) continue;
237
+ const A = M.mimeType || xe(U), B = await $e(M.blob, A);
238
+ m = m.split(d[0]).join(`url("${B}")`);
239
+ }
240
+ return m;
241
+ };
242
+ for (const _ of c) {
243
+ const w = ke(_.url.trim(), o), m = await f(w);
244
+ if (!m) continue;
245
+ const v = m.mimeType || xe(w);
246
+ if (_.kind === "script" || _.kind === "style") {
247
+ let d = await m.blob.text();
248
+ _.kind === "style" && (d = await x(d, w));
249
+ const $ = Rt(d, _.kind), U = _.kind === "script" ? `<script>
250
+ ${$}
251
+ <\/script>` : `<style>
252
+ ${$}
253
+ </style>`;
254
+ a = a.split(_.match).join(U);
255
+ } else {
256
+ const d = await $e(m.blob, v);
257
+ a = a.split(_.match).join(_.match.replace(_.url, d));
258
+ }
259
+ }
260
+ return { blob: new Blob([a], { type: "text/html;charset=utf-8" }), mimeType: "text/html" };
261
+ }, Le = Symbol("wi-chat-output-file-config"), bl = (o) => {
262
+ ye(Le, o);
263
+ }, zt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), Dt = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), Ht = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), Kt = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), Wt = /* @__PURE__ */ new Set(["html", "htm"]), Xt = /* @__PURE__ */ new Set([
148
264
  "js",
149
265
  "mjs",
150
266
  "cjs",
@@ -170,7 +286,7 @@ const Re = [
170
286
  "css",
171
287
  "scss",
172
288
  "less"
173
- ]), _t = /* @__PURE__ */ new Set([
289
+ ]), Gt = /* @__PURE__ */ new Set([
174
290
  "txt",
175
291
  "text",
176
292
  "md",
@@ -186,179 +302,197 @@ const Re = [
186
302
  "env",
187
303
  "toml",
188
304
  "sql"
189
- ]), pt = 20, F = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), ft = (r, a) => {
190
- if (!F.has(r) && F.size >= pt) {
191
- const c = F.keys().next().value;
192
- c !== void 0 && F.delete(c);
305
+ ]), Yt = 20, ne = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map(), Zt = (o, s) => {
306
+ if (!ne.has(o) && ne.size >= Yt) {
307
+ const r = ne.keys().next().value;
308
+ r !== void 0 && ne.delete(r);
193
309
  }
194
- F.set(r, a);
195
- }, vt = (r) => {
196
- const a = r.lastIndexOf(".");
197
- return a >= 0 ? r.slice(a + 1).toLowerCase() : "";
198
- }, wt = (r) => rt.has(r) ? "image" : r === "pdf" ? "pdf" : ct.has(r) ? "html" : lt.has(r) ? "audio" : it.has(r) ? "video" : ut.has(r) ? "office" : dt.has(r) ? "code" : _t.has(r) ? "text" : "unknown", yt = (r) => {
199
- const a = ae() ? re(de, {}) : {}, c = I(() => {
200
- var C;
201
- const _ = z(r);
202
- return ((C = _ == null ? void 0 : _.values) == null ? void 0 : C.file_id) ?? (_ == null ? void 0 : _.file_id) ?? "";
203
- }), t = I(() => {
204
- var C;
205
- const _ = z(r);
206
- return ((C = _ == null ? void 0 : _.values) == null ? void 0 : C.file_name) ?? (_ == null ? void 0 : _.file_name) ?? "未命名文件";
207
- }), o = I(() => vt(t.value)), d = I(() => wt(o.value)), v = U(!1), S = U(!1), g = U(""), k = U(!1), h = U(""), w = U(""), x = U(null), O = I(() => x.value ? Ue(x.value.size) : ""), T = () => {
208
- w.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(w.value), w.value = "";
209
- }, R = async () => {
210
- const _ = c.value, C = t.value;
211
- if (!_) throw new Error("缺少文件 id,无法加载文件");
212
- const E = _ || C, G = F.get(E);
213
- if (G) return G;
214
- let A = ee.get(E);
215
- return A || (A = (async () => {
216
- var W, Y;
217
- if (a.loadFile) return a.loadFile(_);
218
- const L = (W = a.getFileUrl) == null ? void 0 : W.call(a, _);
219
- if (!L) throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");
220
- const y = await fetch(L, { headers: (Y = a.getHeaders) == null ? void 0 : Y.call(a) });
221
- if (!y.ok) throw new Error(`文件加载失败(HTTP ${y.status})`);
222
- return y.blob();
223
- })().then((L) => (ft(E, L), L)).finally(() => ee.delete(E)), ee.set(E, A)), A;
224
- }, b = async () => {
225
- S.value = !0, g.value = "", k.value = !1, h.value = "", T();
310
+ ne.set(o, s);
311
+ }, Jt = (o) => {
312
+ const s = o.lastIndexOf(".");
313
+ return s >= 0 ? o.slice(s + 1).toLowerCase() : "";
314
+ }, Qt = (o) => zt.has(o) ? "image" : o === "pdf" ? "pdf" : Wt.has(o) ? "html" : Dt.has(o) ? "audio" : Ht.has(o) ? "video" : Kt.has(o) ? "office" : Xt.has(o) ? "code" : Gt.has(o) ? "text" : "unknown", je = (o) => {
315
+ const s = Ie() ? fe(Le, {}) : {}, r = b(() => {
316
+ var F;
317
+ const S = ee(o);
318
+ return ((F = S == null ? void 0 : S.values) == null ? void 0 : F.file_id) ?? (S == null ? void 0 : S.file_id) ?? "";
319
+ }), e = b(() => {
320
+ var F;
321
+ const S = ee(o);
322
+ return ((F = S == null ? void 0 : S.values) == null ? void 0 : F.file_name) ?? (S == null ? void 0 : S.file_name) ?? "未命名文件";
323
+ }), a = b(() => Nt(ee(o))), c = b(() => s.readLocalFile ? typeof s.isLocalSupported == "function" ? !!s.isLocalSupported() : !0 : !1), p = b(
324
+ () => c.value && a.value ? "local" : "remote"
325
+ ), f = b(() => Jt(e.value)), x = b(() => Qt(f.value)), _ = q(!1), w = q(!1), m = q(""), v = q(!1), d = q(""), $ = q(""), U = q(null), M = b(() => U.value ? ut(U.value.size) : ""), A = () => {
326
+ $.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL($.value), $.value = "";
327
+ }, B = async () => {
328
+ const S = r.value, F = e.value, W = a.value, O = p.value === "local", Z = O ? `local_${W}` : S ? `remote_${S}` : `file_${F}`, g = ne.get(Z);
329
+ if (g) return g;
330
+ let V = ue.get(Z);
331
+ return V || (V = (async () => {
332
+ var i, u;
333
+ if (O)
334
+ return (await Bt(
335
+ W,
336
+ s.readLocalFile,
337
+ x.value === "html"
338
+ )).blob;
339
+ if (s.loadFile) {
340
+ if (!S) throw new Error("缺少文件 id,无法加载文件");
341
+ return s.loadFile(S);
342
+ }
343
+ const L = S ? (i = s.getFileUrl) == null ? void 0 : i.call(s, S) : void 0;
344
+ if (!L) throw new Error("未配置文件加载方式(请提供 loadFile / getFileUrl,桌面端本地文件需提供 readLocalFile)");
345
+ const C = await fetch(L, { headers: (u = s.getHeaders) == null ? void 0 : u.call(s) });
346
+ if (!C.ok) throw new Error(`文件加载失败(HTTP ${C.status})`);
347
+ return C.blob();
348
+ })().then((L) => (Zt(Z, L), L)).finally(() => ue.delete(Z)), ue.set(Z, V)), V;
349
+ }, G = async () => {
350
+ w.value = !0, m.value = "", v.value = !1, d.value = "", A();
226
351
  try {
227
- const _ = await R();
228
- x.value = _;
229
- const C = d.value;
230
- if (C === "office") {
231
- k.value = !0;
352
+ const S = await B();
353
+ U.value = S;
354
+ const F = x.value;
355
+ if (F === "office") {
356
+ v.value = !0;
232
357
  return;
233
358
  }
234
- if (C === "image" || C === "pdf" || C === "audio" || C === "video") {
235
- typeof URL < "u" && typeof URL.createObjectURL == "function" && (w.value = URL.createObjectURL(_));
359
+ if (F === "image" || F === "pdf" || F === "audio" || F === "video") {
360
+ typeof URL < "u" && typeof URL.createObjectURL == "function" && ($.value = URL.createObjectURL(S));
236
361
  return;
237
362
  }
238
- const E = await _.text();
239
- if (E.includes("\0")) {
240
- k.value = !0;
363
+ const W = await S.text();
364
+ if (W.includes("\0")) {
365
+ v.value = !0;
241
366
  return;
242
367
  }
243
- h.value = E;
244
- } catch (_) {
245
- g.value = _ instanceof Error ? _.message : String(_);
368
+ d.value = W;
369
+ } catch (S) {
370
+ m.value = S instanceof Error ? S.message : String(S);
246
371
  } finally {
247
- S.value = !1;
248
- }
249
- }, $ = async () => {
250
- if (a.openPreview) {
251
- a.openPreview({
252
- fileId: c.value,
253
- fileName: t.value,
254
- loadFile: R,
255
- download: X
256
- });
257
- return;
372
+ w.value = !1;
258
373
  }
259
- v.value = !0, await b();
260
- }, K = () => {
261
- v.value = !1, S.value = !1, g.value = "", k.value = !1, h.value = "", T();
262
- }, X = async () => {
263
- try {
264
- const _ = x.value ?? await R();
265
- if (x.value = _, a.downloadFile) {
266
- a.downloadFile({ fileId: c.value, fileName: t.value, blob: _ });
374
+ }, P = async () => {
375
+ var S;
376
+ if (!((S = s.isAccessBlocked) != null && S.call(s))) {
377
+ if (s.openPreview) {
378
+ s.openPreview({
379
+ fileId: r.value,
380
+ fileName: e.value,
381
+ filePath: a.value,
382
+ source: p.value,
383
+ loadFile: B,
384
+ download: K
385
+ });
267
386
  return;
268
387
  }
269
- if (typeof document > "u" || typeof URL > "u") return;
270
- const C = URL.createObjectURL(_), E = document.createElement("a");
271
- E.href = C, E.download = t.value, document.body.appendChild(E), E.click(), E.remove(), URL.revokeObjectURL(C);
272
- } catch (_) {
273
- g.value = _ instanceof Error ? _.message : String(_), !v.value && !a.openPreview && (v.value = !0);
388
+ _.value = !0, await G();
274
389
  }
275
- }, q = (_) => {
276
- _.key === "Escape" && v.value && K();
390
+ }, R = () => {
391
+ _.value = !1, w.value = !1, m.value = "", v.value = !1, d.value = "", A();
392
+ }, K = async () => {
393
+ var S;
394
+ if (!((S = s.isAccessBlocked) != null && S.call(s)))
395
+ try {
396
+ const F = U.value ?? await B();
397
+ if (U.value = F, s.downloadFile) {
398
+ s.downloadFile({ fileId: r.value, fileName: e.value, blob: F });
399
+ return;
400
+ }
401
+ if (typeof document > "u" || typeof URL > "u") return;
402
+ const W = URL.createObjectURL(F), O = document.createElement("a");
403
+ O.href = W, O.download = e.value, document.body.appendChild(O), O.click(), O.remove(), URL.revokeObjectURL(W);
404
+ } catch (F) {
405
+ m.value = F instanceof Error ? F.message : String(F), !_.value && !s.openPreview && (_.value = !0);
406
+ }
407
+ }, N = (S) => {
408
+ S.key === "Escape" && _.value && R();
277
409
  };
278
- return le(v, (_) => {
279
- typeof window > "u" || (_ ? window.addEventListener("keydown", q) : window.removeEventListener("keydown", q));
280
- }), ge(() => {
281
- typeof window < "u" && window.removeEventListener("keydown", q), T();
410
+ return ae(_, (S) => {
411
+ typeof window > "u" || (S ? window.addEventListener("keydown", N) : window.removeEventListener("keydown", N));
412
+ }), le(() => {
413
+ typeof window < "u" && window.removeEventListener("keydown", N), A();
282
414
  }), {
283
- fileId: c,
284
- fileName: t,
285
- extension: o,
286
- previewKind: d,
287
- fileSize: O,
288
- visible: v,
289
- loading: S,
290
- error: g,
291
- unsupported: k,
292
- textContent: h,
293
- objectUrl: w,
294
- open: $,
295
- close: K,
296
- download: X
415
+ fileId: r,
416
+ fileName: e,
417
+ filePath: a,
418
+ source: p,
419
+ extension: f,
420
+ previewKind: x,
421
+ fileSize: M,
422
+ visible: _,
423
+ loading: w,
424
+ error: m,
425
+ unsupported: v,
426
+ textContent: d,
427
+ objectUrl: $,
428
+ open: P,
429
+ close: R,
430
+ download: K
297
431
  };
298
- }, mt = { class: "wi-output-file" }, ht = ["aria-label"], bt = { class: "wi-output-file__info" }, gt = ["title"], kt = { class: "wi-output-file__meta" }, xt = { class: "wi-output-file__ext" }, St = {
432
+ }, es = { class: "wi-output-file" }, ts = ["aria-label"], ss = { class: "wi-output-file__info" }, ns = ["title"], as = { class: "wi-output-file__meta" }, ls = { class: "wi-output-file__ext" }, os = {
299
433
  key: 0,
300
434
  class: "wi-output-file__size"
301
- }, $t = ["aria-label"], It = { class: "wi-output-file-drawer__head" }, Ct = { class: "wi-output-file-drawer__title" }, Et = { class: "wi-output-file-drawer__ext" }, Ot = ["title"], Tt = {
435
+ }, rs = ["aria-label"], is = { class: "wi-output-file-drawer__head" }, us = { class: "wi-output-file-drawer__title" }, cs = { class: "wi-output-file-drawer__ext" }, ds = ["title"], _s = {
302
436
  key: 0,
303
437
  class: "wi-output-file-drawer__size"
304
- }, Vt = { class: "wi-output-file-drawer__actions" }, Pt = { class: "wi-output-file-drawer__body" }, Ut = {
438
+ }, ps = { class: "wi-output-file-drawer__actions" }, vs = { class: "wi-output-file-drawer__body" }, fs = {
305
439
  key: 0,
306
440
  class: "wi-output-file-drawer__state"
307
- }, Mt = {
441
+ }, ys = {
308
442
  key: 1,
309
443
  class: "wi-output-file-drawer__state is-error"
310
- }, Lt = {
444
+ }, ms = {
311
445
  key: 2,
312
446
  class: "wi-output-file-drawer__state"
313
- }, jt = ["src", "alt"], Nt = ["src", "title"], Rt = ["srcdoc", "title"], At = ["src"], Ft = ["src"], Dt = {
447
+ }, ws = ["src", "alt"], hs = ["src", "title"], gs = ["srcdoc", "title"], bs = ["src"], ks = ["src"], $s = {
314
448
  key: 8,
315
449
  class: "wi-output-file-drawer__text"
316
- }, Bt = /* @__PURE__ */ j({
450
+ }, xs = /* @__PURE__ */ D({
317
451
  __name: "OutputFile",
318
452
  props: {
319
453
  report: {}
320
454
  },
321
- setup(r) {
322
- const a = r, {
323
- fileName: c,
324
- extension: t,
325
- previewKind: o,
326
- fileSize: d,
327
- visible: v,
328
- loading: S,
329
- error: g,
330
- unsupported: k,
331
- textContent: h,
332
- objectUrl: w,
333
- open: x,
334
- close: O,
335
- download: T
336
- } = yt(() => a.report);
337
- return (R, b) => (i(), u("div", mt, [
338
- e("div", {
455
+ setup(o) {
456
+ const s = o, {
457
+ fileName: r,
458
+ extension: e,
459
+ previewKind: a,
460
+ fileSize: c,
461
+ visible: p,
462
+ loading: f,
463
+ error: x,
464
+ unsupported: _,
465
+ textContent: w,
466
+ objectUrl: m,
467
+ open: v,
468
+ close: d,
469
+ download: $
470
+ } = je(() => s.report);
471
+ return (U, M) => (n(), l("div", es, [
472
+ t("div", {
339
473
  class: "wi-output-file__card",
340
474
  role: "button",
341
475
  tabindex: "0",
342
- "aria-label": `预览文件 ${l(c)}`,
343
- onClick: b[1] || (b[1] = //@ts-ignore
344
- (...$) => l(x) && l(x)(...$)),
476
+ "aria-label": `预览文件 ${y(r)}`,
477
+ onClick: M[1] || (M[1] = //@ts-ignore
478
+ (...A) => y(v) && y(v)(...A)),
345
479
  onKeydown: [
346
- b[2] || (b[2] = se(
480
+ M[2] || (M[2] = ie(
347
481
  //@ts-ignore
348
- (...$) => l(x) && l(x)(...$),
482
+ (...A) => y(v) && y(v)(...A),
349
483
  ["enter"]
350
484
  )),
351
- b[3] || (b[3] = se(Q(
485
+ M[3] || (M[3] = ie(Q(
352
486
  //@ts-ignore
353
- (...$) => l(x) && l(x)(...$),
487
+ (...A) => y(v) && y(v)(...A),
354
488
  ["prevent"]
355
489
  ), ["space"]))
356
490
  ]
357
491
  }, [
358
- e("span", {
359
- class: D(["wi-output-file__icon", `is-${l(o)}`])
360
- }, [...b[9] || (b[9] = [
361
- e("svg", {
492
+ t("span", {
493
+ class: X(["wi-output-file__icon", `is-${y(a)}`])
494
+ }, [...M[9] || (M[9] = [
495
+ t("svg", {
362
496
  viewBox: "0 0 24 24",
363
497
  fill: "none",
364
498
  stroke: "currentColor",
@@ -366,32 +500,32 @@ const Re = [
366
500
  "stroke-linecap": "round",
367
501
  "stroke-linejoin": "round"
368
502
  }, [
369
- e("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
370
- e("path", { d: "M14 2.5v4h4" })
503
+ t("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
504
+ t("path", { d: "M14 2.5v4h4" })
371
505
  ], -1)
372
506
  ])], 2),
373
- e("div", bt, [
374
- e("div", {
507
+ t("div", ss, [
508
+ t("div", {
375
509
  class: "wi-output-file__name",
376
- title: l(c)
377
- }, f(l(c)), 9, gt),
378
- e("div", kt, [
379
- e("span", xt, f(l(t).toUpperCase() || "FILE"), 1),
380
- l(d) ? (i(), u("span", St, f(l(d)), 1)) : V("", !0)
510
+ title: y(r)
511
+ }, k(y(r)), 9, ns),
512
+ t("div", as, [
513
+ t("span", ls, k(y(e).toUpperCase() || "FILE"), 1),
514
+ y(c) ? (n(), l("span", os, k(y(c)), 1)) : I("", !0)
381
515
  ])
382
516
  ]),
383
- e("button", {
517
+ t("button", {
384
518
  type: "button",
385
519
  class: "wi-output-file__download",
386
520
  title: "下载文件",
387
521
  "aria-label": "下载文件",
388
- onClick: b[0] || (b[0] = Q(
522
+ onClick: M[0] || (M[0] = Q(
389
523
  //@ts-ignore
390
- (...$) => l(T) && l(T)(...$),
524
+ (...A) => y($) && y($)(...A),
391
525
  ["stop"]
392
526
  ))
393
- }, [...b[10] || (b[10] = [
394
- e("svg", {
527
+ }, [...M[10] || (M[10] = [
528
+ t("svg", {
395
529
  viewBox: "0 0 24 24",
396
530
  fill: "none",
397
531
  stroke: "currentColor",
@@ -399,530 +533,1307 @@ const Re = [
399
533
  "stroke-linecap": "round",
400
534
  "stroke-linejoin": "round"
401
535
  }, [
402
- e("path", { d: "M12 3v12" }),
403
- e("path", { d: "m7 10 5 5 5-5" }),
404
- e("path", { d: "M5 21h14" })
536
+ t("path", { d: "M12 3v12" }),
537
+ t("path", { d: "m7 10 5 5 5-5" }),
538
+ t("path", { d: "M5 21h14" })
405
539
  ], -1)
406
540
  ])])
407
- ], 40, ht),
408
- (i(), Z(ke, { to: "body" }, [
409
- xe(Se, { name: "wi-output-file-fade" }, {
410
- default: $e(() => [
411
- l(v) ? (i(), u("div", {
541
+ ], 40, ts),
542
+ (n(), J(Be, { to: "body" }, [
543
+ ze(De, { name: "wi-output-file-fade" }, {
544
+ default: He(() => [
545
+ y(p) ? (n(), l("div", {
412
546
  key: 0,
413
547
  class: "wi-output-file-mask",
414
- onClick: b[8] || (b[8] = Q(
548
+ onClick: M[8] || (M[8] = Q(
415
549
  //@ts-ignore
416
- (...$) => l(O) && l(O)(...$),
550
+ (...A) => y(d) && y(d)(...A),
417
551
  ["self"]
418
552
  ))
419
553
  }, [
420
- e("aside", {
554
+ t("aside", {
421
555
  class: "wi-output-file-drawer",
422
556
  role: "dialog",
423
557
  "aria-modal": "true",
424
- "aria-label": `预览文件 ${l(c)}`
558
+ "aria-label": `预览文件 ${y(r)}`
425
559
  }, [
426
- e("header", It, [
427
- e("div", Ct, [
428
- e("span", Et, f(l(t).toUpperCase() || "FILE"), 1),
429
- e("div", {
560
+ t("header", is, [
561
+ t("div", us, [
562
+ t("span", cs, k(y(e).toUpperCase() || "FILE"), 1),
563
+ t("div", {
430
564
  class: "wi-output-file-drawer__name",
431
- title: l(c)
432
- }, f(l(c)), 9, Ot),
433
- l(d) ? (i(), u("div", Tt, f(l(d)), 1)) : V("", !0)
565
+ title: y(r)
566
+ }, k(y(r)), 9, ds),
567
+ y(c) ? (n(), l("div", _s, k(y(c)), 1)) : I("", !0)
434
568
  ]),
435
- e("div", Vt, [
436
- e("button", {
569
+ t("div", ps, [
570
+ t("button", {
437
571
  type: "button",
438
572
  class: "wi-output-file-drawer__btn",
439
- onClick: b[4] || (b[4] = //@ts-ignore
440
- (...$) => l(T) && l(T)(...$))
573
+ onClick: M[4] || (M[4] = //@ts-ignore
574
+ (...A) => y($) && y($)(...A))
441
575
  }, "下载"),
442
- e("button", {
576
+ t("button", {
443
577
  type: "button",
444
578
  class: "wi-output-file-drawer__btn wi-output-file-drawer__btn--close",
445
579
  title: "关闭",
446
580
  "aria-label": "关闭预览",
447
- onClick: b[5] || (b[5] = //@ts-ignore
448
- (...$) => l(O) && l(O)(...$))
581
+ onClick: M[5] || (M[5] = //@ts-ignore
582
+ (...A) => y(d) && y(d)(...A))
449
583
  }, " × ")
450
584
  ])
451
585
  ]),
452
- e("div", Pt, [
453
- l(S) ? (i(), u("div", Ut, "文件加载中…")) : l(g) ? (i(), u("div", Mt, [
454
- e("p", null, f(l(g)), 1),
455
- e("button", {
586
+ t("div", vs, [
587
+ y(f) ? (n(), l("div", fs, "文件加载中…")) : y(x) ? (n(), l("div", ys, [
588
+ t("p", null, k(y(x)), 1),
589
+ t("button", {
456
590
  type: "button",
457
591
  class: "wi-output-file-drawer__btn",
458
- onClick: b[6] || (b[6] = //@ts-ignore
459
- (...$) => l(T) && l(T)(...$))
592
+ onClick: M[6] || (M[6] = //@ts-ignore
593
+ (...A) => y($) && y($)(...A))
460
594
  }, "下载文件")
461
- ])) : l(k) ? (i(), u("div", Lt, [
462
- b[11] || (b[11] = e("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)),
463
- e("button", {
595
+ ])) : y(_) ? (n(), l("div", ms, [
596
+ M[11] || (M[11] = t("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)),
597
+ t("button", {
464
598
  type: "button",
465
599
  class: "wi-output-file-drawer__btn",
466
- onClick: b[7] || (b[7] = //@ts-ignore
467
- (...$) => l(T) && l(T)(...$))
600
+ onClick: M[7] || (M[7] = //@ts-ignore
601
+ (...A) => y($) && y($)(...A))
468
602
  }, "下载文件")
469
- ])) : l(o) === "image" && l(w) ? (i(), u("img", {
603
+ ])) : y(a) === "image" && y(m) ? (n(), l("img", {
470
604
  key: 3,
471
605
  class: "wi-output-file-drawer__image",
472
- src: l(w),
473
- alt: l(c)
474
- }, null, 8, jt)) : l(o) === "pdf" && l(w) ? (i(), u("iframe", {
606
+ src: y(m),
607
+ alt: y(r)
608
+ }, null, 8, ws)) : y(a) === "pdf" && y(m) ? (n(), l("iframe", {
475
609
  key: 4,
476
610
  class: "wi-output-file-drawer__frame",
477
- src: l(w),
478
- title: l(c)
479
- }, null, 8, Nt)) : l(o) === "html" ? (i(), u("iframe", {
611
+ src: y(m),
612
+ title: y(r)
613
+ }, null, 8, hs)) : y(a) === "html" ? (n(), l("iframe", {
480
614
  key: 5,
481
615
  class: "wi-output-file-drawer__frame",
482
- srcdoc: l(h),
616
+ srcdoc: y(w),
483
617
  sandbox: "allow-scripts allow-forms allow-modals",
484
- title: l(c)
485
- }, null, 8, Rt)) : l(o) === "audio" && l(w) ? (i(), u("audio", {
618
+ title: y(r)
619
+ }, null, 8, gs)) : y(a) === "audio" && y(m) ? (n(), l("audio", {
486
620
  key: 6,
487
621
  class: "wi-output-file-drawer__media",
488
- src: l(w),
622
+ src: y(m),
489
623
  controls: ""
490
- }, null, 8, At)) : l(o) === "video" && l(w) ? (i(), u("video", {
624
+ }, null, 8, bs)) : y(a) === "video" && y(m) ? (n(), l("video", {
491
625
  key: 7,
492
626
  class: "wi-output-file-drawer__media",
493
- src: l(w),
627
+ src: y(m),
494
628
  controls: ""
495
- }, null, 8, Ft)) : (i(), u("pre", Dt, f(l(h)), 1))
629
+ }, null, 8, ks)) : (n(), l("pre", $s, k(y(w)), 1))
496
630
  ])
497
- ], 8, $t)
498
- ])) : V("", !0)
631
+ ], 8, rs)
632
+ ])) : I("", !0)
499
633
  ]),
500
634
  _: 1
501
635
  })
502
636
  ]))
503
637
  ]));
504
638
  }
505
- }), zt = /* @__PURE__ */ N(Bt, [["__scopeId", "data-v-f61a91b5"]]), qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
639
+ }), Ss = /* @__PURE__ */ H(xs, [["__scopeId", "data-v-f96eaa7a"]]), Cs = { class: "wi-output-file-link" }, Ms = ["title", "aria-label"], Es = { class: "wi-output-file-link__name" }, Is = ["aria-label"], As = /* @__PURE__ */ D({
640
+ __name: "OutputFileLink",
641
+ props: {
642
+ report: {}
643
+ },
644
+ setup(o) {
645
+ const s = o, { fileName: r, open: e, download: a } = je(() => s.report);
646
+ return (c, p) => (n(), l("span", Cs, [
647
+ t("a", {
648
+ class: "wi-output-file-link__anchor",
649
+ role: "link",
650
+ tabindex: "0",
651
+ title: `预览文件 ${y(r)}`,
652
+ "aria-label": `预览文件 ${y(r)}`,
653
+ onClick: p[0] || (p[0] = Q((f) => y(e)(), ["prevent"])),
654
+ onKeydown: [
655
+ p[1] || (p[1] = ie(Q((f) => y(e)(), ["prevent"]), ["enter"])),
656
+ p[2] || (p[2] = ie(Q((f) => y(e)(), ["prevent"]), ["space"]))
657
+ ]
658
+ }, [
659
+ p[4] || (p[4] = t("svg", {
660
+ class: "wi-output-file-link__icon",
661
+ viewBox: "0 0 24 24",
662
+ fill: "none",
663
+ stroke: "currentColor",
664
+ "stroke-width": "1.8",
665
+ "stroke-linecap": "round",
666
+ "stroke-linejoin": "round",
667
+ "aria-hidden": "true"
668
+ }, [
669
+ t("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
670
+ t("path", { d: "M14 2.5v4h4" })
671
+ ], -1)),
672
+ t("span", Es, k(y(r)), 1)
673
+ ], 40, Ms),
674
+ t("button", {
675
+ type: "button",
676
+ class: "wi-output-file-link__download",
677
+ title: "下载文件",
678
+ "aria-label": `下载文件 ${y(r)}`,
679
+ onClick: p[3] || (p[3] = Q((f) => y(a)(), ["stop"]))
680
+ }, [...p[5] || (p[5] = [
681
+ t("svg", {
682
+ viewBox: "0 0 24 24",
683
+ fill: "none",
684
+ stroke: "currentColor",
685
+ "stroke-width": "1.8",
686
+ "stroke-linecap": "round",
687
+ "stroke-linejoin": "round",
688
+ "aria-hidden": "true"
689
+ }, [
690
+ t("path", { d: "M12 3v12" }),
691
+ t("path", { d: "M7 11l5 5 5-5" }),
692
+ t("path", { d: "M4 20h16" })
693
+ ], -1)
694
+ ])], 8, Is)
695
+ ]));
696
+ }
697
+ }), Os = /* @__PURE__ */ H(As, [["__scopeId", "data-v-d9a5a149"]]), Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
698
+ __proto__: null,
699
+ default: Os
700
+ }, Symbol.toStringTag, { value: "Module" })), Ps = { class: "wi-present-files" }, Ls = /* @__PURE__ */ D({
701
+ __name: "PresentFiles",
702
+ props: {
703
+ report: {}
704
+ },
705
+ setup(o) {
706
+ const s = o, r = b(() => {
707
+ var c;
708
+ const a = (c = s.report) == null ? void 0 : c.values;
709
+ return Array.isArray(a == null ? void 0 : a.files) ? a.files : [];
710
+ }), e = (a) => ({
711
+ answer_type: ct,
712
+ values: a
713
+ });
714
+ return (a, c) => (n(), l("div", Ps, [
715
+ (n(!0), l(T, null, j(r.value, (p, f) => (n(), J(Ss, {
716
+ key: `${p.file_id || ""}-${p.file_path || ""}-${f}`,
717
+ report: e(p)
718
+ }, null, 8, ["report"]))), 128))
719
+ ]));
720
+ }
721
+ }), js = /* @__PURE__ */ H(Ls, [["__scopeId", "data-v-9e9518be"]]), Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
506
722
  __proto__: null,
507
- default: zt
508
- }, Symbol.toStringTag, { value: "Module" })), Ht = () => {
509
- var a, c;
510
- const r = (c = (a = window == null ? void 0 : window.globalConfig) == null ? void 0 : a.WebApiUrl) == null ? void 0 : c.MainUrl;
511
- return typeof r == "string" ? r : "";
512
- }, Kt = () => window.location.origin + window.location.pathname, te = "access-session", Xt = () => {
513
- const r = window.location.pathname.split("/").filter((a) => !!a).join("-");
514
- return r ? `${r}-` : "";
515
- }, Gt = () => {
516
- const r = `${Xt()}${te}`, a = [];
517
- for (let t = 0; t < localStorage.length; t++) {
518
- const o = localStorage.key(t);
519
- !o || !o.endsWith(te) || o.slice(0, o.lastIndexOf(":")) !== "wi admin" && (o.endsWith(`x-${te}`) || a.push(o));
723
+ default: js
724
+ }, Symbol.toStringTag, { value: "Module" })), Us = () => {
725
+ var s, r;
726
+ const o = (r = (s = window == null ? void 0 : window.globalConfig) == null ? void 0 : s.WebApiUrl) == null ? void 0 : r.MainUrl;
727
+ return typeof o == "string" ? o : "";
728
+ }, Fs = () => window.location.origin + window.location.pathname, ce = "access-session", Ns = () => {
729
+ const o = window.location.pathname.split("/").filter((s) => !!s).join("-");
730
+ return o ? `${o}-` : "";
731
+ }, qs = () => {
732
+ const o = `${Ns()}${ce}`, s = [];
733
+ for (let e = 0; e < localStorage.length; e++) {
734
+ const a = localStorage.key(e);
735
+ !a || !a.endsWith(ce) || a.slice(0, a.lastIndexOf(":")) !== "wi admin" && (a.endsWith(`x-${ce}`) || s.push(a));
520
736
  }
521
- const c = a.find((t) => t.endsWith(r)) ?? a[0];
522
- if (!c) return "";
737
+ const r = s.find((e) => e.endsWith(o)) ?? s[0];
738
+ if (!r) return "";
523
739
  try {
524
- const t = localStorage.getItem(c);
525
- if (!t || t === "undefined") return "";
526
- const o = JSON.parse(t);
527
- return o == null ? "" : String(o);
740
+ const e = localStorage.getItem(r);
741
+ if (!e || e === "undefined") return "";
742
+ const a = JSON.parse(e);
743
+ return a == null ? "" : String(a);
528
744
  } catch {
529
745
  return "";
530
746
  }
531
- }, _e = Symbol("wi-chat-iframe-page-config"), sn = (r) => {
532
- ie(_e, r);
533
- }, Wt = (r, a) => {
534
- const c = (a == null ? void 0 : a.mainUrl) !== void 0 ? String(z(a.mainUrl)) : Ht(), t = (a == null ? void 0 : a.token) !== void 0 ? String(z(a.token)) : Gt();
535
- return r.replace(/\{\{\s*MAIN_URL\s*\}\}/g, c).replace(/\{\{\s*SERVE_URL\s*\}\}/g, Kt()).replace(/\{\{\s*token\s*\}\}/g, t);
536
- }, Yt = (r) => {
537
- const a = ae() ? re(_e, {}) : {}, c = I(() => {
538
- var v;
539
- const o = z(r), d = ((v = o == null ? void 0 : o.values) == null ? void 0 : v.url) ?? (o == null ? void 0 : o.url) ?? "";
540
- return d ? a.resolveUrl ? a.resolveUrl(d) : Wt(d, a) : "";
541
- }), t = I(() => {
542
- var d;
543
- const o = z(r);
544
- return ((d = o == null ? void 0 : o.values) == null ? void 0 : d.srcdoc) ?? (o == null ? void 0 : o.srcdoc) ?? "";
747
+ }, Ve = Symbol("wi-chat-iframe-page-config"), kl = (o) => {
748
+ ye(Ve, o);
749
+ }, Rs = (o, s) => {
750
+ const r = (s == null ? void 0 : s.mainUrl) !== void 0 ? String(ee(s.mainUrl)) : Us(), e = (s == null ? void 0 : s.token) !== void 0 ? String(ee(s.token)) : qs();
751
+ return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g, r).replace(/\{\{\s*SERVE_URL\s*\}\}/g, Fs()).replace(/\{\{\s*token\s*\}\}/g, e);
752
+ }, Bs = (o) => {
753
+ const s = Ie() ? fe(Ve, {}) : {}, r = b(() => {
754
+ var p;
755
+ const a = ee(o), c = ((p = a == null ? void 0 : a.values) == null ? void 0 : p.url) ?? (a == null ? void 0 : a.url) ?? "";
756
+ return c ? s.resolveUrl ? s.resolveUrl(c) : Rs(c, s) : "";
757
+ }), e = b(() => {
758
+ var c;
759
+ const a = ee(o);
760
+ return ((c = a == null ? void 0 : a.values) == null ? void 0 : c.srcdoc) ?? (a == null ? void 0 : a.srcdoc) ?? "";
545
761
  });
546
- return { url: c, srcdoc: t };
547
- }, oe = "data-wi-iframe-resizer-child", Jt = (r) => {
548
- if (!r) return !1;
549
- let a = null;
762
+ return { url: r, srcdoc: e };
763
+ }, Se = "data-wi-iframe-resizer-child", zs = (o) => {
764
+ if (!o) return !1;
765
+ let s = null;
550
766
  try {
551
- a = r.contentDocument;
767
+ s = o.contentDocument;
552
768
  } catch {
553
769
  return !1;
554
770
  }
555
- if (!a) return !1;
556
- const c = a.head || a.documentElement;
557
- if (!c) return !1;
558
- const t = a.defaultView;
559
- if (t != null && t.parentIframe || t != null && t.parentIFrame || a.querySelector(`script[${oe}]`)) return !1;
560
- const o = a.createElement("script");
561
- return o.textContent = Me, o.setAttribute(oe, ""), c.appendChild(o), !0;
562
- }, Zt = /* @__PURE__ */ j({
771
+ if (!s) return !1;
772
+ const r = s.head || s.documentElement;
773
+ if (!r) return !1;
774
+ const e = s.defaultView;
775
+ if (e != null && e.parentIframe || e != null && e.parentIFrame || s.querySelector(`script[${Se}]`)) return !1;
776
+ const a = s.createElement("script");
777
+ return a.textContent = dt, a.setAttribute(Se, ""), r.appendChild(a), !0;
778
+ }, Ds = /* @__PURE__ */ D({
563
779
  __name: "IframePage",
564
780
  props: {
565
781
  report: {}
566
782
  },
567
- setup(r) {
568
- const a = r, { url: c, srcdoc: t } = Yt(() => a.report), o = (d) => {
569
- Jt(d.target);
783
+ setup(o) {
784
+ const s = o, { url: r, srcdoc: e } = Bs(() => s.report), a = (c) => {
785
+ zs(c.target);
570
786
  };
571
- return (d, v) => l(c) ? (i(), Z(ne, {
787
+ return (c, p) => y(r) ? (n(), J(ge, {
572
788
  key: 0,
573
789
  class: "iframe-page__frame iframe-page__frame--url",
574
790
  license: "GPLv3",
575
- src: l(c),
791
+ src: y(r),
576
792
  width: "100%",
577
793
  "warning-timeout": 0,
578
- onLoad: o
579
- }, null, 8, ["src"])) : l(t) ? (i(), Z(ne, {
794
+ onLoad: a
795
+ }, null, 8, ["src"])) : y(e) ? (n(), J(ge, {
580
796
  key: 1,
581
797
  class: "iframe-page iframe-page--srcdoc",
582
798
  license: "GPLv3",
583
- srcdoc: l(t),
799
+ srcdoc: y(e),
584
800
  width: "100%",
585
801
  frameborder: "no",
586
802
  border: "0",
587
803
  marginwidth: "0",
588
804
  marginheight: "0",
589
805
  scrolling: "no"
590
- }, null, 8, ["srcdoc"])) : V("", !0);
806
+ }, null, 8, ["srcdoc"])) : I("", !0);
591
807
  }
592
- }), Qt = /* @__PURE__ */ N(Zt, [["__scopeId", "data-v-f4c94a4e"]]), es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
808
+ }), Hs = /* @__PURE__ */ H(Ds, [["__scopeId", "data-v-f4c94a4e"]]), Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
593
809
  __proto__: null,
594
- default: Qt
595
- }, Symbol.toStringTag, { value: "Module" })), ts = { class: "wi-clarify__header" }, ss = { class: "wi-clarify__heading" }, ns = { class: "wi-clarify__title" }, os = {
810
+ default: Hs
811
+ }, Symbol.toStringTag, { value: "Module" })), Ws = { class: "wi-clarify__header" }, Xs = { class: "wi-clarify__heading" }, Gs = { class: "wi-clarify__title" }, Ys = {
596
812
  key: 0,
597
813
  class: "wi-clarify__desc"
598
- }, as = { class: "wi-clarify__status" }, rs = { class: "wi-clarify__progress" }, ls = { class: "wi-clarify__progress-track" }, is = {
814
+ }, Zs = { class: "wi-clarify__status" }, Js = { class: "wi-clarify__progress" }, Qs = { class: "wi-clarify__progress-track" }, en = {
599
815
  key: 0,
600
816
  class: "wi-clarify__panel"
601
- }, us = { class: "wi-clarify__question" }, cs = {
817
+ }, tn = { class: "wi-clarify__question" }, sn = {
602
818
  key: 0,
603
819
  class: "wi-clarify__question-desc"
604
- }, ds = {
820
+ }, nn = {
605
821
  key: 1,
606
822
  class: "wi-clarify__binding"
607
- }, _s = {
823
+ }, an = {
608
824
  key: 2,
609
825
  class: "wi-clarify__options"
610
- }, ps = ["onClick"], fs = { class: "wi-clarify__option-indicator" }, vs = {
826
+ }, ln = ["onClick"], on = { class: "wi-clarify__option-indicator" }, rn = {
611
827
  key: 3,
612
828
  class: "wi-clarify__date"
613
- }, ws = ["for"], ys = ["id", "value"], ms = { class: "wi-clarify__text" }, hs = {
829
+ }, un = ["for"], cn = ["id", "value"], dn = { class: "wi-clarify__text" }, _n = {
614
830
  key: 0,
615
831
  class: "wi-clarify__or"
616
- }, bs = ["for"], gs = ["id", "value", "placeholder"], ks = {
832
+ }, pn = ["for"], vn = ["id", "value", "placeholder"], fn = {
617
833
  class: "wi-clarify__dots",
618
834
  "aria-label": "确认问题导航"
619
- }, xs = ["aria-label", "onClick"], Ss = { class: "wi-clarify__footer" }, $s = { class: "wi-clarify__actions" }, Is = { class: "wi-clarify__actions" }, Cs = ["disabled"], Es = {
835
+ }, yn = ["aria-label", "onClick"], mn = { class: "wi-clarify__footer" }, wn = { class: "wi-clarify__actions" }, hn = { class: "wi-clarify__actions" }, gn = ["disabled"], bn = {
620
836
  key: 1,
621
837
  class: "wi-clarify__result"
622
- }, Os = { class: "wi-clarify__result-icon" }, Ts = { class: "wi-clarify__result-body" }, Vs = {
838
+ }, kn = { class: "wi-clarify__result-icon" }, $n = { class: "wi-clarify__result-body" }, xn = {
623
839
  key: 0,
624
840
  class: "wi-clarify__summary"
625
- }, Ps = { key: 1 }, Us = { key: 2 }, Ms = {
841
+ }, Sn = { key: 1 }, Cn = { key: 2 }, Mn = {
626
842
  key: 2,
627
843
  class: "wi-clarify__feedback"
628
- }, Ls = /* @__PURE__ */ j({
844
+ }, En = /* @__PURE__ */ D({
629
845
  __name: "ClarificationCard",
630
846
  props: {
631
847
  report: {}
632
848
  },
633
- setup(r) {
634
- const a = r, c = {
849
+ setup(o) {
850
+ const s = o, r = {
635
851
  requestId: "",
636
852
  title: "需要补充信息",
637
853
  description: "",
638
854
  items: [],
639
855
  status: "expired",
640
856
  resultMessage: "本次补充信息已失效(回答已结束)"
641
- }, t = I(() => a.report.values ?? c), o = I(() => t.value.items ?? []), d = U(0), v = Ie({}), S = U(!1), g = U("");
642
- le(() => {
643
- var s;
644
- return (s = t.value) == null ? void 0 : s.requestId;
857
+ }, e = b(() => s.report.values ?? r), a = b(() => e.value.items ?? []), c = q(0), p = Ke({}), f = q(!1), x = q("");
858
+ ae(() => {
859
+ var i;
860
+ return (i = e.value) == null ? void 0 : i.requestId;
645
861
  }, () => {
646
- Object.keys(v).forEach((s) => delete v[s]), o.value.forEach((s) => {
647
- const n = { structuredValue: void 0, structuredValues: [], textValue: "" };
648
- s.default !== void 0 && (s.input.type === "multi_select" ? n.structuredValues = Array.isArray(s.default) ? [...s.default] : [] : s.input.type === "text" ? n.textValue = String(s.default) : n.structuredValue = s.default), v[s.id] = n;
649
- }), d.value = 0;
862
+ Object.keys(p).forEach((i) => delete p[i]), a.value.forEach((i) => {
863
+ const u = { structuredValue: void 0, structuredValues: [], textValue: "" };
864
+ i.default !== void 0 && (i.input.type === "multi_select" ? u.structuredValues = Array.isArray(i.default) ? [...i.default] : [] : i.input.type === "text" ? u.textValue = String(i.default) : u.structuredValue = i.default), p[i.id] = u;
865
+ }), c.value = 0;
650
866
  }, { immediate: !0 });
651
- const h = (s) => (v[s] || (v[s] = { structuredValue: void 0, structuredValues: [], textValue: "" }), v[s]), w = I(() => {
652
- var s, n, p;
653
- return ((s = t.value) == null ? void 0 : s.status) === "submitted" ? "已提交" : ((n = t.value) == null ? void 0 : n.status) === "cancelled" ? "已取消" : ((p = t.value) == null ? void 0 : p.status) === "expired" ? "已失效" : "等待回答";
654
- }), x = (s) => {
867
+ const w = (i) => (p[i] || (p[i] = { structuredValue: void 0, structuredValues: [], textValue: "" }), p[i]), m = b(() => {
868
+ var i, u, h;
869
+ return ((i = e.value) == null ? void 0 : i.status) === "submitted" ? "已提交" : ((u = e.value) == null ? void 0 : u.status) === "cancelled" ? "已取消" : ((h = e.value) == null ? void 0 : h.status) === "expired" ? "已失效" : "等待回答";
870
+ }), v = (i) => {
655
871
  try {
656
- const n = JSON.stringify(s);
657
- return n === void 0 ? String(s) : n;
872
+ const u = JSON.stringify(i);
873
+ return u === void 0 ? String(i) : u;
658
874
  } catch {
659
- return String(s);
875
+ return String(i);
660
876
  }
661
- }, O = (s, n) => x(s) === x(n), T = (s, n) => {
662
- const p = h(s.id);
663
- return s.input.type === "multi_select" ? p.structuredValues.some((m) => O(m, n)) : O(p.structuredValue, n);
664
- }, R = (s, n) => {
665
- const p = h(s.id);
666
- if (p.textValue = "", s.input.type === "multi_select") {
667
- const m = p.structuredValues.findIndex((P) => O(P, n));
668
- m >= 0 ? p.structuredValues.splice(m, 1) : p.structuredValues.push(n);
877
+ }, d = (i, u) => v(i) === v(u), $ = (i, u) => {
878
+ const h = w(i.id);
879
+ return i.input.type === "multi_select" ? h.structuredValues.some((E) => d(E, u)) : d(h.structuredValue, u);
880
+ }, U = (i, u) => {
881
+ const h = w(i.id);
882
+ if (h.textValue = "", i.input.type === "multi_select") {
883
+ const E = h.structuredValues.findIndex((z) => d(z, u));
884
+ E >= 0 ? h.structuredValues.splice(E, 1) : h.structuredValues.push(u);
669
885
  return;
670
886
  }
671
- p.structuredValue = n;
672
- }, b = (s) => {
673
- var n;
674
- return ((n = s.target) == null ? void 0 : n.value) ?? "";
675
- }, $ = (s, n) => {
676
- const p = h(s.id);
677
- p.textValue = b(n), s.input.type !== "text" && (p.structuredValue = void 0, p.structuredValues.splice(0));
678
- }, K = (s, n) => {
679
- const p = h(s.id);
680
- p.structuredValue = b(n), p.textValue = "";
681
- }, X = (s) => {
682
- const n = h(s.id).structuredValue;
683
- return n == null ? "" : String(n);
684
- }, q = (s) => {
685
- var n;
686
- return ((n = s.input.textInput) == null ? void 0 : n.placeholder) ?? s.input.placeholder ?? (s.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
687
- }, _ = (s) => {
688
- const n = s.binding;
689
- if (!n) return "";
690
- const p = n.actionName ? `动作:${n.actionName}` : "", m = n.parameterPath ? `参数:${n.parameterPath}` : "";
691
- return [p, m].filter(Boolean).join(" · ");
692
- }, C = (s) => {
693
- const n = h(s.id);
694
- return s.input.type === "multi_select" ? n.structuredValues.length > 0 : s.input.type === "single_select" ? n.structuredValue !== void 0 : s.input.type === "date" ? !!n.structuredValue : !1;
695
- }, E = (s) => !!h(s.id).textValue.trim() || C(s), G = (s) => !s.required || E(s) ? !0 : (g.value = `请回答“${s.question}”`, !1), A = () => {
696
- g.value = "", d.value = Math.max(0, d.value - 1);
697
- }, L = () => {
698
- !y.value || !G(y.value) || (g.value = "", d.value = Math.min(o.value.length - 1, d.value + 1));
699
- }, y = I(() => o.value[d.value]), W = (s, n) => s.input.type === "date" ? String(n ?? "") : (Array.isArray(n) ? n : [n]).map((m) => {
700
- var J;
701
- const P = (J = s.input.options) == null ? void 0 : J.find((we) => O(we.value, m));
702
- return (P == null ? void 0 : P.label) ?? String(m ?? "");
703
- }).filter(Boolean).join("、"), Y = (s) => {
704
- const n = h(s.id), p = n.textValue.trim();
705
- if (s.input.type === "text" || p || !C(s))
706
- return { id: s.id, mode: "text", value: p, displayText: p };
707
- const m = s.input.type === "multi_select" ? [...n.structuredValues] : n.structuredValue;
887
+ h.structuredValue = u;
888
+ }, M = (i) => {
889
+ var u;
890
+ return ((u = i.target) == null ? void 0 : u.value) ?? "";
891
+ }, A = (i, u) => {
892
+ const h = w(i.id);
893
+ h.textValue = M(u), i.input.type !== "text" && (h.structuredValue = void 0, h.structuredValues.splice(0));
894
+ }, B = (i, u) => {
895
+ const h = w(i.id);
896
+ h.structuredValue = M(u), h.textValue = "";
897
+ }, G = (i) => {
898
+ const u = w(i.id).structuredValue;
899
+ return u == null ? "" : String(u);
900
+ }, P = (i) => {
901
+ var u;
902
+ return ((u = i.input.textInput) == null ? void 0 : u.placeholder) ?? i.input.placeholder ?? (i.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
903
+ }, R = (i) => {
904
+ const u = i.binding;
905
+ if (!u) return "";
906
+ const h = u.actionName ? `动作:${u.actionName}` : "", E = u.parameterPath ? `参数:${u.parameterPath}` : "";
907
+ return [h, E].filter(Boolean).join(" · ");
908
+ }, K = (i) => {
909
+ const u = w(i.id);
910
+ return i.input.type === "multi_select" ? u.structuredValues.length > 0 : i.input.type === "single_select" ? u.structuredValue !== void 0 : i.input.type === "date" ? !!u.structuredValue : !1;
911
+ }, N = (i) => !!w(i.id).textValue.trim() || K(i), S = (i) => !i.required || N(i) ? !0 : (x.value = `请回答“${i.question}”`, !1), F = () => {
912
+ x.value = "", c.value = Math.max(0, c.value - 1);
913
+ }, W = () => {
914
+ !O.value || !S(O.value) || (x.value = "", c.value = Math.min(a.value.length - 1, c.value + 1));
915
+ }, O = b(() => a.value[c.value]), Z = (i, u) => i.input.type === "date" ? String(u ?? "") : (Array.isArray(u) ? u : [u]).map((E) => {
916
+ var te;
917
+ const z = (te = i.input.options) == null ? void 0 : te.find((Ne) => d(Ne.value, E));
918
+ return (z == null ? void 0 : z.label) ?? String(E ?? "");
919
+ }).filter(Boolean).join("、"), g = (i) => {
920
+ const u = w(i.id), h = u.textValue.trim();
921
+ if (i.input.type === "text" || h || !K(i))
922
+ return { id: i.id, mode: "text", value: h, displayText: h };
923
+ const E = i.input.type === "multi_select" ? [...u.structuredValues] : u.structuredValue;
708
924
  return {
709
- id: s.id,
925
+ id: i.id,
710
926
  mode: "structured",
711
- value: m,
712
- displayText: W(s, m)
927
+ value: E,
928
+ displayText: Z(i, E)
713
929
  };
714
- }, pe = () => {
715
- const s = o.value.findIndex((p) => p.required && !E(p));
716
- if (s >= 0) {
717
- d.value = s, g.value = `请回答“${o.value[s].question}”`;
930
+ }, V = () => {
931
+ const i = a.value.findIndex((h) => h.required && !N(h));
932
+ if (i >= 0) {
933
+ c.value = i, x.value = `请回答“${a.value[i].question}”`;
718
934
  return;
719
935
  }
720
- g.value = "";
721
- const n = o.value.filter((p) => p.required || E(p)).map(Y);
722
- Le(t.value.requestId, n) || (g.value = "本次补充信息已经处理");
723
- }, fe = () => {
724
- S.value = !1, g.value = "", je(t.value.requestId) || (g.value = "本次补充信息已经处理");
725
- }, ve = (s) => {
726
- var n;
727
- return ((n = o.value.find((p) => p.id === s)) == null ? void 0 : n.question) ?? s;
936
+ x.value = "";
937
+ const u = a.value.filter((h) => h.required || N(h)).map(g);
938
+ _t(e.value.requestId, u) || (x.value = "本次补充信息已经处理");
939
+ }, L = () => {
940
+ f.value = !1, x.value = "", pt(e.value.requestId) || (x.value = "本次补充信息已经处理");
941
+ }, C = (i) => {
942
+ var u;
943
+ return ((u = a.value.find((h) => h.id === i)) == null ? void 0 : u.question) ?? i;
728
944
  };
729
- return (s, n) => {
730
- var p;
731
- return i(), u("section", {
732
- class: D(["wi-clarify", `is-${t.value.status}`])
945
+ return (i, u) => {
946
+ var h;
947
+ return n(), l("section", {
948
+ class: X(["wi-clarify", `is-${e.value.status}`])
733
949
  }, [
734
- e("header", ts, [
735
- e("div", ss, [
736
- n[4] || (n[4] = e("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)),
737
- e("h3", ns, f(t.value.title), 1),
738
- t.value.description ? (i(), u("p", os, f(t.value.description), 1)) : V("", !0)
950
+ t("header", Ws, [
951
+ t("div", Xs, [
952
+ u[4] || (u[4] = t("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)),
953
+ t("h3", Gs, k(e.value.title), 1),
954
+ e.value.description ? (n(), l("p", Ys, k(e.value.description), 1)) : I("", !0)
739
955
  ]),
740
- e("span", as, f(w.value), 1)
956
+ t("span", Zs, k(m.value), 1)
741
957
  ]),
742
- t.value.status === "pending" ? (i(), u(M, { key: 0 }, [
743
- e("div", rs, [
744
- e("span", null, "问题 " + f(d.value + 1) + " / " + f(o.value.length), 1),
745
- e("div", ls, [
746
- e("span", {
747
- style: Ce({ width: `${(d.value + 1) / o.value.length * 100}%` })
958
+ e.value.status === "pending" ? (n(), l(T, { key: 0 }, [
959
+ t("div", Js, [
960
+ t("span", null, "问题 " + k(c.value + 1) + " / " + k(a.value.length), 1),
961
+ t("div", Qs, [
962
+ t("span", {
963
+ style: Ae({ width: `${(c.value + 1) / a.value.length * 100}%` })
748
964
  }, null, 4)
749
965
  ])
750
966
  ]),
751
- y.value ? (i(), u("div", is, [
752
- e("div", us, [
753
- e("span", {
754
- class: D(y.value.required ? "wi-clarify__required" : "wi-clarify__optional")
755
- }, f(y.value.required ? "必填" : "选填"), 3),
756
- e("h4", null, f(y.value.question), 1)
967
+ O.value ? (n(), l("div", en, [
968
+ t("div", tn, [
969
+ t("span", {
970
+ class: X(O.value.required ? "wi-clarify__required" : "wi-clarify__optional")
971
+ }, k(O.value.required ? "必填" : "选填"), 3),
972
+ t("h4", null, k(O.value.question), 1)
757
973
  ]),
758
- y.value.description ? (i(), u("p", cs, f(y.value.description), 1)) : V("", !0),
759
- _(y.value) ? (i(), u("div", ds, f(_(y.value)), 1)) : V("", !0),
760
- y.value.input.type === "single_select" || y.value.input.type === "multi_select" ? (i(), u("div", _s, [
761
- (i(!0), u(M, null, B(y.value.input.options, (m, P) => (i(), u("button", {
762
- key: P,
974
+ O.value.description ? (n(), l("p", sn, k(O.value.description), 1)) : I("", !0),
975
+ R(O.value) ? (n(), l("div", nn, k(R(O.value)), 1)) : I("", !0),
976
+ O.value.input.type === "single_select" || O.value.input.type === "multi_select" ? (n(), l("div", an, [
977
+ (n(!0), l(T, null, j(O.value.input.options, (E, z) => (n(), l("button", {
978
+ key: z,
763
979
  type: "button",
764
- class: D(["wi-clarify__option", { "is-selected": T(y.value, m.value) }]),
765
- onClick: (J) => R(y.value, m.value)
980
+ class: X(["wi-clarify__option", { "is-selected": $(O.value, E.value) }]),
981
+ onClick: (te) => U(O.value, E.value)
766
982
  }, [
767
- e("span", fs, f(T(y.value, m.value) ? "✓" : ""), 1),
768
- e("span", null, f(m.label), 1)
769
- ], 10, ps))), 128))
770
- ])) : y.value.input.type === "date" ? (i(), u("div", vs, [
771
- e("label", {
772
- for: `wi-clarify-date-${y.value.id}`
773
- }, "选择日期", 8, ws),
774
- e("input", {
775
- id: `wi-clarify-date-${y.value.id}`,
983
+ t("span", on, k($(O.value, E.value) ? "✓" : ""), 1),
984
+ t("span", null, k(E.label), 1)
985
+ ], 10, ln))), 128))
986
+ ])) : O.value.input.type === "date" ? (n(), l("div", rn, [
987
+ t("label", {
988
+ for: `wi-clarify-date-${O.value.id}`
989
+ }, "选择日期", 8, un),
990
+ t("input", {
991
+ id: `wi-clarify-date-${O.value.id}`,
776
992
  type: "date",
777
- value: X(y.value),
778
- onInput: n[0] || (n[0] = (m) => K(y.value, m))
779
- }, null, 40, ys)
780
- ])) : V("", !0),
781
- e("div", ms, [
782
- y.value.input.type !== "text" ? (i(), u("div", hs, [...n[5] || (n[5] = [
783
- e("span", null, "或者,用自己的话说明", -1)
784
- ])])) : V("", !0),
785
- e("label", {
786
- for: `wi-clarify-text-${y.value.id}`
787
- }, f(y.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, bs),
788
- e("textarea", {
789
- id: `wi-clarify-text-${y.value.id}`,
790
- value: h(y.value.id).textValue,
791
- placeholder: q(y.value),
993
+ value: G(O.value),
994
+ onInput: u[0] || (u[0] = (E) => B(O.value, E))
995
+ }, null, 40, cn)
996
+ ])) : I("", !0),
997
+ t("div", dn, [
998
+ O.value.input.type !== "text" ? (n(), l("div", _n, [...u[5] || (u[5] = [
999
+ t("span", null, "或者,用自己的话说明", -1)
1000
+ ])])) : I("", !0),
1001
+ t("label", {
1002
+ for: `wi-clarify-text-${O.value.id}`
1003
+ }, k(O.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, pn),
1004
+ t("textarea", {
1005
+ id: `wi-clarify-text-${O.value.id}`,
1006
+ value: w(O.value.id).textValue,
1007
+ placeholder: P(O.value),
792
1008
  rows: "3",
793
- onInput: n[1] || (n[1] = (m) => $(y.value, m))
794
- }, null, 40, gs)
1009
+ onInput: u[1] || (u[1] = (E) => A(O.value, E))
1010
+ }, null, 40, vn)
795
1011
  ])
796
- ])) : V("", !0),
797
- e("div", ks, [
798
- (i(!0), u(M, null, B(o.value, (m, P) => (i(), u("button", {
799
- key: m.id,
1012
+ ])) : I("", !0),
1013
+ t("div", fn, [
1014
+ (n(!0), l(T, null, j(a.value, (E, z) => (n(), l("button", {
1015
+ key: E.id,
800
1016
  type: "button",
801
- "aria-label": `查看第 ${P + 1} 个问题`,
802
- class: D({ "is-active": P === d.value, "is-answered": E(m) }),
803
- onClick: (J) => d.value = P
804
- }, null, 10, xs))), 128))
1017
+ "aria-label": `查看第 ${z + 1} 个问题`,
1018
+ class: X({ "is-active": z === c.value, "is-answered": N(E) }),
1019
+ onClick: (te) => c.value = z
1020
+ }, null, 10, yn))), 128))
805
1021
  ]),
806
- e("footer", Ss, [
807
- S.value ? (i(), u(M, { key: 0 }, [
808
- n[6] || (n[6] = e("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)),
809
- e("div", $s, [
810
- e("button", {
1022
+ t("footer", mn, [
1023
+ f.value ? (n(), l(T, { key: 0 }, [
1024
+ u[6] || (u[6] = t("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)),
1025
+ t("div", wn, [
1026
+ t("button", {
811
1027
  type: "button",
812
1028
  class: "wi-clarify__btn wi-clarify__btn--secondary",
813
- onClick: n[2] || (n[2] = (m) => S.value = !1)
1029
+ onClick: u[2] || (u[2] = (E) => f.value = !1)
814
1030
  }, " 继续填写 "),
815
- e("button", {
1031
+ t("button", {
816
1032
  type: "button",
817
1033
  class: "wi-clarify__btn wi-clarify__btn--danger",
818
- onClick: fe
1034
+ onClick: L
819
1035
  }, "确认取消")
820
1036
  ])
821
- ], 64)) : (i(), u(M, { key: 1 }, [
822
- e("button", {
1037
+ ], 64)) : (n(), l(T, { key: 1 }, [
1038
+ t("button", {
823
1039
  type: "button",
824
1040
  class: "wi-clarify__cancel",
825
- onClick: n[3] || (n[3] = (m) => S.value = !0)
1041
+ onClick: u[3] || (u[3] = (E) => f.value = !0)
826
1042
  }, "取消"),
827
- e("div", Is, [
828
- e("button", {
1043
+ t("div", hn, [
1044
+ t("button", {
829
1045
  type: "button",
830
1046
  class: "wi-clarify__btn wi-clarify__btn--secondary",
831
- disabled: d.value === 0,
832
- onClick: A
833
- }, " 上一项 ", 8, Cs),
834
- d.value < o.value.length - 1 ? (i(), u("button", {
1047
+ disabled: c.value === 0,
1048
+ onClick: F
1049
+ }, " 上一项 ", 8, gn),
1050
+ c.value < a.value.length - 1 ? (n(), l("button", {
835
1051
  key: 0,
836
1052
  type: "button",
837
1053
  class: "wi-clarify__btn wi-clarify__btn--primary",
838
- onClick: L
839
- }, " 下一项 ")) : (i(), u("button", {
1054
+ onClick: W
1055
+ }, " 下一项 ")) : (n(), l("button", {
840
1056
  key: 1,
841
1057
  type: "button",
842
1058
  class: "wi-clarify__btn wi-clarify__btn--primary",
843
- onClick: pe
1059
+ onClick: V
844
1060
  }, "提交全部"))
845
1061
  ])
846
1062
  ], 64))
847
1063
  ])
848
- ], 64)) : (i(), u("div", Es, [
849
- e("div", Os, f(t.value.status === "submitted" ? "✓" : t.value.status === "cancelled" ? "—" : "!"), 1),
850
- e("div", Ts, [
851
- e("h4", null, f(t.value.resultMessage || w.value), 1),
852
- t.value.status === "submitted" && ((p = t.value.answers) != null && p.length) ? (i(), u("div", Vs, [
853
- (i(!0), u(M, null, B(t.value.answers, (m) => (i(), u("div", {
854
- key: m.id
1064
+ ], 64)) : (n(), l("div", bn, [
1065
+ t("div", kn, k(e.value.status === "submitted" ? "✓" : e.value.status === "cancelled" ? "—" : "!"), 1),
1066
+ t("div", $n, [
1067
+ t("h4", null, k(e.value.resultMessage || m.value), 1),
1068
+ e.value.status === "submitted" && ((h = e.value.answers) != null && h.length) ? (n(), l("div", xn, [
1069
+ (n(!0), l(T, null, j(e.value.answers, (E) => (n(), l("div", {
1070
+ key: E.id
855
1071
  }, [
856
- e("span", null, f(ve(m.id)), 1),
857
- e("strong", null, f(m.displayText || "未填写"), 1)
1072
+ t("span", null, k(C(E.id)), 1),
1073
+ t("strong", null, k(E.displayText || "未填写"), 1)
858
1074
  ]))), 128))
859
- ])) : t.value.status === "cancelled" ? (i(), u("p", Ps, "本次确认未提交,工作流将收到取消结果。")) : (i(), u("p", Us, "该确认项已失效,无法再提交。"))
1075
+ ])) : e.value.status === "cancelled" ? (n(), l("p", Sn, "本次确认未提交,工作流将收到取消结果。")) : (n(), l("p", Cn, "该确认项已失效,无法再提交。"))
860
1076
  ])
861
1077
  ])),
862
- g.value ? (i(), u("div", Ms, f(g.value), 1)) : V("", !0)
1078
+ x.value ? (n(), l("div", Mn, k(x.value), 1)) : I("", !0)
863
1079
  ], 2);
864
1080
  };
865
1081
  }
866
- }), js = /* @__PURE__ */ N(Ls, [["__scopeId", "data-v-c684f993"]]), Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1082
+ }), In = /* @__PURE__ */ H(En, [["__scopeId", "data-v-c684f993"]]), An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
867
1083
  __proto__: null,
868
- default: js
869
- }, Symbol.toStringTag, { value: "Module" })), Rs = { class: "wi-host-action__head" }, As = {
1084
+ default: In
1085
+ }, Symbol.toStringTag, { value: "Module" })), On = { class: "wi-host-action__head" }, Tn = {
870
1086
  class: "wi-host-action__icon",
871
1087
  "aria-hidden": "true"
872
- }, Fs = { class: "wi-host-action__title" }, Ds = { class: "wi-host-action__name" }, Bs = { class: "wi-host-action__chip" }, zs = { class: "wi-host-action__message" }, qs = {
1088
+ }, Pn = { class: "wi-host-action__title" }, Ln = { class: "wi-host-action__name" }, jn = { class: "wi-host-action__chip" }, Vn = { class: "wi-host-action__message" }, Un = {
873
1089
  key: 0,
874
1090
  class: "wi-host-action__args"
875
- }, Hs = /* @__PURE__ */ j({
1091
+ }, Fn = /* @__PURE__ */ D({
876
1092
  __name: "HostActionStatus",
877
1093
  props: {
878
1094
  report: {}
879
1095
  },
880
- setup(r) {
881
- const a = r, c = {
1096
+ setup(o) {
1097
+ const s = o, r = {
882
1098
  id: "",
883
1099
  name: "",
884
1100
  arguments: {},
885
1101
  status: "unknown",
886
1102
  message: "执行状态未知(回答已结束)"
887
- }, t = I(() => a.report.values ?? c), o = I(() => t.value.status === "running" ? "●" : t.value.status === "success" ? "✓" : t.value.status === "error" ? "!" : "?"), d = I(() => t.value.status === "running" ? "执行中" : t.value.status === "success" ? "已完成" : t.value.status === "error" ? "执行失败" : "状态未知"), v = I(() => {
888
- const g = t.value.arguments;
889
- return !!g && typeof g == "object" && Object.keys(g).length > 0;
890
- }), S = I(() => JSON.stringify(t.value.arguments ?? {}, null, 2));
891
- return (g, k) => (i(), u("section", {
892
- class: D(["wi-host-action", `is-${t.value.status}`])
1103
+ }, e = b(() => s.report.values ?? r), a = b(() => e.value.status === "running" ? "●" : e.value.status === "success" ? "✓" : e.value.status === "error" ? "!" : "?"), c = b(() => e.value.status === "running" ? "执行中" : e.value.status === "success" ? "已完成" : e.value.status === "error" ? "执行失败" : "状态未知"), p = b(() => {
1104
+ const x = e.value.arguments;
1105
+ return !!x && typeof x == "object" && Object.keys(x).length > 0;
1106
+ }), f = b(() => JSON.stringify(e.value.arguments ?? {}, null, 2));
1107
+ return (x, _) => (n(), l("section", {
1108
+ class: X(["wi-host-action", `is-${e.value.status}`])
893
1109
  }, [
894
- e("header", Rs, [
895
- e("span", As, f(o.value), 1),
896
- e("div", Fs, [
897
- k[0] || (k[0] = e("span", { class: "wi-host-action__label" }, "执行操作", -1)),
898
- e("code", Ds, f(t.value.name || "未知操作"), 1)
1110
+ t("header", On, [
1111
+ t("span", Tn, k(a.value), 1),
1112
+ t("div", Pn, [
1113
+ _[0] || (_[0] = t("span", { class: "wi-host-action__label" }, "执行操作", -1)),
1114
+ t("code", Ln, k(e.value.name || "未知操作"), 1)
899
1115
  ]),
900
- e("span", Bs, f(d.value), 1)
1116
+ t("span", jn, k(c.value), 1)
901
1117
  ]),
902
- e("p", zs, f(t.value.message || d.value), 1),
903
- v.value ? (i(), u("details", qs, [
904
- k[1] || (k[1] = e("summary", null, "查看参数", -1)),
905
- e("pre", null, f(S.value), 1)
906
- ])) : V("", !0)
1118
+ t("p", Vn, k(e.value.message || c.value), 1),
1119
+ p.value ? (n(), l("details", Un, [
1120
+ _[1] || (_[1] = t("summary", null, "查看参数", -1)),
1121
+ t("pre", null, k(f.value), 1)
1122
+ ])) : I("", !0)
907
1123
  ], 2));
908
1124
  }
909
- }), Ks = /* @__PURE__ */ N(Hs, [["__scopeId", "data-v-4acb4d02"]]), Xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1125
+ }), Nn = /* @__PURE__ */ H(Fn, [["__scopeId", "data-v-4acb4d02"]]), qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
1126
  __proto__: null,
911
- default: Ks
912
- }, Symbol.toStringTag, { value: "Module" }));
1127
+ default: Nn
1128
+ }, Symbol.toStringTag, { value: "Module" })), $l = /* @__PURE__ */ D({
1129
+ __name: "TextAnswer",
1130
+ props: {
1131
+ report: {}
1132
+ },
1133
+ setup(o) {
1134
+ const s = o, r = b(() => {
1135
+ var e;
1136
+ return typeof ((e = s.report) == null ? void 0 : e.values) == "string" ? s.report.values : "";
1137
+ });
1138
+ return (e, a) => r.value ? (n(), J(y(Te), {
1139
+ key: 0,
1140
+ class: "wi-text-answer",
1141
+ source: r.value
1142
+ }, null, 8, ["source"])) : I("", !0);
1143
+ }
1144
+ }), Rn = { class: "wi-recordset" }, Bn = { class: "wi-recordset__head" }, zn = {
1145
+ key: 0,
1146
+ class: "wi-recordset__title"
1147
+ }, Dn = {
1148
+ key: 1,
1149
+ class: "wi-recordset__switch"
1150
+ }, Hn = ["viewBox"], Kn = ["x2", "y1", "y2"], Wn = ["x", "y"], Xn = ["points", "stroke"], Gn = ["cx", "cy", "fill"], Yn = ["x", "y", "width", "height", "fill"], Zn = ["x", "y"], Jn = {
1151
+ key: 1,
1152
+ class: "wi-recordset__legend"
1153
+ }, Qn = {
1154
+ key: 2,
1155
+ class: "wi-recordset__table-wrap"
1156
+ }, ea = { class: "wi-recordset__table" }, ta = { key: 0 }, sa = ["colspan"], de = 640, _e = 240, se = 48, Ce = 12, pe = 12, na = 26, aa = /* @__PURE__ */ D({
1157
+ __name: "RecordsetView",
1158
+ props: {
1159
+ report: {}
1160
+ },
1161
+ setup(o) {
1162
+ const s = o, r = ["#6455e7", "#36cfc9", "#ffa940", "#f759ab", "#73d13d", "#40a9ff"], e = b(() => {
1163
+ var g;
1164
+ return (g = s.report) == null ? void 0 : g.values;
1165
+ }), a = b(() => {
1166
+ var g;
1167
+ return (((g = e.value) == null ? void 0 : g.cols) ?? []).map((V, L) => ({ ...V, index: L }));
1168
+ }), c = b(() => {
1169
+ var g;
1170
+ return Array.isArray((g = e.value) == null ? void 0 : g.values) ? e.value.values : [];
1171
+ }), p = b(() => {
1172
+ var g;
1173
+ return Number((g = e.value) == null ? void 0 : g.max_cols) || a.value.length;
1174
+ }), f = b(() => a.value.slice(0, p.value)), x = b(() => a.value.find((g) => g.type === "time")), _ = b(() => a.value.filter((g) => g.type === "value")), w = b(() => a.value.find((g) => g.type === "name")), m = b(() => {
1175
+ var g;
1176
+ return ((g = e.value) == null ? void 0 : g.chart) !== "table" && !!x.value && _.value.length > 0 && c.value.length > 0;
1177
+ }), v = q("chart"), d = b(() => {
1178
+ var g;
1179
+ return String(((g = e.value) == null ? void 0 : g.chart_type) ?? "").includes("bar");
1180
+ }), $ = b(() => {
1181
+ var V;
1182
+ const g = ((V = x.value) == null ? void 0 : V.index) ?? 0;
1183
+ return [...new Set(c.value.map((L) => String((L == null ? void 0 : L[g]) ?? "")))];
1184
+ }), U = b(() => {
1185
+ var C;
1186
+ const g = ((C = x.value) == null ? void 0 : C.index) ?? 0, V = new Map($.value.map((i, u) => [i, u])), L = [];
1187
+ if (w.value && _.value.length) {
1188
+ const i = _.value[0].index, u = /* @__PURE__ */ new Map();
1189
+ c.value.forEach((h) => {
1190
+ const E = String((h == null ? void 0 : h[w.value.index]) ?? "");
1191
+ u.has(E) || u.set(E, new Array($.value.length).fill(null));
1192
+ const z = Number(h == null ? void 0 : h[i]);
1193
+ u.get(E)[V.get(String((h == null ? void 0 : h[g]) ?? ""))] = Number.isFinite(z) ? z : null;
1194
+ }), u.forEach((h, E) => L.push({ name: E, data: h }));
1195
+ } else
1196
+ _.value.forEach((i) => {
1197
+ const u = new Array($.value.length).fill(null);
1198
+ c.value.forEach((h) => {
1199
+ const E = Number(h == null ? void 0 : h[i.index]);
1200
+ u[V.get(String((h == null ? void 0 : h[g]) ?? ""))] = Number.isFinite(E) ? E : null;
1201
+ }), L.push({ name: i.title || i.name || "", data: u });
1202
+ });
1203
+ return L;
1204
+ }), M = b(() => U.value.flatMap((g) => g.data.filter((V) => V !== null))), A = b(() => M.value.length ? Math.min(0, ...M.value) : 0), B = b(() => {
1205
+ const g = M.value.length ? Math.max(...M.value) : 1;
1206
+ return g === A.value ? A.value + 1 : g;
1207
+ }), G = de - se - Ce, P = _e - pe - na, R = (g) => pe + P * g / 4, K = (g) => se + ($.value.length <= 1 ? G / 2 : G * g / ($.value.length - 1)), N = (g) => pe + P - (g - A.value) / (B.value - A.value) * P, S = b(() => {
1208
+ const g = $.value.length || 1, V = G / g, L = Math.max(2, V * 0.7 / Math.max(1, U.value.length));
1209
+ return U.value.map((C, i) => ({
1210
+ name: C.name,
1211
+ points: C.data.map((u, h) => u === null ? null : `${K(h).toFixed(1)},${N(u).toFixed(1)}`).filter(Boolean).join(" "),
1212
+ // 只有一个数据点时折线画不出来,改画圆点
1213
+ dots: C.data.length > 1 ? [] : C.data.filter((u) => u !== null).map((u) => ({ x: K(0), y: N(u) })),
1214
+ bars: C.data.map((u, h) => {
1215
+ const E = u ?? 0, z = N(Math.max(E, 0)), te = Math.abs(N(E) - N(0));
1216
+ return { x: se + V * h + V * 0.15 + L * i, y: z, w: L, h: te };
1217
+ })
1218
+ }));
1219
+ }), F = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/, W = b(() => {
1220
+ const g = $.value.length, V = Math.max(1, Math.ceil(g / 6));
1221
+ return $.value.map((L, C) => ({ text: F.test(L) ? L.slice(5, 16) : L, x: d.value ? se + G / g * (C + 0.5) : K(C), i: C })).filter((L) => L.i % V === 0);
1222
+ }), O = (g) => Math.abs(g) >= 1e3 ? g.toFixed(0) : Number(g.toFixed(2)).toString(), Z = (g) => g == null ? "" : typeof g == "object" ? JSON.stringify(g) : String(g);
1223
+ return (g, V) => {
1224
+ var L;
1225
+ return n(), l("div", Rn, [
1226
+ t("div", Bn, [
1227
+ (L = e.value) != null && L.title ? (n(), l("span", zn, k(e.value.title), 1)) : I("", !0),
1228
+ m.value ? (n(), l("div", Dn, [
1229
+ t("button", {
1230
+ type: "button",
1231
+ class: X({ "is-active": v.value === "chart" }),
1232
+ onClick: V[0] || (V[0] = (C) => v.value = "chart")
1233
+ }, "图表", 2),
1234
+ t("button", {
1235
+ type: "button",
1236
+ class: X({ "is-active": v.value === "table" }),
1237
+ onClick: V[1] || (V[1] = (C) => v.value = "table")
1238
+ }, "表格", 2)
1239
+ ])) : I("", !0)
1240
+ ]),
1241
+ v.value === "chart" && m.value ? (n(), l("svg", {
1242
+ key: 0,
1243
+ class: "wi-recordset__chart",
1244
+ viewBox: `0 0 ${de} ${_e}`
1245
+ }, [
1246
+ (n(), l(T, null, j(4, (C) => t("line", {
1247
+ key: `g${C}`,
1248
+ x1: se,
1249
+ x2: de - Ce,
1250
+ y1: R(C),
1251
+ y2: R(C),
1252
+ class: "wi-recordset__grid"
1253
+ }, null, 8, Kn)), 64)),
1254
+ (n(), l(T, null, j(5, (C) => t("text", {
1255
+ key: `y${C}`,
1256
+ x: se - 6,
1257
+ y: R(C - 1) + 4,
1258
+ class: "wi-recordset__axis",
1259
+ "text-anchor": "end"
1260
+ }, k(O(B.value - (B.value - A.value) * (C - 1) / 4)), 9, Wn)), 64)),
1261
+ (n(!0), l(T, null, j(S.value, (C, i) => (n(), l(T, { key: i }, [
1262
+ !d.value && !C.dots.length ? (n(), l("polyline", {
1263
+ key: 0,
1264
+ points: C.points,
1265
+ fill: "none",
1266
+ stroke: r[i % r.length],
1267
+ "stroke-width": "2"
1268
+ }, null, 8, Xn)) : !d.value && C.dots.length ? (n(!0), l(T, { key: 1 }, j(C.dots, (u, h) => (n(), l("circle", {
1269
+ key: h,
1270
+ cx: u.x,
1271
+ cy: u.y,
1272
+ r: "3",
1273
+ fill: r[i % r.length]
1274
+ }, null, 8, Gn))), 128)) : (n(!0), l(T, { key: 2 }, j(C.bars, (u, h) => (n(), l("rect", {
1275
+ key: h,
1276
+ x: u.x,
1277
+ y: u.y,
1278
+ width: u.w,
1279
+ height: u.h,
1280
+ fill: r[i % r.length]
1281
+ }, null, 8, Yn))), 128))
1282
+ ], 64))), 128)),
1283
+ (n(!0), l(T, null, j(W.value, (C, i) => (n(), l("text", {
1284
+ key: `x${i}`,
1285
+ x: C.x,
1286
+ y: _e - 6,
1287
+ class: "wi-recordset__axis",
1288
+ "text-anchor": "middle"
1289
+ }, k(C.text), 9, Zn))), 128))
1290
+ ], 8, Hn)) : I("", !0),
1291
+ v.value === "chart" && m.value && S.value.length > 1 ? (n(), l("div", Jn, [
1292
+ (n(!0), l(T, null, j(S.value, (C, i) => (n(), l("span", { key: i }, [
1293
+ t("i", {
1294
+ style: Ae({ background: r[i % r.length] })
1295
+ }, null, 4),
1296
+ Ee(k(C.name), 1)
1297
+ ]))), 128))
1298
+ ])) : I("", !0),
1299
+ v.value === "table" || !m.value ? (n(), l("div", Qn, [
1300
+ t("table", ea, [
1301
+ t("thead", null, [
1302
+ t("tr", null, [
1303
+ (n(!0), l(T, null, j(f.value, (C, i) => (n(), l("th", { key: i }, k(C.title || C.name), 1))), 128))
1304
+ ])
1305
+ ]),
1306
+ t("tbody", null, [
1307
+ (n(!0), l(T, null, j(c.value, (C, i) => (n(), l("tr", { key: i }, [
1308
+ (n(!0), l(T, null, j(f.value, (u, h) => (n(), l("td", { key: h }, k(Z(C == null ? void 0 : C[u.index])), 1))), 128))
1309
+ ]))), 128)),
1310
+ c.value.length ? I("", !0) : (n(), l("tr", ta, [
1311
+ t("td", {
1312
+ colspan: f.value.length || 1,
1313
+ class: "wi-recordset__empty"
1314
+ }, "无数据", 8, sa)
1315
+ ]))
1316
+ ])
1317
+ ])
1318
+ ])) : I("", !0)
1319
+ ]);
1320
+ };
1321
+ }
1322
+ }), la = /* @__PURE__ */ H(aa, [["__scopeId", "data-v-a284a756"]]), oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1323
+ __proto__: null,
1324
+ default: la
1325
+ }, Symbol.toStringTag, { value: "Module" })), Ue = Symbol("wi-chat-answer-render-config"), xl = (o) => {
1326
+ ye(Ue, o);
1327
+ }, Fe = () => fe(Ue, {}), ra = (o, s) => {
1328
+ var r;
1329
+ return s ? o.getFileUrl ? o.getFileUrl(s) : (r = o.api) != null && r.getFileUrl ? o.api.getFileUrl(s) : /^(https?:|blob:|data:|\/)/.test(s) ? s : "" : "";
1330
+ }, ia = { class: "wi-sql-query" }, ua = { class: "wi-sql-query__head" }, ca = ["disabled"], da = {
1331
+ key: 0,
1332
+ class: "wi-sql-query__error"
1333
+ }, _a = {
1334
+ key: 1,
1335
+ class: "wi-sql-query__table-wrap"
1336
+ }, pa = { class: "wi-sql-query__table" }, va = { key: 0 }, fa = ["colspan"], ya = /* @__PURE__ */ D({
1337
+ __name: "SqlQuery",
1338
+ props: {
1339
+ report: {}
1340
+ },
1341
+ setup(o) {
1342
+ var _, w;
1343
+ const s = o, r = Fe(), e = q(((w = (_ = s.report) == null ? void 0 : _.values) == null ? void 0 : w.sql) ?? ""), a = q(!1), c = q(""), p = q(null), f = b(() => {
1344
+ var m;
1345
+ return !!e.value.trim() && !!((m = r.api) != null && m.queryChatSql);
1346
+ }), x = async () => {
1347
+ var m, v, d;
1348
+ if ((m = r.api) != null && m.queryChatSql) {
1349
+ a.value = !0, c.value = "";
1350
+ try {
1351
+ p.value = await r.api.queryChatSql({ ds_id: (d = (v = s.report) == null ? void 0 : v.values) == null ? void 0 : d.ds_id, sql: e.value });
1352
+ } catch ($) {
1353
+ p.value = null, c.value = $ instanceof Error ? $.message : String($);
1354
+ } finally {
1355
+ a.value = !1;
1356
+ }
1357
+ }
1358
+ };
1359
+ return (m, v) => (n(), l("div", ia, [
1360
+ t("div", ua, [
1361
+ v[1] || (v[1] = t("span", { class: "wi-sql-query__label" }, "SQL", -1)),
1362
+ t("button", {
1363
+ type: "button",
1364
+ class: "wi-sql-query__run",
1365
+ disabled: a.value || !f.value,
1366
+ onClick: x
1367
+ }, k(a.value ? "执行中…" : "执行查询"), 9, ca)
1368
+ ]),
1369
+ ve(t("textarea", {
1370
+ "onUpdate:modelValue": v[0] || (v[0] = (d) => e.value = d),
1371
+ class: "wi-sql-query__editor",
1372
+ spellcheck: "false",
1373
+ rows: "6"
1374
+ }, null, 512), [
1375
+ [Oe, e.value]
1376
+ ]),
1377
+ c.value ? (n(), l("div", da, k(c.value), 1)) : p.value ? (n(), l("div", _a, [
1378
+ t("table", pa, [
1379
+ t("thead", null, [
1380
+ t("tr", null, [
1381
+ (n(!0), l(T, null, j(p.value.columns, (d, $) => (n(), l("th", { key: $ }, k(d), 1))), 128))
1382
+ ])
1383
+ ]),
1384
+ t("tbody", null, [
1385
+ (n(!0), l(T, null, j(p.value.values, (d, $) => (n(), l("tr", { key: $ }, [
1386
+ (n(!0), l(T, null, j(p.value.columns, (U, M) => (n(), l("td", { key: M }, k((d == null ? void 0 : d[M]) ?? ""), 1))), 128))
1387
+ ]))), 128)),
1388
+ p.value.values.length ? I("", !0) : (n(), l("tr", va, [
1389
+ t("td", {
1390
+ colspan: p.value.columns.length || 1,
1391
+ class: "wi-sql-query__empty"
1392
+ }, "无数据", 8, fa)
1393
+ ]))
1394
+ ])
1395
+ ])
1396
+ ])) : I("", !0)
1397
+ ]));
1398
+ }
1399
+ }), ma = /* @__PURE__ */ H(ya, [["__scopeId", "data-v-06a8d258"]]), wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
+ __proto__: null,
1401
+ default: ma
1402
+ }, Symbol.toStringTag, { value: "Module" })), ha = { class: "wi-dlv" }, ga = {
1403
+ key: 0,
1404
+ class: "wi-dlv__title"
1405
+ }, ba = { class: "wi-dlv__wrap" }, ka = { class: "wi-dlv__table" }, $a = ["title"], xa = { class: "wi-dlv__row-head" }, Sa = ["title"], Ca = {
1406
+ key: 1,
1407
+ class: "wi-dlv__pager"
1408
+ }, Ma = ["disabled"], Ea = ["disabled"], Ia = /* @__PURE__ */ D({
1409
+ __name: "DeviceLastValue",
1410
+ props: {
1411
+ report: {},
1412
+ pageSize: { default: 6 }
1413
+ },
1414
+ setup(o) {
1415
+ const s = o, r = b(() => {
1416
+ var _;
1417
+ return (_ = s.report) == null ? void 0 : _.values;
1418
+ }), e = q(1), a = b(() => {
1419
+ var _, w;
1420
+ return ((w = (_ = r.value) == null ? void 0 : _.values) == null ? void 0 : w.length) ?? 0;
1421
+ }), c = b(() => Math.max(1, Math.ceil(a.value / s.pageSize)));
1422
+ ae([a, () => s.pageSize], () => {
1423
+ e.value > c.value && (e.value = c.value);
1424
+ });
1425
+ const p = b(() => {
1426
+ var _;
1427
+ return (((_ = r.value) == null ? void 0 : _.values) ?? []).slice((e.value - 1) * s.pageSize, e.value * s.pageSize);
1428
+ }), f = (_, w) => {
1429
+ const m = _ == null ? void 0 : _[w.id], v = m && typeof m == "object" ? m.OVALUE : m;
1430
+ return v == null || v === "" ? "-" : w.unit ? `${v} ${w.unit}` : String(v);
1431
+ }, x = (_) => [_.OTYPE && `类型:${_.OTYPE}`, _.ONAME && `编号:${_.ONAME}`, _.OTIME && `时间:${_.OTIME}`].filter(Boolean).join(`
1432
+ `);
1433
+ return (_, w) => {
1434
+ var m, v;
1435
+ return n(), l("div", ha, [
1436
+ (m = r.value) != null && m.title ? (n(), l("div", ga, k(r.value.title), 1)) : I("", !0),
1437
+ t("div", ba, [
1438
+ t("table", ka, [
1439
+ t("thead", null, [
1440
+ t("tr", null, [
1441
+ w[2] || (w[2] = t("th", { class: "wi-dlv__corner" }, null, -1)),
1442
+ (n(!0), l(T, null, j(p.value, (d, $) => (n(), l("th", {
1443
+ key: $,
1444
+ title: x(d)
1445
+ }, k(d.OTITLE || d.ONAME || "-"), 9, $a))), 128))
1446
+ ])
1447
+ ]),
1448
+ t("tbody", null, [
1449
+ (n(!0), l(T, null, j(((v = r.value) == null ? void 0 : v.rows) ?? [], (d) => (n(), l("tr", {
1450
+ key: d.id
1451
+ }, [
1452
+ t("th", xa, k(d.title), 1),
1453
+ (n(!0), l(T, null, j(p.value, ($, U) => (n(), l("td", {
1454
+ key: U,
1455
+ title: x($)
1456
+ }, k(f($, d)), 9, Sa))), 128))
1457
+ ]))), 128))
1458
+ ])
1459
+ ])
1460
+ ]),
1461
+ c.value > 1 ? (n(), l("div", Ca, [
1462
+ t("button", {
1463
+ type: "button",
1464
+ disabled: e.value <= 1,
1465
+ onClick: w[0] || (w[0] = (d) => e.value -= 1)
1466
+ }, "‹", 8, Ma),
1467
+ t("span", null, k(e.value) + " / " + k(c.value) + "(共 " + k(a.value) + " 项)", 1),
1468
+ t("button", {
1469
+ type: "button",
1470
+ disabled: e.value >= c.value,
1471
+ onClick: w[1] || (w[1] = (d) => e.value += 1)
1472
+ }, "›", 8, Ea)
1473
+ ])) : I("", !0)
1474
+ ]);
1475
+ };
1476
+ }
1477
+ }), Aa = /* @__PURE__ */ H(Ia, [["__scopeId", "data-v-37504400"]]), Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1478
+ __proto__: null,
1479
+ default: Aa
1480
+ }, Symbol.toStringTag, { value: "Module" })), Ta = { class: "wi-media" }, Pa = ["src"], La = {
1481
+ key: 1,
1482
+ class: "wi-media__tip"
1483
+ }, ja = ["src"], Va = { class: "wi-media__tip" }, Ua = {
1484
+ key: 2,
1485
+ class: "wi-media__grid"
1486
+ }, Fa = ["src", "alt"], Na = {
1487
+ key: 1,
1488
+ class: "wi-media__cam-empty"
1489
+ }, qa = { class: "wi-media__cam-name" }, Ra = {
1490
+ key: 3,
1491
+ class: "wi-media__tip"
1492
+ }, Ba = /* @__PURE__ */ D({
1493
+ __name: "MediaAnswer",
1494
+ props: {
1495
+ report: {}
1496
+ },
1497
+ setup(o) {
1498
+ const s = o, r = Fe(), e = (f) => ra(r, f), a = b(() => {
1499
+ var f, x;
1500
+ return e((x = (f = s.report) == null ? void 0 : f.values) == null ? void 0 : x.file_id);
1501
+ }), c = b(() => {
1502
+ var f, x;
1503
+ return e((x = (f = s.report) == null ? void 0 : f.values) == null ? void 0 : x.file_id);
1504
+ }), p = b(() => {
1505
+ var x;
1506
+ const f = (x = s.report) == null ? void 0 : x.values;
1507
+ return Array.isArray(f == null ? void 0 : f.cameras) && f.cameras.length ? f.cameras : String((f == null ? void 0 : f.res_id) ?? "").split(",").filter(Boolean).map((_) => ({ res_id: _ }));
1508
+ });
1509
+ return (f, x) => {
1510
+ var _, w, m;
1511
+ return n(), l("div", Ta, [
1512
+ o.report.answer_type === "video" ? (n(), l(T, { key: 0 }, [
1513
+ a.value ? (n(), l("video", {
1514
+ key: 0,
1515
+ class: "wi-media__video",
1516
+ src: a.value,
1517
+ controls: "",
1518
+ preload: "metadata"
1519
+ }, null, 8, Pa)) : (n(), l("div", La, "视频资源:" + k(((_ = o.report.values) == null ? void 0 : _.model_id) || ((w = o.report.values) == null ? void 0 : w.file_id) || "-"), 1))
1520
+ ], 64)) : o.report.answer_type === "wav" ? (n(), l(T, { key: 1 }, [
1521
+ c.value ? (n(), l("audio", {
1522
+ key: 0,
1523
+ class: "wi-media__audio",
1524
+ src: c.value,
1525
+ controls: "",
1526
+ preload: "metadata"
1527
+ }, null, 8, ja)) : I("", !0),
1528
+ t("div", Va, "声音分析记录:" + k(((m = o.report.values) == null ? void 0 : m.noise_id) || "-"), 1)
1529
+ ], 64)) : o.report.answer_type === "camera" ? (n(), l("div", Ua, [
1530
+ (n(!0), l(T, null, j(p.value, (v, d) => (n(), l("div", {
1531
+ key: d,
1532
+ class: "wi-media__cam"
1533
+ }, [
1534
+ e(v.file_id) ? (n(), l("img", {
1535
+ key: 0,
1536
+ src: e(v.file_id),
1537
+ alt: v.name || v.res_id
1538
+ }, null, 8, Fa)) : (n(), l("div", Na, "无画面")),
1539
+ t("div", qa, k(v.name || v.res_id || `摄像头 ${d + 1}`), 1)
1540
+ ]))), 128))
1541
+ ])) : (n(), l("div", Ra, "暂不支持此操作,请使用插件"))
1542
+ ]);
1543
+ };
1544
+ }
1545
+ }), za = /* @__PURE__ */ H(Ba, [["__scopeId", "data-v-f6c03f9d"]]), Da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1546
+ __proto__: null,
1547
+ default: za
1548
+ }, Symbol.toStringTag, { value: "Module" })), Ha = { class: "wi-answer-card" }, Ka = ["aria-expanded"], Wa = {
1549
+ key: 1,
1550
+ class: "wi-answer-card__run"
1551
+ }, Xa = {
1552
+ key: 0,
1553
+ class: "wi-answer-card__dot is-running"
1554
+ }, Ga = { key: 1 }, Ya = ["data-wi-md-scope"], Za = { class: "wi-answer-card__step-index" }, Ja = ["innerHTML"], Qa = {
1555
+ key: 3,
1556
+ class: "wi-answer-card__err"
1557
+ }, el = {
1558
+ key: 4,
1559
+ class: "wi-answer-card__err"
1560
+ }, tl = {
1561
+ key: 5,
1562
+ class: "wi-answer-card__body"
1563
+ }, sl = {
1564
+ key: 6,
1565
+ class: "wi-answer-card__typing"
1566
+ }, nl = {
1567
+ key: 7,
1568
+ class: "wi-answer-card__conclusion"
1569
+ }, al = {
1570
+ key: 8,
1571
+ class: "wi-answer-card__stopped"
1572
+ }, ll = {
1573
+ key: 9,
1574
+ class: "wi-answer-card__ask-more"
1575
+ }, ol = ["onClick"], rl = /* @__PURE__ */ D({
1576
+ __name: "AnswerCard",
1577
+ props: {
1578
+ message: {},
1579
+ running: { type: Boolean, default: !1 },
1580
+ contentMap: { default: () => Pe() },
1581
+ showAskMore: { type: Boolean, default: !0 }
1582
+ },
1583
+ emits: ["ask"],
1584
+ setup(o, { emit: s }) {
1585
+ const r = o, e = s, a = b(() => vt(r.message.answer)), c = b(() => r.running && !r.message.stopped && !r.message.error), p = b(() => {
1586
+ var P, R;
1587
+ return ((R = (P = r.message.answer) == null ? void 0 : P.answer) == null ? void 0 : R.reports) ?? [];
1588
+ }), f = b(() => p.value.filter((P) => !!P.answer_type && !!r.contentMap[P.answer_type])), x = q(Date.now());
1589
+ let _ = null;
1590
+ ae(
1591
+ c,
1592
+ (P) => {
1593
+ P && !_ && (x.value = Date.now(), _ = setInterval(() => x.value = Date.now(), 1e3)), !P && _ && (clearInterval(_), _ = null);
1594
+ },
1595
+ { immediate: !0 }
1596
+ ), le(() => _ && clearInterval(_));
1597
+ const w = b(() => {
1598
+ const P = c.value && r.message.runStartAt != null ? x.value - r.message.runStartAt : r.message.runMs;
1599
+ return ft(P) ? P : null;
1600
+ }), m = b(() => r.message.thinking.steps.length > 0), v = b(() => c.value || w.value != null || m.value), d = b(() => {
1601
+ const P = c.value ? "进行中" : r.message.stopped ? "已停止" : "已完成";
1602
+ return w.value == null ? P : `${P},用时 ${yt(w.value)}`;
1603
+ }), $ = () => {
1604
+ r.message.thinking.expanded = !r.message.thinking.expanded;
1605
+ }, U = we(), M = q();
1606
+ let A;
1607
+ ae(M, (P) => {
1608
+ A == null || A(), A = me(P);
1609
+ }), le(() => A == null ? void 0 : A());
1610
+ const B = /* @__PURE__ */ new Map(), G = b(
1611
+ () => r.message.thinking.steps.map((P) => {
1612
+ let R = B.get(P);
1613
+ return R === void 0 && (B.size > 500 && B.clear(), R = he(P, { imageDownload: !1, tableDownload: !1, styleScope: U.selector }), B.set(P, R)), R;
1614
+ })
1615
+ );
1616
+ return (P, R) => {
1617
+ var K;
1618
+ return n(), l("div", Ha, [
1619
+ v.value && m.value ? (n(), l("button", {
1620
+ key: 0,
1621
+ type: "button",
1622
+ class: "wi-answer-card__pill",
1623
+ "aria-expanded": o.message.thinking.expanded,
1624
+ onClick: $
1625
+ }, [
1626
+ t("span", {
1627
+ class: X(["wi-answer-card__dot", { "is-running": c.value }])
1628
+ }, null, 2),
1629
+ t("span", null, k(d.value), 1),
1630
+ t("span", {
1631
+ class: X(["wi-answer-card__caret", { "is-open": o.message.thinking.expanded }])
1632
+ }, "▾", 2)
1633
+ ], 8, Ka)) : v.value ? (n(), l("div", Wa, [
1634
+ c.value ? (n(), l("span", Xa)) : (n(), l("span", Ga, "✓")),
1635
+ t("span", null, k(d.value), 1)
1636
+ ])) : I("", !0),
1637
+ o.message.thinking.expanded && G.value.length ? (n(), l("div", {
1638
+ key: 2,
1639
+ ref_key: "thinkingEl",
1640
+ ref: M,
1641
+ class: "wi-answer-card__thinking",
1642
+ "data-wi-md-scope": y(U).id
1643
+ }, [
1644
+ (n(!0), l(T, null, j(G.value, (N, S) => (n(), l("div", {
1645
+ key: S,
1646
+ class: "wi-answer-card__step"
1647
+ }, [
1648
+ t("span", Za, k(S + 1), 1),
1649
+ t("div", {
1650
+ class: "markdown-it wi-markdown wi-markdown--muted",
1651
+ innerHTML: N
1652
+ }, null, 8, Ja)
1653
+ ]))), 128))
1654
+ ], 8, Ya)) : I("", !0),
1655
+ (K = a.value.err) != null && K.msg ? (n(), l("div", Qa, k(a.value.err.msg), 1)) : I("", !0),
1656
+ o.message.error ? (n(), l("div", el, "回答出错,请重试")) : I("", !0),
1657
+ f.value.length ? (n(), l("div", tl, [
1658
+ (n(!0), l(T, null, j(f.value, (N, S) => (n(), J(Me(o.contentMap[N.answer_type]), {
1659
+ key: S,
1660
+ report: N
1661
+ }, null, 8, ["report"]))), 128))
1662
+ ])) : c.value && !m.value ? (n(), l("div", sl, [...R[0] || (R[0] = [
1663
+ t("span", null, null, -1),
1664
+ t("span", null, null, -1),
1665
+ t("span", null, null, -1)
1666
+ ])])) : I("", !0),
1667
+ a.value.conclusion.length ? (n(), l("div", nl, [
1668
+ (n(!0), l(T, null, j(a.value.conclusion, (N, S) => (n(), J(y(Te), {
1669
+ key: S,
1670
+ source: N.report || ""
1671
+ }, null, 8, ["source"]))), 128))
1672
+ ])) : I("", !0),
1673
+ o.message.stopped ? (n(), l("div", al, "已停止生成")) : I("", !0),
1674
+ o.showAskMore && a.value.contextHistory.length && !c.value ? (n(), l("div", ll, [
1675
+ R[1] || (R[1] = t("div", { class: "wi-answer-card__ask-title" }, "你可以继续问我:", -1)),
1676
+ (n(!0), l(T, null, j(a.value.contextHistory, (N, S) => (n(), l("button", {
1677
+ key: `${N.history_id ?? ""}-${S}`,
1678
+ type: "button",
1679
+ onClick: (F) => e("ask", N.question || "")
1680
+ }, k(N.question), 9, ol))), 128))
1681
+ ])) : I("", !0),
1682
+ We(P.$slots, "footer", { running: c.value }, void 0, !0)
1683
+ ]);
1684
+ };
1685
+ }
1686
+ }), Sl = /* @__PURE__ */ H(rl, [["__scopeId", "data-v-5e57acb8"]]), il = { class: "wi-answer-toolbar" }, ul = {
1687
+ key: 2,
1688
+ class: "wi-answer-toolbar__toast"
1689
+ }, cl = {
1690
+ key: 3,
1691
+ class: "wi-answer-toolbar__feedback"
1692
+ }, dl = { class: "wi-answer-toolbar__feedback-ops" }, _l = ["disabled"], pl = /* @__PURE__ */ D({
1693
+ __name: "AnswerToolbar",
1694
+ props: {
1695
+ message: {},
1696
+ actions: {},
1697
+ shareable: { type: Boolean, default: !0 }
1698
+ },
1699
+ setup(o) {
1700
+ const s = o, r = b(() => s.actions.stateOf(s.message)), e = q(""), a = q(!1), c = q("");
1701
+ let p = null;
1702
+ const f = (v) => {
1703
+ e.value = v, p && clearTimeout(p), p = setTimeout(() => e.value = "", 2e3);
1704
+ }, x = async () => f(await s.actions.copy(s.message) ? "已复制" : "复制失败"), _ = async (v) => {
1705
+ try {
1706
+ await s.actions.toggleState(s.message, v);
1707
+ } catch (d) {
1708
+ f(d instanceof Error ? d.message : "操作失败");
1709
+ }
1710
+ }, w = async () => {
1711
+ try {
1712
+ await s.actions.feedback(s.message, c.value), c.value = "", a.value = !1, f("感谢您的反馈");
1713
+ } catch (v) {
1714
+ f(v instanceof Error ? v.message : "提交失败");
1715
+ }
1716
+ }, m = async () => {
1717
+ try {
1718
+ await s.actions.share(s.message), f("已复制分享链接");
1719
+ } catch (v) {
1720
+ f(v instanceof Error ? v.message : "分享失败");
1721
+ }
1722
+ };
1723
+ return (v, d) => (n(), l("div", il, [
1724
+ o.actions.canCopy(o.message) ? (n(), l("button", {
1725
+ key: 0,
1726
+ type: "button",
1727
+ title: "复制",
1728
+ onClick: x
1729
+ }, [...d[5] || (d[5] = [
1730
+ t("svg", { viewBox: "0 0 24 24" }, [
1731
+ t("rect", {
1732
+ x: "9",
1733
+ y: "9",
1734
+ width: "11",
1735
+ height: "11",
1736
+ rx: "2"
1737
+ }),
1738
+ t("path", { d: "M5 15V5a2 2 0 0 1 2-2h10" })
1739
+ ], -1)
1740
+ ])])) : I("", !0),
1741
+ o.message.historyId ? (n(), l(T, { key: 1 }, [
1742
+ t("button", {
1743
+ type: "button",
1744
+ title: "点赞",
1745
+ class: X({ "is-active": r.value === "1" }),
1746
+ onClick: d[0] || (d[0] = ($) => _("1"))
1747
+ }, [...d[6] || (d[6] = [
1748
+ t("svg", { viewBox: "0 0 24 24" }, [
1749
+ t("path", { d: "M7 10v11H4V10h3Zm0 0 4-7a2 2 0 0 1 3 2l-1 5h6a2 2 0 0 1 2 2.3l-1.4 7A2 2 0 0 1 17.6 21H7" })
1750
+ ], -1)
1751
+ ])], 2),
1752
+ t("button", {
1753
+ type: "button",
1754
+ title: "点踩",
1755
+ class: X({ "is-active": r.value === "0" }),
1756
+ onClick: d[1] || (d[1] = ($) => _("0"))
1757
+ }, [...d[7] || (d[7] = [
1758
+ t("svg", { viewBox: "0 0 24 24" }, [
1759
+ t("path", { d: "M17 14V3h3v11h-3Zm0 0-4 7a2 2 0 0 1-3-2l1-5H5a2 2 0 0 1-2-2.3l1.4-7A2 2 0 0 1 6.4 3H17" })
1760
+ ], -1)
1761
+ ])], 2),
1762
+ t("button", {
1763
+ type: "button",
1764
+ title: "问题反馈",
1765
+ onClick: d[2] || (d[2] = ($) => a.value = !a.value)
1766
+ }, [...d[8] || (d[8] = [
1767
+ t("svg", { viewBox: "0 0 24 24" }, [
1768
+ t("path", { d: "M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10Z" }),
1769
+ t("path", { d: "M12 7v4M12 14h.01" })
1770
+ ], -1)
1771
+ ])]),
1772
+ o.shareable ? (n(), l("button", {
1773
+ key: 0,
1774
+ type: "button",
1775
+ title: "分享",
1776
+ onClick: m
1777
+ }, [...d[9] || (d[9] = [
1778
+ Xe('<svg viewBox="0 0 24 24" data-v-6ffad29a><circle cx="18" cy="5" r="3" data-v-6ffad29a></circle><circle cx="6" cy="12" r="3" data-v-6ffad29a></circle><circle cx="18" cy="19" r="3" data-v-6ffad29a></circle><path d="m8.6 13.5 6.8 4M15.4 6.5l-6.8 4" data-v-6ffad29a></path></svg>', 1)
1779
+ ])])) : I("", !0)
1780
+ ], 64)) : I("", !0),
1781
+ e.value ? (n(), l("span", ul, k(e.value), 1)) : I("", !0),
1782
+ a.value ? (n(), l("div", cl, [
1783
+ d[10] || (d[10] = t("div", { class: "wi-answer-toolbar__feedback-title" }, "你的反馈将帮助我们优化进步", -1)),
1784
+ ve(t("textarea", {
1785
+ "onUpdate:modelValue": d[3] || (d[3] = ($) => c.value = $),
1786
+ rows: "3",
1787
+ placeholder: "请描述回答存在的问题"
1788
+ }, null, 512), [
1789
+ [Oe, c.value]
1790
+ ]),
1791
+ t("div", dl, [
1792
+ t("button", {
1793
+ type: "button",
1794
+ onClick: d[4] || (d[4] = ($) => a.value = !1)
1795
+ }, "取消"),
1796
+ t("button", {
1797
+ type: "button",
1798
+ class: "is-primary",
1799
+ disabled: !c.value.trim(),
1800
+ onClick: w
1801
+ }, "提交", 8, _l)
1802
+ ])
1803
+ ])) : I("", !0)
1804
+ ]));
1805
+ }
1806
+ }), Cl = /* @__PURE__ */ H(pl, [["__scopeId", "data-v-6ffad29a"]]);
913
1807
  export {
914
- Qs as AiAnswerBubble,
915
- js as ClarificationCard,
916
- en as DeepThinkingSteps,
917
- Ks as HostActionStatus,
918
- Qt as IframePage,
919
- ot as KnowledgeStreamResult,
920
- zt as OutputFile,
921
- Ae as createAnswerContentMap,
922
- Jt as injectIframeResizerChild,
923
- sn as provideIframePageConfig,
924
- tn as provideOutputFileConfig,
925
- Wt as resolveIframePlaceholders,
926
- Yt as useIframePage
1808
+ Ue as ANSWER_RENDER_CONFIG,
1809
+ hl as AiAnswerBubble,
1810
+ Sl as AnswerCard,
1811
+ Cl as AnswerToolbar,
1812
+ In as ClarificationCard,
1813
+ gl as DeepThinkingSteps,
1814
+ Aa as DeviceLastValue,
1815
+ Nn as HostActionStatus,
1816
+ Hs as IframePage,
1817
+ Vt as KnowledgeStreamResult,
1818
+ za as MediaAnswer,
1819
+ Ss as OutputFile,
1820
+ Os as OutputFileLink,
1821
+ js as PresentFiles,
1822
+ la as RecordsetView,
1823
+ ma as SqlQuery,
1824
+ $l as TextAnswer,
1825
+ Pe as createAnswerContentMap,
1826
+ xe as guessMimeType,
1827
+ zs as injectIframeResizerChild,
1828
+ ke as joinLocalAssetPath,
1829
+ xl as provideAnswerRenderConfig,
1830
+ kl as provideIframePageConfig,
1831
+ bl as provideOutputFileConfig,
1832
+ Bt as readLocalFileForPreview,
1833
+ Nt as readLocalFilePath,
1834
+ ra as resolveFileUrl,
1835
+ Rs as resolveIframePlaceholders,
1836
+ Fe as useAnswerRenderConfig,
1837
+ Bs as useIframePage
927
1838
  };
928
1839
  //# sourceMappingURL=index.js.map