@flyfish-group/file-viewer3 1.0.2 → 1.0.4

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 (48) hide show
  1. package/dist/components/index.js +55 -52
  2. package/dist/index.d.ts +47 -0
  3. package/dist/index.umd.js +1 -1
  4. package/dist/src/package/index.d.ts +3 -0
  5. package/dist/worker/xlsx.worker.js +1 -1
  6. package/package.json +1 -1
  7. package/dist/components/utils.d.ts +0 -3
  8. package/dist/main.d.ts +0 -0
  9. package/dist/package/common/type.d.ts +0 -30
  10. package/dist/package/common/util.d.ts +0 -5
  11. package/dist/package/common/worker-ref.d.ts +0 -12
  12. package/dist/package/components/FileViewer/FileViewer.vue.d.ts +0 -18
  13. package/dist/package/components/FileViewer/index.d.ts +0 -2
  14. package/dist/package/components/FileViewer/util.d.ts +0 -2
  15. package/dist/package/index.d.ts +0 -12
  16. package/dist/package/use/index.d.ts +0 -1
  17. package/dist/package/use/worker.d.ts +0 -24
  18. package/dist/package/vendors/docx/index.d.ts +0 -4
  19. package/dist/package/vendors/image/ImageViewer.vue.d.ts +0 -15
  20. package/dist/package/vendors/image/index.d.ts +0 -4
  21. package/dist/package/vendors/md/MarkdownViewer.vue.d.ts +0 -15
  22. package/dist/package/vendors/md/index.d.ts +0 -4
  23. package/dist/package/vendors/mp4/index.d.ts +0 -4
  24. package/dist/package/vendors/pdf/PdfView.vue.d.ts +0 -15
  25. package/dist/package/vendors/pdf/index.d.ts +0 -1
  26. package/dist/package/vendors/pdf/worker/index.d.ts +0 -4
  27. package/dist/package/vendors/pptx/PptxRender.vue.d.ts +0 -87
  28. package/dist/package/vendors/pptx/index.d.ts +0 -6
  29. package/dist/package/vendors/pptx/options.d.ts +0 -39
  30. package/dist/package/vendors/pptx/support/chart.d.ts +0 -4
  31. package/dist/package/vendors/pptx/worker/index.d.ts +0 -4
  32. package/dist/package/vendors/renders.d.ts +0 -3
  33. package/dist/package/vendors/text/CodeViewer.vue.d.ts +0 -15
  34. package/dist/package/vendors/text/index.d.ts +0 -6
  35. package/dist/package/vendors/xlsx/XlsxTable.vue.d.ts +0 -17
  36. package/dist/package/vendors/xlsx/index.d.ts +0 -5
  37. package/dist/package/vendors/xlsx/render.d.ts +0 -6
  38. package/dist/package/vendors/xlsx/util.d.ts +0 -8
  39. package/dist/package/vendors/xlsx/worker/index.d.ts +0 -6
  40. package/dist/package/vendors/xlsx/worker/xls/SheetJsModel.d.ts +0 -36
  41. package/dist/package/vendors/xlsx/worker/xls/index.d.ts +0 -4
  42. package/dist/package/vendors/xlsx/worker/xls/sheet.worker.d.ts +0 -1
  43. package/dist/package/vendors/xlsx/worker/xlsx/ExcelJsModel.d.ts +0 -39
  44. package/dist/package/vendors/xlsx/worker/xlsx/color.d.ts +0 -2
  45. package/dist/package/vendors/xlsx/worker/xlsx/context.d.ts +0 -7
  46. package/dist/package/vendors/xlsx/worker/xlsx/index.d.ts +0 -4
  47. package/dist/package/vendors/xlsx/worker/xlsx/util.d.ts +0 -10
  48. package/dist/package/vendors/xlsx/worker/xlsx/xlsx.worker.d.ts +0 -2
@@ -26,7 +26,7 @@ var w = (e, t, n) => new Promise((r, s) => {
26
26
  }, l = (u) => u.done ? r(u.value) : Promise.resolve(u.value).then(o, i);
27
27
  l((n = n.apply(e, t)).next());
28
28
  });
29
- import { defineAsyncComponent as k, createApp as N, createVNode as F, defineComponent as Ue, openBlock as H, createElementBlock as M, toDisplayString as q, ref as B, onMounted as lt, watch as Ee, createElementVNode as ee, Fragment as ut, withDirectives as be, vShow as Re } from "vue";
29
+ import { defineAsyncComponent as k, createApp as N, createVNode as F, defineComponent as Ue, openBlock as H, createElementBlock as M, toDisplayString as q, ref as B, onMounted as lt, watch as be, createElementVNode as ee, Fragment as ut, withDirectives as Ee, vShow as Re } from "vue";
30
30
  const ft = (() => {
31
31
  const e = {
32
32
  module: null,
@@ -82,7 +82,7 @@ function wt(e, t) {
82
82
  return n.mount(t), n;
83
83
  });
84
84
  }
85
- function Et(e) {
85
+ function bt(e) {
86
86
  return w(this, null, function* () {
87
87
  return new Promise((t, n) => {
88
88
  const r = new FileReader();
@@ -93,7 +93,7 @@ function Et(e) {
93
93
  });
94
94
  });
95
95
  }
96
- function bt(e) {
96
+ function Et(e) {
97
97
  return w(this, null, function* () {
98
98
  return new Promise((t, n) => {
99
99
  const r = new FileReader();
@@ -120,7 +120,7 @@ function De(e) {
120
120
  const Rt = k(() => import("./ImageViewer.js"));
121
121
  function St(e, t) {
122
122
  return w(this, null, function* () {
123
- const n = yield bt(e), r = N({
123
+ const n = yield Et(e), r = N({
124
124
  render: () => F(Rt, {
125
125
  image: n
126
126
  }, null)
@@ -167,7 +167,10 @@ function Tt(e, t) {
167
167
  }
168
168
  function Pt(e, t) {
169
169
  const n = document.createElement("video");
170
- n.width = 840, n.height = 480, n.controls = !0;
170
+ n.width = 840, n.height = 480, n.controls = !0, Object.assign(n.style, {
171
+ margin: "40px auto",
172
+ display: "block"
173
+ });
171
174
  const r = document.createElement("source");
172
175
  r.src = URL.createObjectURL(new Blob([e])), n.appendChild(r), t.appendChild(n);
173
176
  }
@@ -213,7 +216,7 @@ const I = (e) => ({
213
216
  },
214
217
  // 图片过滤器
215
218
  {
216
- accepts: ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg"],
219
+ accepts: ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg", "webp"],
217
220
  handler: (e, t) => w(void 0, null, function* () {
218
221
  return St(e, t);
219
222
  })
@@ -560,8 +563,8 @@ function G(e, t, n) {
560
563
  metaTokens: !0,
561
564
  dots: !1,
562
565
  indexes: !1
563
- }, !1, function(d, b) {
564
- return !a.isUndefined(b[d]);
566
+ }, !1, function(d, E) {
567
+ return !a.isUndefined(E[d]);
565
568
  });
566
569
  const r = n.metaTokens, s = n.visitor || f, o = n.dots, i = n.indexes, u = (n.Blob || typeof Blob != "undefined" && Blob) && a.isSpecCompliantForm(t);
567
570
  if (!a.isFunction(s))
@@ -575,9 +578,9 @@ function G(e, t, n) {
575
578
  throw new m("Blob is not supported. Use a Buffer instead.");
576
579
  return a.isArrayBuffer(h) || a.isTypedArray(h) ? u && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
577
580
  }
578
- function f(h, d, b) {
581
+ function f(h, d, E) {
579
582
  let S = h;
580
- if (h && !b && typeof h == "object") {
583
+ if (h && !E && typeof h == "object") {
581
584
  if (a.endsWith(d, "{}"))
582
585
  d = r ? d : d.slice(0, -2), h = JSON.stringify(h);
583
586
  else if (a.isArray(h) && hn(h) || (a.isFileList(h) || a.endsWith(d, "[]")) && (S = a.toArray(h)))
@@ -589,14 +592,14 @@ function G(e, t, n) {
589
592
  );
590
593
  }), !1;
591
594
  }
592
- return ie(h) ? !0 : (t.append(Ae(b, d, o), p(h)), !1);
595
+ return ie(h) ? !0 : (t.append(Ae(E, d, o), p(h)), !1);
593
596
  }
594
597
  const c = [], y = Object.assign(mn, {
595
598
  defaultVisitor: f,
596
599
  convertValue: p,
597
600
  isVisitable: ie
598
601
  });
599
- function E(h, d) {
602
+ function b(h, d) {
600
603
  if (!a.isUndefined(h)) {
601
604
  if (c.indexOf(h) !== -1)
602
605
  throw Error("Circular reference detected in " + d.join("."));
@@ -607,13 +610,13 @@ function G(e, t, n) {
607
610
  a.isString(O) ? O.trim() : O,
608
611
  d,
609
612
  y
610
- )) === !0 && E(S, d ? d.concat(O) : [O]);
613
+ )) === !0 && b(S, d ? d.concat(O) : [O]);
611
614
  }), c.pop();
612
615
  }
613
616
  }
614
617
  if (!a.isObject(e))
615
618
  throw new TypeError("data must be an object");
616
- return E(e), t;
619
+ return b(e), t;
617
620
  }
618
621
  function _e(e) {
619
622
  const t = {
@@ -716,11 +719,11 @@ const Te = wn, Qe = {
716
719
  silentJSONParsing: !0,
717
720
  forcedJSONParsing: !0,
718
721
  clarifyTimeoutError: !1
719
- }, En = typeof URLSearchParams != "undefined" ? URLSearchParams : fe, bn = typeof FormData != "undefined" ? FormData : null, Rn = typeof Blob != "undefined" ? Blob : null, Sn = {
722
+ }, bn = typeof URLSearchParams != "undefined" ? URLSearchParams : fe, En = typeof FormData != "undefined" ? FormData : null, Rn = typeof Blob != "undefined" ? Blob : null, Sn = {
720
723
  isBrowser: !0,
721
724
  classes: {
722
- URLSearchParams: En,
723
- FormData: bn,
725
+ URLSearchParams: bn,
726
+ FormData: En,
724
727
  Blob: Rn
725
728
  },
726
729
  protocols: ["http", "https", "file", "blob", "url", "data"]
@@ -1138,8 +1141,8 @@ function Mn(e, t) {
1138
1141
  y += n[c++], c = c % e;
1139
1142
  if (s = (s + 1) % e, s === o && (o = (o + 1) % e), p - i < t)
1140
1143
  return;
1141
- const E = f && p - f;
1142
- return E ? Math.round(y * 1e3 / E) : void 0;
1144
+ const b = f && p - f;
1145
+ return b ? Math.round(y * 1e3 / b) : void 0;
1143
1146
  };
1144
1147
  }
1145
1148
  function Ce(e, t) {
@@ -1173,18 +1176,18 @@ const qn = typeof XMLHttpRequest != "undefined", zn = qn && function(e) {
1173
1176
  if (A.hasStandardBrowserEnv || A.hasStandardBrowserWebWorkerEnv)
1174
1177
  o.setContentType(!1);
1175
1178
  else if ((f = o.getContentType()) !== !1) {
1176
- const [d, ...b] = f ? f.split(";").map((S) => S.trim()).filter(Boolean) : [];
1177
- o.setContentType([d || "multipart/form-data", ...b].join("; "));
1179
+ const [d, ...E] = f ? f.split(";").map((S) => S.trim()).filter(Boolean) : [];
1180
+ o.setContentType([d || "multipart/form-data", ...E].join("; "));
1178
1181
  }
1179
1182
  }
1180
1183
  let c = new XMLHttpRequest();
1181
1184
  if (e.auth) {
1182
- const d = e.auth.username || "", b = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
1183
- o.set("Authorization", "Basic " + btoa(d + ":" + b));
1185
+ const d = e.auth.username || "", E = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
1186
+ o.set("Authorization", "Basic " + btoa(d + ":" + E));
1184
1187
  }
1185
1188
  const y = tt(e.baseURL, e.url);
1186
1189
  c.open(e.method.toUpperCase(), Ge(y, e.params, e.paramsSerializer), !0), c.timeout = e.timeout;
1187
- function E() {
1190
+ function b() {
1188
1191
  if (!c)
1189
1192
  return;
1190
1193
  const d = T.from(
@@ -1203,17 +1206,17 @@ const qn = typeof XMLHttpRequest != "undefined", zn = qn && function(e) {
1203
1206
  r(x), p();
1204
1207
  }, S), c = null;
1205
1208
  }
1206
- if ("onloadend" in c ? c.onloadend = E : c.onreadystatechange = function() {
1207
- !c || c.readyState !== 4 || c.status === 0 && !(c.responseURL && c.responseURL.indexOf("file:") === 0) || setTimeout(E);
1209
+ if ("onloadend" in c ? c.onloadend = b : c.onreadystatechange = function() {
1210
+ !c || c.readyState !== 4 || c.status === 0 && !(c.responseURL && c.responseURL.indexOf("file:") === 0) || setTimeout(b);
1208
1211
  }, c.onabort = function() {
1209
1212
  c && (r(new m("Request aborted", m.ECONNABORTED, e, c)), c = null);
1210
1213
  }, c.onerror = function() {
1211
1214
  r(new m("Network Error", m.ERR_NETWORK, e, c)), c = null;
1212
1215
  }, c.ontimeout = function() {
1213
- let b = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
1216
+ let E = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
1214
1217
  const S = e.transitional || Qe;
1215
- e.timeoutErrorMessage && (b = e.timeoutErrorMessage), r(new m(
1216
- b,
1218
+ e.timeoutErrorMessage && (E = e.timeoutErrorMessage), r(new m(
1219
+ E,
1217
1220
  S.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
1218
1221
  e,
1219
1222
  c
@@ -1222,8 +1225,8 @@ const qn = typeof XMLHttpRequest != "undefined", zn = qn && function(e) {
1222
1225
  const d = e.xsrfHeaderName && e.xsrfCookieName && kn.read(e.xsrfCookieName);
1223
1226
  d && o.set(e.xsrfHeaderName, d);
1224
1227
  }
1225
- s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(b, S) {
1226
- c.setRequestHeader(S, b);
1228
+ s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(E, S) {
1229
+ c.setRequestHeader(S, E);
1227
1230
  }), a.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials), i && i !== "json" && (c.responseType = e.responseType), typeof e.onDownloadProgress == "function" && c.addEventListener("progress", Ce(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && c.upload && c.upload.addEventListener("progress", Ce(e.onUploadProgress)), (e.cancelToken || e.signal) && (u = (d) => {
1228
1231
  c && (r(!d || d.type ? new v(null, e, c) : d), c.abort(), c = null);
1229
1232
  }, e.cancelToken && e.cancelToken.subscribe(u), e.signal && (e.signal.aborted ? u() : e.signal.addEventListener("abort", u)));
@@ -1484,18 +1487,18 @@ class J {
1484
1487
  return f;
1485
1488
  }
1486
1489
  y = l.length;
1487
- let E = n;
1490
+ let b = n;
1488
1491
  for (c = 0; c < y; ) {
1489
1492
  const h = l[c++], d = l[c++];
1490
1493
  try {
1491
- E = h(E);
1492
- } catch (b) {
1493
- d.call(this, b);
1494
+ b = h(b);
1495
+ } catch (E) {
1496
+ d.call(this, E);
1494
1497
  break;
1495
1498
  }
1496
1499
  }
1497
1500
  try {
1498
- f = Fe.call(this, E);
1501
+ f = Fe.call(this, b);
1499
1502
  } catch (h) {
1500
1503
  return Promise.reject(h);
1501
1504
  }
@@ -1735,13 +1738,13 @@ const Gn = R, Qn = { class: "file-viewer" }, Zn = { class: "name" }, Yn = {
1735
1738
  this.startLoading(l.loading);
1736
1739
  const y = c.substring(c.lastIndexOf("/") + 1);
1737
1740
  try {
1738
- const { data: E } = yield Gn({ url: c, method: "get", responseType: "blob" });
1739
- if (!E)
1741
+ const { data: b } = yield Gn({ url: c, method: "get", responseType: "blob" });
1742
+ if (!b)
1740
1743
  return this.showError("文件下载失败");
1741
- const h = this.wrap(E, y);
1744
+ const h = this.wrap(b, y);
1742
1745
  return this.resolveFile(h);
1743
- } catch (E) {
1744
- this.showError(l.errorLoading(E));
1746
+ } catch (b) {
1747
+ this.showError(l.errorLoading(b));
1745
1748
  } finally {
1746
1749
  this.endLoading();
1747
1750
  }
@@ -1765,10 +1768,10 @@ const Gn = R, Qn = { class: "file-viewer" }, Zn = { class: "name" }, Yn = {
1765
1768
  this.startLoading(l.reading);
1766
1769
  try {
1767
1770
  o.value = y.name && decodeURIComponent(y.name) || "";
1768
- const E = yield Et(y);
1769
- E instanceof ArrayBuffer && (u = yield this.displayResult(E, y));
1770
- } catch (E) {
1771
- console.error(E), this.showError(l.errorReading(E));
1771
+ const b = yield bt(y);
1772
+ b instanceof ArrayBuffer && (u = yield this.displayResult(b, y));
1773
+ } catch (b) {
1774
+ console.error(b), this.showError(l.errorReading(b));
1772
1775
  } finally {
1773
1776
  this.endLoading();
1774
1777
  }
@@ -1776,13 +1779,13 @@ const Gn = R, Qn = { class: "file-viewer" }, Zn = { class: "name" }, Yn = {
1776
1779
  },
1777
1780
  // 展示渲染最终效果
1778
1781
  displayResult(c, y) {
1779
- const { name: E } = y, h = Nt(E), d = i.value;
1782
+ const { name: b } = y, h = Nt(b), d = i.value;
1780
1783
  if (!d)
1781
1784
  return Promise.resolve();
1782
1785
  u && (d.lastChild && d.removeChild(d.lastChild), u.unmount());
1783
- const b = document.createElement("div");
1784
- b.className = "file-render";
1785
- const S = d.appendChild(b);
1786
+ const E = document.createElement("div");
1787
+ E.className = "file-render";
1788
+ const S = d.appendChild(E);
1786
1789
  return new Promise((O, x) => Ft(c, h, S).then(O).catch(x));
1787
1790
  },
1788
1791
  showError(c) {
@@ -1797,14 +1800,14 @@ const Gn = R, Qn = { class: "file-viewer" }, Zn = { class: "name" }, Yn = {
1797
1800
  };
1798
1801
  lt(() => {
1799
1802
  t.file && p.resolveFile(t.file), p.loadFromUrl();
1800
- }), Ee(() => t.url, () => p.loadFromUrl()), Ee(() => t.file, (c) => c && p.resolveFile(c));
1803
+ }), be(() => t.url, () => p.loadFromUrl()), be(() => t.file, (c) => c && p.resolveFile(c));
1801
1804
  })(), (l, u) => (H(), M("div", Qn, [
1802
1805
  ee("div", Zn, q(o.value), 1),
1803
1806
  r.value ? (H(), M("div", Yn, q(r.value), 1)) : (H(), M(ut, { key: 1 }, [
1804
- be(ee("div", { class: "content loading" }, q(s.value), 513), [
1807
+ Ee(ee("div", { class: "content loading" }, q(s.value), 513), [
1805
1808
  [Re, n.value]
1806
1809
  ]),
1807
- be(ee("div", {
1810
+ Ee(ee("div", {
1808
1811
  class: "content",
1809
1812
  ref_key: "output",
1810
1813
  ref: i
@@ -0,0 +1,47 @@
1
+ import type { App } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { DefineComponent } from 'vue';
4
+ import { ExtractPropTypes } from 'vue';
5
+ import { PropType } from 'vue';
6
+ import { PublicProps } from 'vue';
7
+
8
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
9
+
10
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
18
+
19
+ declare const _default: Installer;
20
+ export default _default;
21
+
22
+ /**
23
+ * 文件引用,支持三种
24
+ */
25
+ declare type FileRef = File | Blob | ArrayBuffer;
26
+
27
+ export declare const FileViewer: DefineComponent<__VLS_TypePropsToRuntimeProps<{
28
+ file?: FileRef | undefined;
29
+ url?: string | undefined;
30
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
31
+ file?: FileRef | undefined;
32
+ url?: string | undefined;
33
+ }>>>, {}, {}>;
34
+
35
+ declare interface FileViewerInstaller {
36
+ install(app: App): void;
37
+ }
38
+
39
+ /**
40
+ * 安装器
41
+ */
42
+ declare class Installer implements FileViewerInstaller {
43
+ private installed;
44
+ install(app: App): void;
45
+ }
46
+
47
+ export { }
package/dist/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  var ru=Object.defineProperty,nu=Object.defineProperties;var iu=Object.getOwnPropertyDescriptors;var oa=Object.getOwnPropertySymbols;var vl=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable;var Cs=Math.pow,Ya=(Ti,Ii,Mi)=>Ii in Ti?ru(Ti,Ii,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):Ti[Ii]=Mi,bi=(Ti,Ii)=>{for(var Mi in Ii||(Ii={}))vl.call(Ii,Mi)&&Ya(Ti,Mi,Ii[Mi]);if(oa)for(var Mi of oa(Ii))yl.call(Ii,Mi)&&Ya(Ti,Mi,Ii[Mi]);return Ti},Bi=(Ti,Ii)=>nu(Ti,iu(Ii));var Ji=(Ti,Ii)=>{var Mi={};for(var Xi in Ti)vl.call(Ti,Xi)&&Ii.indexOf(Xi)<0&&(Mi[Xi]=Ti[Xi]);if(Ti!=null&&oa)for(var Xi of oa(Ti))Ii.indexOf(Xi)<0&&yl.call(Ti,Xi)&&(Mi[Xi]=Ti[Xi]);return Mi};var wi=(Ti,Ii,Mi)=>(Ya(Ti,typeof Ii!="symbol"?Ii+"":Ii,Mi),Mi),za=(Ti,Ii,Mi)=>{if(!Ii.has(Ti))throw TypeError("Cannot "+Mi)};var ye=(Ti,Ii,Mi)=>(za(Ti,Ii,"read from private field"),Mi?Mi.call(Ti):Ii.get(Ti)),pn=(Ti,Ii,Mi)=>{if(Ii.has(Ti))throw TypeError("Cannot add the same private member more than once");Ii instanceof WeakSet?Ii.add(Ti):Ii.set(Ti,Mi)},xn=(Ti,Ii,Mi,Xi)=>(za(Ti,Ii,"write to private field"),Xi?Xi.call(Ti,Mi):Ii.set(Ti,Mi),Mi);var $s=(Ti,Ii,Mi,Xi)=>({set _(t){xn(Ti,Ii,t,Mi)},get _(){return ye(Ti,Ii,Xi)}}),_n=(Ti,Ii,Mi)=>(za(Ti,Ii,"access private method"),Mi);var ui=(Ti,Ii,Mi)=>new Promise((Xi,t)=>{var e=i=>{try{n(Mi.next(i))}catch(s){t(s)}},r=i=>{try{n(Mi.throw(i))}catch(s){t(s)}},n=i=>i.done?Xi(i.value):Promise.resolve(i.value).then(e,r);n((Mi=Mi.apply(Ti,Ii)).next())});(function(Ti,Ii){typeof exports=="object"&&typeof module!="undefined"?Ii(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ii):(Ti=typeof globalThis!="undefined"?globalThis:Ti||self,Ii(Ti["file-viewer3"]={},Ti.Vue))})(this,function(exports,vue){var Ti,Zo,Mi,Cc;"use strict";var _documentCurrentScript=typeof document!="undefined"?document.currentScript:null;const loadLibrary=(()=>{const t={module:null,load(){return ui(this,null,function*(){return this.module||(this.module=Promise.resolve().then(()=>docxPreview)),this.module})}};return()=>ui(this,null,function*(){return yield t.load()})})();function renderDocx(t,e){return ui(this,null,function*(){const{defaultOptions:r,renderAsync:n}=yield loadLibrary(),i=Object.assign(r,{debug:!0,experimental:!0});yield n(t,e,void 0,i)})}const PptxRender$2=vue.defineAsyncComponent(()=>Promise.resolve().then(()=>PptxRender$1));function renderPptx(t,e){return ui(this,null,function*(){return vue.createApp({render:()=>vue.createVNode(PptxRender$2,{data:t},null)}).mount(e)})}const XlsxTable$2=vue.defineAsyncComponent(()=>Promise.resolve().then(()=>XlsxTable$1));function render$3(t,e,r){return ui(this,null,function*(){const n=vue.createApp({render:()=>vue.createVNode(XlsxTable$2,{data:t,type:r},null)});return n.mount(e),n})}const PdfView$2=vue.defineAsyncComponent(()=>Promise.resolve().then(()=>PdfView$1));function renderPdf(t,e){return ui(this,null,function*(){const r=vue.createApp({render:()=>vue.createVNode(PdfView$2,{data:t},null)});return r.mount(e),r})}function readBuffer(t){return ui(this,null,function*(){return new Promise((e,r)=>{const n=new FileReader;n.onload=i=>{var s;return e((s=i.target)==null?void 0:s.result)},n.onerror=i=>r(i),n.readAsArrayBuffer(t)})})}function readDataURL(t){return ui(this,null,function*(){return new Promise((e,r)=>{const n=new FileReader;n.onload=i=>{var a;const s=(a=i.target)==null?void 0:a.result;typeof s=="string"&&e(s)},n.onerror=i=>r(i),n.readAsDataURL(new Blob([t]))})})}function readText(t){return ui(this,null,function*(){return new Promise((e,r)=>{const n=new FileReader;n.onload=i=>{var a;const s=(a=i.target)==null?void 0:a.result;typeof s=="string"&&e(s)},n.onerror=i=>r(i),n.readAsText(new Blob([t]),"utf-8")})})}const ImageViewer$2=vue.defineAsyncComponent(()=>Promise.resolve().then(()=>ImageViewer$1));function renderImage(t,e){return ui(this,null,function*(){const r=yield readDataURL(t),n=vue.createApp({render:()=>vue.createVNode(ImageViewer$2,{image:r},null)});return n.mount(e),n})}const MarkdownViewer$2=vue.defineAsyncComponent(()=>Promise.resolve().then(()=>MarkdownViewer$1));function renderMd(t,e){return ui(this,null,function*(){const r=yield readText(t),n=vue.createApp({render:()=>vue.createVNode(MarkdownViewer$2,{data:r},null)});return n.mount(e),n})}const _hoisted_1$6={class:"code-area"},_sfc_main$6=vue.defineComponent({__name:"CodeViewer",props:{value:{}},setup(t){return(e,r)=>(vue.openBlock(),vue.createElementBlock("pre",_hoisted_1$6," "+vue.toDisplayString(e.value)+`
2
- `,1))}}),CodeViewer_vue_vue_type_style_index_0_scoped_3be501eb_lang="",_export_sfc=(t,e)=>{const r=t.__vccOpts||t;for(const[n,i]of e)r[n]=i;return r},CodeViewer=_export_sfc(_sfc_main$6,[["__scopeId","data-v-3be501eb"]]);function renderText$1(t,e){return ui(this,null,function*(){const r=yield readText(t),n=vue.createApp({render:()=>vue.createVNode(CodeViewer,{value:r},null)});return n.mount(e),n})}function renderMp4(t,e){const r=document.createElement("video");r.width=840,r.height=480,r.controls=!0;const n=document.createElement("source");n.src=URL.createObjectURL(new Blob([t])),r.appendChild(n),e.appendChild(r)}const createWrapper=t=>({$el:t,unmount(){}}),handlers$2=[{accepts:["docx"],handler:(t,e)=>ui(this,null,function*(){return yield renderDocx(t,e),window.dispatchEvent(new Event("resize")),createWrapper(e)})},{accepts:["pptx"],handler:(t,e)=>ui(this,null,function*(){return yield renderPptx(t,e),window.dispatchEvent(new Event("resize")),createWrapper(e)})},{accepts:["xlsx"],handler:(t,e)=>ui(this,null,function*(){return render$3(t,e,"xml")})},{accepts:["xlsm","xlsb","xls","csv","ods","fods","numbers"],handler:(t,e)=>ui(this,null,function*(){return render$3(t,e,"binary")})},{accepts:["pdf"],handler:(t,e)=>ui(this,null,function*(){return renderPdf(t,e)})},{accepts:["gif","jpg","jpeg","bmp","tiff","tif","png","svg"],handler:(t,e)=>ui(this,null,function*(){return renderImage(t,e)})},{accepts:["md","markdown"],handler:(t,e)=>ui(this,null,function*(){return renderMd(t,e)})},{accepts:["txt","json","js","css","java","py","html","jsx","ts","tsx","xml","log"],handler:(t,e)=>ui(this,null,function*(){return renderText$1(t,e)})},{accepts:["mp4"],handler:(t,e)=>ui(this,null,function*(){return renderMp4(t,e),createWrapper(e)})},{accepts:["error"],handler:(t,e,r)=>ui(this,null,function*(){return e.innerHTML=`<div style='text-align: center; margin-top: 80px'>不支持.${r}格式的在线预览,请下载后预览或转换为支持的格式</div>
2
+ `,1))}}),CodeViewer_vue_vue_type_style_index_0_scoped_3be501eb_lang="",_export_sfc=(t,e)=>{const r=t.__vccOpts||t;for(const[n,i]of e)r[n]=i;return r},CodeViewer=_export_sfc(_sfc_main$6,[["__scopeId","data-v-3be501eb"]]);function renderText$1(t,e){return ui(this,null,function*(){const r=yield readText(t),n=vue.createApp({render:()=>vue.createVNode(CodeViewer,{value:r},null)});return n.mount(e),n})}function renderMp4(t,e){const r=document.createElement("video");r.width=840,r.height=480,r.controls=!0,Object.assign(r.style,{margin:"40px auto",display:"block"});const n=document.createElement("source");n.src=URL.createObjectURL(new Blob([t])),r.appendChild(n),e.appendChild(r)}const createWrapper=t=>({$el:t,unmount(){}}),handlers$2=[{accepts:["docx"],handler:(t,e)=>ui(this,null,function*(){return yield renderDocx(t,e),window.dispatchEvent(new Event("resize")),createWrapper(e)})},{accepts:["pptx"],handler:(t,e)=>ui(this,null,function*(){return yield renderPptx(t,e),window.dispatchEvent(new Event("resize")),createWrapper(e)})},{accepts:["xlsx"],handler:(t,e)=>ui(this,null,function*(){return render$3(t,e,"xml")})},{accepts:["xlsm","xlsb","xls","csv","ods","fods","numbers"],handler:(t,e)=>ui(this,null,function*(){return render$3(t,e,"binary")})},{accepts:["pdf"],handler:(t,e)=>ui(this,null,function*(){return renderPdf(t,e)})},{accepts:["gif","jpg","jpeg","bmp","tiff","tif","png","svg","webp"],handler:(t,e)=>ui(this,null,function*(){return renderImage(t,e)})},{accepts:["md","markdown"],handler:(t,e)=>ui(this,null,function*(){return renderMd(t,e)})},{accepts:["txt","json","js","css","java","py","html","jsx","ts","tsx","xml","log"],handler:(t,e)=>ui(this,null,function*(){return renderText$1(t,e)})},{accepts:["mp4"],handler:(t,e)=>ui(this,null,function*(){return renderMp4(t,e),createWrapper(e)})},{accepts:["error"],handler:(t,e,r)=>ui(this,null,function*(){return e.innerHTML=`<div style='text-align: center; margin-top: 80px'>不支持.${r}格式的在线预览,请下载后预览或转换为支持的格式</div>
3
3
  <div style='text-align: center'>支持docx, xlsx, pptx, pdf, 以及纯文本格式和各种图片格式的在线预览</div>`,createWrapper(e)})}],renders=handlers$2.reduce((t,{accepts:e,handler:r})=>(e.forEach(n=>t.set(n,r)),t),new Map),errorHandler=renders.get("error");function getExtend(t){const e=t.lastIndexOf(".");return t.substring(e+1)}function render$2(t,e,r){return ui(this,null,function*(){const n=renders.get(e.toLowerCase());if(n)return n(t,r);if(errorHandler)return errorHandler(t,r,e)})}function bind$3(t,e){return function(){return t.apply(e,arguments)}}const{toString:toString$6}=Object.prototype,{getPrototypeOf:getPrototypeOf$1}=Object,kindOf=(t=>e=>{const r=toString$6.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=t=>(t=t.toLowerCase(),e=>kindOf(e)===t),typeOfTest=t=>e=>typeof e===t,{isArray:isArray$6}=Array,isUndefined$4=typeOfTest("undefined");function isBuffer(t){return t!==null&&!isUndefined$4(t)&&t.constructor!==null&&!isUndefined$4(t.constructor)&&isFunction$4(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&isArrayBuffer(t.buffer),e}const isString$4=typeOfTest("string"),isFunction$4=typeOfTest("function"),isNumber$3=typeOfTest("number"),isObject$e=t=>t!==null&&typeof t=="object",isBoolean=t=>t===!0||t===!1,isPlainObject$1=t=>{if(kindOf(t)!=="object")return!1;const e=getPrototypeOf$1(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},isDate$3=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=t=>isObject$e(t)&&isFunction$4(t.pipe),isFormData=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||isFunction$4(t.append)&&((e=kindOf(t))==="formdata"||e==="object"&&isFunction$4(t.toString)&&t.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),trim$1=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t=="undefined")return;let n,i;if(typeof t!="object"&&(t=[t]),isArray$6(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const s=r?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length;let o;for(n=0;n<a;n++)o=s[n],e.call(null,t[o],o,t)}}function findKey(t,e){e=e.toLowerCase();const r=Object.keys(t);let n=r.length,i;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}const _global=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),isContextDefined=t=>!isUndefined$4(t)&&t!==_global;function merge(){const{caseless:t}=isContextDefined(this)&&this||{},e={},r=(n,i)=>{const s=t&&findKey(e,i)||i;isPlainObject$1(e[s])&&isPlainObject$1(n)?e[s]=merge(e[s],n):isPlainObject$1(n)?e[s]=merge({},n):isArray$6(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&forEach$1(arguments[n],r);return e}const extend$5=(t,e,r,{allOwnKeys:n}={})=>(forEach$1(e,(i,s)=>{r&&isFunction$4(i)?t[s]=bind$3(i,r):t[s]=i},{allOwnKeys:n}),t),stripBOM=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),inherits=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject=(t,e,r,n)=>{let i,s,a;const o={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=r!==!1&&getPrototypeOf$1(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},endsWith=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},toArray$2=t=>{if(!t)return null;if(isArray$6(t))return t;let e=t.length;if(!isNumber$3(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},isTypedArray=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&getPrototypeOf$1(Uint8Array)),forEachEntry=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},matchAll=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),hasOwnProperty$5=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),isRegExp$1=kindOfTest("RegExp"),reduceDescriptors=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};forEach$1(r,(i,s)=>{let a;(a=e(i,s,t))!==!1&&(n[s]=a||i)}),Object.defineProperties(t,n)},freezeMethods=t=>{reduceDescriptors(t,(e,r)=>{if(isFunction$4(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(isFunction$4(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},toObjectSet=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return isArray$6(t)?n(t):n(String(t).split(e)),r},noop$2=()=>{},toFiniteNumber=(t,e)=>(t=+t,Number.isFinite(t)?t:e),ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(t=16,e=ALPHABET.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function isSpecCompliantForm(t){return!!(t&&isFunction$4(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const toJSONObject=t=>{const e=new Array(10),r=(n,i)=>{if(isObject$e(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=isArray$6(n)?[]:{};return forEach$1(n,(a,o)=>{const l=r(a,i+1);!isUndefined$4(l)&&(s[o]=l)}),e[i]=void 0,s}}return n};return r(t,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=t=>t&&(isObject$e(t)||isFunction$4(t))&&isFunction$4(t.then)&&isFunction$4(t.catch),utils$1={isArray:isArray$6,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString:isString$4,isNumber:isNumber$3,isBoolean,isObject:isObject$e,isPlainObject:isPlainObject$1,isUndefined:isUndefined$4,isDate:isDate$3,isFile,isBlob,isRegExp:isRegExp$1,isFunction:isFunction$4,isStream,isURLSearchParams,isTypedArray,isFileList,forEach:forEach$1,merge,extend:extend$5,trim:trim$1,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$2,forEachEntry,matchAll,isHTMLForm,hasOwnProperty:hasOwnProperty$5,hasOwnProp:hasOwnProperty$5,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$2,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable};function AxiosError(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}utils$1.inherits(AxiosError,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$1.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors$1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{descriptors$1[t]={value:t}}),Object.defineProperties(AxiosError,descriptors$1),Object.defineProperty(prototype$1,"isAxiosError",{value:!0}),AxiosError.from=(t,e,r,n,i,s)=>{const a=Object.create(prototype$1);return utils$1.toFlatObject(t,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),AxiosError.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const httpAdapter=null;function isVisitable(t){return utils$1.isPlainObject(t)||utils$1.isArray(t)}function removeBrackets(t){return utils$1.endsWith(t,"[]")?t.slice(0,-2):t}function renderKey(t,e,r){return t?t.concat(e).map(function(i,s){return i=removeBrackets(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function isFlatArray(t){return utils$1.isArray(t)&&!t.some(isVisitable)}const predicates=utils$1.toFlatObject(utils$1,{},null,function(e){return/^is[A-Z]/.test(e)});function toFormData(t,e,r){if(!utils$1.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=utils$1.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!utils$1.isUndefined(v[m])});const n=r.metaTokens,i=r.visitor||u,s=r.dots,a=r.indexes,l=(r.Blob||typeof Blob!="undefined"&&Blob)&&utils$1.isSpecCompliantForm(e);if(!utils$1.isFunction(i))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(utils$1.isDate(p))return p.toISOString();if(!l&&utils$1.isBlob(p))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$1.isArrayBuffer(p)||utils$1.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,m,v){let A=p;if(p&&!v&&typeof p=="object"){if(utils$1.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(utils$1.isArray(p)&&isFlatArray(p)||(utils$1.isFileList(p)||utils$1.endsWith(m,"[]"))&&(A=utils$1.toArray(p)))return m=removeBrackets(m),A.forEach(function(T,D){!(utils$1.isUndefined(T)||T===null)&&e.append(a===!0?renderKey([m],D,s):a===null?m:m+"[]",c(T))}),!1}return isVisitable(p)?!0:(e.append(renderKey(v,m,s),c(p)),!1)}const h=[],d=Object.assign(predicates,{defaultVisitor:u,convertValue:c,isVisitable});function g(p,m){if(!utils$1.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(p),utils$1.forEach(p,function(A,w){(!(utils$1.isUndefined(A)||A===null)&&i.call(e,A,utils$1.isString(w)?w.trim():w,m,d))===!0&&g(A,m?m.concat(w):[w])}),h.pop()}}if(!utils$1.isObject(t))throw new TypeError("data must be an object");return g(t),e}function encode$1(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function AxiosURLSearchParams(t,e){this._pairs=[],t&&toFormData(t,this,e)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(e,r){this._pairs.push([e,r])},prototype.toString=function(e){const r=e?function(n){return e.call(this,n,encode$1)}:encode$1;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function encode(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(t,e,r){if(!e)return t;const n=r&&r.encode||encode,i=r&&r.serialize;let s;if(i?s=i(e,r):s=utils$1.isURLSearchParams(e)?e.toString():new AxiosURLSearchParams(e,r).toString(n),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class InterceptorManager{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){utils$1.forEach(this.handlers,function(n){n!==null&&e(n)})}}const InterceptorManager$1=InterceptorManager,transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams!="undefined"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData!="undefined"?FormData:null,Blob$1=typeof Blob!="undefined"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window!="undefined"&&typeof document!="undefined",hasStandardBrowserEnv=(t=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator!="undefined"&&navigator.product),hasStandardBrowserWebWorkerEnv=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),utils=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv},Symbol.toStringTag,{value:"Module"})),platform=bi(bi({},utils),platform$1);function toURLEncodedForm(t,e){return toFormData(t,new platform.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return platform.isNode&&utils$1.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function parsePropPath(t){return utils$1.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function arrayToObject(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}function formDataToJSON(t){function e(r,n,i,s){let a=r[s++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),l=s>=r.length;return a=!a&&utils$1.isArray(i)?i.length:a,l?(utils$1.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!o):((!i[a]||!utils$1.isObject(i[a]))&&(i[a]=[]),e(r,n,i[a],s)&&utils$1.isArray(i[a])&&(i[a]=arrayToObject(i[a])),!o)}if(utils$1.isFormData(t)&&utils$1.isFunction(t.entries)){const r={};return utils$1.forEachEntry(t,(n,i)=>{e(parsePropPath(n),i,r,0)}),r}return null}function stringifySafely(t,e,r){if(utils$1.isString(t))try{return(e||JSON.parse)(t),utils$1.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const defaults$3={transitional:transitionalDefaults,adapter:["xhr","http"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=utils$1.isObject(e);if(s&&utils$1.isHTMLForm(e)&&(e=new FormData(e)),utils$1.isFormData(e))return i?JSON.stringify(formDataToJSON(e)):e;if(utils$1.isArrayBuffer(e)||utils$1.isBuffer(e)||utils$1.isStream(e)||utils$1.isFile(e)||utils$1.isBlob(e))return e;if(utils$1.isArrayBufferView(e))return e.buffer;if(utils$1.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(e,this.formSerializer).toString();if((o=utils$1.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return toFormData(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),stringifySafely(e)):e}],transformResponse:[function(e){const r=this.transitional||defaults$3.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&utils$1.isString(e)&&(n&&!this.responseType||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?AxiosError.from(o,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$1.forEach(["delete","get","head","post","put","patch"],t=>{defaults$3.headers[t]={}});const defaults$4=defaults$3,ignoreDuplicateOf=utils$1.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=t=>{const e={};let r,n,i;return t&&t.split(`
4
4
  `).forEach(function(a){i=a.indexOf(":"),r=a.substring(0,i).trim().toLowerCase(),n=a.substring(i+1).trim(),!(!r||e[r]&&ignoreDuplicateOf[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},$internals=Symbol("internals");function normalizeHeader(t){return t&&String(t).trim().toLowerCase()}function normalizeValue(t){return t===!1||t==null?t:utils$1.isArray(t)?t.map(normalizeValue):String(t)}function parseTokens(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const isValidHeaderName=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function matchHeaderValue(t,e,r,n,i){if(utils$1.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!utils$1.isString(e)){if(utils$1.isString(n))return e.indexOf(n)!==-1;if(utils$1.isRegExp(n))return n.test(e)}}function formatHeader(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function buildAccessors(t,e){const r=utils$1.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:!0})})}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(o,l,c){const u=normalizeHeader(l);if(!u)throw new Error("header name must be a non-empty string");const h=utils$1.findKey(i,u);(!h||i[h]===void 0||c===!0||c===void 0&&i[h]!==!1)&&(i[h||l]=normalizeValue(o))}const a=(o,l)=>utils$1.forEach(o,(c,u)=>s(c,u,l));return utils$1.isPlainObject(e)||e instanceof this.constructor?a(e,r):utils$1.isString(e)&&(e=e.trim())&&!isValidHeaderName(e)?a(parseHeaders(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=normalizeHeader(e),e){const n=utils$1.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return parseTokens(i);if(utils$1.isFunction(r))return r.call(this,i,n);if(utils$1.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=normalizeHeader(e),e){const n=utils$1.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||matchHeaderValue(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(a){if(a=normalizeHeader(a),a){const o=utils$1.findKey(n,a);o&&(!r||matchHeaderValue(n,n[o],o,r))&&(delete n[o],i=!0)}}return utils$1.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||matchHeaderValue(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return utils$1.forEach(this,(i,s)=>{const a=utils$1.findKey(n,s);if(a){r[a]=normalizeValue(i),delete r[s];return}const o=e?formatHeader(s):String(s).trim();o!==s&&delete r[s],r[o]=normalizeValue(i),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return utils$1.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&utils$1.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
5
5
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[$internals]=this[$internals]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=normalizeHeader(a);n[o]||(buildAccessors(i,a),n[o]=!0)}return utils$1.isArray(e)?e.forEach(s):s(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),utils$1.freezeMethods(AxiosHeaders);const AxiosHeaders$1=AxiosHeaders;function transformData(t,e){const r=this||defaults$4,n=e||r,i=AxiosHeaders$1.from(n.headers);let s=n.data;return utils$1.forEach(t,function(o){s=o.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function isCancel(t){return!!(t&&t.__CANCEL__)}function CanceledError(t,e,r){AxiosError.call(this,t==null?"canceled":t,AxiosError.ERR_CANCELED,e,r),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new AxiosError("Request failed with status code "+r.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}const cookies=platform.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];utils$1.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),utils$1.isString(n)&&a.push("path="+n),utils$1.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function combineURLs(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function buildFullPath(t,e){return t&&!isAbsoluteURL(e)?combineURLs(t,e):e}const isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function i(s){let a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){const o=utils$1.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function parseProtocol(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function speedometer(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,a;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=n[s];a||(a=c),r[i]=l,n[i]=c;let h=s,d=0;for(;h!==i;)d+=r[h++],h=h%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-a<e)return;const g=u&&c-u;return g?Math.round(d*1e3/g):void 0}}function progressEventReducer(t,e){let r=0;const n=speedometer(50,250);return i=>{const s=i.loaded,a=i.lengthComputable?i.total:void 0,o=s-r,l=n(o),c=s<=a;r=s;const u={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:i};u[e?"download":"upload"]=!0,t(u)}}const isXHRAdapterSupported=typeof XMLHttpRequest!="undefined",xhrAdapter=isXHRAdapterSupported&&function(t){return new Promise(function(r,n){let i=t.data;const s=AxiosHeaders$1.from(t.headers).normalize();let{responseType:a,withXSRFToken:o}=t,l;function c(){t.cancelToken&&t.cancelToken.unsubscribe(l),t.signal&&t.signal.removeEventListener("abort",l)}let u;if(utils$1.isFormData(i)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((u=s.getContentType())!==!1){const[m,...v]=u?u.split(";").map(A=>A.trim()).filter(Boolean):[];s.setContentType([m||"multipart/form-data",...v].join("; "))}}let h=new XMLHttpRequest;if(t.auth){const m=t.auth.username||"",v=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(m+":"+v))}const d=buildFullPath(t.baseURL,t.url);h.open(t.method.toUpperCase(),buildURL(d,t.params,t.paramsSerializer),!0),h.timeout=t.timeout;function g(){if(!h)return;const m=AxiosHeaders$1.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),A={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:m,config:t,request:h};settle(function(T){r(T),c()},function(T){n(T),c()},A),h=null}if("onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(g)},h.onabort=function(){h&&(n(new AxiosError("Request aborted",AxiosError.ECONNABORTED,t,h)),h=null)},h.onerror=function(){n(new AxiosError("Network Error",AxiosError.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let v=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const A=t.transitional||transitionalDefaults;t.timeoutErrorMessage&&(v=t.timeoutErrorMessage),n(new AxiosError(v,A.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,t,h)),h=null},platform.hasStandardBrowserEnv&&(o&&utils$1.isFunction(o)&&(o=o(t)),o||o!==!1&&isURLSameOrigin(d))){const m=t.xsrfHeaderName&&t.xsrfCookieName&&cookies.read(t.xsrfCookieName);m&&s.set(t.xsrfHeaderName,m)}i===void 0&&s.setContentType(null),"setRequestHeader"in h&&utils$1.forEach(s.toJSON(),function(v,A){h.setRequestHeader(A,v)}),utils$1.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),a&&a!=="json"&&(h.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&h.addEventListener("progress",progressEventReducer(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",progressEventReducer(t.onUploadProgress)),(t.cancelToken||t.signal)&&(l=m=>{h&&(n(!m||m.type?new CanceledError(null,t,h):m),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(l),t.signal&&(t.signal.aborted?l():t.signal.addEventListener("abort",l)));const p=parseProtocol(d);if(p&&platform.protocols.indexOf(p)===-1){n(new AxiosError("Unsupported protocol "+p+":",AxiosError.ERR_BAD_REQUEST,t));return}h.send(i||null)})},knownAdapters={http:httpAdapter,xhr:xhrAdapter};utils$1.forEach(knownAdapters,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});const renderReason=t=>`- ${t}`,isResolvedHandle=t=>utils$1.isFunction(t)||t===null||t===!1,adapters={getAdapter:t=>{t=utils$1.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s<e;s++){r=t[s];let a;if(n=r,!isResolvedHandle(r)&&(n=knownAdapters[(a=String(r)).toLowerCase()],n===void 0))throw new AxiosError(`Unknown adapter '${a}'`);if(n)break;i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(([o,l])=>`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since :
@@ -0,0 +1,3 @@
1
+ export * from '../../package/index'
2
+ import FileViewer3 from '../../package/index'
3
+ export default FileViewer3
@@ -59,4 +59,4 @@ use chrome, FireFox or Internet Explorer 11`)}var n=e("safe-buffer"),t=e("random
59
59
  * @author Louis-Dominique Dubeau
60
60
  * @license MIT
61
61
  * @copyright Louis-Dominique Dubeau
62
- */function d(o){return o>=65&&o<=90||o===95||o>=97&&o<=122||o>=192&&o<=214||o>=216&&o<=246||o>=248&&o<=767||o>=880&&o<=893||o>=895&&o<=8191||o>=8204&&o<=8205||o>=8304&&o<=8591||o>=11264&&o<=12271||o>=12289&&o<=55295||o>=63744&&o<=64975||o>=65008&&o<=65533||o>=65536&&o<=983039}Object.defineProperty(_,"__esModule",{value:!0}),_.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",_.NC_NAME_CHAR="-"+_.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",_.NC_NAME_START_CHAR_RE=new RegExp("^["+_.NC_NAME_START_CHAR+"]$","u"),_.NC_NAME_CHAR_RE=new RegExp("^["+_.NC_NAME_CHAR+"]$","u"),_.NC_NAME_RE=new RegExp("^["+_.NC_NAME_START_CHAR+"]["+_.NC_NAME_CHAR+"]*$","u"),_.isNCNameStartChar=d,_.isNCNameChar=function(o){return d(o)||o===45||o===46||o>=48&&o<=57||o===183||o>=768&&o<=879||o>=8255&&o<=8256}},{}]},{},[15])(15)})})(jr);var vn=jr.exports,wn=yn(vn);const ir=self;ir.onmessage=W=>Jt(this,null,function*(){const{data:{type:Z,payload:{sheet:e,workbook:S}}}=W;switch(Z){case"parseWorkbook":yield _n(S);break;case"parseSheet":xn(e);break}}),ir.onerror=W=>{console.error(W)};const _n=W=>Jt(this,null,function*(){var Z,e;Le.workbook=yield new wn.Workbook().xlsx.load(W),kn(),Sn((e=(Z=Le.workbook)==null?void 0:Z.model)==null?void 0:e.themes)}),xn=W=>{const Z=Le.workbook,e=Le.sheets;if(Z!=null&&Z.getWorksheet&&e.length){const S=Z.getWorksheet(W);if(!S)return;const _=yr.create(S).toObject();ir.postMessage({type:"parseSheet",payload:{sheetData:_}})}},kn=()=>{const W=Le.workbook;return W!=null&&W.worksheets&&(Le.sheets=W.worksheets.filter(Z=>Z.rowCount).map(Z=>({id:Z.id,name:Z.name})),ir.postMessage({type:"sheets",payload:{sheets:Le.sheets}})),[]},Sn=W=>{Array.isArray(W)?W.forEach(Ir):W&&Object.values(W).forEach(Ir)},Ir=W=>{const Z=he(W),S=ae(Z,_=>_.tagName==="a:clrScheme")[0];if(S){const _=S.children,d={};for(let o=0;o<_.length;o++){const a=_[o];if(!a)continue;const n=a.children[0];if(!n)continue;let t;n.tagName==="a:sysClr"?t=n.attributes.lastClr:t=n.attributes.val,d[a.tagName.substring(2)]=t||"000000"}Le.themeColors=d}}})();
62
+ */function d(o){return o>=65&&o<=90||o===95||o>=97&&o<=122||o>=192&&o<=214||o>=216&&o<=246||o>=248&&o<=767||o>=880&&o<=893||o>=895&&o<=8191||o>=8204&&o<=8205||o>=8304&&o<=8591||o>=11264&&o<=12271||o>=12289&&o<=55295||o>=63744&&o<=64975||o>=65008&&o<=65533||o>=65536&&o<=983039}Object.defineProperty(_,"__esModule",{value:!0}),_.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",_.NC_NAME_CHAR="-"+_.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",_.NC_NAME_START_CHAR_RE=new RegExp("^["+_.NC_NAME_START_CHAR+"]$","u"),_.NC_NAME_CHAR_RE=new RegExp("^["+_.NC_NAME_CHAR+"]$","u"),_.NC_NAME_RE=new RegExp("^["+_.NC_NAME_START_CHAR+"]["+_.NC_NAME_CHAR+"]*$","u"),_.isNCNameStartChar=d,_.isNCNameChar=function(o){return d(o)||o===45||o===46||o>=48&&o<=57||o===183||o>=768&&o<=879||o>=8255&&o<=8256}},{}]},{},[15])(15)})})(jr);var vn=jr.exports,wn=yn(vn);const ir=self;ir.onmessage=W=>Jt(this,null,function*(){const{data:{type:Z,payload:{sheet:e,workbook:S}}}=W;switch(Z){case"parseWorkbook":yield _n(S);break;case"parseSheet":xn(e);break}}),ir.onerror=W=>{console.error(W)};const _n=W=>Jt(this,null,function*(){var Z,e;Le.workbook=yield new wn.Workbook().xlsx.load(W,{ignoreNodes:["dataValidations"]}),kn(),Sn((e=(Z=Le.workbook)==null?void 0:Z.model)==null?void 0:e.themes)}),xn=W=>{const Z=Le.workbook,e=Le.sheets;if(Z!=null&&Z.getWorksheet&&e.length){const S=Z.getWorksheet(W);if(!S)return;const _=yr.create(S).toObject();ir.postMessage({type:"parseSheet",payload:{sheetData:_}})}},kn=()=>{const W=Le.workbook;return W!=null&&W.worksheets&&(Le.sheets=W.worksheets.filter(Z=>Z.rowCount).map(Z=>({id:Z.id,name:Z.name})),ir.postMessage({type:"sheets",payload:{sheets:Le.sheets}})),[]},Sn=W=>{Array.isArray(W)?W.forEach(Ir):W&&Object.values(W).forEach(Ir)},Ir=W=>{const Z=he(W),S=ae(Z,_=>_.tagName==="a:clrScheme")[0];if(S){const _=S.children,d={};for(let o=0;o<_.length;o++){const a=_[o];if(!a)continue;const n=a.children[0];if(!n)continue;let t;n.tagName==="a:sysClr"?t=n.attributes.lastClr:t=n.attributes.val,d[a.tagName.substring(2)]=t||"000000"}Le.themeColors=d}}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flyfish-group/file-viewer3",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "description": "基于Vue3+TypeScript+Vite实现的文件在线预览组件,此组件开源,请打赏任意金额即可获取仓库地址",
6
6
  "keywords": [
@@ -1,3 +0,0 @@
1
- type ListenCallback = (file?: File, url?: string) => void;
2
- export declare function listenForFile(callback: ListenCallback): void;
3
- export {};
package/dist/main.d.ts DELETED
File without changes
@@ -1,30 +0,0 @@
1
- import type { App } from 'vue';
2
- /**
3
- * 声明vue包装
4
- */
5
- export interface AppWrapper {
6
- $el: Node;
7
- unmount(): void;
8
- }
9
- /**
10
- * 声明别名
11
- */
12
- export type Rendered = App | AppWrapper;
13
- /**
14
- * 文件引用,支持三种
15
- */
16
- export type FileRef = File | Blob | ArrayBuffer;
17
- /**
18
- * 文件处理逻辑,用于声明文件处理器
19
- * @param buffer 二进制缓存
20
- * @param target 目标dom
21
- * @param type 目标类型
22
- */
23
- export type FileHandler = (buffer: ArrayBuffer, target: HTMLDivElement, type?: string) => Promise<Rendered>;
24
- /**
25
- * 文件处理器组合
26
- */
27
- export interface FileHandlerComposite {
28
- accepts: Array<string>;
29
- handler: FileHandler;
30
- }
@@ -1,5 +0,0 @@
1
- type ReadResult = string | ArrayBuffer | undefined | null;
2
- export declare function readBuffer(file: File): Promise<ReadResult>;
3
- export declare function readDataURL(buffer: ArrayBuffer): Promise<string>;
4
- export declare function readText(buffer: ArrayBuffer): Promise<string>;
5
- export {};
@@ -1,12 +0,0 @@
1
- type WorkerProvider = () => Worker;
2
- export interface WorkerRef {
3
- worker: Worker | null;
4
- defaults(provider: WorkerProvider): Worker;
5
- }
6
- export default class WorkerRefImpl implements WorkerRef {
7
- worker: Worker | null;
8
- constructor(worker: Worker | null);
9
- defaults(provider: WorkerProvider): Worker;
10
- }
11
- export declare function refWorker(name: string, module?: boolean): WorkerRef;
12
- export {};
@@ -1,18 +0,0 @@
1
- import type { FileRef } from '../../common/type';
2
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
- file?: FileRef | undefined;
4
- url?: string | undefined;
5
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
- file?: FileRef | undefined;
7
- url?: string | undefined;
8
- }>>>, {}, {}>;
9
- export default _default;
10
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
- type __VLS_TypePropsToRuntimeProps<T> = {
12
- [K in keyof T]-?: {} extends Pick<T, K> ? {
13
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
14
- } : {
15
- type: import('vue').PropType<T[K]>;
16
- required: true;
17
- };
18
- };
@@ -1,2 +0,0 @@
1
- import FileViewer from './FileViewer.vue';
2
- export default FileViewer;
@@ -1,2 +0,0 @@
1
- export declare function getExtend(name: string): string;
2
- export declare function render(buffer: ArrayBuffer, type: string, target: HTMLDivElement): Promise<import("../../common/type").Rendered | undefined>;
@@ -1,12 +0,0 @@
1
- import FileViewer from './components/FileViewer';
2
- import type { App } from 'vue';
3
- /**
4
- * 安装器
5
- */
6
- declare class Installer {
7
- private installed;
8
- install(app: App): void;
9
- }
10
- declare const _default: Installer;
11
- export default _default;
12
- export { FileViewer };
@@ -1 +0,0 @@
1
- export * from './worker';
@@ -1,24 +0,0 @@
1
- declare type EventHandler = (payload: any) => void;
2
- declare interface WorkerContext {
3
- emit(type: string, payload: any): void;
4
- }
5
- /**
6
- * 使用worker
7
- * 添加内部监听器自省
8
- * 缺省消息格式
9
- * {
10
- * type: '消息类型',
11
- * payload: {消息体},
12
- * }
13
- */
14
- export declare const useWorker: (factory: () => undefined | Worker) => {
15
- loading: import("vue").Ref<boolean>;
16
- worker: WorkerContext;
17
- onWorkerMessage: (hook: Function) => number;
18
- onWorkerError: (hook: Function) => number;
19
- onWorkerEvent: (type: string, hook: EventHandler) => void;
20
- mapEvents: (mappings: string[] | {
21
- [key: string]: string;
22
- }) => any;
23
- };
24
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * 渲染mp4
3
- */
4
- export default function (buffer: ArrayBuffer, target: HTMLDivElement): Promise<void>;
@@ -1,15 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
- image: string;
3
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
- image: string;
5
- }>>>, {}, {}>;
6
- export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToRuntimeProps<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * 图片渲染
3
- */
4
- export default function renderImage(buffer: ArrayBuffer, target: HTMLDivElement): Promise<import("vue").App<Element>>;
@@ -1,15 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
- data: string;
3
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
- data: string;
5
- }>>>, {}, {}>;
6
- export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToRuntimeProps<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * 渲染mp4
3
- */
4
- export default function (buffer: ArrayBuffer, target: HTMLDivElement): Promise<import("vue").App<Element>>;
@@ -1,4 +0,0 @@
1
- /**
2
- * 渲染mp4
3
- */
4
- export default function (buffer: ArrayBuffer, target: HTMLDivElement): void;
@@ -1,15 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
- data: ArrayBuffer;
3
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
- data: ArrayBuffer;
5
- }>>>, {}, {}>;
6
- export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToRuntimeProps<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
@@ -1 +0,0 @@
1
- export default function renderPdf(buffer: ArrayBuffer, target: HTMLDivElement): Promise<import("vue").App<Element>>;
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- create(): Worker;
3
- };
4
- export default _default;
@@ -1,87 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
- data: ArrayBuffer;
3
- options?: Function | undefined;
4
- }>, {
5
- options: () => {
6
- slidesScale: string;
7
- slideMode: boolean;
8
- slideType: string;
9
- revealjsPath: string;
10
- keyBoardShortCut: boolean;
11
- mediaProcess: boolean;
12
- jsZipV2: boolean;
13
- themeProcess: boolean;
14
- incSlide: {
15
- width: number;
16
- height: number;
17
- };
18
- slideModeConfig: {
19
- first: number;
20
- nav: boolean;
21
- navTxtColor: string;
22
- keyBoardShortCut: boolean;
23
- showSlideNum: boolean;
24
- showTotalSlideNum: boolean;
25
- autoSlide: boolean;
26
- randomAutoSlide: boolean;
27
- loop: boolean;
28
- background: boolean;
29
- transition: string;
30
- transitionTime: number;
31
- };
32
- revealjsConfig: {};
33
- };
34
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
35
- data: ArrayBuffer;
36
- options?: Function | undefined;
37
- }>, {
38
- options: () => {
39
- slidesScale: string;
40
- slideMode: boolean;
41
- slideType: string;
42
- revealjsPath: string;
43
- keyBoardShortCut: boolean;
44
- mediaProcess: boolean;
45
- jsZipV2: boolean;
46
- themeProcess: boolean;
47
- incSlide: {
48
- width: number;
49
- height: number;
50
- };
51
- slideModeConfig: {
52
- first: number;
53
- nav: boolean;
54
- navTxtColor: string;
55
- keyBoardShortCut: boolean;
56
- showSlideNum: boolean;
57
- showTotalSlideNum: boolean;
58
- autoSlide: boolean;
59
- randomAutoSlide: boolean;
60
- loop: boolean;
61
- background: boolean;
62
- transition: string;
63
- transitionTime: number;
64
- };
65
- revealjsConfig: {};
66
- };
67
- }>>>, {
68
- options: Function;
69
- }, {}>;
70
- export default _default;
71
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
72
- type __VLS_TypePropsToRuntimeProps<T> = {
73
- [K in keyof T]-?: {} extends Pick<T, K> ? {
74
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
75
- } : {
76
- type: import('vue').PropType<T[K]>;
77
- required: true;
78
- };
79
- };
80
- type __VLS_WithDefaults<P, D> = {
81
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
82
- default: D[K];
83
- }> : P[K];
84
- };
85
- type __VLS_Prettify<T> = {
86
- [K in keyof T]: T[K];
87
- } & {};
@@ -1,6 +0,0 @@
1
- /**
2
- * pptx渲染逻辑,使用vue组件,重构自pptxjs,感谢大神让我站在巨人的肩膀上
3
- * @param buffer 二进制数据
4
- * @param target 目标
5
- */
6
- export default function renderPptx(buffer: ArrayBuffer, target: HTMLDivElement): Promise<import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}>>;
@@ -1,39 +0,0 @@
1
- export declare const DefaultOptions: () => {
2
- slidesScale: string;
3
- slideMode: boolean;
4
- slideType: string;
5
- revealjsPath: string;
6
- keyBoardShortCut: boolean;
7
- mediaProcess: boolean;
8
- jsZipV2: boolean;
9
- themeProcess: boolean;
10
- incSlide: {
11
- width: number;
12
- height: number;
13
- };
14
- slideModeConfig: {
15
- first: number;
16
- nav: boolean;
17
- /** true,false : show or not nav buttons*/
18
- navTxtColor: string;
19
- /** color */
20
- keyBoardShortCut: boolean;
21
- /** true,false ,condition: */
22
- showSlideNum: boolean;
23
- /** true,false */
24
- showTotalSlideNum: boolean;
25
- /** true,false */
26
- autoSlide: boolean;
27
- /** false or seconds , F8 to active ,keyBoardShortCut: true */
28
- randomAutoSlide: boolean;
29
- /** true,false ,autoSlide:true */
30
- loop: boolean;
31
- /** true,false */
32
- background: boolean;
33
- /** false or color*/
34
- transition: string;
35
- /** transition type: "slid","fade","default","random" , to show transition efects :transitionTime > 0.5 */
36
- transitionTime: number; /** transition time between slides in seconds */
37
- };
38
- revealjsConfig: {};
39
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * 显示图表
3
- */
4
- export declare const displayChart: (charts: any) => void;
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- create(): Worker;
3
- };
4
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { FileHandler } from '../common/type';
2
- declare const renders: Map<string, FileHandler>;
3
- export default renders;
@@ -1,15 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
- value: string;
3
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
- value: string;
5
- }>>>, {}, {}>;
6
- export default _default;
7
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
- type __VLS_TypePropsToRuntimeProps<T> = {
9
- [K in keyof T]-?: {} extends Pick<T, K> ? {
10
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
- } : {
12
- type: import('vue').PropType<T[K]>;
13
- required: true;
14
- };
15
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * 渲染文本
3
- * @param buffer 文本二进制内容
4
- * @param target 目标
5
- */
6
- export default function renderText(buffer: ArrayBuffer, target: HTMLDivElement): Promise<import("vue").App<Element>>;
@@ -1,17 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
- data: ArrayBuffer;
3
- type: string;
4
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
5
- data: ArrayBuffer;
6
- type: string;
7
- }>>>, {}, {}>;
8
- export default _default;
9
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
- type __VLS_TypePropsToRuntimeProps<T> = {
11
- [K in keyof T]-?: {} extends Pick<T, K> ? {
12
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
- } : {
14
- type: import('vue').PropType<T[K]>;
15
- required: true;
16
- };
17
- };
@@ -1,5 +0,0 @@
1
- import type { App } from 'vue';
2
- /**
3
- * 渲染excel
4
- */
5
- export default function render(buffer: ArrayBuffer, target: HTMLDivElement, type: string): Promise<App>;
@@ -1,6 +0,0 @@
1
- export declare const context: {
2
- selection: {
3
- style: {};
4
- ranges: never[];
5
- };
6
- };
@@ -1,8 +0,0 @@
1
- export declare function cellKey(row: number, col: number): string;
2
- export declare function flatten(routes: Array<any>): Array<any>;
3
- export declare function toStyleString(style: any): string;
4
- export declare const darkMode: {
5
- value: import("vue").Ref<null>;
6
- } | {
7
- value: import("vue").Ref<boolean>;
8
- };
@@ -1,6 +0,0 @@
1
- import ExcelJsWorker from './xlsx';
2
- import SheetJsWorker from './xls';
3
- import type SheetJsModel from './xls/SheetJsModel';
4
- import type ExcelJsModel from './xlsx/ExcelJsModel';
5
- export { ExcelJsWorker, SheetJsWorker };
6
- export type { SheetJsModel, ExcelJsModel };
@@ -1,36 +0,0 @@
1
- import type { WorkSheet } from 'xlsx';
2
- import type { CellMerge, SheetModel } from '../type';
3
- export declare const defaults: {
4
- rowHeight: number;
5
- colWidth: number;
6
- };
7
- /**
8
- * sheet数据表数据
9
- */
10
- export default class SheetJsModel implements SheetModel {
11
- private readonly _ws;
12
- private static readonly defaults;
13
- private _data;
14
- private _merge;
15
- private _rowHeights;
16
- private _colWidths;
17
- private readonly range;
18
- static create(ws: WorkSheet): SheetJsModel;
19
- private constructor();
20
- private get ws();
21
- get defaults(): {
22
- rowHeight: number;
23
- colWidth: number;
24
- };
25
- get data(): string[][];
26
- get cell(): {};
27
- get merge(): CellMerge[];
28
- get columns(): never[];
29
- get rowHeights(): number | number[];
30
- get colWidths(): number | number[];
31
- private getData;
32
- private getMerge;
33
- private getRowHeights;
34
- private getColWidths;
35
- toObject(): object;
36
- }
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- create(): Worker;
3
- };
4
- export default _default;
@@ -1,39 +0,0 @@
1
- import type { Worksheet } from 'exceljs/index.d';
2
- import type { CellMerge, SheetColumn, SheetModel } from '../type';
3
- export declare const borders: Array<BorderKey>;
4
- type BorderKey = 'left' | 'right' | 'top' | 'bottom';
5
- /**
6
- * sheet数据表数据
7
- */
8
- export default class ExcelJsModel implements SheetModel {
9
- private readonly _ws;
10
- private _defaults;
11
- private _data;
12
- private _cell;
13
- private _merge;
14
- private _rowHeights;
15
- private _colWidths;
16
- private _columns;
17
- static create(ws: Worksheet): ExcelJsModel;
18
- private constructor();
19
- private get ws();
20
- get defaults(): {
21
- rowHeight: number;
22
- colWidth: number;
23
- };
24
- get data(): string[][];
25
- get cell(): any;
26
- get merge(): CellMerge[];
27
- get rowHeights(): number | number[];
28
- get colWidths(): number | number[];
29
- get columns(): SheetColumn[];
30
- private getDefaults;
31
- private getData;
32
- private getCell;
33
- private getMerge;
34
- private getRowHeights;
35
- private getColWidths;
36
- private getColumns;
37
- toObject(): object;
38
- }
39
- export {};
@@ -1,2 +0,0 @@
1
- export declare const indexedColors: string[];
2
- export declare function getTintColor(hex: string, tint: number): string;
@@ -1,7 +0,0 @@
1
- import type { Workbook } from 'exceljs/index.d';
2
- import type { SheetDefinition } from '../type';
3
- export declare const context: {
4
- themeColors: any;
5
- workbook: Workbook | undefined;
6
- sheets: SheetDefinition[];
7
- };
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- create(): Worker;
3
- };
4
- export default _default;
@@ -1,10 +0,0 @@
1
- import type { Alignment, CellErrorValue, CellValue, Row } from 'exceljs/index.d';
2
- export declare function valuesOf(row: Row): CellValue[];
3
- export declare function valueOf(value: CellValue | {
4
- error: CellErrorValue;
5
- }): string;
6
- export declare function getColor(color: any, themeColors: string[]): string | undefined;
7
- export declare function alignToClass({ horizontal, vertical }: Partial<Alignment>): string;
8
- export declare function fixMatrix(data: string[][], colLen: number): string[][];
9
- export declare function captain(str: string): string;
10
- export declare function camelCase(str: string): string;
@@ -1,2 +0,0 @@
1
- declare const ctx: Worker;
2
- export default ctx;