@glodon-aiot/react-components 3.25.1-alpha.7 → 3.26.0-alpha.11

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.
@@ -1,40 +1,40 @@
1
- var g = (o, n, r) => new Promise((f, u) => {
2
- var w = (l) => {
1
+ var x = (o, n, r) => new Promise((h, u) => {
2
+ var y = (l) => {
3
3
  try {
4
- e(r.next(l));
5
- } catch (s) {
6
- u(s);
4
+ s(r.next(l));
5
+ } catch (e) {
6
+ u(e);
7
7
  }
8
- }, h = (l) => {
8
+ }, v = (l) => {
9
9
  try {
10
- e(r.throw(l));
11
- } catch (s) {
12
- u(s);
10
+ s(r.throw(l));
11
+ } catch (e) {
12
+ u(e);
13
13
  }
14
- }, e = (l) => l.done ? f(l.value) : Promise.resolve(l.value).then(w, h);
15
- e((r = r.apply(o, n)).next());
14
+ }, s = (l) => l.done ? h(l.value) : Promise.resolve(l.value).then(y, v);
15
+ s((r = r.apply(o, n)).next());
16
16
  });
17
- import { jsxs as C, jsx as t } from "react/jsx-runtime";
18
- import { useMemo as x, useState as p, useEffect as _, useCallback as M, useRef as de } from "react";
19
- import { message as b, Space as ue, Button as D, Dropdown as me, Spin as Z, Alert as J } from "antd";
20
- import { DownloadOutlined as L, CopyOutlined as pe } from "@ant-design/icons";
21
- import { renderAsync as fe } from "docx-preview";
22
- import { getFileExtension as V, getFileType as we } from "../../utils/file.mjs";
23
- import { MAX_FILE_SIZE as B } from "./constants.mjs";
24
- import { normalizeUrl as he } from "./utils.mjs";
25
- import { useZipViewer as ye } from "./hooks/useZipViewer.mjs";
26
- import { TextRenderer as X, CodeRenderer as ve, XmlRenderer as ge, HtmlRenderer as xe, MarkdownRenderer as be, JsonlRenderer as ke, TsvRenderer as Ce, CsvRenderer as Te, JsonRenderer as Re } from "./components/FileRenderers.mjs";
27
- import { AudioRenderer as Fe, VideoRenderer as ze, ImageRenderer as Ne } from "./components/MediaRenderers.mjs";
28
- import { ZipRenderer as Ee } from "./components/ZipRenderer.mjs";
29
- import { ErrorAlert as Me } from "./components/ErrorAlert.mjs";
17
+ import { jsxs as T, jsx as t } from "react/jsx-runtime";
18
+ import { useMemo as b, useState as w, useEffect as J, useCallback as L, useRef as me } from "react";
19
+ import { message as k, Space as fe, Button as $, Dropdown as pe, Spin as G, Alert as K } from "antd";
20
+ import { DownloadOutlined as O, CopyOutlined as we } from "@ant-design/icons";
21
+ import { renderAsync as he } from "docx-preview";
22
+ import { getFileExtension as _, getFileType as ye } from "../../utils/file.mjs";
23
+ import { MAX_FILE_SIZE as j } from "./constants.mjs";
24
+ import { normalizeUrl as ve } from "./utils.mjs";
25
+ import { useZipViewer as ge } from "./hooks/useZipViewer.mjs";
26
+ import { TextRenderer as Z, CodeRenderer as xe, XmlRenderer as be, HtmlRenderer as ke, MarkdownRenderer as Ce, JsonlRenderer as Te, TsvRenderer as ze, CsvRenderer as Fe, JsonRenderer as Re } from "./components/FileRenderers.mjs";
27
+ import { AudioRenderer as Ne, VideoRenderer as Ee, ImageRenderer as Se } from "./components/MediaRenderers.mjs";
28
+ import { ZipRenderer as Me } from "./components/ZipRenderer.mjs";
29
+ import { ErrorAlert as Be } from "./components/ErrorAlert.mjs";
30
30
  import "./style.less.mjs";
31
- import Be from "./components/PDFViewer/index.mjs";
32
- const De = (o) => {
31
+ import De from "./components/PDFViewer/index.mjs";
32
+ const Le = (o) => {
33
33
  if (!o)
34
34
  return "unknown";
35
35
  const n = o.split(";")[0].trim().toLowerCase();
36
36
  return n.startsWith("image/") ? "image" : n.startsWith("video/") ? "video" : n.startsWith("audio/") ? "audio" : n === "application/pdf" ? "pdf" : n === "text/markdown" || n === "text/x-markdown" ? "markdown" : n === "application/json" ? "json" : n === "application/jsonl" ? "jsonl" : n === "text/csv" || n === "application/csv" ? "csv" : n === "text/tab-separated-values" ? "tsv" : n === "application/javascript" || n === "text/javascript" ? "code" : n === "application/xml" || n === "text/xml" ? "xml" : n === "text/html" || n === "application/xhtml+xml" ? "html" : n === "text/plain" ? "text" : "unknown";
37
- }, Le = (o) => !o || Number.isNaN(o) ? "大小未知" : o < 1024 ? `${o}B` : o < 1024 * 1024 ? `${(o / 1024).toFixed(1)}KB` : o < 1024 * 1024 * 1024 ? `${(o / 1024 / 1024).toFixed(1)}MB` : `${(o / 1024 / 1024 / 1024).toFixed(1)}GB`, Se = (o, n) => {
37
+ }, je = (o) => !o || Number.isNaN(o) ? "大小未知" : o < 1024 ? `${o} B` : o < 1024 * 1024 ? `${(o / 1024).toFixed(1)} KB` : o < 1024 * 1024 * 1024 ? `${(o / 1024 / 1024).toFixed(1)} MB` : `${(o / 1024 / 1024 / 1024).toFixed(1)} GB`, $e = (o, n) => {
38
38
  if (n)
39
39
  return n;
40
40
  try {
@@ -43,112 +43,114 @@ const De = (o) => {
43
43
  } catch (r) {
44
44
  return o;
45
45
  }
46
- }, je = (o) => {
46
+ }, Oe = (o) => {
47
47
  const {
48
48
  url: n,
49
49
  fileName: r,
50
- className: f,
50
+ className: h,
51
51
  style: u,
52
- showToolbar: w = !1,
53
- page: h = 1
54
- } = o, e = x(() => he(n), [n]);
52
+ showToolbar: y = !1,
53
+ toolbarExtra: v,
54
+ fileSize: s,
55
+ page: l = 1
56
+ } = o, e = b(() => ve(n), [n]);
55
57
  console.log("normalizedUrl", e);
56
- const l = x(() => V(e) || V(r || ""), [e, r]), s = x(() => we(l), [l]), [k, T] = p(s), {
57
- zipFiles: G,
58
- zipLoading: K,
59
- zipError: q,
60
- selectedZipFile: Q,
61
- zipFileContent: Y,
62
- handleFileClick: ee
63
- } = ye(s === "zip" ? e : ""), [te, m] = p(!0), [S, y] = p(null), [a, j] = p(null), [c, $] = p(0), [re, O] = p(!1), U = x(() => Se(e, r), [r, e]), ne = x(() => Le(c), [c]), R = !!(a != null && a.content), oe = !R && !e, ie = x(() => [{
58
+ const C = b(() => _(e) || _(r || ""), [e, r]), f = b(() => ye(C), [C]), [E, z] = w(f), {
59
+ zipFiles: q,
60
+ zipLoading: Q,
61
+ zipError: Y,
62
+ selectedZipFile: ee,
63
+ zipFileContent: te,
64
+ handleFileClick: re
65
+ } = ge(f === "zip" ? e : ""), [ne, m] = w(!0), [U, g] = w(null), [a, H] = w(null), [c, F] = w(s || 0), [oe, I] = w(!1), A = b(() => $e(e, r), [r, e]), ie = b(() => je(c || s || 0), [c, s]), S = !!(a != null && a.content), ae = !S && !e, se = b(() => [{
64
66
  key: "copy-content",
65
67
  label: "复制内容",
66
- disabled: !R
68
+ disabled: !S
67
69
  }, {
68
70
  key: "copy-url",
69
71
  label: "复制地址",
70
72
  disabled: !e
71
- }], [R, e]);
72
- _(() => {
73
- if (T(s), s === "pdf" || s === "zip") {
73
+ }], [S, e]);
74
+ J(() => {
75
+ if (s && s > 0 && F(s), z(f), f === "pdf" || f === "zip") {
74
76
  m(!1);
75
77
  return;
76
78
  }
77
79
  if (!e) {
78
- y("文件URL不能为空"), m(!1);
80
+ g("文件URL不能为空"), m(!1);
79
81
  return;
80
82
  }
81
- if (["image", "video", "audio", "office"].includes(s)) {
83
+ if (["image", "video", "audio", "office"].includes(f)) {
82
84
  m(!1);
83
85
  return;
84
86
  }
85
- m(!0), y(null), g(void 0, null, function* () {
87
+ m(!0), g(null), x(void 0, null, function* () {
86
88
  try {
87
89
  if (e.startsWith("blob:") || e.startsWith("data:")) {
88
- const v = yield fetch(e);
89
- if (!v.ok)
90
- throw new Error(`HTTP error! status: ${v.status}`);
91
- const P = yield v.blob(), E = P.size;
92
- if ($(E), E > B) {
93
- y(`文件过大(${Math.round(E / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
90
+ const p = yield fetch(e);
91
+ if (!p.ok)
92
+ throw new Error(`HTTP error! status: ${p.status}`);
93
+ const X = yield p.blob(), D = X.size;
94
+ if (F(D), D > j) {
95
+ g(`文件过大(${Math.round(D / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
94
96
  return;
95
97
  }
96
- const ce = yield P.text();
97
- s === "unknown" && T("text"), j({
98
- content: ce
98
+ const ue = yield X.text();
99
+ f === "unknown" && z("text"), H({
100
+ content: ue
99
101
  }), m(!1);
100
102
  return;
101
103
  }
102
104
  const i = yield fetch(e, {
103
105
  method: "HEAD"
104
- }), I = i.headers.get("Content-Length"), le = i.headers.get("Content-Type"), z = I ? parseInt(I, 10) : 0;
105
- if ($(z), s === "unknown") {
106
- const v = De(le);
107
- v !== "unknown" && T(v);
106
+ }), P = i.headers.get("Content-Length"), de = i.headers.get("Content-Type"), R = P ? parseInt(P, 10) : 0;
107
+ if (R > 0 && F(R), f === "unknown") {
108
+ const p = Le(de);
109
+ p !== "unknown" && z(p);
108
110
  }
109
- if (z > B) {
110
- y(`文件过大(${Math.round(z / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
111
+ if (R > j) {
112
+ g(`文件过大(${Math.round(R / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
111
113
  return;
112
114
  }
113
- const N = yield fetch(e);
114
- if (!N.ok)
115
- throw new Error(`HTTP error! status: ${N.status}`);
116
- const A = yield N.text(), W = new Blob([A]).size;
117
- if (W > B) {
118
- y(`文件过大(${Math.round(W / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
115
+ const B = yield fetch(e);
116
+ if (!B.ok)
117
+ throw new Error(`HTTP error! status: ${B.status}`);
118
+ const V = yield B.text(), N = new Blob([V]).size;
119
+ if (N > 0 && F((p) => p || N), N > j) {
120
+ g(`文件过大(${Math.round(N / 1024 / 1024)}MB),无法预览。请下载后查看。`), m(!1);
119
121
  return;
120
122
  }
121
- k === "unknown" && T("text"), j({
122
- content: A
123
+ E === "unknown" && z("text"), H({
124
+ content: V
123
125
  }), m(!1);
124
126
  } catch (d) {
125
- y(d.message || "加载文件失败"), m(!1);
127
+ g(d.message || "加载文件失败"), m(!1);
126
128
  }
127
129
  });
128
- }, [e, s]);
129
- const F = M(() => g(void 0, null, function* () {
130
+ }, [e, f, s]);
131
+ const M = L(() => x(void 0, null, function* () {
130
132
  var d;
131
133
  if (!(a != null && a.content)) {
132
- b.warning("暂无可复制的内容");
134
+ k.warning("暂无可复制的内容");
133
135
  return;
134
136
  }
135
137
  try {
136
- if (O(!0), (d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText)
138
+ if (I(!0), (d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText)
137
139
  yield navigator.clipboard.writeText(a.content);
138
140
  else {
139
141
  const i = document.createElement("textarea");
140
142
  i.value = a.content, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select(), document.execCommand("copy"), document.body.removeChild(i);
141
143
  }
142
- b.success("内容已复制到剪贴板");
144
+ k.success("内容已复制到剪贴板");
143
145
  } catch (i) {
144
- b.error((i == null ? void 0 : i.message) || "复制失败,请手动复制");
146
+ k.error((i == null ? void 0 : i.message) || "复制失败,请手动复制");
145
147
  } finally {
146
- O(!1);
148
+ I(!1);
147
149
  }
148
- }), [a]), H = M(() => g(void 0, null, function* () {
150
+ }), [a]), W = L(() => x(void 0, null, function* () {
149
151
  var d;
150
152
  if (!e) {
151
- b.warning("暂无可复制的地址");
153
+ k.warning("暂无可复制的地址");
152
154
  return;
153
155
  }
154
156
  try {
@@ -158,40 +160,40 @@ const De = (o) => {
158
160
  const i = document.createElement("textarea");
159
161
  i.value = e, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select(), document.execCommand("copy"), document.body.removeChild(i);
160
162
  }
161
- b.success("链接已复制到剪贴板");
163
+ k.success("链接已复制到剪贴板");
162
164
  } catch (i) {
163
- b.error((i == null ? void 0 : i.message) || "复制失败,请手动复制");
165
+ k.error((i == null ? void 0 : i.message) || "复制失败,请手动复制");
164
166
  }
165
- }), [e]), ae = M((i) => g(void 0, [i], function* ({
167
+ }), [e]), le = L((i) => x(void 0, [i], function* ({
166
168
  key: d
167
169
  }) {
168
- d === "copy-content" && (yield F()), d === "copy-url" && (yield H());
169
- }), [F, H]), se = () => {
170
- if (te)
170
+ d === "copy-content" && (yield M()), d === "copy-url" && (yield W());
171
+ }), [M, W]), ce = () => {
172
+ if (ne)
171
173
  return /* @__PURE__ */ t("div", {
172
174
  className: "document-viewer-loading",
173
- children: /* @__PURE__ */ t(Z, {
175
+ children: /* @__PURE__ */ t(G, {
174
176
  size: "large",
175
177
  tip: "加载中..."
176
178
  })
177
179
  });
178
- if (S)
179
- return /* @__PURE__ */ t(Me, {
180
+ if (U)
181
+ return /* @__PURE__ */ t(Be, {
180
182
  message: "加载失败",
181
- description: S,
183
+ description: U,
182
184
  url: e,
183
185
  fileName: r
184
186
  });
185
- if (k === "unknown" && (a != null && a.content))
186
- return /* @__PURE__ */ t(X, {
187
+ if (E === "unknown" && (a != null && a.content))
188
+ return /* @__PURE__ */ t(Z, {
187
189
  fileContent: a,
188
190
  fileSize: c,
189
191
  url: e,
190
192
  fileName: r
191
193
  });
192
- switch (k) {
194
+ switch (E) {
193
195
  case "text":
194
- return /* @__PURE__ */ t(X, {
196
+ return /* @__PURE__ */ t(Z, {
195
197
  fileContent: a,
196
198
  fileSize: c,
197
199
  url: e,
@@ -205,159 +207,159 @@ const De = (o) => {
205
207
  fileName: r
206
208
  });
207
209
  case "csv":
208
- return /* @__PURE__ */ t(Te, {
210
+ return /* @__PURE__ */ t(Fe, {
209
211
  fileContent: a,
210
212
  fileSize: c,
211
213
  url: e,
212
214
  fileName: r
213
215
  });
214
216
  case "tsv":
215
- return /* @__PURE__ */ t(Ce, {
217
+ return /* @__PURE__ */ t(ze, {
216
218
  fileContent: a,
217
219
  fileSize: c,
218
220
  url: e,
219
221
  fileName: r
220
222
  });
221
223
  case "jsonl":
222
- return /* @__PURE__ */ t(ke, {
224
+ return /* @__PURE__ */ t(Te, {
223
225
  fileContent: a,
224
226
  fileSize: c,
225
227
  url: e,
226
228
  fileName: r
227
229
  });
228
230
  case "markdown":
229
- return /* @__PURE__ */ t(be, {
231
+ return /* @__PURE__ */ t(Ce, {
230
232
  fileContent: a,
231
233
  fileSize: c,
232
234
  url: e,
233
235
  fileName: r
234
236
  });
235
237
  case "html":
236
- return /* @__PURE__ */ t(xe, {
238
+ return /* @__PURE__ */ t(ke, {
237
239
  fileContent: a,
238
240
  fileSize: c,
239
241
  url: e,
240
242
  fileName: r
241
243
  });
242
244
  case "xml":
243
- return /* @__PURE__ */ t(ge, {
245
+ return /* @__PURE__ */ t(be, {
244
246
  fileContent: a,
245
247
  fileSize: c,
246
248
  url: e,
247
249
  fileName: r
248
250
  });
249
251
  case "code":
250
- return /* @__PURE__ */ t(ve, {
252
+ return /* @__PURE__ */ t(xe, {
251
253
  fileContent: a,
252
254
  fileSize: c,
253
255
  url: e,
254
256
  fileName: r
255
257
  });
256
258
  case "image":
257
- return /* @__PURE__ */ t(Ne, {
259
+ return /* @__PURE__ */ t(Se, {
258
260
  url: e,
259
261
  fileName: r
260
262
  });
261
263
  case "video":
262
- return /* @__PURE__ */ t(ze, {
264
+ return /* @__PURE__ */ t(Ee, {
263
265
  url: e,
264
266
  fileName: r
265
267
  });
266
268
  case "audio":
267
- return /* @__PURE__ */ t(Fe, {
269
+ return /* @__PURE__ */ t(Ne, {
268
270
  url: e,
269
271
  fileName: r
270
272
  });
271
273
  case "pdf":
272
- return /* @__PURE__ */ t(Be, {
274
+ return /* @__PURE__ */ t(De, {
273
275
  fileUrl: e,
274
- pageNumber: h
276
+ pageNumber: l
275
277
  });
276
278
  case "office":
277
- return /* @__PURE__ */ t($e, {
279
+ return /* @__PURE__ */ t(Ue, {
278
280
  url: e,
279
281
  fileName: r,
280
- extension: l
282
+ extension: C
281
283
  });
282
284
  case "zip":
283
- return /* @__PURE__ */ t(Ee, {
284
- zipFiles: G,
285
- zipLoading: K,
286
- zipError: q,
287
- selectedZipFile: Q,
288
- zipFileContent: Y,
289
- onFileClick: ee,
285
+ return /* @__PURE__ */ t(Me, {
286
+ zipFiles: q,
287
+ zipLoading: Q,
288
+ zipError: Y,
289
+ selectedZipFile: ee,
290
+ zipFileContent: te,
291
+ onFileClick: re,
290
292
  url: e
291
293
  });
292
294
  case "unknown":
293
295
  default:
294
- return /* @__PURE__ */ t(Ue, {
296
+ return /* @__PURE__ */ t(Ie, {
295
297
  url: e
296
298
  });
297
299
  }
298
300
  };
299
- return /* @__PURE__ */ C("div", {
300
- className: `document-viewer ${f || ""}`,
301
+ return /* @__PURE__ */ T("div", {
302
+ className: `document-viewer ${h || ""}`,
301
303
  style: u,
302
- children: [w && /* @__PURE__ */ C("div", {
304
+ children: [y && /* @__PURE__ */ T("div", {
303
305
  className: "document-viewer-toolbar",
304
- children: [/* @__PURE__ */ C("div", {
306
+ children: [/* @__PURE__ */ T("div", {
305
307
  className: "document-viewer-toolbar-meta",
306
308
  children: [/* @__PURE__ */ t("span", {
307
309
  className: "document-viewer-toolbar-name",
308
- title: U,
309
- children: U
310
+ title: A,
311
+ children: A
310
312
  }), /* @__PURE__ */ t("span", {
311
313
  className: "document-viewer-toolbar-size",
312
- children: ne
314
+ children: ie
313
315
  })]
314
- }), /* @__PURE__ */ C(ue, {
316
+ }), /* @__PURE__ */ T(fe, {
315
317
  size: 8,
316
318
  wrap: !0,
317
- children: [/* @__PURE__ */ t(D, {
318
- icon: /* @__PURE__ */ t(L, {}),
319
+ children: [/* @__PURE__ */ t($, {
320
+ icon: /* @__PURE__ */ t(O, {}),
319
321
  size: "small",
320
322
  href: e,
321
323
  target: "_blank",
322
324
  rel: "noopener noreferrer",
323
325
  download: r || void 0,
324
326
  children: "下载"
325
- }), /* @__PURE__ */ t(me.Button, {
327
+ }), /* @__PURE__ */ t(pe.Button, {
326
328
  size: "small",
327
- icon: /* @__PURE__ */ t(pe, {}),
329
+ icon: /* @__PURE__ */ t(we, {}),
328
330
  menu: {
329
- items: ie,
330
- onClick: ae
331
+ items: se,
332
+ onClick: le
331
333
  },
332
- disabled: oe,
333
- loading: re,
334
- onClick: F,
334
+ disabled: ae,
335
+ loading: oe,
336
+ onClick: M,
335
337
  children: "复制"
336
- })]
338
+ }), v]
337
339
  })]
338
340
  }), /* @__PURE__ */ t("div", {
339
341
  className: "document-viewer-body",
340
- children: se()
342
+ children: ce()
341
343
  })]
342
344
  });
343
- }, $e = ({
345
+ }, Ue = ({
344
346
  url: o,
345
347
  fileName: n,
346
348
  extension: r
347
- }) => r === "docx" ? /* @__PURE__ */ t(Oe, {
349
+ }) => r === "docx" ? /* @__PURE__ */ t(He, {
348
350
  url: o,
349
351
  fileName: n
350
352
  }) : /* @__PURE__ */ t("div", {
351
353
  className: "document-viewer-office",
352
- children: /* @__PURE__ */ t(J, {
354
+ children: /* @__PURE__ */ t(K, {
353
355
  className: "document-viewer-alert-full",
354
356
  message: "暂不支持在线预览",
355
357
  description: "当前仅支持 docx 文件在线预览,其他 Office 文档请下载后查看。",
356
358
  type: "info",
357
359
  showIcon: !0,
358
- action: /* @__PURE__ */ t(D, {
360
+ action: /* @__PURE__ */ t($, {
359
361
  type: "link",
360
- icon: /* @__PURE__ */ t(L, {}),
362
+ icon: /* @__PURE__ */ t(O, {}),
361
363
  href: o,
362
364
  download: n,
363
365
  target: "_blank",
@@ -365,51 +367,51 @@ const De = (o) => {
365
367
  children: "下载文件"
366
368
  })
367
369
  })
368
- }), Oe = ({
370
+ }), He = ({
369
371
  url: o,
370
372
  fileName: n
371
373
  }) => {
372
- const r = de(null), [f, u] = p(!0), [w, h] = p(null);
373
- return _(() => {
374
- let e = !1;
374
+ const r = me(null), [h, u] = w(!0), [y, v] = w(null);
375
+ return J(() => {
376
+ let s = !1;
375
377
  const l = r.current;
376
- return l && (l.innerHTML = ""), u(!0), h(null), g(void 0, null, function* () {
378
+ return l && (l.innerHTML = ""), u(!0), v(null), x(void 0, null, function* () {
377
379
  try {
378
- const s = yield fetch(o);
379
- if (!s.ok)
380
- throw new Error(`HTTP error! status: ${s.status}`);
381
- const k = yield s.blob();
382
- if (e || !r.current)
380
+ const e = yield fetch(o);
381
+ if (!e.ok)
382
+ throw new Error(`HTTP error! status: ${e.status}`);
383
+ const C = yield e.blob();
384
+ if (s || !r.current)
383
385
  return;
384
- yield fe(k, r.current, void 0, {
386
+ yield he(C, r.current, void 0, {
385
387
  inWrapper: !1,
386
388
  ignoreWidth: !1,
387
389
  ignoreHeight: !1,
388
390
  breakPages: !0
389
- }), e || u(!1);
390
- } catch (s) {
391
- e || (h((s == null ? void 0 : s.message) || "DOCX文件预览失败"), u(!1));
391
+ }), s || u(!1);
392
+ } catch (e) {
393
+ s || (v((e == null ? void 0 : e.message) || "DOCX文件预览失败"), u(!1));
392
394
  }
393
395
  }), () => {
394
- e = !0, l && (l.innerHTML = "");
396
+ s = !0, l && (l.innerHTML = "");
395
397
  };
396
- }, [o]), /* @__PURE__ */ C("div", {
398
+ }, [o]), /* @__PURE__ */ T("div", {
397
399
  className: "document-viewer-office document-viewer-docx",
398
- children: [f && /* @__PURE__ */ t("div", {
400
+ children: [h && /* @__PURE__ */ t("div", {
399
401
  className: "document-viewer-loading",
400
- children: /* @__PURE__ */ t(Z, {
402
+ children: /* @__PURE__ */ t(G, {
401
403
  size: "large",
402
404
  tip: "加载DOCX中..."
403
405
  })
404
- }), w && /* @__PURE__ */ t(J, {
406
+ }), y && /* @__PURE__ */ t(K, {
405
407
  className: "document-viewer-alert-full",
406
408
  message: "DOCX预览失败",
407
409
  description: "文件无法在线预览,请下载后查看。",
408
410
  type: "warning",
409
411
  showIcon: !0,
410
- action: /* @__PURE__ */ t(D, {
412
+ action: /* @__PURE__ */ t($, {
411
413
  type: "link",
412
- icon: /* @__PURE__ */ t(L, {}),
414
+ icon: /* @__PURE__ */ t(O, {}),
413
415
  href: o,
414
416
  download: n,
415
417
  target: "_blank",
@@ -420,11 +422,11 @@ const De = (o) => {
420
422
  ref: r,
421
423
  className: "document-viewer-docx-content",
422
424
  style: {
423
- display: f || w ? "none" : void 0
425
+ display: h || y ? "none" : void 0
424
426
  }
425
427
  })]
426
428
  });
427
- }, Ue = ({
429
+ }, Ie = ({
428
430
  url: o
429
431
  }) => /* @__PURE__ */ t("div", {
430
432
  className: "document-viewer-unknown",
@@ -433,7 +435,7 @@ const De = (o) => {
433
435
  className: "document-viewer-iframe",
434
436
  title: "File Preview"
435
437
  })
436
- }), tt = je;
438
+ }), nt = Oe;
437
439
  export {
438
- tt as default
440
+ nt as default
439
441
  };