@glodon-aiot/react-components 3.11.0 → 3.11.1-shapshot.1765331455

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