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