@eternalheart/vue-file-preview 1.6.13 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +4 -0
  2. package/README.zh-CN.md +4 -0
  3. package/lib/FilePreviewContent.vue.d.ts +25 -6
  4. package/lib/FilePreviewEmbed.vue.d.ts +19 -6
  5. package/lib/FilePreviewModal.vue.d.ts +19 -6
  6. package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-Cf00sjt2.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-cn1P7b2x.mjs} +1 -1
  9. package/lib/chunks/{index-BASg1cr4.mjs → index-0VXtKKev.mjs} +1018 -1018
  10. package/lib/chunks/index-0fXL30y0.mjs +333 -0
  11. package/lib/chunks/{index-C9mAajbD.mjs → index-B1AwVHWI.mjs} +191 -191
  12. package/lib/chunks/{index-BvBqDq3O.mjs → index-B77rFiau.mjs} +2023 -2023
  13. package/lib/chunks/index-BB10as16.mjs +108 -0
  14. package/lib/chunks/index-BBIn-k4u.mjs +359 -0
  15. package/lib/chunks/index-BSzaI9ea.mjs +122 -0
  16. package/lib/chunks/index-BZvy39tn.mjs +117 -0
  17. package/lib/chunks/index-BlJEM2Lb.mjs +383 -0
  18. package/lib/chunks/{index-CxKZKUJj.mjs → index-CZlnxQFA.mjs} +1385 -1385
  19. package/lib/chunks/index-ClhTPqDI.mjs +137 -0
  20. package/lib/chunks/{index-8Vpbg2kS.mjs → index-D690gnNu.mjs} +118 -117
  21. package/lib/chunks/index-D7WykPYL.mjs +51 -0
  22. package/lib/chunks/{index-DZZN3kYi.mjs → index-DBzyeU0G.mjs} +1609 -1375
  23. package/lib/chunks/{index-Dkro_8Fy.mjs → index-DKFX5ToE.mjs} +33 -33
  24. package/lib/chunks/index-DRmKaFXK.mjs +157 -0
  25. package/lib/chunks/index-DXf3wXT5.mjs +155 -0
  26. package/lib/chunks/{index-BuqPb5mP.mjs → index-Dp7QQjNH.mjs} +114 -114
  27. package/lib/chunks/index-FzI__DHC.mjs +104 -0
  28. package/lib/chunks/index-PWjCziZG.mjs +90 -0
  29. package/lib/chunks/index-bT6XWKO_.mjs +52 -0
  30. package/lib/chunks/{index-DN4Ui0Gh.mjs → index-tX9VR6Vo.mjs} +122 -122
  31. package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-D-OEDL3n.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-CVN06LUc.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-DBqcJPFK.mjs} +5 -5
  34. package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-8-0icdyL.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-a_GUszuU.mjs} +1 -1
  36. package/lib/composables/useAudioPlayer.d.ts +1 -1
  37. package/lib/composables/usePreviewEvents.d.ts +27 -0
  38. package/lib/composables/useRequest.d.ts +16 -4
  39. package/lib/composables/useThemeMode.d.ts +1 -1
  40. package/lib/composables/useTranslator.d.ts +2 -2
  41. package/lib/core/events.d.ts +69 -0
  42. package/lib/core/i18n/index.d.ts +29 -0
  43. package/lib/core/i18n/messages/en-US.d.ts +5 -0
  44. package/lib/core/i18n/messages/index.d.ts +9 -0
  45. package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
  46. package/lib/core/i18n/types.d.ts +23 -0
  47. package/lib/core/index.d.ts +34 -0
  48. package/lib/core/loaders/avifLoader.d.ts +22 -0
  49. package/lib/core/loaders/heicLoader.d.ts +21 -0
  50. package/lib/core/loaders/jp2Loader.d.ts +16 -0
  51. package/lib/core/loaders/jp2Worker.d.ts +1 -0
  52. package/lib/core/loaders/psdLoader.d.ts +14 -0
  53. package/lib/core/loaders/rawLoader.d.ts +14 -0
  54. package/lib/core/loaders/registry.d.ts +32 -0
  55. package/lib/core/loaders/tiffLoader.d.ts +28 -0
  56. package/lib/core/loaders/types.d.ts +56 -0
  57. package/lib/core/types.d.ts +89 -0
  58. package/lib/core/utils/csvParser.d.ts +31 -0
  59. package/lib/core/utils/emptyState.d.ts +28 -0
  60. package/lib/core/utils/excelDataConverter.d.ts +61 -0
  61. package/lib/core/utils/fileNormalizer.d.ts +21 -0
  62. package/lib/core/utils/fileType.d.ts +21 -0
  63. package/lib/core/utils/legacy-office/doc.d.ts +25 -0
  64. package/lib/core/utils/legacy-office/index.d.ts +8 -0
  65. package/lib/core/utils/legacy-office/ole.d.ts +8 -0
  66. package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
  67. package/lib/core/utils/legacy-office/xls.d.ts +28 -0
  68. package/lib/core/utils/mimeTypes.d.ts +29 -0
  69. package/lib/core/utils/ooxml/docx.d.ts +17 -0
  70. package/lib/core/utils/ooxml/index.d.ts +4 -0
  71. package/lib/core/utils/ooxml/pptx.d.ts +7 -0
  72. package/lib/core/utils/ooxml/xml.d.ts +15 -0
  73. package/lib/core/utils/ooxml/zip.d.ts +3 -0
  74. package/lib/core/utils/pdfWorker.d.ts +61 -0
  75. package/lib/core/utils/previewMode.d.ts +7 -0
  76. package/lib/core/utils/request.d.ts +49 -0
  77. package/lib/core/utils/subtitleParser.d.ts +44 -0
  78. package/lib/core/utils/textDecoder.d.ts +30 -0
  79. package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
  80. package/lib/core/utils/zipReader.d.ts +51 -0
  81. package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
  82. package/lib/core/workers/workerClient.d.ts +14 -0
  83. package/lib/i18n/localeKey.d.ts +1 -1
  84. package/lib/index.cjs +60 -60
  85. package/lib/index.css +1 -1
  86. package/lib/index.d.ts +11 -9
  87. package/lib/index.mjs +15 -12
  88. package/lib/renderers/Audio/index.vue.d.ts +1 -1
  89. package/lib/renderers/Cad/index.vue.d.ts +1 -1
  90. package/lib/renderers/Cad/toolbar.d.ts +2 -2
  91. package/lib/renderers/Csv/index.vue.d.ts +1 -1
  92. package/lib/renderers/Doc/index.vue.d.ts +1 -1
  93. package/lib/renderers/Docx/index.vue.d.ts +1 -1
  94. package/lib/renderers/Epub/index.vue.d.ts +1 -1
  95. package/lib/renderers/Font/index.vue.d.ts +1 -1
  96. package/lib/renderers/Image/index.vue.d.ts +2 -2
  97. package/lib/renderers/Json/index.vue.d.ts +2 -2
  98. package/lib/renderers/Markdown/index.vue.d.ts +1 -1
  99. package/lib/renderers/Mobi/index.vue.d.ts +1 -1
  100. package/lib/renderers/Msg/index.vue.d.ts +1 -1
  101. package/lib/renderers/Pdf/index.vue.d.ts +1 -1
  102. package/lib/renderers/Ppt/index.vue.d.ts +1 -1
  103. package/lib/renderers/Pptx/index.vue.d.ts +2 -2
  104. package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
  105. package/lib/renderers/Text/index.vue.d.ts +2 -2
  106. package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
  107. package/lib/renderers/Video/index.vue.d.ts +1 -1
  108. package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
  109. package/lib/renderers/Xml/index.vue.d.ts +1 -1
  110. package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
  111. package/lib/renderers/Zip/index.vue.d.ts +1 -1
  112. package/lib/renderers/base.types.d.ts +1 -1
  113. package/lib/renderers/registry.d.ts +1 -1
  114. package/lib/types.d.ts +3 -3
  115. package/package.json +2 -2
  116. package/lib/chunks/index--612Smof.mjs +0 -383
  117. package/lib/chunks/index-B21EAyWz.mjs +0 -137
  118. package/lib/chunks/index-BB0i4QqI.mjs +0 -117
  119. package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
  120. package/lib/chunks/index-BlrFFeqc.mjs +0 -330
  121. package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
  122. package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
  123. package/lib/chunks/index-CDg6vIbT.mjs +0 -51
  124. package/lib/chunks/index-CWE-hKSs.mjs +0 -90
  125. package/lib/chunks/index-CY3xzGgt.mjs +0 -108
  126. package/lib/chunks/index-D30L8tm9.mjs +0 -155
  127. package/lib/chunks/index-VdzIFJJW.mjs +0 -118
  128. package/lib/chunks/index-aoXgVLBb.mjs +0 -52
@@ -1,21 +1,21 @@
1
- import { defineComponent as ne, ref as z, onMounted as re, onUnmounted as ae, watch as se, openBlock as k, createElementBlock as H, createVNode as le, createCommentVNode as q, createElementVNode as U, toDisplayString as fe, unref as ue } from "vue";
2
- import { u as de, c as ce, k as pe } from "./index-DZZN3kYi.mjs";
1
+ import { defineComponent as re, ref as z, onMounted as se, onUnmounted as ae, watch as le, openBlock as U, createElementBlock as V, createVNode as fe, createCommentVNode as q, createElementVNode as k, toDisplayString as ue, unref as de } from "vue";
2
+ import { u as ce, a as pe, b as me, J as ve } from "./index-DBzyeU0G.mjs";
3
3
  import * as o from "three";
4
- import { OrbitControls as me } from "three/examples/jsm/controls/OrbitControls";
5
- import { DXFLoader as ve } from "three-dxf-loader";
6
- import { STLLoader as ge } from "three/examples/jsm/loaders/STLLoader";
7
- import { OBJLoader as he } from "three/examples/jsm/loaders/OBJLoader";
8
- import { GLTFLoader as we } from "three/examples/jsm/loaders/GLTFLoader";
9
- import { _ as be } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
10
- import { T as Me } from "./base.types-DaftHyg7.mjs";
11
- import { RotateCcw as ye, Box as xe, Grid3x3 as Ce, Axis3d as Le } from "lucide-vue-next";
4
+ import { OrbitControls as ge } from "three/examples/jsm/controls/OrbitControls";
5
+ import { DXFLoader as he } from "three-dxf-loader";
6
+ import { STLLoader as we } from "three/examples/jsm/loaders/STLLoader";
7
+ import { OBJLoader as be } from "three/examples/jsm/loaders/OBJLoader";
8
+ import { GLTFLoader as Me } from "three/examples/jsm/loaders/GLTFLoader";
9
+ import { _ as ye } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
10
+ import { T as xe } from "./base.types-DaftHyg7.mjs";
11
+ import { RotateCcw as Ce, Box as Le, Grid3x3 as Ee, Axis3d as Pe } from "lucide-vue-next";
12
12
  function _e(m) {
13
13
  return [
14
14
  {
15
15
  items: [
16
16
  {
17
17
  type: "button",
18
- icon: ye,
18
+ icon: Ce,
19
19
  tooltip: m.t("toolbar.reset"),
20
20
  action: () => {
21
21
  var b;
@@ -29,7 +29,7 @@ function _e(m) {
29
29
  ...m.isDxf ? [] : [
30
30
  {
31
31
  type: "button",
32
- icon: xe,
32
+ icon: Le,
33
33
  tooltip: m.wireframe ? m.t("cad.solid") : m.t("cad.wireframe"),
34
34
  active: m.wireframe,
35
35
  action: () => {
@@ -40,7 +40,7 @@ function _e(m) {
40
40
  ],
41
41
  {
42
42
  type: "button",
43
- icon: Ce,
43
+ icon: Ee,
44
44
  tooltip: m.t("cad.grid"),
45
45
  active: m.showGrid,
46
46
  action: () => {
@@ -50,7 +50,7 @@ function _e(m) {
50
50
  },
51
51
  {
52
52
  type: "button",
53
- icon: Le,
53
+ icon: Pe,
54
54
  tooltip: m.t("cad.axes"),
55
55
  active: m.showAxes,
56
56
  action: () => {
@@ -65,10 +65,10 @@ function _e(m) {
65
65
  const Ae = {
66
66
  key: 0,
67
67
  class: "vfp-absolute vfp-inset-0 vfp-bg-surface-3 vfp-z-10"
68
- }, Ee = {
68
+ }, Re = {
69
69
  key: 1,
70
70
  class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-z-10"
71
- }, Pe = { class: "vfp-renderer-loading-content" }, Re = { class: "vfp-renderer-loading-text" }, He = /* @__PURE__ */ ne({
71
+ }, Se = { class: "vfp-renderer-loading-content" }, ze = { class: "vfp-renderer-loading-text" }, ke = /* @__PURE__ */ re({
72
72
  __name: "index",
73
73
  props: {
74
74
  url: {},
@@ -77,32 +77,32 @@ const Ae = {
77
77
  baseUrl: {}
78
78
  },
79
79
  setup(m, { expose: b }) {
80
- const J = (e) => {
80
+ const X = (e) => {
81
81
  if (!e || e.startsWith("blob:") || e.startsWith("data:")) return "";
82
82
  try {
83
83
  return new URL(".", new URL(e, document.baseURI)).href;
84
84
  } catch {
85
85
  return "";
86
86
  }
87
- }, V = (e, t, i, a) => {
88
- const c = Math.max(a.x, a.y, a.z), g = Number.isFinite(c) && c > 0 ? c : 1;
87
+ }, W = (e, t, i, s) => {
88
+ const c = Math.max(s.x, s.y, s.z), g = Number.isFinite(c) && c > 0 ? c : 1;
89
89
  if (e instanceof o.OrthographicCamera) {
90
- const l = (e.right - e.left) / (e.top - e.bottom), h = (Math.max(a.y, a.x / l) || g) * 0.55;
90
+ const l = (e.right - e.left) / (e.top - e.bottom), h = (Math.max(s.y, s.x / l) || g) * 0.55;
91
91
  e.left = -h * l, e.right = h * l, e.top = h, e.bottom = -h, e.near = 0, e.far = g * 4, e.zoom = 1, e.up.set(0, 1, 0), e.position.set(i.x, i.y, i.z + g * 2), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
92
92
  return;
93
93
  }
94
- const r = e.fov * (Math.PI / 180), s = Math.abs(g / 2 / Math.tan(r / 2)) * 1.5;
95
- e.near = Math.max(g * 1e-3, 1e-4), e.far = Math.max(s * 4, i.length() * 2 + g * 4, e.near * 100), e.position.set(i.x + s, i.y + s, i.z + s), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
96
- }, v = m, { t: P } = de(), X = ce(), x = z(null), A = z(!0), E = z(null), T = z(!1), F = z(!0), G = z(!0);
97
- let n = null, f = null, d = null, u = null, C = null, p = null, w = null, R = null, D = null, S = null, M = !1, L = !0;
98
- const O = new Me(), N = (e, t, i) => {
99
- var a, c, g;
100
- return i != null && i.name ? ((a = i.name.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "" : t ? ((c = t.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "" : ((g = e.split(".").pop()) == null ? void 0 : g.toLowerCase().split("?")[0]) || "";
101
- }, Y = () => {
94
+ const n = e.fov * (Math.PI / 180), a = Math.abs(g / 2 / Math.tan(n / 2)) * 1.5;
95
+ e.near = Math.max(g * 1e-3, 1e-4), e.far = Math.max(a * 4, i.length() * 2 + g * 4, e.near * 100), e.position.set(i.x + a, i.y + a, i.z + a), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
96
+ }, v = m, { t: A } = ce(), Y = pe(), N = me(), x = z(null), P = z(!0), _ = z(null), T = z(!1), F = z(!0), G = z(!0);
97
+ let r = null, f = null, d = null, u = null, C = null, p = null, w = null, R = null, D = null, S = null, M = !1, L = !0;
98
+ const O = new xe(), H = (e, t, i) => {
99
+ var s, c, g;
100
+ return i != null && i.name ? ((s = i.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "" : t ? ((c = t.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "" : ((g = e.split(".").pop()) == null ? void 0 : g.toLowerCase().split("?")[0]) || "";
101
+ }, Z = () => {
102
102
  if (!u || !f || !C) return;
103
103
  const e = new o.Box3().setFromObject(C), t = e.getCenter(new o.Vector3()), i = e.getSize(new o.Vector3());
104
- V(f, u, t, i), L = !0;
105
- }, Z = () => {
104
+ W(f, u, t, i), L = !0;
105
+ }, $ = () => {
106
106
  T.value = !T.value, C && C.traverse((e) => {
107
107
  if (e instanceof o.Mesh) {
108
108
  const t = e.material;
@@ -111,140 +111,140 @@ const Ae = {
111
111
  }) : t.wireframe = T.value);
112
112
  }
113
113
  }), L = !0, O.notify();
114
- }, $ = () => {
115
- F.value = !F.value, p && (p.visible = F.value), L = !0, O.notify();
116
114
  }, K = () => {
115
+ F.value = !F.value, p && (p.visible = F.value), L = !0, O.notify();
116
+ }, Q = () => {
117
117
  G.value = !G.value, w && (w.visible = G.value), L = !0, O.notify();
118
- }, Q = (e) => {
119
- if (!n) return;
120
- const t = e.getSize(new o.Vector3()), i = Math.max(t.x, t.y, t.z), a = Number.isFinite(i) && i > 0 ? i : 1, c = Math.max(
118
+ }, ee = (e) => {
119
+ if (!r) return;
120
+ const t = e.getSize(new o.Vector3()), i = Math.max(t.x, t.y, t.z), s = Number.isFinite(i) && i > 0 ? i : 1, c = Math.max(
121
121
  Math.abs(e.min.x),
122
122
  Math.abs(e.max.x),
123
123
  Math.abs(e.min.y),
124
124
  Math.abs(e.max.y),
125
125
  Math.abs(e.min.z),
126
126
  Math.abs(e.max.z)
127
- ), g = Number.isFinite(c) ? c : a, r = Math.max(a, g * 1.25), s = f instanceof o.OrthographicCamera, l = s ? a * 2 : Math.max(a * 2, g * 2.5);
128
- p && (p.geometry.dispose(), p.material.dispose(), n.remove(p)), w && (w.geometry.dispose(), w.material.dispose(), n.remove(w)), p = new o.GridHelper(l, 20, 4473924, 2236962), s && (p.rotation.x = Math.PI / 2, e.getCenter(p.position), p.position.z = e.min.z - a * 1e-3), p.visible = F.value, n.add(p), w = new o.AxesHelper(r), w.visible = G.value, n.add(w);
127
+ ), g = Number.isFinite(c) ? c : s, n = Math.max(s, g * 1.25), a = f instanceof o.OrthographicCamera, l = a ? s * 2 : Math.max(s * 2, g * 2.5);
128
+ p && (p.geometry.dispose(), p.material.dispose(), r.remove(p)), w && (w.geometry.dispose(), w.material.dispose(), r.remove(w)), p = new o.GridHelper(l, 20, 4473924, 2236962), a && (p.rotation.x = Math.PI / 2, e.getCenter(p.position), p.position.z = e.min.z - s * 1e-3), p.visible = F.value, r.add(p), w = new o.AxesHelper(n), w.visible = G.value, r.add(w);
129
129
  };
130
130
  b({
131
131
  getToolbarGroups: () => _e({
132
- cadRef: { resetView: Y, toggleWireframe: Z, toggleGrid: $, toggleAxes: K },
133
- isDxf: N(v.url, v.fileName, v.file) === "dxf",
132
+ cadRef: { resetView: Z, toggleWireframe: $, toggleGrid: K, toggleAxes: Q },
133
+ isDxf: H(v.url, v.fileName, v.file) === "dxf",
134
134
  wireframe: T.value,
135
135
  showGrid: F.value,
136
136
  showAxes: G.value,
137
- t: P.value
137
+ t: A.value
138
138
  }),
139
139
  onToolbarChange: (e) => O.subscribe(e)
140
140
  });
141
- const ee = (e) => {
141
+ const te = (e) => {
142
142
  e.traverse((t) => {
143
143
  t.geometry && t.geometry.dispose(), t.material && (Array.isArray(t.material) ? t.material.forEach((i) => {
144
- W(i);
145
- }) : W(t.material));
144
+ j(i);
145
+ }) : j(t.material));
146
146
  });
147
- }, W = (e) => {
147
+ }, j = (e) => {
148
148
  e.map && e.map.dispose(), e.lightMap && e.lightMap.dispose(), e.bumpMap && e.bumpMap.dispose(), e.normalMap && e.normalMap.dispose(), e.specularMap && e.specularMap.dispose(), e.envMap && e.envMap.dispose(), e.dispose();
149
- }, j = () => {
149
+ }, I = () => {
150
150
  if (!x.value) return;
151
151
  M = !1, S = new AbortController();
152
152
  const e = x.value, t = e.clientWidth, i = e.clientHeight;
153
- n = new o.Scene(), n.background = new o.Color(1710618);
154
- const a = N(v.url, v.fileName, v.file) === "dxf", c = Math.max(t, 1) / Math.max(i, 1);
155
- f = a ? new o.OrthographicCamera(-c, c, 1, -1, 0, 1e6) : new o.PerspectiveCamera(45, c, 0.01, 1e6), f.position.set(100, 100, 100), d = new o.WebGLRenderer({ antialias: !0 }), d.setSize(t, i), d.setPixelRatio(Math.min(window.devicePixelRatio, 2)), L = !0, e.appendChild(d.domElement), u = new me(f, d.domElement), u.enableDamping = !0, u.dampingFactor = 0.05, a && (u.enableRotate = !1, u.screenSpacePanning = !0, u.mouseButtons.LEFT = o.MOUSE.PAN, u.touches.ONE = o.TOUCH.PAN, u.touches.TWO = o.TOUCH.DOLLY_PAN);
153
+ r = new o.Scene(), r.background = new o.Color(1710618);
154
+ const s = H(v.url, v.fileName, v.file) === "dxf", c = Math.max(t, 1) / Math.max(i, 1);
155
+ f = s ? new o.OrthographicCamera(-c, c, 1, -1, 0, 1e6) : new o.PerspectiveCamera(45, c, 0.01, 1e6), f.position.set(100, 100, 100), d = new o.WebGLRenderer({ antialias: !0 }), d.setSize(t, i), d.setPixelRatio(Math.min(window.devicePixelRatio, 2)), L = !0, e.appendChild(d.domElement), u = new ge(f, d.domElement), u.enableDamping = !0, u.dampingFactor = 0.05, s && (u.enableRotate = !1, u.screenSpacePanning = !0, u.mouseButtons.LEFT = o.MOUSE.PAN, u.touches.ONE = o.TOUCH.PAN, u.touches.TWO = o.TOUCH.DOLLY_PAN);
156
156
  const g = new o.AmbientLight(16777215, 0.6);
157
- n.add(g);
158
- const r = new o.DirectionalLight(16777215, 0.8);
159
- r.position.set(1, 1, 1), n.add(r);
160
- const s = new o.DirectionalLight(16777215, 0.4);
161
- s.position.set(-1, -1, -1), n.add(s), te();
157
+ r.add(g);
158
+ const n = new o.DirectionalLight(16777215, 0.8);
159
+ n.position.set(1, 1, 1), r.add(n);
160
+ const a = new o.DirectionalLight(16777215, 0.4);
161
+ a.position.set(-1, -1, -1), r.add(a), oe();
162
162
  const l = () => {
163
163
  if (M) return;
164
- D = requestAnimationFrame(l), ((u == null ? void 0 : u.update()) || L) && n && f && d && (d.render(n, f), L = !1);
164
+ D = requestAnimationFrame(l), ((u == null ? void 0 : u.update()) || L) && r && f && d && (d.render(r, f), L = !1);
165
165
  };
166
- l(), R = new ResizeObserver(oe), R.observe(e);
167
- }, te = () => {
168
- if (!n || !f || !u || M) return;
169
- const e = N(v.url, v.fileName, v.file);
166
+ l(), R = new ResizeObserver(ie), R.observe(e);
167
+ }, oe = () => {
168
+ if (N.begin(v.url), !r || !f || !u || M) return;
169
+ const e = H(v.url, v.fileName, v.file);
170
170
  let t;
171
171
  const i = new o.LoadingManager();
172
172
  if (e === "dxf")
173
- t = new ve();
173
+ t = new he();
174
174
  else if (e === "stl")
175
- t = new ge(i);
175
+ t = new we(i);
176
176
  else if (e === "obj")
177
- t = new he(i);
177
+ t = new be(i);
178
178
  else if (e === "gltf" || e === "glb")
179
- t = new we(i);
179
+ t = new Me(i);
180
180
  else {
181
- E.value = P.value("cad.parse_failed"), A.value = !1;
181
+ _.value = A.value("cad.parse_failed"), P.value = !1;
182
182
  return;
183
183
  }
184
- const a = (r, s) => {
184
+ const s = (n, a) => {
185
185
  if (M) return;
186
- if (!r) {
187
- E.value = P.value("cad.parse_failed"), A.value = !1;
186
+ if (!n) {
187
+ _.value = A.value("cad.parse_failed"), P.value = !1;
188
188
  return;
189
189
  }
190
190
  let l;
191
- if (s === "stl") {
192
- const _ = r, ie = new o.MeshPhongMaterial({
191
+ if (a === "stl") {
192
+ const E = n, ne = new o.MeshPhongMaterial({
193
193
  color: 8947848,
194
194
  flatShading: !0,
195
195
  side: o.DoubleSide
196
196
  });
197
- l = new o.Mesh(_, ie);
198
- } else if (s === "gltf" || s === "glb") {
199
- if (l = r.scene, !l) {
200
- E.value = P.value("cad.parse_failed"), A.value = !1;
197
+ l = new o.Mesh(E, ne);
198
+ } else if (a === "gltf" || a === "glb") {
199
+ if (l = n.scene, !l) {
200
+ _.value = A.value("cad.parse_failed"), P.value = !1;
201
201
  return;
202
202
  }
203
203
  } else
204
- l = r, l.traverse((_) => {
205
- _ instanceof o.Mesh && !_.material && (_.material = new o.MeshPhongMaterial({
204
+ l = n, l.traverse((E) => {
205
+ E instanceof o.Mesh && !E.material && (E.material = new o.MeshPhongMaterial({
206
206
  color: 8947848,
207
207
  side: o.DoubleSide
208
208
  }));
209
209
  });
210
210
  const h = new o.Box3().setFromObject(l);
211
211
  if (h.isEmpty()) {
212
- E.value = P.value("cad.parse_failed"), A.value = !1;
212
+ _.value = A.value("cad.parse_failed"), P.value = !1;
213
213
  return;
214
214
  }
215
- n.add(l), C = l;
215
+ r.add(l), C = l;
216
216
  const y = h.getCenter(new o.Vector3()), B = h.getSize(new o.Vector3());
217
- Q(h), V(f, u, y, B), L = !0, A.value = !1, O.notify();
218
- }, c = (r) => {
219
- M || r.name !== "AbortError" && (E.value = P.value("cad.load_failed"), A.value = !1);
217
+ ee(h), W(f, u, y, B), L = !0, P.value = !1, O.notify(), N.ready();
218
+ }, c = (n) => {
219
+ M || n.name !== "AbortError" && (_.value = A.value("cad.load_failed"), P.value = !1, N.error(n));
220
220
  };
221
- (v.file ? v.file.arrayBuffer() : X.value(v.url, { signal: S == null ? void 0 : S.signal }).then((r) => {
221
+ (v.file ? v.file.arrayBuffer() : Y.value(v.url, { signal: S == null ? void 0 : S.signal }).then((n) => {
222
222
  if (!M) {
223
- if (!r.ok) throw new pe("file.load_failed");
224
- return r.arrayBuffer();
223
+ if (!n.ok) throw new ve("file.load_failed");
224
+ return n.arrayBuffer();
225
225
  }
226
- })).then((r) => {
227
- if (!(M || !r)) {
226
+ })).then((n) => {
227
+ if (!(M || !n)) {
228
228
  if (e === "stl") {
229
- const s = t.parse(r);
230
- a(s, e);
229
+ const a = t.parse(n);
230
+ s(a, e);
231
231
  } else if (e === "obj") {
232
- const l = new TextDecoder("utf-8").decode(r), h = t.parse(l);
233
- a(h, e);
232
+ const l = new TextDecoder("utf-8").decode(n), h = t.parse(l);
233
+ s(h, e);
234
234
  } else if (e === "gltf" || e === "glb")
235
235
  t.parse(
236
- r,
237
- J(v.baseUrl || v.url),
238
- (s) => {
239
- M || a(s, e);
236
+ n,
237
+ X(v.baseUrl || v.url),
238
+ (a) => {
239
+ M || s(a, e);
240
240
  },
241
- (s) => c(s)
241
+ (a) => c(a)
242
242
  );
243
243
  else if (e === "dxf") {
244
- const l = new TextDecoder("utf-8").decode(r), h = o.BufferGeometry.prototype.setFromPoints;
244
+ const l = new TextDecoder("utf-8").decode(n), h = o.BufferGeometry.prototype.setFromPoints;
245
245
  o.BufferGeometry.prototype.setFromPoints = function(y) {
246
246
  const B = (y || []).filter(
247
- (_) => _ && _.x !== void 0 && _.y !== void 0
247
+ (E) => E && E.x !== void 0 && E.y !== void 0
248
248
  );
249
249
  return h.call(this, B);
250
250
  };
@@ -254,7 +254,7 @@ const Ae = {
254
254
  (y) => {
255
255
  if (!M) {
256
256
  const B = (y == null ? void 0 : y.entity) || y;
257
- a(B, e);
257
+ s(B, e);
258
258
  }
259
259
  },
260
260
  (y) => {
@@ -268,39 +268,39 @@ const Ae = {
268
268
  }
269
269
  }
270
270
  }
271
- }).catch((r) => {
272
- M || c(r);
271
+ }).catch((n) => {
272
+ M || c(n);
273
273
  });
274
- }, oe = () => {
274
+ }, ie = () => {
275
275
  if (!x.value || !f || !d || M) return;
276
276
  const e = x.value.clientWidth, t = x.value.clientHeight;
277
277
  e <= 0 || t <= 0 || (f instanceof o.OrthographicCamera ? (f.right = f.top * e / t, f.left = -f.right) : f.aspect = e / t, f.updateProjectionMatrix(), d.setSize(e, t), L = !0);
278
- }, I = () => {
279
- M = !0, S && S.abort(), D !== null && (cancelAnimationFrame(D), D = null), R == null || R.disconnect(), R = null, C && (ee(C), n == null || n.remove(C), C = null), p && (p.geometry.dispose(), p.material.dispose(), n == null || n.remove(p), p = null), w && (w.geometry.dispose(), w.material.dispose(), n == null || n.remove(w), w = null), u == null || u.dispose(), d == null || d.dispose(), x.value && (d != null && d.domElement) && x.value.contains(d.domElement) && x.value.removeChild(d.domElement), n = null, f = null, d = null, u = null;
278
+ }, J = () => {
279
+ M = !0, S && S.abort(), D !== null && (cancelAnimationFrame(D), D = null), R == null || R.disconnect(), R = null, C && (te(C), r == null || r.remove(C), C = null), p && (p.geometry.dispose(), p.material.dispose(), r == null || r.remove(p), p = null), w && (w.geometry.dispose(), w.material.dispose(), r == null || r.remove(w), w = null), u == null || u.dispose(), d == null || d.dispose(), x.value && (d != null && d.domElement) && x.value.contains(d.domElement) && x.value.removeChild(d.domElement), r = null, f = null, d = null, u = null;
280
280
  };
281
- return re(() => {
282
- j();
283
- }), ae(() => {
281
+ return se(() => {
284
282
  I();
285
- }), se(() => v.url, () => {
286
- I(), A.value = !0, E.value = null, x.value && j();
287
- }), (e, t) => (k(), H("div", {
283
+ }), ae(() => {
284
+ J();
285
+ }), le(() => v.url, () => {
286
+ J(), P.value = !0, _.value = null, x.value && I();
287
+ }), (e, t) => (U(), V("div", {
288
288
  ref_key: "containerRef",
289
289
  ref: x,
290
290
  class: "vfp-relative vfp-w-full vfp-h-full vfp-bg-media-bg"
291
291
  }, [
292
- E.value ? (k(), H("div", Ae, [
293
- le(be, { message: E.value }, null, 8, ["message"])
292
+ _.value ? (U(), V("div", Ae, [
293
+ fe(ye, { message: _.value }, null, 8, ["message"])
294
294
  ])) : q("", !0),
295
- A.value ? (k(), H("div", Ee, [
296
- U("div", Pe, [
297
- t[0] || (t[0] = U("div", { class: "vfp-renderer-spinner" }, null, -1)),
298
- U("p", Re, fe(ue(P)("cad.loading")), 1)
295
+ P.value ? (U(), V("div", Re, [
296
+ k("div", Se, [
297
+ t[0] || (t[0] = k("div", { class: "vfp-renderer-spinner" }, null, -1)),
298
+ k("p", ze, ue(de(A)("cad.loading")), 1)
299
299
  ])
300
300
  ])) : q("", !0)
301
301
  ], 512));
302
302
  }
303
303
  });
304
304
  export {
305
- He as default
305
+ ke as default
306
306
  };
@@ -0,0 +1,104 @@
1
+ import { defineComponent as D, ref as m, onMounted as z, watch as M, onBeforeUnmount as G, openBlock as v, createElementBlock as w, createElementVNode as g, toDisplayString as N, unref as S, createCommentVNode as b, createBlock as B, normalizeStyle as C } from "vue";
2
+ import { S as H } from "./index-CyBXARuf.mjs";
3
+ import { u as R, a as W, b as E, f as F, G as L, Y as O, Q } from "./index-DBzyeU0G.mjs";
4
+ import { _ as V } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
+ const Y = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, q = {
6
+ key: 0,
7
+ class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
8
+ }, A = { class: "vfp-renderer-loading-content" }, I = { class: "vfp-renderer-loading-text" }, K = /* @__PURE__ */ D({
9
+ __name: "index",
10
+ props: {
11
+ url: {},
12
+ fileName: {}
13
+ },
14
+ setup(y, { expose: T }) {
15
+ const a = y, { t: d } = R(), k = W(), h = E(), r = m(!0), n = m(null), l = m(null);
16
+ let o = null, u = null, i = null, c = { width: 0, height: 0 };
17
+ const p = () => {
18
+ if (!l.value) return { width: 800, height: 600 };
19
+ const e = l.value.clientWidth, t = l.value.clientHeight, s = e > 100 ? e : 800, f = t > 100 ? t : 600;
20
+ return { width: s, height: f };
21
+ }, _ = () => {
22
+ if (!l.value || !o) return;
23
+ l.value.innerHTML = "";
24
+ const { width: e, height: t } = p(), s = e < 640;
25
+ new H(l.value, {
26
+ mode: "read",
27
+ showToolbar: !1,
28
+ showContextmenu: !1,
29
+ showGrid: !0,
30
+ row: {
31
+ len: 100,
32
+ height: 25
33
+ },
34
+ col: {
35
+ len: 26,
36
+ width: s ? 80 : 100,
37
+ indexWidth: s ? 40 : 60,
38
+ minWidth: s ? 40 : 60
39
+ },
40
+ view: {
41
+ height: () => t,
42
+ width: () => e
43
+ }
44
+ }).loadData(o);
45
+ }, x = async () => {
46
+ if (h.begin(a.url), !!l.value) {
47
+ r.value = !0, n.value = null;
48
+ try {
49
+ const e = await F(a.url, { fetcher: k.value }), t = L(e, { delimiter: O(a.fileName) });
50
+ o = Q(t.header, t.rows, a.fileName), _(), r.value = !1, h.ready();
51
+ } catch (e) {
52
+ console.error(d.value("csv.parse_failed") + ":", e), n.value = d.value("csv.load_failed"), r.value = !1, h.error(e);
53
+ }
54
+ }
55
+ };
56
+ return z(() => {
57
+ if (!l.value) return;
58
+ let e = !0;
59
+ u = new ResizeObserver(() => {
60
+ if (e) {
61
+ e = !1, c = p();
62
+ return;
63
+ }
64
+ const t = p(), s = Math.abs(c.width - t.width), f = Math.abs(c.height - t.height);
65
+ s < 10 && f < 10 || (c = t, i !== null && clearTimeout(i), i = window.setTimeout(() => {
66
+ o && _();
67
+ }, 500));
68
+ }), u.observe(l.value), setTimeout(() => {
69
+ requestAnimationFrame(() => x());
70
+ }, 100);
71
+ }), M(
72
+ () => a.url,
73
+ () => {
74
+ x();
75
+ }
76
+ ), G(() => {
77
+ u && u.disconnect(), i !== null && clearTimeout(i), o = null, l.value && (l.value.innerHTML = "");
78
+ }), T({
79
+ getToolbarGroups: () => []
80
+ }), (e, t) => (v(), w("div", Y, [
81
+ r.value ? (v(), w("div", q, [
82
+ g("div", A, [
83
+ t[0] || (t[0] = g("div", { class: "vfp-renderer-spinner" }, null, -1)),
84
+ g("p", I, N(S(d)("csv.loading")), 1)
85
+ ])
86
+ ])) : b("", !0),
87
+ n.value && !r.value ? (v(), B(V, {
88
+ key: 1,
89
+ message: n.value,
90
+ class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
91
+ }, null, 8, ["message"])) : b("", !0),
92
+ n.value ? b("", !0) : (v(), w("div", {
93
+ key: 2,
94
+ ref_key: "containerRef",
95
+ ref: l,
96
+ class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
97
+ style: C({ opacity: r.value ? 0 : 1 })
98
+ }, null, 4))
99
+ ]));
100
+ }
101
+ });
102
+ export {
103
+ K as default
104
+ };
@@ -0,0 +1,90 @@
1
+ import { defineComponent as M, ref as u, watch as D, computed as H, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as m, unref as g, createBlock as P, normalizeStyle as B, Fragment as k, renderList as E } from "vue";
2
+ import { u as F, a as G, b as N, f as X } from "./index-DBzyeU0G.mjs";
3
+ import { u as j } from "./useShikiHighlight-a_GUszuU.mjs";
4
+ import { _ as q } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
+ const A = {
6
+ key: 0,
7
+ class: "vfp-renderer-loading"
8
+ }, C = { class: "vfp-renderer-loading-content" }, I = { class: "vfp-renderer-loading-text" }, O = {
9
+ key: 2,
10
+ class: "vfp-w-full vfp-h-full vfp-overflow-auto",
11
+ style: { background: "var(--fp-code-bg)" }
12
+ }, R = { class: "vfp-py-6 vfp-px-4 vfp-text-fg-primary vfp-font-mono vfp-text-sm vfp-whitespace-pre-wrap vfp-break-words" }, V = {
13
+ key: 3,
14
+ class: "vfp-w-full vfp-h-full vfp-overflow-auto",
15
+ style: { background: "var(--fp-code-bg)" }
16
+ }, J = { class: "vfp-code-gutter" }, K = ["innerHTML"], re = /* @__PURE__ */ M({
17
+ __name: "index",
18
+ props: {
19
+ url: {},
20
+ fileName: {}
21
+ },
22
+ setup(x, { expose: b }) {
23
+ const f = x, { t: _ } = F(), S = G(), d = N(), i = u(""), v = u(!0), c = u(null), T = u("xml"), { lineHtmls: h } = j(i, T), $ = (e) => {
24
+ const r = " ", o = /(>)(<)(\/*)/g, s = e.replace(o, `$1
25
+ $2$3`);
26
+ let n = 0;
27
+ return s.split(`
28
+ `).map((p) => {
29
+ let w = 0;
30
+ /^<\/\w/.test(p) ? n = Math.max(n - 1, 0) : /^<\w[^>]*[^/]>.*$/.test(p) && !/<.+<\/.+>$/.test(p) && (w = 1);
31
+ const L = r.repeat(n) + p;
32
+ return n += w, L;
33
+ }).join(`
34
+ `);
35
+ }, z = (e) => {
36
+ try {
37
+ const o = new DOMParser().parseFromString(e, "application/xml");
38
+ if (o.querySelector("parsererror")) return e;
39
+ const n = new XMLSerializer().serializeToString(o);
40
+ return $(n);
41
+ } catch {
42
+ return e;
43
+ }
44
+ };
45
+ D(() => f.url, async () => {
46
+ d.begin(f.url), v.value = !0, c.value = null;
47
+ try {
48
+ const e = await X(f.url, { fetcher: S.value });
49
+ i.value = z(e), d.ready();
50
+ } catch (e) {
51
+ console.error(e), c.value = _.value("xml.load_failed"), d.error(e);
52
+ } finally {
53
+ v.value = !1;
54
+ }
55
+ }, { immediate: !0 });
56
+ const y = H(() => i.value.split(`
57
+ `));
58
+ return b({
59
+ getToolbarGroups: () => []
60
+ }), (e, r) => v.value ? (l(), a("div", A, [
61
+ t("div", C, [
62
+ r[0] || (r[0] = t("div", { class: "vfp-renderer-spinner" }, null, -1)),
63
+ t("span", I, m(g(_)("common.loading")), 1)
64
+ ])
65
+ ])) : c.value ? (l(), P(q, {
66
+ key: 1,
67
+ message: c.value
68
+ }, null, 8, ["message"])) : g(h).length === 0 ? (l(), a("div", O, [
69
+ t("pre", R, m(i.value), 1)
70
+ ])) : (l(), a("div", V, [
71
+ t("div", {
72
+ class: "vfp-code-block with-line-numbers vfp-w-full",
73
+ style: B({ gridTemplateRows: `repeat(${y.value.length}, auto) minmax(1.5rem, 1fr)` })
74
+ }, [
75
+ (l(!0), a(k, null, E(y.value, (o, s) => (l(), a(k, { key: s }, [
76
+ t("span", J, m(s + 1), 1),
77
+ t("span", {
78
+ class: "vfp-code-line",
79
+ innerHTML: g(h)[s] ?? ""
80
+ }, null, 8, K)
81
+ ], 64))), 128)),
82
+ r[1] || (r[1] = t("span", { class: "vfp-code-gutter-filler" }, null, -1)),
83
+ r[2] || (r[2] = t("span", { class: "vfp-code-line-filler" }, null, -1))
84
+ ], 4)
85
+ ]));
86
+ }
87
+ });
88
+ export {
89
+ re as default
90
+ };
@@ -0,0 +1,52 @@
1
+ import { defineComponent as m, ref as i, watch as h, openBlock as f, createElementBlock as u, createElementVNode as o, toDisplayString as g, unref as y, createBlock as w } from "vue";
2
+ import { u as x, a as k, b, J as T, q as B } from "./index-DBzyeU0G.mjs";
3
+ import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
+ const D = {
5
+ key: 0,
6
+ class: "vfp-renderer-loading"
7
+ }, G = { class: "vfp-renderer-loading-content" }, H = { class: "vfp-renderer-loading-text" }, L = {
8
+ key: 2,
9
+ class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
10
+ }, M = { class: "vfp-flex vfp-flex-col vfp-items-center" }, N = { class: "vfp-legacy-doc-paper" }, q = ["innerHTML"], S = /* @__PURE__ */ m({
11
+ __name: "index",
12
+ props: {
13
+ url: {}
14
+ },
15
+ setup(d, { expose: p }) {
16
+ const a = d, { t } = x(), v = k(), l = b(), n = i(""), c = i(!0), r = i(null), _ = async () => {
17
+ l.begin(a.url), c.value = !0, r.value = null, n.value = "";
18
+ try {
19
+ const e = await v.value(a.url);
20
+ if (!e.ok) throw new T("file.load_failed");
21
+ const s = await e.arrayBuffer();
22
+ n.value = await B(s), l.ready();
23
+ } catch (e) {
24
+ console.error(t.value("doc.parse_failed") + ":", e), r.value = t.value("doc.parse_failed"), l.error(e);
25
+ } finally {
26
+ c.value = !1;
27
+ }
28
+ };
29
+ return h(() => a.url, (e) => {
30
+ e && _();
31
+ }, { immediate: !0 }), p({
32
+ getToolbarGroups: () => []
33
+ }), (e, s) => c.value ? (f(), u("div", D, [
34
+ o("div", G, [
35
+ s[0] || (s[0] = o("div", { class: "vfp-renderer-spinner" }, null, -1)),
36
+ o("span", H, g(y(t)("common.loading")), 1)
37
+ ])
38
+ ])) : r.value ? (f(), w(E, {
39
+ key: 1,
40
+ message: r.value
41
+ }, null, 8, ["message"])) : (f(), u("div", L, [
42
+ o("div", M, [
43
+ o("div", N, [
44
+ o("div", { innerHTML: n.value }, null, 8, q)
45
+ ])
46
+ ])
47
+ ]));
48
+ }
49
+ });
50
+ export {
51
+ S as default
52
+ };