wi-chat 0.4.0 → 0.5.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 (70) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +129 -123
  3. package/dist/core/useChat.d.ts +11 -3
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +5 -3
  6. package/dist/index.js +102 -74
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
  8. package/dist/mobile-ui/index.cjs +1 -1
  9. package/dist/mobile-ui/index.d.ts +1 -1
  10. package/dist/mobile-ui/index.js +89 -82
  11. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  12. package/dist/mobile-ui/style.css +1 -1
  13. package/dist/page-context/extArgs.d.ts +46 -0
  14. package/dist/page-context/index.cjs +2 -0
  15. package/dist/page-context/index.d.ts +18 -0
  16. package/dist/page-context/index.js +48 -0
  17. package/dist/page-context/state.d.ts +10 -0
  18. package/dist/page-context/types.d.ts +218 -0
  19. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  20. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  21. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  22. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  23. package/dist/parser/index.cjs +2 -2
  24. package/dist/parser/index.d.ts +9 -0
  25. package/dist/parser/index.js +537 -251
  26. package/dist/parser/registry.d.ts +8 -1
  27. package/dist/parser/title.d.ts +27 -0
  28. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  29. package/dist/renderers/index.cjs +1 -1
  30. package/dist/renderers/index.d.ts +1 -0
  31. package/dist/renderers/index.js +641 -354
  32. package/dist/renderers/style.css +1 -1
  33. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  34. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  35. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  36. package/dist/right-panel/icons.d.ts +48 -0
  37. package/dist/right-panel/index.cjs +2 -0
  38. package/dist/right-panel/index.d.ts +43 -0
  39. package/dist/right-panel/index.js +1004 -0
  40. package/dist/right-panel/panels/index.d.ts +7 -0
  41. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  42. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  43. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  44. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  45. package/dist/right-panel/panels/web/index.d.ts +4 -0
  46. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  47. package/dist/right-panel/registry.d.ts +24 -0
  48. package/dist/right-panel/runtime.d.ts +45 -0
  49. package/dist/right-panel/scope.d.ts +34 -0
  50. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  51. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  52. package/dist/right-panel/style.css +1 -0
  53. package/dist/right-panel/types.d.ts +363 -0
  54. package/dist/right-panel/useRightPanel.d.ts +39 -0
  55. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  56. package/dist/tools/index.cjs +4 -4
  57. package/dist/tools/index.d.ts +1 -1
  58. package/dist/tools/index.js +200 -165
  59. package/dist/tools/markdown/index.d.ts +1 -1
  60. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  61. package/dist/tools/useAutoScroll.d.ts +11 -3
  62. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  63. package/dist/web-ui/chat/ChatContainer.vue.d.ts +3 -3
  64. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  65. package/dist/web-ui/index.cjs +1 -1
  66. package/dist/web-ui/index.d.ts +1 -1
  67. package/dist/web-ui/index.js +403 -392
  68. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  69. package/dist/web-ui/style.css +1 -1
  70. package/package.json +13 -6
@@ -1,144 +1,149 @@
1
1
  import "wi-chat/style.css";
2
- import { defineAsyncComponent as N, defineComponent as L, computed as I, openBlock as l, createElementBlock as d, createElementVNode as i, Fragment as M, renderList as B, createBlock as P, resolveDynamicComponent as ie, createCommentVNode as C, createTextVNode as le, pushScopeId as H, popScopeId as K, toDisplayString as S, withDirectives as ce, vShow as de, getCurrentInstance as te, inject as oe, toValue as O, ref as E, watch as ue, onBeforeUnmount as pe, provide as ne, withKeys as J, unref as n, withModifiers as D, normalizeClass as _e, Teleport as fe, createVNode as we, Transition as me, withCtx as ve } from "vue";
3
- import { knowledgeStreamParser as he, iframePageParser as be, outputFileParser as ge, formatFileSize as ye, IFRAME_RESIZER_CHILD_SCRIPT as ke } from "wi-chat/parser";
4
- import { renderMarkdown as se, downloadTableAsExcel as Se } from "wi-chat/tools";
5
- import Z from "@iframe-resizer/vue/iframe-resizer.vue";
6
- const Ie = [
7
- { ...he, component: N(() => Promise.resolve().then(() => We)) },
8
- { ...be, component: N(() => Promise.resolve().then(() => Xt)) },
9
- { ...ge, component: N(() => Promise.resolve().then(() => jt)) }
10
- ], Ee = (o) => {
11
- const t = (r) => {
12
- const s = {};
13
- for (const e of r)
14
- !e.answerType || !e.component || (s[e.answerType] = e.component);
15
- return s;
2
+ import { defineAsyncComponent as J, defineComponent as D, computed as T, openBlock as i, createElementBlock as u, createElementVNode as s, Fragment as M, renderList as F, createBlock as Z, resolveDynamicComponent as ge, createCommentVNode as V, createTextVNode as ke, pushScopeId as Q, popScopeId as ee, unref as l, toDisplayString as m, withDirectives as Se, vShow as $e, getCurrentInstance as ue, inject as ce, toValue as A, ref as L, watch as de, onBeforeUnmount as xe, provide as _e, withKeys as re, withModifiers as te, normalizeClass as q, Teleport as Ie, createVNode as Ce, Transition as Ee, withCtx as Oe, reactive as Te, normalizeStyle as Ve } from "vue";
3
+ import { knowledgeStreamParser as Ue, iframePageParser as Le, outputFileParser as Me, actionExecuteParser as Pe, formatFileSize as je, IFRAME_RESIZER_CHILD_SCRIPT as Re, submitClarification as Ne, cancelClarification as Fe } from "wi-chat/parser";
4
+ import { createStyleScope as pe, renderMarkdown as fe, downloadTableAsExcel as Ae } from "wi-chat/tools";
5
+ import le from "@iframe-resizer/vue/iframe-resizer.vue";
6
+ const De = [
7
+ { ...Ue, component: J(() => Promise.resolve().then(() => _t)) },
8
+ { ...Le, component: J(() => Promise.resolve().then(() => _s)) },
9
+ { ...Me, component: J(() => Promise.resolve().then(() => ss)) },
10
+ // 确认卡片(action_execute → collect_clarifications):解析由内置 actionExecuteParser 完成,
11
+ // 提交/取消经 wi-chat/parser 的 submitClarification / cancelClarification 回传 wait_reply
12
+ { ...Pe, component: J(() => Promise.resolve().then(() => Qs)) }
13
+ ], Be = (n) => {
14
+ const a = (c) => {
15
+ const r = {};
16
+ for (const t of c)
17
+ !t.answerType || !t.component || (r[t.answerType] = t.component);
18
+ return r;
16
19
  };
17
- return { ...t(Ie), ...t(o ?? []) };
18
- }, Ce = (o) => (H("data-v-efad55c8"), o = o(), K(), o), Ue = { class: "flex justify-start" }, Oe = { class: "ai-answer-bubble" }, xe = {
20
+ return { ...a(De), ...a(n ?? []) };
21
+ }, ze = (n) => (Q("data-v-efad55c8"), n = n(), ee(), n), qe = { class: "flex justify-start" }, Ke = { class: "ai-answer-bubble" }, He = {
19
22
  key: 0,
20
23
  class: "ai-answer-bubble__error"
21
- }, Le = { class: "ai-answer-bubble__body" }, Te = {
24
+ }, Xe = { class: "ai-answer-bubble__body" }, Ge = {
22
25
  key: 0,
23
26
  class: "ai-answer-bubble__status"
24
- }, $e = {
27
+ }, We = {
25
28
  key: 2,
26
29
  class: "ai-answer-bubble__status"
27
- }, Re = {
30
+ }, Ye = {
28
31
  key: 3,
29
32
  class: "ai-answer-bubble__loading"
30
- }, Me = /* @__PURE__ */ Ce(() => /* @__PURE__ */ i("span", { class: "ai-answer-bubble__pulse" }, null, -1)), Pe = /* @__PURE__ */ L({
33
+ }, Je = /* @__PURE__ */ ze(() => /* @__PURE__ */ s("span", { class: "ai-answer-bubble__pulse" }, null, -1)), Ze = /* @__PURE__ */ D({
31
34
  __name: "AiAnswerBubble",
32
35
  props: {
33
36
  answer: {},
34
37
  error: { type: Boolean, default: !1 },
35
38
  stopped: { type: Boolean, default: !1 },
36
- contentMap: { default: () => Ee() }
39
+ contentMap: { default: () => Be() }
37
40
  },
38
- setup(o) {
39
- const t = o, r = I(() => {
40
- var e, c;
41
- return ((c = (e = t.answer) == null ? void 0 : e.answer) == null ? void 0 : c.reports) ?? [];
42
- }), s = I(() => r.value.filter((e) => t.contentMap[e.answer_type]));
43
- return (e, c) => (l(), d("div", Ue, [
44
- i("div", Oe, [
45
- e.error ? (l(), d("div", xe, "回答加载失败")) : s.value.length ? (l(), d(M, { key: 1 }, [
46
- i("div", Le, [
47
- (l(!0), d(M, null, B(s.value, (_, p) => (l(), P(ie(e.contentMap[_.answer_type]), {
48
- key: p,
49
- report: _
41
+ setup(n) {
42
+ const a = n, c = T(() => {
43
+ var t, _;
44
+ return ((_ = (t = a.answer) == null ? void 0 : t.answer) == null ? void 0 : _.reports) ?? [];
45
+ }), r = T(() => c.value.filter((t) => a.contentMap[t.answer_type]));
46
+ return (t, _) => (i(), u("div", qe, [
47
+ s("div", Ke, [
48
+ t.error ? (i(), u("div", He, "回答加载失败")) : r.value.length ? (i(), u(M, { key: 1 }, [
49
+ s("div", Xe, [
50
+ (i(!0), u(M, null, F(r.value, (w, x) => (i(), Z(ge(t.contentMap[w.answer_type]), {
51
+ key: x,
52
+ report: w
50
53
  }, null, 8, ["report"]))), 128))
51
54
  ]),
52
- e.stopped ? (l(), d("div", Te, "回答已停止")) : C("", !0)
53
- ], 64)) : e.stopped ? (l(), d("div", $e, "回答已停止")) : r.value.length ? C("", !0) : (l(), d("div", Re, [
54
- Me,
55
- le("正在思考...")
55
+ t.stopped ? (i(), u("div", Ge, "回答已停止")) : V("", !0)
56
+ ], 64)) : t.stopped ? (i(), u("div", We, "回答已停止")) : c.value.length ? V("", !0) : (i(), u("div", Ye, [
57
+ Je,
58
+ ke("正在思考...")
56
59
  ]))
57
60
  ])
58
61
  ]));
59
62
  }
60
- }), T = (o, t) => {
61
- const r = o.__vccOpts || o;
62
- for (const [s, e] of t)
63
- r[s] = e;
64
- return r;
65
- }, Zt = /* @__PURE__ */ T(Pe, [["__scopeId", "data-v-efad55c8"]]), je = (o) => (H("data-v-c6f5cb64"), o = o(), K(), o), Fe = {
66
- key: 0,
67
- class: "deep-thinking"
68
- }, Ne = ["aria-expanded"], De = /* @__PURE__ */ je(() => /* @__PURE__ */ i("span", { class: "deep-thinking__title" }, "深度思考", -1)), Ae = { class: "deep-thinking__count" }, ze = { class: "deep-thinking__list" }, Be = { class: "deep-thinking__index" }, He = ["innerHTML"], Ke = /* @__PURE__ */ L({
63
+ }), B = (n, a) => {
64
+ const c = n.__vccOpts || n;
65
+ for (const [r, t] of a)
66
+ c[r] = t;
67
+ return c;
68
+ }, an = /* @__PURE__ */ B(Ze, [["__scopeId", "data-v-efad55c8"]]), Qe = (n) => (Q("data-v-de333356"), n = n(), ee(), n), et = ["data-wi-md-scope"], tt = ["aria-expanded"], st = /* @__PURE__ */ Qe(() => /* @__PURE__ */ s("span", { class: "deep-thinking__title" }, "深度思考", -1)), nt = { class: "deep-thinking__count" }, ot = { class: "deep-thinking__list" }, at = { class: "deep-thinking__index" }, rt = ["innerHTML"], lt = /* @__PURE__ */ D({
69
69
  __name: "DeepThinkingSteps",
70
70
  props: {
71
71
  steps: {},
72
72
  expanded: { type: Boolean }
73
73
  },
74
74
  emits: ["update:expanded"],
75
- setup(o, { emit: t }) {
76
- const r = o, s = t, e = { imageDownload: !1, tableDownload: !1 }, c = /* @__PURE__ */ new Map(), _ = (u) => {
77
- let f = c.get(u);
78
- return f === void 0 && (c.size > 500 && c.clear(), f = se(u, e), c.set(u, f)), f;
79
- }, p = I(() => r.steps.map(_));
80
- return (u, f) => p.value.length ? (l(), d("div", Fe, [
81
- i("button", {
75
+ setup(n, { emit: a }) {
76
+ const c = n, r = a, t = { imageDownload: !1, tableDownload: !1 }, _ = pe(), w = { ...t, styleScope: _.selector }, x = /* @__PURE__ */ new Map(), b = (p) => {
77
+ let y = x.get(p);
78
+ return y === void 0 && (x.size > 500 && x.clear(), y = fe(p, w), x.set(p, y)), y;
79
+ }, g = T(() => c.steps.map(b));
80
+ return (p, y) => g.value.length ? (i(), u("div", {
81
+ key: 0,
82
+ class: "deep-thinking",
83
+ "data-wi-md-scope": l(_).id
84
+ }, [
85
+ s("button", {
82
86
  type: "button",
83
87
  class: "deep-thinking__header",
84
- "aria-expanded": u.expanded,
85
- onClick: f[0] || (f[0] = (b) => s("update:expanded", !u.expanded))
88
+ "aria-expanded": p.expanded,
89
+ onClick: y[0] || (y[0] = (k) => r("update:expanded", !p.expanded))
86
90
  }, [
87
- De,
88
- i("span", Ae, S(p.value.length), 1),
89
- i("span", null, S(u.expanded ? "收起" : "展开"), 1)
90
- ], 8, Ne),
91
- ce(i("div", ze, [
92
- (l(!0), d(M, null, B(p.value, (b, w) => (l(), d("div", {
93
- key: w,
91
+ st,
92
+ s("span", nt, m(g.value.length), 1),
93
+ s("span", null, m(p.expanded ? "收起" : "展开"), 1)
94
+ ], 8, tt),
95
+ Se(s("div", ot, [
96
+ (i(!0), u(M, null, F(g.value, (k, E) => (i(), u("div", {
97
+ key: E,
94
98
  class: "deep-thinking__item"
95
99
  }, [
96
- i("span", Be, S(w + 1), 1),
97
- i("div", {
100
+ s("span", at, m(E + 1), 1),
101
+ s("div", {
98
102
  class: "markdown-it",
99
- innerHTML: b
100
- }, null, 8, He)
103
+ innerHTML: k
104
+ }, null, 8, rt)
101
105
  ]))), 128))
102
106
  ], 512), [
103
- [de, u.expanded]
107
+ [$e, p.expanded]
104
108
  ])
105
- ])) : C("", !0);
109
+ ], 8, et)) : V("", !0);
106
110
  }
107
- }), Qt = /* @__PURE__ */ T(Ke, [["__scopeId", "data-v-c6f5cb64"]]), Ve = ["innerHTML"], Xe = /* @__PURE__ */ L({
111
+ }), rn = /* @__PURE__ */ B(lt, [["__scopeId", "data-v-de333356"]]), it = ["data-wi-md-scope"], ut = ["innerHTML"], ct = /* @__PURE__ */ D({
108
112
  __name: "KnowledgeStreamResult",
109
113
  props: {
110
114
  report: {}
111
115
  },
112
- setup(o) {
113
- const t = o, r = { imageDownload: !1, tableDownload: !0 }, s = (p) => {
114
- var w;
115
- const f = p.target.closest(".wi-md-table-download");
116
- if (!f)
116
+ setup(n) {
117
+ const a = n, c = { imageDownload: !1, tableDownload: !0 }, r = pe(), t = { ...c, styleScope: r.selector }, _ = (g) => {
118
+ var E;
119
+ const y = g.target.closest(".wi-md-table-download");
120
+ if (!y)
117
121
  return;
118
- p.preventDefault(), p.stopPropagation();
119
- const b = (w = f.closest(".wi-md-table-wrap")) == null ? void 0 : w.querySelector("table");
120
- b && Se(b);
121
- }, e = /* @__PURE__ */ new Map(), c = (p) => {
122
- let u = e.get(p);
123
- return u === void 0 && (e.size > 300 && e.clear(), u = se(p, r), e.set(p, u)), u;
124
- }, _ = I(() => (t.report.values || []).map((p) => c(p.answer || "")));
125
- return (p, u) => (l(), d("div", {
122
+ g.preventDefault(), g.stopPropagation();
123
+ const k = (E = y.closest(".wi-md-table-wrap")) == null ? void 0 : E.querySelector("table");
124
+ k && Ae(k);
125
+ }, w = /* @__PURE__ */ new Map(), x = (g) => {
126
+ let p = w.get(g);
127
+ return p === void 0 && (w.size > 300 && w.clear(), p = fe(g, t), w.set(g, p)), p;
128
+ }, b = T(() => (a.report.values || []).map((g) => x(g.answer || "")));
129
+ return (g, p) => (i(), u("div", {
126
130
  class: "knowledge-result",
127
- onClick: s
131
+ "data-wi-md-scope": l(r).id,
132
+ onClick: _
128
133
  }, [
129
- (l(!0), d(M, null, B(_.value, (f, b) => (l(), d("div", {
130
- key: b,
134
+ (i(!0), u(M, null, F(b.value, (y, k) => (i(), u("div", {
135
+ key: k,
131
136
  class: "markdown-it",
132
- innerHTML: f
133
- }, null, 8, Ve))), 128))
134
- ]));
137
+ innerHTML: y
138
+ }, null, 8, ut))), 128))
139
+ ], 8, it));
135
140
  }
136
- }), Ge = /* @__PURE__ */ T(Xe, [["__scopeId", "data-v-1827e802"]]), We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
141
+ }), dt = /* @__PURE__ */ B(ct, [["__scopeId", "data-v-857bc0d2"]]), _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
137
142
  __proto__: null,
138
- default: Ge
139
- }, Symbol.toStringTag, { value: "Module" })), re = Symbol("wi-chat-output-file-config"), eo = (o) => {
140
- ne(re, o);
141
- }, qe = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), Ye = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), Je = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), Ze = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), Qe = /* @__PURE__ */ new Set(["html", "htm"]), et = /* @__PURE__ */ new Set([
143
+ default: dt
144
+ }, Symbol.toStringTag, { value: "Module" })), ve = Symbol("wi-chat-output-file-config"), ln = (n) => {
145
+ _e(ve, n);
146
+ }, pt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), ft = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), vt = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), wt = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), yt = /* @__PURE__ */ new Set(["html", "htm"]), ht = /* @__PURE__ */ new Set([
142
147
  "js",
143
148
  "mjs",
144
149
  "cjs",
@@ -164,7 +169,7 @@ const Ie = [
164
169
  "css",
165
170
  "scss",
166
171
  "less"
167
- ]), tt = /* @__PURE__ */ new Set([
172
+ ]), mt = /* @__PURE__ */ new Set([
168
173
  "txt",
169
174
  "text",
170
175
  "md",
@@ -180,116 +185,122 @@ const Ie = [
180
185
  "env",
181
186
  "toml",
182
187
  "sql"
183
- ]), Q = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), ot = (o) => {
184
- const t = o.lastIndexOf(".");
185
- return t >= 0 ? o.slice(t + 1).toLowerCase() : "";
186
- }, nt = (o) => qe.has(o) ? "image" : o === "pdf" ? "pdf" : Qe.has(o) ? "html" : Ye.has(o) ? "audio" : Je.has(o) ? "video" : Ze.has(o) ? "office" : et.has(o) ? "code" : tt.has(o) ? "text" : "unknown", st = (o) => {
187
- const t = te() ? oe(re, {}) : {}, r = I(() => {
188
- var h;
189
- const a = O(o);
190
- return ((h = a == null ? void 0 : a.values) == null ? void 0 : h.file_id) ?? (a == null ? void 0 : a.file_id) ?? "";
191
- }), s = I(() => {
192
- var h;
193
- const a = O(o);
194
- return ((h = a == null ? void 0 : a.values) == null ? void 0 : h.file_name) ?? (a == null ? void 0 : a.file_name) ?? "未命名文件";
195
- }), e = I(() => ot(s.value)), c = I(() => nt(e.value)), _ = E(!1), p = E(!1), u = E(""), f = E(!1), b = E(""), w = E(""), y = E(null), U = I(() => y.value ? ye(y.value.size) : ""), k = () => {
196
- w.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(w.value), w.value = "";
197
- }, $ = async () => {
198
- const a = r.value, h = s.value;
199
- if (!a)
188
+ ]), bt = 20, N = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map(), gt = (n, a) => {
189
+ if (!N.has(n) && N.size >= bt) {
190
+ const c = N.keys().next().value;
191
+ c !== void 0 && N.delete(c);
192
+ }
193
+ N.set(n, a);
194
+ }, kt = (n) => {
195
+ const a = n.lastIndexOf(".");
196
+ return a >= 0 ? n.slice(a + 1).toLowerCase() : "";
197
+ }, St = (n) => pt.has(n) ? "image" : n === "pdf" ? "pdf" : yt.has(n) ? "html" : ft.has(n) ? "audio" : vt.has(n) ? "video" : wt.has(n) ? "office" : ht.has(n) ? "code" : mt.has(n) ? "text" : "unknown", $t = (n) => {
198
+ const a = ue() ? ce(ve, {}) : {}, c = T(() => {
199
+ var I;
200
+ const d = A(n);
201
+ return ((I = d == null ? void 0 : d.values) == null ? void 0 : I.file_id) ?? (d == null ? void 0 : d.file_id) ?? "";
202
+ }), r = T(() => {
203
+ var I;
204
+ const d = A(n);
205
+ return ((I = d == null ? void 0 : d.values) == null ? void 0 : I.file_name) ?? (d == null ? void 0 : d.file_name) ?? "未命名文件";
206
+ }), t = T(() => kt(r.value)), _ = T(() => St(t.value)), w = L(!1), x = L(!1), b = L(""), g = L(!1), p = L(""), y = L(""), k = L(null), E = T(() => k.value ? je(k.value.size) : ""), O = () => {
207
+ y.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(y.value), y.value = "";
208
+ }, j = async () => {
209
+ const d = c.value, I = r.value;
210
+ if (!d)
200
211
  throw new Error("缺少文件 id,无法加载文件");
201
- const g = a || h, W = Q.get(g);
202
- if (W)
203
- return W;
204
- let R = A.get(g);
212
+ const C = d || I, X = N.get(C);
213
+ if (X)
214
+ return X;
215
+ let R = se.get(C);
205
216
  return R || (R = (async () => {
206
- var q, Y;
207
- if (t.loadFile)
208
- return t.loadFile(a);
209
- const x = (q = t.getFileUrl) == null ? void 0 : q.call(t, a);
210
- if (!x)
217
+ var G, W;
218
+ if (a.loadFile)
219
+ return a.loadFile(d);
220
+ const P = (G = a.getFileUrl) == null ? void 0 : G.call(a, d);
221
+ if (!P)
211
222
  throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");
212
- const F = await fetch(x, { headers: (Y = t.getHeaders) == null ? void 0 : Y.call(t) });
213
- if (!F.ok)
214
- throw new Error(`文件加载失败(HTTP ${F.status})`);
215
- return F.blob();
216
- })().then((x) => (Q.set(g, x), x)).finally(() => A.delete(g)), A.set(g, R)), R;
217
- }, m = async () => {
218
- p.value = !0, u.value = "", f.value = !1, b.value = "", k();
223
+ const v = await fetch(P, { headers: (W = a.getHeaders) == null ? void 0 : W.call(a) });
224
+ if (!v.ok)
225
+ throw new Error(`文件加载失败(HTTP ${v.status})`);
226
+ return v.blob();
227
+ })().then((P) => (gt(C, P), P)).finally(() => se.delete(C)), se.set(C, R)), R;
228
+ }, S = async () => {
229
+ x.value = !0, b.value = "", g.value = !1, p.value = "", O();
219
230
  try {
220
- const a = await $();
221
- y.value = a;
222
- const h = c.value;
223
- if (h === "office") {
224
- f.value = !0;
231
+ const d = await j();
232
+ k.value = d;
233
+ const I = _.value;
234
+ if (I === "office") {
235
+ g.value = !0;
225
236
  return;
226
237
  }
227
- if (h === "image" || h === "pdf" || h === "audio" || h === "video") {
228
- typeof URL < "u" && typeof URL.createObjectURL == "function" && (w.value = URL.createObjectURL(a));
238
+ if (I === "image" || I === "pdf" || I === "audio" || I === "video") {
239
+ typeof URL < "u" && typeof URL.createObjectURL == "function" && (y.value = URL.createObjectURL(d));
229
240
  return;
230
241
  }
231
- const g = await a.text();
232
- if (g.includes("\0")) {
233
- f.value = !0;
242
+ const C = await d.text();
243
+ if (C.includes("\0")) {
244
+ g.value = !0;
234
245
  return;
235
246
  }
236
- b.value = g;
237
- } catch (a) {
238
- u.value = a instanceof Error ? a.message : String(a);
247
+ p.value = C;
248
+ } catch (d) {
249
+ b.value = d instanceof Error ? d.message : String(d);
239
250
  } finally {
240
- p.value = !1;
251
+ x.value = !1;
241
252
  }
242
- }, v = async () => {
243
- if (t.openPreview) {
244
- t.openPreview({
245
- fileId: r.value,
246
- fileName: s.value,
247
- loadFile: $,
248
- download: G
253
+ }, $ = async () => {
254
+ if (a.openPreview) {
255
+ a.openPreview({
256
+ fileId: c.value,
257
+ fileName: r.value,
258
+ loadFile: j,
259
+ download: H
249
260
  });
250
261
  return;
251
262
  }
252
- _.value = !0, await m();
253
- }, X = () => {
254
- _.value = !1, p.value = !1, u.value = "", f.value = !1, b.value = "", k();
255
- }, G = async () => {
263
+ w.value = !0, await S();
264
+ }, K = () => {
265
+ w.value = !1, x.value = !1, b.value = "", g.value = !1, p.value = "", O();
266
+ }, H = async () => {
256
267
  try {
257
- const a = y.value ?? await $();
258
- if (y.value = a, t.downloadFile) {
259
- t.downloadFile({ fileId: r.value, fileName: s.value, blob: a });
268
+ const d = k.value ?? await j();
269
+ if (k.value = d, a.downloadFile) {
270
+ a.downloadFile({ fileId: c.value, fileName: r.value, blob: d });
260
271
  return;
261
272
  }
262
273
  if (typeof document > "u" || typeof URL > "u")
263
274
  return;
264
- const h = URL.createObjectURL(a), g = document.createElement("a");
265
- g.href = h, g.download = s.value, document.body.appendChild(g), g.click(), g.remove(), URL.revokeObjectURL(h);
266
- } catch (a) {
267
- u.value = a instanceof Error ? a.message : String(a), !_.value && !t.openPreview && (_.value = !0);
275
+ const I = URL.createObjectURL(d), C = document.createElement("a");
276
+ C.href = I, C.download = r.value, document.body.appendChild(C), C.click(), C.remove(), URL.revokeObjectURL(I);
277
+ } catch (d) {
278
+ b.value = d instanceof Error ? d.message : String(d), !w.value && !a.openPreview && (w.value = !0);
268
279
  }
269
- }, j = (a) => {
270
- a.key === "Escape" && _.value && X();
280
+ }, z = (d) => {
281
+ d.key === "Escape" && w.value && K();
271
282
  };
272
- return ue(_, (a) => {
273
- typeof window > "u" || (a ? window.addEventListener("keydown", j) : window.removeEventListener("keydown", j));
274
- }), pe(() => {
275
- typeof window < "u" && window.removeEventListener("keydown", j), k();
283
+ return de(w, (d) => {
284
+ typeof window > "u" || (d ? window.addEventListener("keydown", z) : window.removeEventListener("keydown", z));
285
+ }), xe(() => {
286
+ typeof window < "u" && window.removeEventListener("keydown", z), O();
276
287
  }), {
277
- fileId: r,
278
- fileName: s,
279
- extension: e,
280
- previewKind: c,
281
- fileSize: U,
282
- visible: _,
283
- loading: p,
284
- error: u,
285
- unsupported: f,
286
- textContent: b,
287
- objectUrl: w,
288
- open: v,
289
- close: X,
290
- download: G
288
+ fileId: c,
289
+ fileName: r,
290
+ extension: t,
291
+ previewKind: _,
292
+ fileSize: E,
293
+ visible: w,
294
+ loading: x,
295
+ error: b,
296
+ unsupported: g,
297
+ textContent: p,
298
+ objectUrl: y,
299
+ open: $,
300
+ close: K,
301
+ download: H
291
302
  };
292
- }, V = (o) => (H("data-v-f61a91b5"), o = o(), K(), o), rt = { class: "wi-output-file" }, at = ["aria-label"], it = /* @__PURE__ */ V(() => /* @__PURE__ */ i("svg", {
303
+ }, oe = (n) => (Q("data-v-f61a91b5"), n = n(), ee(), n), xt = { class: "wi-output-file" }, It = ["aria-label"], Ct = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("svg", {
293
304
  viewBox: "0 0 24 24",
294
305
  fill: "none",
295
306
  stroke: "currentColor",
@@ -297,14 +308,14 @@ const Ie = [
297
308
  "stroke-linecap": "round",
298
309
  "stroke-linejoin": "round"
299
310
  }, [
300
- /* @__PURE__ */ i("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
301
- /* @__PURE__ */ i("path", { d: "M14 2.5v4h4" })
302
- ], -1)), lt = [
303
- it
304
- ], ct = { class: "wi-output-file__info" }, dt = ["title"], ut = { class: "wi-output-file__meta" }, pt = { class: "wi-output-file__ext" }, _t = {
311
+ /* @__PURE__ */ s("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
312
+ /* @__PURE__ */ s("path", { d: "M14 2.5v4h4" })
313
+ ], -1)), Et = [
314
+ Ct
315
+ ], Ot = { class: "wi-output-file__info" }, Tt = ["title"], Vt = { class: "wi-output-file__meta" }, Ut = { class: "wi-output-file__ext" }, Lt = {
305
316
  key: 0,
306
317
  class: "wi-output-file__size"
307
- }, ft = /* @__PURE__ */ V(() => /* @__PURE__ */ i("svg", {
318
+ }, Mt = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("svg", {
308
319
  viewBox: "0 0 24 24",
309
320
  fill: "none",
310
321
  stroke: "currentColor",
@@ -312,298 +323,574 @@ const Ie = [
312
323
  "stroke-linecap": "round",
313
324
  "stroke-linejoin": "round"
314
325
  }, [
315
- /* @__PURE__ */ i("path", { d: "M12 3v12" }),
316
- /* @__PURE__ */ i("path", { d: "m7 10 5 5 5-5" }),
317
- /* @__PURE__ */ i("path", { d: "M5 21h14" })
318
- ], -1)), wt = [
319
- ft
320
- ], mt = ["aria-label"], vt = { class: "wi-output-file-drawer__head" }, ht = { class: "wi-output-file-drawer__title" }, bt = { class: "wi-output-file-drawer__ext" }, gt = ["title"], yt = {
326
+ /* @__PURE__ */ s("path", { d: "M12 3v12" }),
327
+ /* @__PURE__ */ s("path", { d: "m7 10 5 5 5-5" }),
328
+ /* @__PURE__ */ s("path", { d: "M5 21h14" })
329
+ ], -1)), Pt = [
330
+ Mt
331
+ ], jt = ["aria-label"], Rt = { class: "wi-output-file-drawer__head" }, Nt = { class: "wi-output-file-drawer__title" }, Ft = { class: "wi-output-file-drawer__ext" }, At = ["title"], Dt = {
321
332
  key: 0,
322
333
  class: "wi-output-file-drawer__size"
323
- }, kt = { class: "wi-output-file-drawer__actions" }, St = { class: "wi-output-file-drawer__body" }, It = {
334
+ }, Bt = { class: "wi-output-file-drawer__actions" }, zt = { class: "wi-output-file-drawer__body" }, qt = {
324
335
  key: 0,
325
336
  class: "wi-output-file-drawer__state"
326
- }, Et = {
337
+ }, Kt = {
327
338
  key: 1,
328
339
  class: "wi-output-file-drawer__state is-error"
329
- }, Ct = {
340
+ }, Ht = {
330
341
  key: 2,
331
342
  class: "wi-output-file-drawer__state"
332
- }, Ut = /* @__PURE__ */ V(() => /* @__PURE__ */ i("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)), Ot = ["src", "alt"], xt = ["src", "title"], Lt = ["srcdoc", "title"], Tt = ["src"], $t = ["src"], Rt = {
343
+ }, Xt = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)), Gt = ["src", "alt"], Wt = ["src", "title"], Yt = ["srcdoc", "title"], Jt = ["src"], Zt = ["src"], Qt = {
333
344
  key: 8,
334
345
  class: "wi-output-file-drawer__text"
335
- }, Mt = /* @__PURE__ */ L({
346
+ }, es = /* @__PURE__ */ D({
336
347
  __name: "OutputFile",
337
348
  props: {
338
349
  report: {}
339
350
  },
340
- setup(o) {
341
- const t = o, {
342
- fileName: r,
343
- extension: s,
344
- previewKind: e,
345
- fileSize: c,
346
- visible: _,
347
- loading: p,
348
- error: u,
349
- unsupported: f,
350
- textContent: b,
351
- objectUrl: w,
352
- open: y,
353
- close: U,
354
- download: k
355
- } = st(() => t.report);
356
- return ($, m) => (l(), d("div", rt, [
357
- i("div", {
351
+ setup(n) {
352
+ const a = n, {
353
+ fileName: c,
354
+ extension: r,
355
+ previewKind: t,
356
+ fileSize: _,
357
+ visible: w,
358
+ loading: x,
359
+ error: b,
360
+ unsupported: g,
361
+ textContent: p,
362
+ objectUrl: y,
363
+ open: k,
364
+ close: E,
365
+ download: O
366
+ } = $t(() => a.report);
367
+ return (j, S) => (i(), u("div", xt, [
368
+ s("div", {
358
369
  class: "wi-output-file__card",
359
370
  role: "button",
360
371
  tabindex: "0",
361
- "aria-label": `预览文件 ${n(r)}`,
362
- onClick: m[1] || (m[1] = //@ts-ignore
363
- (...v) => n(y) && n(y)(...v)),
372
+ "aria-label": `预览文件 ${l(c)}`,
373
+ onClick: S[1] || (S[1] = //@ts-ignore
374
+ (...$) => l(k) && l(k)(...$)),
364
375
  onKeydown: [
365
- m[2] || (m[2] = J(
376
+ S[2] || (S[2] = re(
366
377
  //@ts-ignore
367
- (...v) => n(y) && n(y)(...v),
378
+ (...$) => l(k) && l(k)(...$),
368
379
  ["enter"]
369
380
  )),
370
- m[3] || (m[3] = J(D(
381
+ S[3] || (S[3] = re(te(
371
382
  //@ts-ignore
372
- (...v) => n(y) && n(y)(...v),
383
+ (...$) => l(k) && l(k)(...$),
373
384
  ["prevent"]
374
385
  ), ["space"]))
375
386
  ]
376
387
  }, [
377
- i("span", {
378
- class: _e(["wi-output-file__icon", `is-${n(e)}`])
379
- }, lt, 2),
380
- i("div", ct, [
381
- i("div", {
388
+ s("span", {
389
+ class: q(["wi-output-file__icon", `is-${l(t)}`])
390
+ }, Et, 2),
391
+ s("div", Ot, [
392
+ s("div", {
382
393
  class: "wi-output-file__name",
383
- title: n(r)
384
- }, S(n(r)), 9, dt),
385
- i("div", ut, [
386
- i("span", pt, S(n(s).toUpperCase() || "FILE"), 1),
387
- n(c) ? (l(), d("span", _t, S(n(c)), 1)) : C("", !0)
394
+ title: l(c)
395
+ }, m(l(c)), 9, Tt),
396
+ s("div", Vt, [
397
+ s("span", Ut, m(l(r).toUpperCase() || "FILE"), 1),
398
+ l(_) ? (i(), u("span", Lt, m(l(_)), 1)) : V("", !0)
388
399
  ])
389
400
  ]),
390
- i("button", {
401
+ s("button", {
391
402
  type: "button",
392
403
  class: "wi-output-file__download",
393
404
  title: "下载文件",
394
405
  "aria-label": "下载文件",
395
- onClick: m[0] || (m[0] = D(
406
+ onClick: S[0] || (S[0] = te(
396
407
  //@ts-ignore
397
- (...v) => n(k) && n(k)(...v),
408
+ (...$) => l(O) && l(O)(...$),
398
409
  ["stop"]
399
410
  ))
400
- }, wt)
401
- ], 40, at),
402
- (l(), P(fe, { to: "body" }, [
403
- we(me, { name: "wi-output-file-fade" }, {
404
- default: ve(() => [
405
- n(_) ? (l(), d("div", {
411
+ }, Pt)
412
+ ], 40, It),
413
+ (i(), Z(Ie, { to: "body" }, [
414
+ Ce(Ee, { name: "wi-output-file-fade" }, {
415
+ default: Oe(() => [
416
+ l(w) ? (i(), u("div", {
406
417
  key: 0,
407
418
  class: "wi-output-file-mask",
408
- onClick: m[8] || (m[8] = D(
419
+ onClick: S[8] || (S[8] = te(
409
420
  //@ts-ignore
410
- (...v) => n(U) && n(U)(...v),
421
+ (...$) => l(E) && l(E)(...$),
411
422
  ["self"]
412
423
  ))
413
424
  }, [
414
- i("aside", {
425
+ s("aside", {
415
426
  class: "wi-output-file-drawer",
416
427
  role: "dialog",
417
428
  "aria-modal": "true",
418
- "aria-label": `预览文件 ${n(r)}`
429
+ "aria-label": `预览文件 ${l(c)}`
419
430
  }, [
420
- i("header", vt, [
421
- i("div", ht, [
422
- i("span", bt, S(n(s).toUpperCase() || "FILE"), 1),
423
- i("div", {
431
+ s("header", Rt, [
432
+ s("div", Nt, [
433
+ s("span", Ft, m(l(r).toUpperCase() || "FILE"), 1),
434
+ s("div", {
424
435
  class: "wi-output-file-drawer__name",
425
- title: n(r)
426
- }, S(n(r)), 9, gt),
427
- n(c) ? (l(), d("div", yt, S(n(c)), 1)) : C("", !0)
436
+ title: l(c)
437
+ }, m(l(c)), 9, At),
438
+ l(_) ? (i(), u("div", Dt, m(l(_)), 1)) : V("", !0)
428
439
  ]),
429
- i("div", kt, [
430
- i("button", {
440
+ s("div", Bt, [
441
+ s("button", {
431
442
  type: "button",
432
443
  class: "wi-output-file-drawer__btn",
433
- onClick: m[4] || (m[4] = //@ts-ignore
434
- (...v) => n(k) && n(k)(...v))
444
+ onClick: S[4] || (S[4] = //@ts-ignore
445
+ (...$) => l(O) && l(O)(...$))
435
446
  }, "下载"),
436
- i("button", {
447
+ s("button", {
437
448
  type: "button",
438
449
  class: "wi-output-file-drawer__btn wi-output-file-drawer__btn--close",
439
450
  title: "关闭",
440
451
  "aria-label": "关闭预览",
441
- onClick: m[5] || (m[5] = //@ts-ignore
442
- (...v) => n(U) && n(U)(...v))
452
+ onClick: S[5] || (S[5] = //@ts-ignore
453
+ (...$) => l(E) && l(E)(...$))
443
454
  }, " × ")
444
455
  ])
445
456
  ]),
446
- i("div", St, [
447
- n(p) ? (l(), d("div", It, "文件加载中…")) : n(u) ? (l(), d("div", Et, [
448
- i("p", null, S(n(u)), 1),
449
- i("button", {
457
+ s("div", zt, [
458
+ l(x) ? (i(), u("div", qt, "文件加载中…")) : l(b) ? (i(), u("div", Kt, [
459
+ s("p", null, m(l(b)), 1),
460
+ s("button", {
450
461
  type: "button",
451
462
  class: "wi-output-file-drawer__btn",
452
- onClick: m[6] || (m[6] = //@ts-ignore
453
- (...v) => n(k) && n(k)(...v))
463
+ onClick: S[6] || (S[6] = //@ts-ignore
464
+ (...$) => l(O) && l(O)(...$))
454
465
  }, "下载文件")
455
- ])) : n(f) ? (l(), d("div", Ct, [
456
- Ut,
457
- i("button", {
466
+ ])) : l(g) ? (i(), u("div", Ht, [
467
+ Xt,
468
+ s("button", {
458
469
  type: "button",
459
470
  class: "wi-output-file-drawer__btn",
460
- onClick: m[7] || (m[7] = //@ts-ignore
461
- (...v) => n(k) && n(k)(...v))
471
+ onClick: S[7] || (S[7] = //@ts-ignore
472
+ (...$) => l(O) && l(O)(...$))
462
473
  }, "下载文件")
463
- ])) : n(e) === "image" && n(w) ? (l(), d("img", {
474
+ ])) : l(t) === "image" && l(y) ? (i(), u("img", {
464
475
  key: 3,
465
476
  class: "wi-output-file-drawer__image",
466
- src: n(w),
467
- alt: n(r)
468
- }, null, 8, Ot)) : n(e) === "pdf" && n(w) ? (l(), d("iframe", {
477
+ src: l(y),
478
+ alt: l(c)
479
+ }, null, 8, Gt)) : l(t) === "pdf" && l(y) ? (i(), u("iframe", {
469
480
  key: 4,
470
481
  class: "wi-output-file-drawer__frame",
471
- src: n(w),
472
- title: n(r)
473
- }, null, 8, xt)) : n(e) === "html" ? (l(), d("iframe", {
482
+ src: l(y),
483
+ title: l(c)
484
+ }, null, 8, Wt)) : l(t) === "html" ? (i(), u("iframe", {
474
485
  key: 5,
475
486
  class: "wi-output-file-drawer__frame",
476
- srcdoc: n(b),
487
+ srcdoc: l(p),
477
488
  sandbox: "allow-scripts allow-forms allow-modals",
478
- title: n(r)
479
- }, null, 8, Lt)) : n(e) === "audio" && n(w) ? (l(), d("audio", {
489
+ title: l(c)
490
+ }, null, 8, Yt)) : l(t) === "audio" && l(y) ? (i(), u("audio", {
480
491
  key: 6,
481
492
  class: "wi-output-file-drawer__media",
482
- src: n(w),
493
+ src: l(y),
483
494
  controls: ""
484
- }, null, 8, Tt)) : n(e) === "video" && n(w) ? (l(), d("video", {
495
+ }, null, 8, Jt)) : l(t) === "video" && l(y) ? (i(), u("video", {
485
496
  key: 7,
486
497
  class: "wi-output-file-drawer__media",
487
- src: n(w),
498
+ src: l(y),
488
499
  controls: ""
489
- }, null, 8, $t)) : (l(), d("pre", Rt, S(n(b)), 1))
500
+ }, null, 8, Zt)) : (i(), u("pre", Qt, m(l(p)), 1))
490
501
  ])
491
- ], 8, mt)
492
- ])) : C("", !0)
502
+ ], 8, jt)
503
+ ])) : V("", !0)
493
504
  ]),
494
505
  _: 1
495
506
  })
496
507
  ]))
497
508
  ]));
498
509
  }
499
- }), Pt = /* @__PURE__ */ T(Mt, [["__scopeId", "data-v-f61a91b5"]]), jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
510
+ }), ts = /* @__PURE__ */ B(es, [["__scopeId", "data-v-f61a91b5"]]), ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
500
511
  __proto__: null,
501
- default: Pt
502
- }, Symbol.toStringTag, { value: "Module" })), Ft = () => {
503
- var t, r;
504
- const o = (r = (t = window == null ? void 0 : window.globalConfig) == null ? void 0 : t.WebApiUrl) == null ? void 0 : r.MainUrl;
505
- return typeof o == "string" ? o : "";
506
- }, Nt = () => window.location.origin + window.location.pathname, z = "access-session", Dt = () => {
507
- const o = window.location.pathname.split("/").filter((t) => !!t).join("-");
508
- return o ? `${o}-` : "";
509
- }, At = () => {
510
- const o = `${Dt()}${z}`, t = [];
511
- for (let s = 0; s < localStorage.length; s++) {
512
- const e = localStorage.key(s);
513
- !e || !e.endsWith(z) || e.slice(0, e.lastIndexOf(":")) !== "wi admin" && (e.endsWith(`x-${z}`) || t.push(e));
512
+ default: ts
513
+ }, Symbol.toStringTag, { value: "Module" })), ns = () => {
514
+ var a, c;
515
+ const n = (c = (a = window == null ? void 0 : window.globalConfig) == null ? void 0 : a.WebApiUrl) == null ? void 0 : c.MainUrl;
516
+ return typeof n == "string" ? n : "";
517
+ }, os = () => window.location.origin + window.location.pathname, ne = "access-session", as = () => {
518
+ const n = window.location.pathname.split("/").filter((a) => !!a).join("-");
519
+ return n ? `${n}-` : "";
520
+ }, rs = () => {
521
+ const n = `${as()}${ne}`, a = [];
522
+ for (let r = 0; r < localStorage.length; r++) {
523
+ const t = localStorage.key(r);
524
+ !t || !t.endsWith(ne) || t.slice(0, t.lastIndexOf(":")) !== "wi admin" && (t.endsWith(`x-${ne}`) || a.push(t));
514
525
  }
515
- const r = t.find((s) => s.endsWith(o)) ?? t[0];
516
- if (!r)
526
+ const c = a.find((r) => r.endsWith(n)) ?? a[0];
527
+ if (!c)
517
528
  return "";
518
529
  try {
519
- const s = localStorage.getItem(r);
520
- if (!s || s === "undefined")
530
+ const r = localStorage.getItem(c);
531
+ if (!r || r === "undefined")
521
532
  return "";
522
- const e = JSON.parse(s);
523
- return e == null ? "" : String(e);
533
+ const t = JSON.parse(r);
534
+ return t == null ? "" : String(t);
524
535
  } catch {
525
536
  return "";
526
537
  }
527
- }, ae = Symbol("wi-chat-iframe-page-config"), to = (o) => {
528
- ne(ae, o);
529
- }, zt = (o, t) => {
530
- const r = (t == null ? void 0 : t.mainUrl) !== void 0 ? String(O(t.mainUrl)) : Ft(), s = (t == null ? void 0 : t.token) !== void 0 ? String(O(t.token)) : At();
531
- return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g, r).replace(/\{\{\s*SERVE_URL\s*\}\}/g, Nt()).replace(/\{\{\s*token\s*\}\}/g, s);
532
- }, Bt = (o) => {
533
- const t = te() ? oe(ae, {}) : {}, r = I(() => {
538
+ }, we = Symbol("wi-chat-iframe-page-config"), un = (n) => {
539
+ _e(we, n);
540
+ }, ls = (n, a) => {
541
+ const c = (a == null ? void 0 : a.mainUrl) !== void 0 ? String(A(a.mainUrl)) : ns(), r = (a == null ? void 0 : a.token) !== void 0 ? String(A(a.token)) : rs();
542
+ return n.replace(/\{\{\s*MAIN_URL\s*\}\}/g, c).replace(/\{\{\s*SERVE_URL\s*\}\}/g, os()).replace(/\{\{\s*token\s*\}\}/g, r);
543
+ }, is = (n) => {
544
+ const a = ue() ? ce(we, {}) : {}, c = T(() => {
545
+ var w;
546
+ const t = A(n), _ = ((w = t == null ? void 0 : t.values) == null ? void 0 : w.url) ?? (t == null ? void 0 : t.url) ?? "";
547
+ return _ ? a.resolveUrl ? a.resolveUrl(_) : ls(_, a) : "";
548
+ }), r = T(() => {
534
549
  var _;
535
- const e = O(o), c = ((_ = e == null ? void 0 : e.values) == null ? void 0 : _.url) ?? (e == null ? void 0 : e.url) ?? "";
536
- return c ? t.resolveUrl ? t.resolveUrl(c) : zt(c, t) : "";
537
- }), s = I(() => {
538
- var c;
539
- const e = O(o);
540
- return ((c = e == null ? void 0 : e.values) == null ? void 0 : c.srcdoc) ?? (e == null ? void 0 : e.srcdoc) ?? "";
550
+ const t = A(n);
551
+ return ((_ = t == null ? void 0 : t.values) == null ? void 0 : _.srcdoc) ?? (t == null ? void 0 : t.srcdoc) ?? "";
541
552
  });
542
- return { url: r, srcdoc: s };
543
- }, ee = "data-wi-iframe-resizer-child", Ht = (o) => {
544
- if (!o)
553
+ return { url: c, srcdoc: r };
554
+ }, ie = "data-wi-iframe-resizer-child", us = (n) => {
555
+ if (!n)
545
556
  return !1;
546
- let t = null;
557
+ let a = null;
547
558
  try {
548
- t = o.contentDocument;
559
+ a = n.contentDocument;
549
560
  } catch {
550
561
  return !1;
551
562
  }
552
- if (!t)
563
+ if (!a)
553
564
  return !1;
554
- const r = t.head || t.documentElement;
555
- if (!r)
565
+ const c = a.head || a.documentElement;
566
+ if (!c)
556
567
  return !1;
557
- const s = t.defaultView;
558
- if (s != null && s.parentIframe || s != null && s.parentIFrame || t.querySelector(`script[${ee}]`))
568
+ const r = a.defaultView;
569
+ if (r != null && r.parentIframe || r != null && r.parentIFrame || a.querySelector(`script[${ie}]`))
559
570
  return !1;
560
- const e = t.createElement("script");
561
- return e.textContent = ke, e.setAttribute(ee, ""), r.appendChild(e), !0;
562
- }, Kt = /* @__PURE__ */ L({
571
+ const t = a.createElement("script");
572
+ return t.textContent = Re, t.setAttribute(ie, ""), c.appendChild(t), !0;
573
+ }, cs = /* @__PURE__ */ D({
563
574
  __name: "IframePage",
564
575
  props: {
565
576
  report: {}
566
577
  },
567
- setup(o) {
568
- const t = o, { url: r, srcdoc: s } = Bt(() => t.report), e = (c) => {
569
- Ht(c.target);
578
+ setup(n) {
579
+ const a = n, { url: c, srcdoc: r } = is(() => a.report), t = (_) => {
580
+ us(_.target);
570
581
  };
571
- return (c, _) => n(r) ? (l(), P(Z, {
582
+ return (_, w) => l(c) ? (i(), Z(le, {
572
583
  key: 0,
573
584
  class: "iframe-page__frame iframe-page__frame--url",
574
585
  license: "GPLv3",
575
- src: n(r),
586
+ src: l(c),
576
587
  width: "100%",
577
588
  "warning-timeout": 0,
578
- onLoad: e
579
- }, null, 8, ["src"])) : n(s) ? (l(), P(Z, {
589
+ onLoad: t
590
+ }, null, 8, ["src"])) : l(r) ? (i(), Z(le, {
580
591
  key: 1,
581
592
  class: "iframe-page iframe-page--srcdoc",
582
593
  license: "GPLv3",
583
- srcdoc: n(s),
594
+ srcdoc: l(r),
584
595
  width: "100%",
585
596
  frameborder: "no",
586
597
  border: "0",
587
598
  marginwidth: "0",
588
599
  marginheight: "0",
589
600
  scrolling: "no"
590
- }, null, 8, ["srcdoc"])) : C("", !0);
601
+ }, null, 8, ["srcdoc"])) : V("", !0);
602
+ }
603
+ }), ds = /* @__PURE__ */ B(cs, [["__scopeId", "data-v-f4c94a4e"]]), _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
604
+ __proto__: null,
605
+ default: ds
606
+ }, Symbol.toStringTag, { value: "Module" })), ae = (n) => (Q("data-v-74053305"), n = n(), ee(), n), ps = { class: "wi-clarify__header" }, fs = { class: "wi-clarify__heading" }, vs = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)), ws = { class: "wi-clarify__title" }, ys = {
607
+ key: 0,
608
+ class: "wi-clarify__desc"
609
+ }, hs = { class: "wi-clarify__status" }, ms = { class: "wi-clarify__progress" }, bs = { class: "wi-clarify__progress-track" }, gs = {
610
+ key: 0,
611
+ class: "wi-clarify__panel"
612
+ }, ks = { class: "wi-clarify__question" }, Ss = {
613
+ key: 0,
614
+ class: "wi-clarify__question-desc"
615
+ }, $s = {
616
+ key: 1,
617
+ class: "wi-clarify__binding"
618
+ }, xs = {
619
+ key: 2,
620
+ class: "wi-clarify__options"
621
+ }, Is = ["onClick"], Cs = { class: "wi-clarify__option-indicator" }, Es = {
622
+ key: 3,
623
+ class: "wi-clarify__date"
624
+ }, Os = ["for"], Ts = ["id", "value"], Vs = { class: "wi-clarify__text" }, Us = {
625
+ key: 0,
626
+ class: "wi-clarify__or"
627
+ }, Ls = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("span", null, "或者,用自己的话说明", -1)), Ms = [
628
+ Ls
629
+ ], Ps = ["for"], js = ["id", "value", "placeholder"], Rs = {
630
+ class: "wi-clarify__dots",
631
+ "aria-label": "确认问题导航"
632
+ }, Ns = ["aria-label", "onClick"], Fs = { class: "wi-clarify__footer" }, As = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)), Ds = { class: "wi-clarify__actions" }, Bs = { class: "wi-clarify__actions" }, zs = ["disabled"], qs = {
633
+ key: 1,
634
+ class: "wi-clarify__result"
635
+ }, Ks = { class: "wi-clarify__result-icon" }, Hs = { class: "wi-clarify__result-body" }, Xs = {
636
+ key: 0,
637
+ class: "wi-clarify__summary"
638
+ }, Gs = { key: 1 }, Ws = { key: 2 }, Ys = {
639
+ key: 2,
640
+ class: "wi-clarify__feedback"
641
+ }, Js = /* @__PURE__ */ D({
642
+ __name: "ClarificationCard",
643
+ props: {
644
+ report: {}
645
+ },
646
+ setup(n) {
647
+ const a = n, c = {
648
+ requestId: "",
649
+ title: "需要补充信息",
650
+ description: "",
651
+ items: [],
652
+ status: "expired",
653
+ resultMessage: "本次补充信息已失效(回答已结束)"
654
+ }, r = T(() => a.report.values ?? c), t = T(() => r.value.items ?? []), _ = L(0), w = Te({}), x = L(!1), b = L("");
655
+ de(() => {
656
+ var e;
657
+ return (e = r.value) == null ? void 0 : e.requestId;
658
+ }, () => {
659
+ Object.keys(w).forEach((e) => delete w[e]), t.value.forEach((e) => {
660
+ const o = { structuredValue: void 0, structuredValues: [], textValue: "" };
661
+ e.default !== void 0 && (e.input.type === "multi_select" ? o.structuredValues = Array.isArray(e.default) ? [...e.default] : [] : e.input.type === "text" ? o.textValue = String(e.default) : o.structuredValue = e.default), w[e.id] = o;
662
+ }), _.value = 0;
663
+ }, { immediate: !0 });
664
+ const p = (e) => (w[e] || (w[e] = { structuredValue: void 0, structuredValues: [], textValue: "" }), w[e]), y = T(() => {
665
+ var e, o, f;
666
+ return ((e = r.value) == null ? void 0 : e.status) === "submitted" ? "已提交" : ((o = r.value) == null ? void 0 : o.status) === "cancelled" ? "已取消" : ((f = r.value) == null ? void 0 : f.status) === "expired" ? "已失效" : "等待回答";
667
+ }), k = (e) => {
668
+ try {
669
+ const o = JSON.stringify(e);
670
+ return o === void 0 ? String(e) : o;
671
+ } catch {
672
+ return String(e);
673
+ }
674
+ }, E = (e, o) => k(e) === k(o), O = (e, o) => {
675
+ const f = p(e.id);
676
+ return e.input.type === "multi_select" ? f.structuredValues.some((h) => E(h, o)) : E(f.structuredValue, o);
677
+ }, j = (e, o) => {
678
+ const f = p(e.id);
679
+ if (f.textValue = "", e.input.type === "multi_select") {
680
+ const h = f.structuredValues.findIndex((U) => E(U, o));
681
+ h >= 0 ? f.structuredValues.splice(h, 1) : f.structuredValues.push(o);
682
+ return;
683
+ }
684
+ f.structuredValue = o;
685
+ }, S = (e) => {
686
+ var o;
687
+ return ((o = e.target) == null ? void 0 : o.value) ?? "";
688
+ }, $ = (e, o) => {
689
+ const f = p(e.id);
690
+ f.textValue = S(o), e.input.type !== "text" && (f.structuredValue = void 0, f.structuredValues.splice(0));
691
+ }, K = (e, o) => {
692
+ const f = p(e.id);
693
+ f.structuredValue = S(o), f.textValue = "";
694
+ }, H = (e) => {
695
+ const o = p(e.id).structuredValue;
696
+ return o == null ? "" : String(o);
697
+ }, z = (e) => {
698
+ var o;
699
+ return ((o = e.input.textInput) == null ? void 0 : o.placeholder) ?? e.input.placeholder ?? (e.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
700
+ }, d = (e) => {
701
+ const o = e.binding;
702
+ if (!o)
703
+ return "";
704
+ const f = o.actionName ? `动作:${o.actionName}` : "", h = o.parameterPath ? `参数:${o.parameterPath}` : "";
705
+ return [f, h].filter(Boolean).join(" · ");
706
+ }, I = (e) => {
707
+ const o = p(e.id);
708
+ return e.input.type === "multi_select" ? o.structuredValues.length > 0 : e.input.type === "single_select" ? o.structuredValue !== void 0 : e.input.type === "date" ? !!o.structuredValue : !1;
709
+ }, C = (e) => !!p(e.id).textValue.trim() || I(e), X = (e) => !e.required || C(e) ? !0 : (b.value = `请回答“${e.question}”`, !1), R = () => {
710
+ b.value = "", _.value = Math.max(0, _.value - 1);
711
+ }, P = () => {
712
+ !v.value || !X(v.value) || (b.value = "", _.value = Math.min(t.value.length - 1, _.value + 1));
713
+ }, v = T(() => t.value[_.value]), G = (e, o) => e.input.type === "date" ? String(o ?? "") : (Array.isArray(o) ? o : [o]).map((h) => {
714
+ var Y;
715
+ const U = (Y = e.input.options) == null ? void 0 : Y.find((be) => E(be.value, h));
716
+ return (U == null ? void 0 : U.label) ?? String(h ?? "");
717
+ }).filter(Boolean).join("、"), W = (e) => {
718
+ const o = p(e.id), f = o.textValue.trim();
719
+ if (e.input.type === "text" || f || !I(e))
720
+ return { id: e.id, mode: "text", value: f, displayText: f };
721
+ const h = e.input.type === "multi_select" ? [...o.structuredValues] : o.structuredValue;
722
+ return {
723
+ id: e.id,
724
+ mode: "structured",
725
+ value: h,
726
+ displayText: G(e, h)
727
+ };
728
+ }, ye = () => {
729
+ const e = t.value.findIndex((f) => f.required && !C(f));
730
+ if (e >= 0) {
731
+ _.value = e, b.value = `请回答“${t.value[e].question}”`;
732
+ return;
733
+ }
734
+ b.value = "";
735
+ const o = t.value.map(W);
736
+ Ne(r.value.requestId, o) || (b.value = "本次补充信息已经处理");
737
+ }, he = () => {
738
+ x.value = !1, b.value = "", Fe(r.value.requestId) || (b.value = "本次补充信息已经处理");
739
+ }, me = (e) => {
740
+ var o;
741
+ return ((o = t.value.find((f) => f.id === e)) == null ? void 0 : o.question) ?? e;
742
+ };
743
+ return (e, o) => {
744
+ var f;
745
+ return i(), u("section", {
746
+ class: q(["wi-clarify", `is-${r.value.status}`])
747
+ }, [
748
+ s("header", ps, [
749
+ s("div", fs, [
750
+ vs,
751
+ s("h3", ws, m(r.value.title), 1),
752
+ r.value.description ? (i(), u("p", ys, m(r.value.description), 1)) : V("", !0)
753
+ ]),
754
+ s("span", hs, m(y.value), 1)
755
+ ]),
756
+ r.value.status === "pending" ? (i(), u(M, { key: 0 }, [
757
+ s("div", ms, [
758
+ s("span", null, "问题 " + m(_.value + 1) + " / " + m(t.value.length), 1),
759
+ s("div", bs, [
760
+ s("span", {
761
+ style: Ve({ width: `${(_.value + 1) / t.value.length * 100}%` })
762
+ }, null, 4)
763
+ ])
764
+ ]),
765
+ v.value ? (i(), u("div", gs, [
766
+ s("div", ks, [
767
+ s("span", {
768
+ class: q(v.value.required ? "wi-clarify__required" : "wi-clarify__optional")
769
+ }, m(v.value.required ? "必填" : "选填"), 3),
770
+ s("h4", null, m(v.value.question), 1)
771
+ ]),
772
+ v.value.description ? (i(), u("p", Ss, m(v.value.description), 1)) : V("", !0),
773
+ d(v.value) ? (i(), u("div", $s, m(d(v.value)), 1)) : V("", !0),
774
+ v.value.input.type === "single_select" || v.value.input.type === "multi_select" ? (i(), u("div", xs, [
775
+ (i(!0), u(M, null, F(v.value.input.options, (h, U) => (i(), u("button", {
776
+ key: U,
777
+ type: "button",
778
+ class: q(["wi-clarify__option", { "is-selected": O(v.value, h.value) }]),
779
+ onClick: (Y) => j(v.value, h.value)
780
+ }, [
781
+ s("span", Cs, m(O(v.value, h.value) ? "✓" : ""), 1),
782
+ s("span", null, m(h.label), 1)
783
+ ], 10, Is))), 128))
784
+ ])) : v.value.input.type === "date" ? (i(), u("div", Es, [
785
+ s("label", {
786
+ for: `wi-clarify-date-${v.value.id}`
787
+ }, "选择日期", 8, Os),
788
+ s("input", {
789
+ id: `wi-clarify-date-${v.value.id}`,
790
+ type: "date",
791
+ value: H(v.value),
792
+ onInput: o[0] || (o[0] = (h) => K(v.value, h))
793
+ }, null, 40, Ts)
794
+ ])) : V("", !0),
795
+ s("div", Vs, [
796
+ v.value.input.type !== "text" ? (i(), u("div", Us, Ms)) : V("", !0),
797
+ s("label", {
798
+ for: `wi-clarify-text-${v.value.id}`
799
+ }, m(v.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, Ps),
800
+ s("textarea", {
801
+ id: `wi-clarify-text-${v.value.id}`,
802
+ value: p(v.value.id).textValue,
803
+ placeholder: z(v.value),
804
+ rows: "3",
805
+ onInput: o[1] || (o[1] = (h) => $(v.value, h))
806
+ }, null, 40, js)
807
+ ])
808
+ ])) : V("", !0),
809
+ s("div", Rs, [
810
+ (i(!0), u(M, null, F(t.value, (h, U) => (i(), u("button", {
811
+ key: h.id,
812
+ type: "button",
813
+ "aria-label": `查看第 ${U + 1} 个问题`,
814
+ class: q({ "is-active": U === _.value, "is-answered": C(h) }),
815
+ onClick: (Y) => _.value = U
816
+ }, null, 10, Ns))), 128))
817
+ ]),
818
+ s("footer", Fs, [
819
+ x.value ? (i(), u(M, { key: 0 }, [
820
+ As,
821
+ s("div", Ds, [
822
+ s("button", {
823
+ type: "button",
824
+ class: "wi-clarify__btn wi-clarify__btn--secondary",
825
+ onClick: o[2] || (o[2] = (h) => x.value = !1)
826
+ }, " 继续填写 "),
827
+ s("button", {
828
+ type: "button",
829
+ class: "wi-clarify__btn wi-clarify__btn--danger",
830
+ onClick: he
831
+ }, "确认取消")
832
+ ])
833
+ ], 64)) : (i(), u(M, { key: 1 }, [
834
+ s("button", {
835
+ type: "button",
836
+ class: "wi-clarify__cancel",
837
+ onClick: o[3] || (o[3] = (h) => x.value = !0)
838
+ }, "取消"),
839
+ s("div", Bs, [
840
+ s("button", {
841
+ type: "button",
842
+ class: "wi-clarify__btn wi-clarify__btn--secondary",
843
+ disabled: _.value === 0,
844
+ onClick: R
845
+ }, " 上一项 ", 8, zs),
846
+ _.value < t.value.length - 1 ? (i(), u("button", {
847
+ key: 0,
848
+ type: "button",
849
+ class: "wi-clarify__btn wi-clarify__btn--primary",
850
+ onClick: P
851
+ }, " 下一项 ")) : (i(), u("button", {
852
+ key: 1,
853
+ type: "button",
854
+ class: "wi-clarify__btn wi-clarify__btn--primary",
855
+ onClick: ye
856
+ }, "提交全部"))
857
+ ])
858
+ ], 64))
859
+ ])
860
+ ], 64)) : (i(), u("div", qs, [
861
+ s("div", Ks, m(r.value.status === "submitted" ? "✓" : r.value.status === "cancelled" ? "—" : "!"), 1),
862
+ s("div", Hs, [
863
+ s("h4", null, m(r.value.resultMessage || y.value), 1),
864
+ r.value.status === "submitted" && ((f = r.value.answers) != null && f.length) ? (i(), u("div", Xs, [
865
+ (i(!0), u(M, null, F(r.value.answers, (h) => (i(), u("div", {
866
+ key: h.id
867
+ }, [
868
+ s("span", null, m(me(h.id)), 1),
869
+ s("strong", null, m(h.displayText || "未填写"), 1)
870
+ ]))), 128))
871
+ ])) : r.value.status === "cancelled" ? (i(), u("p", Gs, "本次确认未提交,工作流将收到取消结果。")) : (i(), u("p", Ws, "该确认项已失效,无法再提交。"))
872
+ ])
873
+ ])),
874
+ b.value ? (i(), u("div", Ys, m(b.value), 1)) : V("", !0)
875
+ ], 2);
876
+ };
591
877
  }
592
- }), Vt = /* @__PURE__ */ T(Kt, [["__scopeId", "data-v-f4c94a4e"]]), Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
878
+ }), Zs = /* @__PURE__ */ B(Js, [["__scopeId", "data-v-74053305"]]), Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
593
879
  __proto__: null,
594
- default: Vt
880
+ default: Zs
595
881
  }, Symbol.toStringTag, { value: "Module" }));
596
882
  export {
597
- Zt as AiAnswerBubble,
598
- Qt as DeepThinkingSteps,
599
- Vt as IframePage,
600
- Ge as KnowledgeStreamResult,
601
- Pt as OutputFile,
602
- Ee as createAnswerContentMap,
603
- Ht as injectIframeResizerChild,
604
- to as provideIframePageConfig,
605
- eo as provideOutputFileConfig,
606
- zt as resolveIframePlaceholders,
607
- Bt as useIframePage
883
+ an as AiAnswerBubble,
884
+ Zs as ClarificationCard,
885
+ rn as DeepThinkingSteps,
886
+ ds as IframePage,
887
+ dt as KnowledgeStreamResult,
888
+ ts as OutputFile,
889
+ Be as createAnswerContentMap,
890
+ us as injectIframeResizerChild,
891
+ un as provideIframePageConfig,
892
+ ln as provideOutputFileConfig,
893
+ ls as resolveIframePlaceholders,
894
+ is as useIframePage
608
895
  };
609
896
  //# sourceMappingURL=index.js.map