@files-preview-app/preview-file 1.2.2 → 1.2.3

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.
package/dist/vue.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
- var DOMPurify6 = require('dompurify');
6
+ var DOMPurify2 = require('dompurify');
7
7
  var docx = require('docx-preview');
8
8
  var fflate = require('fflate');
9
9
  var XLSX = require('xlsx');
@@ -36,7 +36,7 @@ function _interopNamespace(e) {
36
36
  return Object.freeze(n);
37
37
  }
38
38
 
39
- var DOMPurify6__default = /*#__PURE__*/_interopDefault(DOMPurify6);
39
+ var DOMPurify2__default = /*#__PURE__*/_interopDefault(DOMPurify2);
40
40
  var docx__namespace = /*#__PURE__*/_interopNamespace(docx);
41
41
  var XLSX__namespace = /*#__PURE__*/_interopNamespace(XLSX);
42
42
  var hljs__default = /*#__PURE__*/_interopDefault(hljs);
@@ -370,7 +370,7 @@ async function sourceToArrayBuffer(source, signal) {
370
370
  return { buffer, metadata };
371
371
  }
372
372
  function sanitizeSVG(svg) {
373
- return DOMPurify6__default.default.sanitize(svg, {
373
+ return DOMPurify2__default.default.sanitize(svg, {
374
374
  USE_PROFILES: { svg: true, svgFilters: true }
375
375
  });
376
376
  }
@@ -430,6 +430,9 @@ var ICON_THUMBNAILS = `<svg width="24" height="24" viewBox="0 0 24 24" fill="non
430
430
  var ICON_CLOSE = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`;
431
431
  var ICON_FULLSCREEN = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg>`;
432
432
  var ICON_COPY = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`;
433
+ var ICON_FAST_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 19 22 12 13 5 13 19"></polygon><polygon points="2 19 11 12 2 5 2 19"></polygon></svg>`;
434
+ var ICON_REWIND = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="11 19 2 12 11 5 11 19"></polygon><polygon points="22 19 13 12 22 5 22 19"></polygon></svg>`;
435
+ var ICON_SPEED = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`;
433
436
  var ICON_MAP = {
434
437
  "zoom-in": ICON_ZOOM_IN,
435
438
  "zoom-out": ICON_ZOOM_OUT,
@@ -450,7 +453,12 @@ var ICON_MAP = {
450
453
  "page-prev": ICON_PAGE_PREV,
451
454
  "page-next": ICON_PAGE_NEXT,
452
455
  "chevron-left": ICON_PAGE_PREV,
453
- "chevron-right": ICON_PAGE_NEXT
456
+ "chevron-right": ICON_PAGE_NEXT,
457
+ "fast-forward": ICON_FAST_FORWARD,
458
+ "forward-10": ICON_FAST_FORWARD,
459
+ "rewind": ICON_REWIND,
460
+ "replay-10": ICON_REWIND,
461
+ "speed": ICON_SPEED
454
462
  };
455
463
  var ToolbarController = class {
456
464
  el;
@@ -1418,6 +1426,16 @@ var MediaPlugin = class {
1418
1426
  }
1419
1427
  if (instance.play) {
1420
1428
  actions.push(
1429
+ {
1430
+ id: "replay-10",
1431
+ icon: "replay-10",
1432
+ label: "Rewind 10s",
1433
+ type: "button",
1434
+ group: "actions",
1435
+ execute: () => {
1436
+ instance.rewind?.(10);
1437
+ }
1438
+ },
1421
1439
  {
1422
1440
  id: "play",
1423
1441
  icon: "play",
@@ -1437,6 +1455,26 @@ var MediaPlugin = class {
1437
1455
  execute: () => {
1438
1456
  instance.pause?.();
1439
1457
  }
1458
+ },
1459
+ {
1460
+ id: "forward-10",
1461
+ icon: "forward-10",
1462
+ label: "Fast Forward 10s",
1463
+ type: "button",
1464
+ group: "actions",
1465
+ execute: () => {
1466
+ instance.fastForward?.(10);
1467
+ }
1468
+ },
1469
+ {
1470
+ id: "speed",
1471
+ icon: "speed",
1472
+ label: "Playback Speed",
1473
+ type: "button",
1474
+ group: "actions",
1475
+ execute: () => {
1476
+ instance.cycleSpeed?.();
1477
+ }
1440
1478
  }
1441
1479
  );
1442
1480
  }
@@ -1559,6 +1597,28 @@ var MediaPlugin = class {
1559
1597
  play: mediaElement ? () => mediaElement?.play() : void 0,
1560
1598
  pause: mediaElement ? () => mediaElement?.pause() : void 0,
1561
1599
  isPlaying: mediaElement ? () => !mediaElement?.paused : void 0,
1600
+ fastForward: mediaElement ? (seconds = 10) => {
1601
+ if (mediaElement) {
1602
+ mediaElement.currentTime = Math.min(mediaElement.duration || Infinity, mediaElement.currentTime + seconds);
1603
+ }
1604
+ } : void 0,
1605
+ rewind: mediaElement ? (seconds = 10) => {
1606
+ if (mediaElement) {
1607
+ mediaElement.currentTime = Math.max(0, mediaElement.currentTime - seconds);
1608
+ }
1609
+ } : void 0,
1610
+ cycleSpeed: mediaElement ? () => {
1611
+ if (mediaElement) {
1612
+ const speeds = [1, 1.25, 1.5, 2, 0.5];
1613
+ const curIndex = speeds.indexOf(mediaElement.playbackRate);
1614
+ const nextIndex = curIndex === -1 ? 0 : (curIndex + 1) % speeds.length;
1615
+ mediaElement.playbackRate = speeds[nextIndex];
1616
+ }
1617
+ } : void 0,
1618
+ setPlaybackRate: mediaElement ? (rate) => {
1619
+ if (mediaElement) mediaElement.playbackRate = rate;
1620
+ } : void 0,
1621
+ getPlaybackRate: mediaElement ? () => mediaElement?.playbackRate ?? 1 : void 0,
1562
1622
  download: () => {
1563
1623
  const a = document.createElement("a");
1564
1624
  a.href = url;
@@ -1640,16 +1700,35 @@ var DocxPlugin = class {
1640
1700
  wrapper.style.transformOrigin = "top center";
1641
1701
  wrapper.style.transition = "transform 0.2s ease";
1642
1702
  wrapper.style.padding = "24px 16px";
1643
- wrapper.style.maxWidth = "900px";
1703
+ wrapper.style.maxWidth = "950px";
1644
1704
  wrapper.style.margin = "0 auto";
1645
1705
  wrapper.style.boxSizing = "border-box";
1646
1706
  ctx.container.style.overflow = "auto";
1647
1707
  ctx.container.style.backgroundColor = "#f1f5f9";
1648
1708
  ctx.container.appendChild(wrapper);
1709
+ const styleOverride = document.createElement("style");
1710
+ styleOverride.textContent = `
1711
+ .fp-docx-wrapper .docx-wrapper {
1712
+ background: transparent !important;
1713
+ padding: 0 !important;
1714
+ display: flex !important;
1715
+ flex-direction: column !important;
1716
+ align-items: center !important;
1717
+ box-sizing: border-box !important;
1718
+ }
1719
+ .fp-docx-wrapper section.docx {
1720
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
1721
+ border-radius: 4px !important;
1722
+ margin-bottom: 24px !important;
1723
+ background-color: #ffffff !important;
1724
+ }
1725
+ `;
1726
+ ctx.container.appendChild(styleOverride);
1649
1727
  let scale = 1;
1650
1728
  let renderedSuccessfully = false;
1729
+ const createdBlobUrls = [];
1651
1730
  try {
1652
- await docx__namespace.renderAsync(ctx.buffer, wrapper, ctx.container, {
1731
+ await docx__namespace.renderAsync(ctx.buffer, wrapper, wrapper, {
1653
1732
  inWrapper: true,
1654
1733
  ignoreWidth: false,
1655
1734
  ignoreHeight: false,
@@ -1658,19 +1737,25 @@ var DocxPlugin = class {
1658
1737
  breakPages: true,
1659
1738
  experimental: true
1660
1739
  });
1740
+ if (!ctx.container.contains(wrapper)) {
1741
+ ctx.container.appendChild(wrapper);
1742
+ }
1661
1743
  if (wrapper.children.length > 0 && (wrapper.textContent?.trim().length ?? 0) > 0) {
1662
1744
  renderedSuccessfully = true;
1663
1745
  }
1664
1746
  } catch (err) {
1665
- console.warn("[DocxPlugin] docx-preview failed, triggering native XML fallback:", err);
1747
+ console.warn("[DocxPlugin] docx-preview failed, triggering native fallback:", err);
1666
1748
  }
1667
1749
  if (!renderedSuccessfully) {
1668
1750
  try {
1669
1751
  wrapper.innerHTML = "";
1670
- this.renderXmlFallback(ctx, wrapper);
1752
+ this.renderXmlFallback(ctx, wrapper, createdBlobUrls);
1753
+ if (!ctx.container.contains(wrapper)) {
1754
+ ctx.container.appendChild(wrapper);
1755
+ }
1671
1756
  renderedSuccessfully = true;
1672
1757
  } catch (fallbackErr) {
1673
- console.error("[DocxPlugin] XML fallback failed:", fallbackErr);
1758
+ console.error("[DocxPlugin] Native fallback failed:", fallbackErr);
1674
1759
  wrapper.innerHTML = `
1675
1760
  <div style="text-align:center; padding: 48px; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);">
1676
1761
  <div style="font-size:48px; margin-bottom: 16px;">\u{1F4C4}</div>
@@ -1678,10 +1763,17 @@ var DocxPlugin = class {
1678
1763
  <p style="color: #64748b; margin: 0;">Could not parse document content</p>
1679
1764
  </div>
1680
1765
  `;
1766
+ if (!ctx.container.contains(wrapper)) {
1767
+ ctx.container.appendChild(wrapper);
1768
+ }
1681
1769
  }
1682
1770
  }
1683
1771
  const cleanup = () => {
1772
+ for (const url of createdBlobUrls) {
1773
+ URL.revokeObjectURL(url);
1774
+ }
1684
1775
  wrapper.remove();
1776
+ styleOverride.remove();
1685
1777
  ctx.container.innerHTML = "";
1686
1778
  };
1687
1779
  ctx.signal.addEventListener("abort", cleanup);
@@ -1718,13 +1810,50 @@ var DocxPlugin = class {
1718
1810
  }
1719
1811
  };
1720
1812
  }
1721
- renderXmlFallback(ctx, wrapper) {
1813
+ renderXmlFallback(ctx, wrapper, createdBlobUrls) {
1814
+ const magic = new Uint8Array(ctx.buffer.slice(0, 8));
1815
+ if (magic[0] === 208 && magic[1] === 207 && magic[2] === 17 && magic[3] === 224) {
1816
+ this.renderBinaryDocFallback(ctx, wrapper);
1817
+ return;
1818
+ }
1722
1819
  const unzipped = fflate.unzipSync(new Uint8Array(ctx.buffer));
1723
- const docXmlEntry = unzipped["word/document.xml"];
1820
+ const docKey = Object.keys(unzipped).find((k) => k.replace(/^[./\\]+/, "").toLowerCase() === "word/document.xml");
1821
+ const docXmlEntry = docKey ? unzipped[docKey] : void 0;
1724
1822
  if (!docXmlEntry) throw new Error("Missing word/document.xml in DOCX package");
1725
1823
  const xmlStr = fflate.strFromU8(docXmlEntry);
1726
1824
  const parser = new DOMParser();
1727
1825
  const doc = parser.parseFromString(xmlStr, "application/xml");
1826
+ const imageMap = {};
1827
+ const relsKey = Object.keys(unzipped).find((k) => k.replace(/^[./\\]+/, "").toLowerCase() === "word/_rels/document.xml.rels");
1828
+ if (relsKey && unzipped[relsKey]) {
1829
+ try {
1830
+ const relsXml = fflate.strFromU8(unzipped[relsKey]);
1831
+ const relsDoc = parser.parseFromString(relsXml, "application/xml");
1832
+ const relEls = Array.from(relsDoc.getElementsByTagName("Relationship"));
1833
+ for (const rel of relEls) {
1834
+ const rId = rel.getAttribute("Id");
1835
+ const target = rel.getAttribute("Target");
1836
+ if (rId && target) {
1837
+ const cleanTarget = target.replace(/^\.\.\//, "").replace(/^\//, "");
1838
+ const fullTargetKey = Object.keys(unzipped).find((k) => {
1839
+ const norm = k.replace(/^[./\\]+/, "").toLowerCase();
1840
+ return norm === ("word/" + cleanTarget).toLowerCase() || norm === cleanTarget.toLowerCase();
1841
+ });
1842
+ if (fullTargetKey && unzipped[fullTargetKey]) {
1843
+ const bytes = unzipped[fullTargetKey];
1844
+ const ext = cleanTarget.split(".").pop()?.toLowerCase() || "png";
1845
+ const mime = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : ext === "gif" ? "image/gif" : ext === "svg" ? "image/svg+xml" : "image/png";
1846
+ const blob = new Blob([bytes], { type: mime });
1847
+ const blobUrl = URL.createObjectURL(blob);
1848
+ imageMap[rId] = blobUrl;
1849
+ createdBlobUrls.push(blobUrl);
1850
+ }
1851
+ }
1852
+ }
1853
+ } catch (relsErr) {
1854
+ console.warn("[DocxPlugin] Error parsing relationships:", relsErr);
1855
+ }
1856
+ }
1728
1857
  const card = document.createElement("div");
1729
1858
  card.className = "fp-docx-page-card";
1730
1859
  card.style.backgroundColor = "#ffffff";
@@ -1742,7 +1871,7 @@ var DocxPlugin = class {
1742
1871
  const pStyle = child.getElementsByTagNameNS("*", "pStyle")[0];
1743
1872
  const styleVal = pStyle?.getAttribute("w:val") || pStyle?.getAttribute("val") || "";
1744
1873
  const numPr = child.getElementsByTagNameNS("*", "numPr")[0];
1745
- const textContent = this.extractParagraphHtml(child);
1874
+ const textContent = this.extractParagraphHtml(child, imageMap);
1746
1875
  if (!textContent.trim()) {
1747
1876
  html += '<div style="height: 10px;"></div>';
1748
1877
  continue;
@@ -1768,7 +1897,7 @@ var DocxPlugin = class {
1768
1897
  html += `<tr style="${rIdx === 0 ? "background-color: #f8fafc; font-weight: 600;" : ""}">`;
1769
1898
  const cells = Array.from(tr.getElementsByTagNameNS("*", "tc"));
1770
1899
  cells.forEach((tc) => {
1771
- const cellText = this.extractParagraphHtml(tc);
1900
+ const cellText = this.extractParagraphHtml(tc, imageMap);
1772
1901
  html += `<td style="border: 1px solid #cbd5e1; padding: 8px 12px; font-size: 13px;">${cellText || "&nbsp;"}</td>`;
1773
1902
  });
1774
1903
  html += "</tr>";
@@ -1776,34 +1905,63 @@ var DocxPlugin = class {
1776
1905
  html += "</table>";
1777
1906
  }
1778
1907
  }
1779
- card.innerHTML = DOMPurify6__default.default.sanitize(html, {
1780
- ADD_TAGS: ["h1", "h2", "h3", "h4", "p", "table", "tr", "td", "span", "b", "i", "u", "img", "div"],
1908
+ card.innerHTML = DOMPurify2__default.default.sanitize(html, {
1909
+ ADD_TAGS: ["h1", "h2", "h3", "h4", "p", "table", "tr", "td", "span", "b", "i", "u", "s", "strike", "img", "div", "br"],
1781
1910
  ADD_ATTR: ["style", "src", "alt", "colspan", "rowspan"]
1782
1911
  });
1783
1912
  wrapper.appendChild(card);
1784
1913
  }
1785
- extractParagraphHtml(pElement) {
1914
+ extractParagraphHtml(pElement, imageMap = {}) {
1786
1915
  let result = "";
1916
+ const drawings = Array.from(pElement.getElementsByTagNameNS("*", "drawing"));
1917
+ for (const drawing of drawings) {
1918
+ const blip = drawing.getElementsByTagNameNS("*", "blip")[0];
1919
+ const rId = blip?.getAttribute("r:embed") || blip?.getAttribute("r:id");
1920
+ if (rId && imageMap[rId]) {
1921
+ result += `<div style="text-align:center; margin: 12px 0;"><img src="${imageMap[rId]}" style="max-width: 100%; height: auto; border-radius: 4px;" /></div>`;
1922
+ }
1923
+ }
1787
1924
  const runs = Array.from(pElement.getElementsByTagNameNS("*", "r"));
1788
- if (runs.length === 0) {
1789
- return DOMPurify6__default.default.sanitize(pElement.textContent || "");
1925
+ if (runs.length === 0 && !result) {
1926
+ return DOMPurify2__default.default.sanitize(pElement.textContent || "");
1790
1927
  }
1791
1928
  for (const r of runs) {
1929
+ const blip = r.getElementsByTagNameNS("*", "blip")[0] || r.getElementsByTagNameNS("*", "imagedata")[0];
1930
+ const rId = blip?.getAttribute("r:embed") || blip?.getAttribute("r:id");
1931
+ if (rId && imageMap[rId]) {
1932
+ result += `<img src="${imageMap[rId]}" style="max-width: 100%; height: auto; display: inline-block; margin: 4px;" />`;
1933
+ }
1934
+ const brs = r.getElementsByTagNameNS("*", "br");
1935
+ for (let i = 0; i < brs.length; i++) {
1936
+ result += "<br/>";
1937
+ }
1938
+ const tabs = r.getElementsByTagNameNS("*", "tab");
1939
+ if (tabs.length > 0) {
1940
+ result += "&emsp;";
1941
+ }
1792
1942
  const rPr = r.getElementsByTagNameNS("*", "rPr")[0];
1793
1943
  const isBold = !!rPr?.getElementsByTagNameNS("*", "b")[0];
1794
1944
  const isItalic = !!rPr?.getElementsByTagNameNS("*", "i")[0];
1795
1945
  const isUnderline = !!rPr?.getElementsByTagNameNS("*", "u")[0];
1946
+ const isStrike = !!rPr?.getElementsByTagNameNS("*", "strike")[0];
1796
1947
  const colorNode = rPr?.getElementsByTagNameNS("*", "color")[0];
1797
1948
  const colorVal = colorNode?.getAttribute("w:val") || colorNode?.getAttribute("val");
1949
+ const szNode = rPr?.getElementsByTagNameNS("*", "sz")[0];
1950
+ const szVal = szNode?.getAttribute("w:val") || szNode?.getAttribute("val");
1798
1951
  const texts = Array.from(r.getElementsByTagNameNS("*", "t"));
1799
1952
  let text = texts.map((t) => t.textContent || "").join("");
1800
1953
  if (!text) continue;
1801
- text = DOMPurify6__default.default.sanitize(text);
1954
+ text = DOMPurify2__default.default.sanitize(text);
1802
1955
  let styles = "";
1803
1956
  if (isBold) styles += "font-weight: bold; ";
1804
1957
  if (isItalic) styles += "font-style: italic; ";
1805
1958
  if (isUnderline) styles += "text-decoration: underline; ";
1959
+ if (isStrike) styles += "text-decoration: line-through; ";
1806
1960
  if (colorVal && colorVal !== "auto") styles += `color: #${colorVal}; `;
1961
+ if (szVal) {
1962
+ const pt = parseInt(szVal, 10) / 2;
1963
+ if (!isNaN(pt) && pt > 0) styles += `font-size: ${pt}pt; `;
1964
+ }
1807
1965
  if (styles) {
1808
1966
  result += `<span style="${styles}">${text}</span>`;
1809
1967
  } else {
@@ -1812,6 +1970,52 @@ var DocxPlugin = class {
1812
1970
  }
1813
1971
  return result;
1814
1972
  }
1973
+ renderBinaryDocFallback(ctx, wrapper) {
1974
+ const card = document.createElement("div");
1975
+ card.className = "fp-docx-page-card";
1976
+ card.style.backgroundColor = "#ffffff";
1977
+ card.style.borderRadius = "6px";
1978
+ card.style.boxShadow = "0 4px 24px rgba(0,0,0,0.08)";
1979
+ card.style.padding = "48px 56px";
1980
+ card.style.fontFamily = 'Calibri, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
1981
+ card.style.color = "#1e293b";
1982
+ card.style.lineHeight = "1.6";
1983
+ try {
1984
+ const cfbf = new CfbfReader(ctx.buffer);
1985
+ const wordDocStream = cfbf.readStream("WordDocument");
1986
+ if (wordDocStream && wordDocStream.length >= 512) {
1987
+ const text2 = this.extractReadableStrings(wordDocStream);
1988
+ card.innerHTML = `<div style="white-space: pre-wrap;">${DOMPurify2__default.default.sanitize(text2)}</div>`;
1989
+ wrapper.appendChild(card);
1990
+ return;
1991
+ }
1992
+ } catch {
1993
+ }
1994
+ const text = this.extractReadableStrings(new Uint8Array(ctx.buffer));
1995
+ card.innerHTML = `<div style="white-space: pre-wrap;">${DOMPurify2__default.default.sanitize(text)}</div>`;
1996
+ wrapper.appendChild(card);
1997
+ }
1998
+ extractReadableStrings(bytes) {
1999
+ let result = "";
2000
+ let current = "";
2001
+ for (let i = 0; i < bytes.length; i++) {
2002
+ const b = bytes[i];
2003
+ if (b >= 32 && b <= 126 || b === 10 || b === 13 || b === 9) {
2004
+ current += String.fromCharCode(b);
2005
+ } else if (b === 0 && i + 1 < bytes.length && bytes[i + 1] >= 32 && bytes[i + 1] <= 126) {
2006
+ continue;
2007
+ } else {
2008
+ if (current.trim().length > 3) {
2009
+ result += current.trim() + "\n\n";
2010
+ }
2011
+ current = "";
2012
+ }
2013
+ }
2014
+ if (current.trim().length > 3) {
2015
+ result += current.trim();
2016
+ }
2017
+ return result;
2018
+ }
1815
2019
  };
1816
2020
  function docxPlugin() {
1817
2021
  return new DocxPlugin();
@@ -2623,7 +2827,7 @@ var MarkdownPlugin = class {
2623
2827
  gfm: true,
2624
2828
  breaks: true
2625
2829
  });
2626
- const cleanHtml = DOMPurify6__default.default.sanitize(rawHtml, {
2830
+ const cleanHtml = DOMPurify2__default.default.sanitize(rawHtml, {
2627
2831
  USE_PROFILES: { html: true }
2628
2832
  });
2629
2833
  const wrapper = document.createElement("div");
@@ -3338,7 +3542,7 @@ var HtmlPreviewPlugin = class {
3338
3542
  }
3339
3543
  async render(ctx) {
3340
3544
  const rawHtml = new TextDecoder("utf-8").decode(ctx.buffer);
3341
- const sanitized = DOMPurify6__default.default.sanitize(rawHtml, {
3545
+ const sanitized = DOMPurify2__default.default.sanitize(rawHtml, {
3342
3546
  WHOLE_DOCUMENT: true,
3343
3547
  ADD_TAGS: ["style", "link"],
3344
3548
  ADD_ATTR: ["target", "rel"]
@@ -3581,7 +3785,7 @@ var OpenDocumentPlugin = class {
3581
3785
  wrapper.style.padding = "48px";
3582
3786
  wrapper.style.minHeight = "100%";
3583
3787
  const bodyHtml = this.renderOdfBody(contentDoc, styleMap, imageUrls);
3584
- wrapper.innerHTML = DOMPurify6__default.default.sanitize(bodyHtml, {
3788
+ wrapper.innerHTML = DOMPurify2__default.default.sanitize(bodyHtml, {
3585
3789
  ADD_TAGS: ["math", "semantics", "mrow", "mi", "mo", "mn", "msup", "msub"],
3586
3790
  ADD_ATTR: ["style", "colspan", "rowspan"]
3587
3791
  });
@@ -4101,24 +4305,24 @@ var DocPlugin = class {
4101
4305
  html += "</ul>";
4102
4306
  inList = false;
4103
4307
  }
4104
- html += `<h2 style="font-size: 18px; font-weight: 700; color: #1e3a8a; margin: 20px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify6__default.default.sanitize(line)}</h2>`;
4308
+ html += `<h2 style="font-size: 18px; font-weight: 700; color: #1e3a8a; margin: 20px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify2__default.default.sanitize(line)}</h2>`;
4105
4309
  } else if (line.startsWith("\u2022") || line.startsWith("-") || line.startsWith("*")) {
4106
4310
  if (!inList) {
4107
4311
  html += '<ul style="margin: 8px 0; padding-left: 24px;">';
4108
4312
  inList = true;
4109
4313
  }
4110
4314
  const bulletText = line.replace(/^[•\-\*]\s*/, "");
4111
- html += `<li style="margin: 4px 0; line-height: 1.6;">${DOMPurify6__default.default.sanitize(bulletText)}</li>`;
4315
+ html += `<li style="margin: 4px 0; line-height: 1.6;">${DOMPurify2__default.default.sanitize(bulletText)}</li>`;
4112
4316
  } else {
4113
4317
  if (inList) {
4114
4318
  html += "</ul>";
4115
4319
  inList = false;
4116
4320
  }
4117
- html += `<p style="line-height: 1.7; margin: 10px 0; font-size: 14px; text-align: justify;">${DOMPurify6__default.default.sanitize(line)}</p>`;
4321
+ html += `<p style="line-height: 1.7; margin: 10px 0; font-size: 14px; text-align: justify;">${DOMPurify2__default.default.sanitize(line)}</p>`;
4118
4322
  }
4119
4323
  }
4120
4324
  if (inList) html += "</ul>";
4121
- return html || `<p style="color: #64748b; font-style: italic;">(No readable text found in ${DOMPurify6__default.default.sanitize(filename)})</p>`;
4325
+ return html || `<p style="color: #64748b; font-style: italic;">(No readable text found in ${DOMPurify2__default.default.sanitize(filename)})</p>`;
4122
4326
  }
4123
4327
  };
4124
4328
  function docPlugin() {
@@ -4273,10 +4477,10 @@ var PptPlugin = class {
4273
4477
  </div>
4274
4478
  <div style="text-align: center; width: 100%;">
4275
4479
  <h1 style="font-size: ${idx === 1 ? "36px" : "28px"}; color: #1e3a8a; margin: 0 0 24px; font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 700;">
4276
- ${DOMPurify6__default.default.sanitize(s.title || `Slide ${idx}`)}
4480
+ ${DOMPurify2__default.default.sanitize(s.title || `Slide ${idx}`)}
4277
4481
  </h1>
4278
4482
  <div style="display: flex; flex-direction: column; gap: 12px; max-width: 80%; margin: 0 auto; text-align: ${idx === 1 ? "center" : "left"};">
4279
- ${s.texts.map((t) => `<div style="font-size: 18px; color: #334155; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">${DOMPurify6__default.default.sanitize(t)}</div>`).join("")}
4483
+ ${s.texts.map((t) => `<div style="font-size: 18px; color: #334155; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">${DOMPurify2__default.default.sanitize(t)}</div>`).join("")}
4280
4484
  </div>
4281
4485
  </div>
4282
4486
  `;