@pixerate/editor 0.24.0 → 0.26.0

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 (162) hide show
  1. package/README.md +101 -1
  2. package/THIRD_PARTY_NOTICES.md +40 -0
  3. package/dist/agent/index.cjs +175 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +168 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +8588 -1857
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1847 -9
  16. package/dist/canvas/index.d.ts +1847 -9
  17. package/dist/canvas/index.js +8577 -1846
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  22. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  23. package/dist/chunk-BVP3TSLH.cjs +69 -0
  24. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  25. package/dist/{chunk-OLZJXL4R.cjs → chunk-CS6NZWWA.cjs} +59 -25
  26. package/dist/chunk-CS6NZWWA.cjs.map +1 -0
  27. package/dist/{chunk-MCSJFWAO.cjs → chunk-EWCOFSCQ.cjs} +685 -100
  28. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  29. package/dist/chunk-HDYMLS3X.cjs +409 -0
  30. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  31. package/dist/chunk-HRMEDT2L.js +1406 -0
  32. package/dist/chunk-HRMEDT2L.js.map +1 -0
  33. package/dist/{chunk-D27YFC46.cjs → chunk-IFHKKVXH.cjs} +382 -63
  34. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  35. package/dist/{chunk-PGNZKFQS.js → chunk-JOIREKL7.js} +137 -58
  36. package/dist/chunk-JOIREKL7.js.map +1 -0
  37. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  38. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  39. package/dist/{chunk-3LV6RRPH.js → chunk-MHEPLBFB.js} +2 -2
  40. package/dist/chunk-MR2764X2.js +831 -0
  41. package/dist/chunk-MR2764X2.js.map +1 -0
  42. package/dist/{chunk-XNORY7M6.cjs → chunk-NFVBT3UZ.cjs} +166 -87
  43. package/dist/chunk-NFVBT3UZ.cjs.map +1 -0
  44. package/dist/chunk-NQF32I6Z.cjs +6478 -0
  45. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  46. package/dist/chunk-O5RYH2PG.js +69 -0
  47. package/dist/chunk-O5RYH2PG.js.map +1 -0
  48. package/dist/{chunk-ITBSKI26.js → chunk-Q2OHWD2A.js} +1064 -360
  49. package/dist/chunk-Q2OHWD2A.js.map +1 -0
  50. package/dist/{chunk-FODNLX5N.js → chunk-QJSOZFCZ.js} +38 -4
  51. package/dist/chunk-QJSOZFCZ.js.map +1 -0
  52. package/dist/{chunk-SML64VJG.cjs → chunk-RRREAOVM.cjs} +4 -4
  53. package/dist/{chunk-SML64VJG.cjs.map → chunk-RRREAOVM.cjs.map} +1 -1
  54. package/dist/{chunk-5S3Z4PPF.js → chunk-SWE3NPOU.js} +347 -28
  55. package/dist/chunk-SWE3NPOU.js.map +1 -0
  56. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  57. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  58. package/dist/chunk-UBCFIABU.js +409 -0
  59. package/dist/chunk-UBCFIABU.js.map +1 -0
  60. package/dist/chunk-X7HXL2SB.js +6478 -0
  61. package/dist/chunk-X7HXL2SB.js.map +1 -0
  62. package/dist/{chunk-SBCZ6RN5.cjs → chunk-YOMYSFJU.cjs} +1163 -459
  63. package/dist/chunk-YOMYSFJU.cjs.map +1 -0
  64. package/dist/{chunk-3CN2WD3X.js → chunk-ZRNHGAQT.js} +661 -76
  65. package/dist/chunk-ZRNHGAQT.js.map +1 -0
  66. package/dist/commands/index.cjs +425 -4
  67. package/dist/commands/index.cjs.map +1 -1
  68. package/dist/commands/index.d.cts +39 -77
  69. package/dist/commands/index.d.ts +39 -77
  70. package/dist/commands/index.js +424 -3
  71. package/dist/commands/index.js.map +1 -1
  72. package/dist/compare/index.cjs +3 -3
  73. package/dist/compare/index.d.cts +1 -1
  74. package/dist/compare/index.d.ts +1 -1
  75. package/dist/compare/index.js +2 -2
  76. package/dist/controller-CxXGOEmy.d.cts +2038 -0
  77. package/dist/controller-CxXGOEmy.d.ts +2038 -0
  78. package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
  79. package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
  80. package/dist/export/index.cjs +36 -0
  81. package/dist/export/index.cjs.map +1 -0
  82. package/dist/export/index.d.cts +243 -0
  83. package/dist/export/index.d.ts +243 -0
  84. package/dist/export/index.js +36 -0
  85. package/dist/export/index.js.map +1 -0
  86. package/dist/extensions/index.cjs +101 -6
  87. package/dist/extensions/index.cjs.map +1 -1
  88. package/dist/extensions/index.d.cts +18 -5
  89. package/dist/extensions/index.d.ts +18 -5
  90. package/dist/extensions/index.js +101 -6
  91. package/dist/generation/index.cjs +1013 -69
  92. package/dist/generation/index.cjs.map +1 -1
  93. package/dist/generation/index.d.cts +474 -13
  94. package/dist/generation/index.d.ts +474 -13
  95. package/dist/generation/index.js +976 -32
  96. package/dist/generation/index.js.map +1 -1
  97. package/dist/image-editor/index.cjs +3385 -1275
  98. package/dist/image-editor/index.cjs.map +1 -1
  99. package/dist/image-editor/index.d.cts +693 -128
  100. package/dist/image-editor/index.d.ts +693 -128
  101. package/dist/image-editor/index.js +3325 -1215
  102. package/dist/image-editor/index.js.map +1 -1
  103. package/dist/{index-fJrlkJCd.d.ts → index-B273Zllk.d.ts} +500 -7
  104. package/dist/{index-BhJBSm2d.d.cts → index-jcJwmBYt.d.cts} +500 -7
  105. package/dist/index.cjs +1603 -45
  106. package/dist/index.cjs.map +1 -1
  107. package/dist/index.d.cts +154 -27
  108. package/dist/index.d.ts +154 -27
  109. package/dist/index.js +1584 -26
  110. package/dist/index.js.map +1 -1
  111. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  112. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  113. package/dist/model-C1zApQM8.d.cts +219 -0
  114. package/dist/model-C1zApQM8.d.ts +219 -0
  115. package/dist/persistence/index.d.cts +3 -120
  116. package/dist/persistence/index.d.ts +3 -120
  117. package/dist/registry-CED5C0lA.d.cts +204 -0
  118. package/dist/registry-CED5C0lA.d.ts +204 -0
  119. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
  120. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
  121. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  122. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  123. package/dist/serializers/index.cjs +12 -4
  124. package/dist/serializers/index.cjs.map +1 -1
  125. package/dist/serializers/index.d.cts +41 -13
  126. package/dist/serializers/index.d.ts +41 -13
  127. package/dist/serializers/index.js +12 -4
  128. package/dist/spreadsheet/index.cjs +157 -3
  129. package/dist/spreadsheet/index.cjs.map +1 -1
  130. package/dist/spreadsheet/index.d.cts +534 -11
  131. package/dist/spreadsheet/index.d.ts +534 -11
  132. package/dist/spreadsheet/index.js +157 -3
  133. package/dist/storage-BpFfspHm.d.cts +120 -0
  134. package/dist/storage-BpFfspHm.d.ts +120 -0
  135. package/dist/tokens/index.cjs +115 -0
  136. package/dist/tokens/index.cjs.map +1 -0
  137. package/dist/tokens/index.d.cts +212 -0
  138. package/dist/tokens/index.d.ts +212 -0
  139. package/dist/tokens/index.js +115 -0
  140. package/dist/tokens/index.js.map +1 -0
  141. package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
  142. package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
  143. package/package.json +15 -1
  144. package/dist/chunk-3CN2WD3X.js.map +0 -1
  145. package/dist/chunk-5S3Z4PPF.js.map +0 -1
  146. package/dist/chunk-D27YFC46.cjs.map +0 -1
  147. package/dist/chunk-FODNLX5N.js.map +0 -1
  148. package/dist/chunk-ITBSKI26.js.map +0 -1
  149. package/dist/chunk-MA2F5KHF.cjs +0 -3223
  150. package/dist/chunk-MA2F5KHF.cjs.map +0 -1
  151. package/dist/chunk-MCSJFWAO.cjs.map +0 -1
  152. package/dist/chunk-OLZJXL4R.cjs.map +0 -1
  153. package/dist/chunk-PGNZKFQS.js.map +0 -1
  154. package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
  155. package/dist/chunk-U5KWZU4X.js +0 -3223
  156. package/dist/chunk-U5KWZU4X.js.map +0 -1
  157. package/dist/chunk-XNORY7M6.cjs.map +0 -1
  158. package/dist/controller-BhLLAoi8.d.cts +0 -1000
  159. package/dist/controller-BhLLAoi8.d.ts +0 -1000
  160. package/dist/types-DX4Mh4SL.d.cts +0 -217
  161. package/dist/types-DX4Mh4SL.d.ts +0 -217
  162. /package/dist/{chunk-3LV6RRPH.js.map → chunk-MHEPLBFB.js.map} +0 -0
@@ -1,6 +1,13 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
2
2
 
3
- var _chunkOLZJXL4Rcjs = require('./chunk-OLZJXL4R.cjs');
3
+ var _chunkCS6NZWWAcjs = require('./chunk-CS6NZWWA.cjs');
4
+
5
+
6
+
7
+
8
+
9
+
10
+ var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
4
11
 
5
12
 
6
13
 
@@ -16,20 +23,29 @@ var _chunkMKA3AHLVcjs = require('./chunk-MKA3AHLV.cjs');
16
23
 
17
24
 
18
25
 
19
- var _chunkSML64VJGcjs = require('./chunk-SML64VJG.cjs');
26
+ var _chunkRRREAOVMcjs = require('./chunk-RRREAOVM.cjs');
27
+
28
+
29
+
30
+
31
+
32
+
20
33
 
21
34
 
35
+ var _chunkHDYMLS3Xcjs = require('./chunk-HDYMLS3X.cjs');
22
36
 
23
37
 
24
38
 
25
- var _chunkXNORY7M6cjs = require('./chunk-XNORY7M6.cjs');
26
39
 
27
40
 
41
+ var _chunkNFVBT3UZcjs = require('./chunk-NFVBT3UZ.cjs');
28
42
 
29
43
 
30
44
 
31
45
 
32
- var _chunkD27YFC46cjs = require('./chunk-D27YFC46.cjs');
46
+
47
+
48
+ var _chunkIFHKKVXHcjs = require('./chunk-IFHKKVXH.cjs');
33
49
 
34
50
  // src/extensions/gradient-text.ts
35
51
  var _core = require('@tiptap/core');
@@ -601,10 +617,47 @@ var Mention = BaseMention.extend({
601
617
  if (!attributes.color) return {};
602
618
  return { "data-color": attributes.color };
603
619
  }
620
+ },
621
+ // Role of an asset mention (`reference`, `style`, `start_frame`, …). The
622
+ // node attribute is `assetRole` so entities that already carry a `role`
623
+ // (e.g. a user's job title) passed as suggestion props do not set it.
624
+ assetRole: {
625
+ default: null,
626
+ parseHTML: (element) => {
627
+ const role = element.getAttribute("data-role");
628
+ return role && MENTION_ROLE_PATTERN.test(role) ? role : null;
629
+ },
630
+ renderHTML: (attributes) => {
631
+ if (!attributes.assetRole) return {};
632
+ return { "data-role": attributes.assetRole };
633
+ }
604
634
  }
605
635
  };
606
636
  }
607
637
  });
638
+ var MENTION_ROLE_PATTERN = /^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9])?$/;
639
+ function getMentionNodes(editor) {
640
+ const result = [];
641
+ editor.state.doc.descendants((node, pos) => {
642
+ if (_optionalChain([node, 'access', _36 => _36.type, 'optionalAccess', _37 => _37.name]) !== "mention") return;
643
+ result.push({
644
+ pos,
645
+ id: _nullishCoalesce(node.attrs.id, () => ( "")),
646
+ label: _nullishCoalesce(node.attrs.label, () => ( "")),
647
+ ...node.attrs.type ? { type: node.attrs.type } : {},
648
+ ...node.attrs.assetRole ? { role: node.attrs.assetRole } : {}
649
+ });
650
+ });
651
+ return result;
652
+ }
653
+ function setMentionRoleAt(editor, pos, role) {
654
+ const node = _optionalChain([editor, 'optionalAccess', _38 => _38.state, 'optionalAccess', _39 => _39.doc, 'optionalAccess', _40 => _40.nodeAt, 'call', _41 => _41(pos)]);
655
+ if (!node || node.type.name !== "mention") return false;
656
+ if (role !== null && !MENTION_ROLE_PATTERN.test(role)) return false;
657
+ const tr = editor.state.tr.setNodeMarkup(pos, void 0, { ...node.attrs, assetRole: role });
658
+ editor.view.dispatch(tr);
659
+ return true;
660
+ }
608
661
  function createMentionExtension(options = {}) {
609
662
  const { HTMLAttributes = {}, ...rest } = options;
610
663
  return Mention.configure({
@@ -1626,13 +1679,13 @@ var Markdown = _core.Extension.create({
1626
1679
  });
1627
1680
 
1628
1681
  // src/extensions/markdown.ts
1629
- var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess', _36 => _36[name]]) || _optionalChain([mod, 'optionalAccess', _37 => _37.default, 'optionalAccess', _38 => _38[name]]) || _optionalChain([mod, 'optionalAccess', _39 => _39.default, 'optionalAccess', _40 => _40.default]) || _optionalChain([mod, 'optionalAccess', _41 => _41.default]) || mod;
1682
+ var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess', _42 => _42[name]]) || _optionalChain([mod, 'optionalAccess', _43 => _43.default, 'optionalAccess', _44 => _44[name]]) || _optionalChain([mod, 'optionalAccess', _45 => _45.default, 'optionalAccess', _46 => _46.default]) || _optionalChain([mod, 'optionalAccess', _47 => _47.default]) || mod;
1630
1683
  var Markdown2 = resolveExt(Markdown, "Markdown");
1631
1684
 
1632
1685
  // src/extensions/image.ts
1633
1686
  var _extensionimage = require('@tiptap/extension-image'); var _Image = _interopRequireWildcard(_extensionimage);
1634
1687
 
1635
- var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess', _42 => _42[name]]) || _optionalChain([mod, 'optionalAccess', _43 => _43.default, 'optionalAccess', _44 => _44[name]]) || _optionalChain([mod, 'optionalAccess', _45 => _45.default, 'optionalAccess', _46 => _46.default]) || _optionalChain([mod, 'optionalAccess', _47 => _47.default]) || mod;
1688
+ var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess', _48 => _48[name]]) || _optionalChain([mod, 'optionalAccess', _49 => _49.default, 'optionalAccess', _50 => _50[name]]) || _optionalChain([mod, 'optionalAccess', _51 => _51.default, 'optionalAccess', _52 => _52.default]) || _optionalChain([mod, 'optionalAccess', _53 => _53.default]) || mod;
1636
1689
  var BaseImage = resolveExt2(_Image, "Image");
1637
1690
  var imagePastePluginKey = new (0, _state.PluginKey)("imagePasteHandler");
1638
1691
  function insertImageNode(view, src, alt) {
@@ -1739,7 +1792,7 @@ function handleImageInsertion(view, file, options) {
1739
1792
  var Image2 = BaseImage.extend({
1740
1793
  addOptions() {
1741
1794
  return {
1742
- ..._optionalChain([this, 'access', _48 => _48.parent, 'optionalCall', _49 => _49()]),
1795
+ ..._optionalChain([this, 'access', _54 => _54.parent, 'optionalCall', _55 => _55()]),
1743
1796
  allowBase64: true,
1744
1797
  maxBase64Size: 65536,
1745
1798
  enablePaste: true,
@@ -1752,7 +1805,7 @@ var Image2 = BaseImage.extend({
1752
1805
  };
1753
1806
  },
1754
1807
  addProseMirrorPlugins() {
1755
- const parentPlugins = _optionalChain([this, 'access', _50 => _50.parent, 'optionalCall', _51 => _51()]) || [];
1808
+ const parentPlugins = _optionalChain([this, 'access', _56 => _56.parent, 'optionalCall', _57 => _57()]) || [];
1756
1809
  const options = this.options;
1757
1810
  if (!options.enablePaste && !options.enableDrop) {
1758
1811
  return parentPlugins;
@@ -1762,7 +1815,7 @@ var Image2 = BaseImage.extend({
1762
1815
  props: {
1763
1816
  handlePaste(view, event) {
1764
1817
  if (!options.enablePaste) return false;
1765
- const items = Array.from(_optionalChain([event, 'access', _52 => _52.clipboardData, 'optionalAccess', _53 => _53.items]) || []);
1818
+ const items = Array.from(_optionalChain([event, 'access', _58 => _58.clipboardData, 'optionalAccess', _59 => _59.items]) || []);
1766
1819
  const imageItems = items.filter(
1767
1820
  (item) => item.kind === "file" && item.type.startsWith("image/")
1768
1821
  );
@@ -1777,7 +1830,7 @@ var Image2 = BaseImage.extend({
1777
1830
  },
1778
1831
  handleDrop(view, event) {
1779
1832
  if (!options.enableDrop) return false;
1780
- const files = Array.from(_optionalChain([event, 'access', _54 => _54.dataTransfer, 'optionalAccess', _55 => _55.files]) || []);
1833
+ const files = Array.from(_optionalChain([event, 'access', _60 => _60.dataTransfer, 'optionalAccess', _61 => _61.files]) || []);
1781
1834
  const imageFiles = files.filter((f) => f.type.startsWith("image/"));
1782
1835
  if (imageFiles.length === 0) return false;
1783
1836
  event.preventDefault();
@@ -1835,8 +1888,8 @@ function getCommentAnchors(doc) {
1835
1888
  function getCommentIdsAt(state, pos = state.selection.from) {
1836
1889
  const $pos = state.doc.resolve(pos);
1837
1890
  const marks = [
1838
- ..._nullishCoalesce(_optionalChain([$pos, 'access', _56 => _56.nodeAfter, 'optionalAccess', _57 => _57.marks]), () => ( [])),
1839
- ..._nullishCoalesce(_optionalChain([$pos, 'access', _58 => _58.nodeBefore, 'optionalAccess', _59 => _59.marks]), () => ( []))
1891
+ ..._nullishCoalesce(_optionalChain([$pos, 'access', _62 => _62.nodeAfter, 'optionalAccess', _63 => _63.marks]), () => ( [])),
1892
+ ..._nullishCoalesce(_optionalChain([$pos, 'access', _64 => _64.nodeBefore, 'optionalAccess', _65 => _65.marks]), () => ( []))
1840
1893
  ];
1841
1894
  const ids = [];
1842
1895
  marks.forEach((m) => {
@@ -1847,7 +1900,7 @@ function getCommentIdsAt(state, pos = state.selection.from) {
1847
1900
  return ids;
1848
1901
  }
1849
1902
  function getCommentStore(editor) {
1850
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _60 => _60.storage, 'optionalAccess', _61 => _61[COMMENT_MARK_NAME], 'optionalAccess', _62 => _62.store]), () => ( null));
1903
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _66 => _66.storage, 'optionalAccess', _67 => _67[COMMENT_MARK_NAME], 'optionalAccess', _68 => _68.store]), () => ( null));
1851
1904
  }
1852
1905
  function resolveAuthor(author) {
1853
1906
  return typeof author === "function" ? author() : author;
@@ -1871,7 +1924,7 @@ var Comments = _core.Mark.create({
1871
1924
  },
1872
1925
  addStorage() {
1873
1926
  return {
1874
- store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkD27YFC46cjs.CommentStore)())),
1927
+ store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkIFHKKVXHcjs.CommentStore)())),
1875
1928
  // tiptap-markdown: comments are not part of the exported markdown.
1876
1929
  markdown: { serialize: { open: "", close: "" }, parse: {} }
1877
1930
  };
@@ -1898,7 +1951,7 @@ var Comments = _core.Mark.create({
1898
1951
  const { from, to, empty } = state.selection;
1899
1952
  if (empty) return false;
1900
1953
  if (dispatch) {
1901
- const id = _nullishCoalesce(options.id, () => ( _chunkD27YFC46cjs.createReviewId.call(void 0, "comment")));
1954
+ const id = _nullishCoalesce(options.id, () => ( _chunkIFHKKVXHcjs.createReviewId.call(void 0, "comment")));
1902
1955
  tr.addMark(from, to, this.type.create({ commentId: id }));
1903
1956
  tr.setMeta(commentsPluginKey, "refresh");
1904
1957
  store().createThread({
@@ -1970,7 +2023,7 @@ var Comments = _core.Mark.create({
1970
2023
  const decorations = [];
1971
2024
  findCommentRanges(doc).forEach((ranges, id) => {
1972
2025
  const thread = store.getThread(id);
1973
- const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _63 => _63.resolved]), () => ( false));
2026
+ const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _69 => _69.resolved]), () => ( false));
1974
2027
  const active = snapshot.activeThreadId === id;
1975
2028
  const cls = [
1976
2029
  resolved ? options.resolvedClass : options.commentClass,
@@ -2003,7 +2056,7 @@ var Comments = _core.Mark.create({
2003
2056
  scheduled = false;
2004
2057
  if (destroyed) return;
2005
2058
  sync();
2006
- if (_optionalChain([cache, 'optionalAccess', _64 => _64.snapshot]) !== store.getSnapshot()) {
2059
+ if (_optionalChain([cache, 'optionalAccess', _70 => _70.snapshot]) !== store.getSnapshot()) {
2007
2060
  view.dispatch(
2008
2061
  view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
2009
2062
  );
@@ -2032,17 +2085,17 @@ var Comments = _core.Mark.create({
2032
2085
  }
2033
2086
  });
2034
2087
  function getCommentAuthor(editor) {
2035
- const ext = _optionalChain([editor, 'optionalAccess', _65 => _65.extensionManager, 'optionalAccess', _66 => _66.extensions, 'access', _67 => _67.find, 'call', _68 => _68((e) => e.name === COMMENT_MARK_NAME)]);
2088
+ const ext = _optionalChain([editor, 'optionalAccess', _71 => _71.extensionManager, 'optionalAccess', _72 => _72.extensions, 'access', _73 => _73.find, 'call', _74 => _74((e) => e.name === COMMENT_MARK_NAME)]);
2036
2089
  return ext ? resolveAuthor(ext.options.author) : null;
2037
2090
  }
2038
2091
 
2039
2092
  // src/extensions/document-compare.ts
2040
2093
 
2041
2094
  function trackChangesAuthor(state) {
2042
- return _optionalChain([_chunkD27YFC46cjs.trackChangesPluginKey, 'access', _69 => _69.getState, 'call', _70 => _70(state), 'optionalAccess', _71 => _71.author]);
2095
+ return _optionalChain([_chunkIFHKKVXHcjs.trackChangesPluginKey, 'access', _75 => _75.getState, 'call', _76 => _76(state), 'optionalAccess', _77 => _77.author]);
2043
2096
  }
2044
2097
  function compareInEditor(editor, original, revised, options = {}) {
2045
- return _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
2098
+ return _chunkCS6NZWWAcjs.compareDocuments.call(void 0, original, revised, {
2046
2099
  ...options,
2047
2100
  author: _nullishCoalesce(options.author, () => ( trackChangesAuthor(editor.state))),
2048
2101
  schema: editor.schema
@@ -2052,7 +2105,7 @@ function applyDocumentComparison(editor, original, revised, options = {}) {
2052
2105
  const result = compareInEditor(editor, original, revised, options);
2053
2106
  const { state } = editor;
2054
2107
  const tr = state.tr.replaceWith(0, state.doc.content.size, result.doc.content);
2055
- tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
2108
+ tr.setMeta(_chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META, true);
2056
2109
  editor.view.dispatch(tr);
2057
2110
  return result;
2058
2111
  }
@@ -2068,14 +2121,14 @@ var DocumentCompare = _core.Extension.create({
2068
2121
  return {
2069
2122
  setContentFromComparison: (original, revised, options = {}) => ({ state, tr, dispatch }) => {
2070
2123
  const merged = { ...this.options.compare, ...options };
2071
- const result = _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
2124
+ const result = _chunkCS6NZWWAcjs.compareDocuments.call(void 0, original, revised, {
2072
2125
  ...merged,
2073
2126
  author: _nullishCoalesce(merged.author, () => ( trackChangesAuthor(state))),
2074
2127
  schema: state.schema
2075
2128
  });
2076
2129
  if (dispatch) {
2077
2130
  tr.replaceWith(0, tr.doc.content.size, result.doc.content);
2078
- tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
2131
+ tr.setMeta(_chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META, true);
2079
2132
  this.storage.lastResult = result;
2080
2133
  }
2081
2134
  return true;
@@ -2173,7 +2226,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2173
2226
  * wildcards, then higher `priority`, then the most recently registered.
2174
2227
  */
2175
2228
  find(query) {
2176
- const fileName = _nullishCoalesce(_optionalChain([query, 'access', _72 => _72.fileName, 'optionalAccess', _73 => _73.toLowerCase, 'call', _74 => _74()]), () => ( ""));
2229
+ const fileName = _nullishCoalesce(_optionalChain([query, 'access', _78 => _78.fileName, 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]), () => ( ""));
2177
2230
  const mime = normalizeMimeType(query.mimeType);
2178
2231
  let best;
2179
2232
  let bestScore = 0;
@@ -2249,7 +2302,13 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2249
2302
  { fileName }
2250
2303
  );
2251
2304
  }
2252
- const context = createImportContext(input, { fileName, mimeType, target: adapter.target, registry: this });
2305
+ const context = createImportContext(input, {
2306
+ fileName,
2307
+ mimeType,
2308
+ target: adapter.target,
2309
+ registry: this,
2310
+ options: _optionalChain([options, 'access', _81 => _81.adapterOptions, 'optionalAccess', _82 => _82[adapter.id]])
2311
+ });
2253
2312
  try {
2254
2313
  const result = await adapter.import(input, context);
2255
2314
  return { adapterId: adapter.id, target: adapter.target, fileName, mimeType, result };
@@ -2267,319 +2326,6 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2267
2326
  }
2268
2327
  }, _class);
2269
2328
 
2270
- // src/import/zip.ts
2271
- var ZipError = class extends Error {
2272
-
2273
-
2274
- constructor(code, message, details = {}) {
2275
- super(message, details.cause !== void 0 ? { cause: details.cause } : void 0);
2276
- this.name = "ZipError";
2277
- this.code = code;
2278
- this.entryName = details.entryName;
2279
- }
2280
- };
2281
- var DEFAULT_ZIP_MAX_ENTRIES = 1e4;
2282
- var DEFAULT_ZIP_MAX_TOTAL_SIZE = 256 * 1024 * 1024;
2283
- var SIG_EOCD = 101010256;
2284
- var SIG_ZIP64_EOCD = 101075792;
2285
- var SIG_ZIP64_LOCATOR = 117853008;
2286
- var SIG_CENTRAL = 33639248;
2287
- var SIG_LOCAL = 67324752;
2288
- var EOCD_SIZE = 22;
2289
- var MAX_COMMENT = 65535;
2290
- var crcTable = null;
2291
- function zipCrc32(data) {
2292
- if (!crcTable) {
2293
- crcTable = new Uint32Array(256);
2294
- for (let n = 0; n < 256; n++) {
2295
- let c = n;
2296
- for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
2297
- crcTable[n] = c >>> 0;
2298
- }
2299
- }
2300
- let crc = 4294967295;
2301
- for (let i = 0; i < data.length; i++) crc = crcTable[(crc ^ data[i]) & 255] ^ crc >>> 8;
2302
- return (crc ^ 4294967295) >>> 0;
2303
- }
2304
- function toBytes(data) {
2305
- if (ArrayBuffer.isView(data)) return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
2306
- return new Uint8Array(data);
2307
- }
2308
- function isUnsafeZipPath(name) {
2309
- if (!name || name.includes("\0")) return true;
2310
- const normalized = name.replace(/\\/g, "/");
2311
- if (normalized.startsWith("/") || /^[a-zA-Z]:/.test(normalized)) return true;
2312
- return normalized.split("/").some((segment) => segment === "..");
2313
- }
2314
- var utf8 = new TextDecoder("utf-8");
2315
- var CP437_HIGH = "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
2316
- function decodeName(bytes, isUtf8) {
2317
- if (isUtf8 || bytes.every((b) => b < 128)) return utf8.decode(bytes);
2318
- let out = "";
2319
- for (const b of bytes) out += b < 128 ? String.fromCharCode(b) : CP437_HIGH[b - 128];
2320
- return out;
2321
- }
2322
- var ZipArchive = (_class2 = class {
2323
- constructor(bytes, entries, maxTotalSize) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
2324
- this.bytes = bytes;
2325
- this.maxTotalSize = maxTotalSize;
2326
- this.entries = entries;
2327
- entries.forEach((entry) => {
2328
- if (!this.byName.has(entry.name)) this.byName.set(entry.name, entry);
2329
- });
2330
- }
2331
-
2332
-
2333
- /** Entries in central-directory order. */
2334
-
2335
- __init2() {this.byName = /* @__PURE__ */ new Map()}
2336
- __init3() {this.extracted = 0}
2337
- /** Looks up an entry by exact name (a leading `/` is ignored). */
2338
- get(name) {
2339
- return this.byName.get(name.replace(/^\/+/, ""));
2340
- }
2341
- has(name) {
2342
- return !!this.get(name);
2343
- }
2344
- /** Uncompressed bytes extracted so far (counted against `maxTotalSize`). */
2345
- get extractedSize() {
2346
- return this.extracted;
2347
- }
2348
- /** Extracts an entry's data, verifying its size and CRC-32. */
2349
- async read(entryOrName) {
2350
- const entry = typeof entryOrName === "string" ? this.get(entryOrName) : entryOrName;
2351
- if (!entry) {
2352
- throw new ZipError("entry_not_found", `ZIP entry "${String(entryOrName)}" not found.`, {
2353
- entryName: String(entryOrName)
2354
- });
2355
- }
2356
- const name = entry.name;
2357
- if (entry.encrypted) {
2358
- throw new ZipError("encrypted", `ZIP entry "${name}" is encrypted; encrypted archives are not supported.`, {
2359
- entryName: name
2360
- });
2361
- }
2362
- if (entry.isDirectory) return new Uint8Array(0);
2363
- const remaining = this.maxTotalSize - this.extracted;
2364
- if (entry.size > remaining) {
2365
- throw new ZipError(
2366
- "too_large",
2367
- `Extracting "${name}" (${entry.size} bytes) would exceed the ${this.maxTotalSize}-byte limit.`,
2368
- { entryName: name }
2369
- );
2370
- }
2371
- const { bytes } = this;
2372
- const offset = entry.localHeaderOffset;
2373
- if (offset + 30 > bytes.length || readU32(bytes, offset) !== SIG_LOCAL) {
2374
- throw new ZipError("corrupt_entry", `ZIP entry "${name}" has no valid local header.`, { entryName: name });
2375
- }
2376
- const dataStart = offset + 30 + readU16(bytes, offset + 26) + readU16(bytes, offset + 28);
2377
- const dataEnd = dataStart + entry.compressedSize;
2378
- if (dataEnd > bytes.length) {
2379
- throw new ZipError("corrupt_entry", `ZIP entry "${name}" is truncated.`, { entryName: name });
2380
- }
2381
- const raw = bytes.subarray(dataStart, dataEnd);
2382
- let data;
2383
- if (entry.method === 0) {
2384
- if (entry.compressedSize !== entry.size) {
2385
- throw new ZipError("corrupt_entry", `Stored ZIP entry "${name}" has inconsistent sizes.`, { entryName: name });
2386
- }
2387
- data = raw.slice();
2388
- } else if (entry.method === 8) {
2389
- data = await inflateRaw(raw, entry.size, name);
2390
- } else {
2391
- throw new ZipError(
2392
- "unsupported_feature",
2393
- `ZIP entry "${name}" uses unsupported compression method ${entry.method}; only stored and deflate are supported.`,
2394
- { entryName: name }
2395
- );
2396
- }
2397
- if (data.length !== entry.size) {
2398
- throw new ZipError("corrupt_entry", `ZIP entry "${name}" size does not match the directory.`, { entryName: name });
2399
- }
2400
- this.extracted += data.length;
2401
- if (zipCrc32(data) !== entry.crc32) {
2402
- throw new ZipError("corrupt_entry", `ZIP entry "${name}" failed its CRC-32 check.`, { entryName: name });
2403
- }
2404
- return data;
2405
- }
2406
- /** Extracts an entry and decodes it as UTF-8 (a leading BOM is removed). */
2407
- async readText(entryOrName) {
2408
- const text = utf8.decode(await this.read(entryOrName));
2409
- return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
2410
- }
2411
- }, _class2);
2412
- function readU16(bytes, offset) {
2413
- return bytes[offset] | bytes[offset + 1] << 8;
2414
- }
2415
- function readU32(bytes, offset) {
2416
- return (bytes[offset] | bytes[offset + 1] << 8 | bytes[offset + 2] << 16 | bytes[offset + 3] << 24) >>> 0;
2417
- }
2418
- function readU64(bytes, offset) {
2419
- const value = readU32(bytes, offset) + readU32(bytes, offset + 4) * 4294967296;
2420
- if (!Number.isSafeInteger(value)) {
2421
- throw new ZipError("unsupported_feature", "ZIP64 value exceeds the supported range.");
2422
- }
2423
- return value;
2424
- }
2425
- async function inflateRaw(raw, limit, entryName) {
2426
- const Stream = globalThis.DecompressionStream;
2427
- if (typeof Stream !== "function") {
2428
- throw new ZipError(
2429
- "unsupported_environment",
2430
- "Inflating ZIP entries needs DecompressionStream (modern browsers, Node 18+).",
2431
- { entryName }
2432
- );
2433
- }
2434
- const stream = new Stream("deflate-raw");
2435
- const writer = stream.writable.getWriter();
2436
- const reader = stream.readable.getReader();
2437
- const CHUNK = 64 * 1024;
2438
- const feeding = (async () => {
2439
- for (let i = 0; i < raw.length; i += CHUNK) await writer.write(raw.subarray(i, i + CHUNK));
2440
- await writer.close();
2441
- })();
2442
- feeding.catch(() => {
2443
- });
2444
- const chunks = [];
2445
- let total = 0;
2446
- try {
2447
- for (; ; ) {
2448
- const { done, value } = await reader.read();
2449
- if (done) break;
2450
- total += value.length;
2451
- if (total > limit) {
2452
- throw new ZipError(
2453
- "corrupt_entry",
2454
- `ZIP entry "${entryName}" inflates beyond its declared size of ${limit} bytes.`,
2455
- { entryName }
2456
- );
2457
- }
2458
- chunks.push(value);
2459
- }
2460
- } catch (error) {
2461
- reader.cancel().catch(() => {
2462
- });
2463
- writer.abort().catch(() => {
2464
- });
2465
- if (error instanceof ZipError) throw error;
2466
- throw new ZipError("corrupt_entry", `ZIP entry "${entryName}" has an invalid deflate stream.`, {
2467
- entryName,
2468
- cause: error
2469
- });
2470
- }
2471
- await feeding.catch(() => {
2472
- });
2473
- const out = new Uint8Array(total);
2474
- let pos = 0;
2475
- for (const chunk of chunks) {
2476
- out.set(chunk, pos);
2477
- pos += chunk.length;
2478
- }
2479
- return out;
2480
- }
2481
- function findEndOfCentralDirectory(bytes) {
2482
- const min = Math.max(0, bytes.length - EOCD_SIZE - MAX_COMMENT);
2483
- for (let i = bytes.length - EOCD_SIZE; i >= min; i--) {
2484
- if (readU32(bytes, i) === SIG_EOCD && i + EOCD_SIZE + readU16(bytes, i + 20) <= bytes.length) return i;
2485
- }
2486
- return -1;
2487
- }
2488
- async function readZip(data, options = {}) {
2489
- const bytes = toBytes(data);
2490
- const maxEntries = _nullishCoalesce(options.maxEntries, () => ( DEFAULT_ZIP_MAX_ENTRIES));
2491
- const maxTotalSize = _nullishCoalesce(options.maxTotalSize, () => ( DEFAULT_ZIP_MAX_TOTAL_SIZE));
2492
- const eocd = findEndOfCentralDirectory(bytes);
2493
- if (eocd < 0) throw new ZipError("invalid_archive", "Not a ZIP archive (no end of central directory record).");
2494
- let diskNumber = readU16(bytes, eocd + 4);
2495
- let cdDisk = readU16(bytes, eocd + 6);
2496
- let count = readU16(bytes, eocd + 10);
2497
- let cdSize = readU32(bytes, eocd + 12);
2498
- let cdOffset = readU32(bytes, eocd + 16);
2499
- if (count === 65535 || cdSize === 4294967295 || cdOffset === 4294967295) {
2500
- const locator = eocd - 20;
2501
- if (locator < 0 || readU32(bytes, locator) !== SIG_ZIP64_LOCATOR) {
2502
- throw new ZipError("invalid_archive", "ZIP64 archive is missing its end of central directory locator.");
2503
- }
2504
- const record = readU64(bytes, locator + 8);
2505
- if (record + 56 > bytes.length || readU32(bytes, record) !== SIG_ZIP64_EOCD) {
2506
- throw new ZipError("invalid_archive", "ZIP64 end of central directory record not found.");
2507
- }
2508
- diskNumber = readU32(bytes, record + 16);
2509
- cdDisk = readU32(bytes, record + 20);
2510
- count = readU64(bytes, record + 32);
2511
- cdSize = readU64(bytes, record + 40);
2512
- cdOffset = readU64(bytes, record + 48);
2513
- }
2514
- if (diskNumber !== 0 || cdDisk !== 0) {
2515
- throw new ZipError("unsupported_feature", "Multi-disk (spanned) ZIP archives are not supported.");
2516
- }
2517
- if (count > maxEntries) {
2518
- throw new ZipError("too_many_entries", `ZIP archive has ${count} entries; the limit is ${maxEntries}.`);
2519
- }
2520
- if (cdOffset + cdSize > bytes.length) {
2521
- throw new ZipError("invalid_archive", "ZIP central directory lies outside the file.");
2522
- }
2523
- const entries = [];
2524
- let p = cdOffset;
2525
- for (let i = 0; i < count; i++) {
2526
- if (p + 46 > bytes.length || readU32(bytes, p) !== SIG_CENTRAL) {
2527
- throw new ZipError("invalid_archive", "ZIP central directory is corrupt.");
2528
- }
2529
- const flags = readU16(bytes, p + 8);
2530
- const method = readU16(bytes, p + 10);
2531
- const crc32 = readU32(bytes, p + 16);
2532
- let compressedSize = readU32(bytes, p + 20);
2533
- let size = readU32(bytes, p + 24);
2534
- const nameLength = readU16(bytes, p + 28);
2535
- const extraLength = readU16(bytes, p + 30);
2536
- const commentLength = readU16(bytes, p + 32);
2537
- let localHeaderOffset = readU32(bytes, p + 42);
2538
- const nameStart = p + 46;
2539
- const extraStart = nameStart + nameLength;
2540
- const next = extraStart + extraLength + commentLength;
2541
- if (next > bytes.length) throw new ZipError("invalid_archive", "ZIP central directory is truncated.");
2542
- for (let e = extraStart; e + 4 <= extraStart + extraLength; ) {
2543
- const id = readU16(bytes, e);
2544
- const len = readU16(bytes, e + 2);
2545
- if (id === 1) {
2546
- let f = e + 4;
2547
- const end = f + len;
2548
- if (size === 4294967295 && f + 8 <= end) {
2549
- size = readU64(bytes, f);
2550
- f += 8;
2551
- }
2552
- if (compressedSize === 4294967295 && f + 8 <= end) {
2553
- compressedSize = readU64(bytes, f);
2554
- f += 8;
2555
- }
2556
- if (localHeaderOffset === 4294967295 && f + 8 <= end) localHeaderOffset = readU64(bytes, f);
2557
- }
2558
- e += 4 + len;
2559
- }
2560
- const rawName = decodeName(bytes.subarray(nameStart, extraStart), (flags & 2048) !== 0);
2561
- const name = rawName.replace(/\\/g, "/");
2562
- p = next;
2563
- if (isUnsafeZipPath(rawName)) {
2564
- if (options.unsafePaths === "skip") continue;
2565
- throw new ZipError("unsafe_path", `ZIP entry name "${rawName}" is absolute or escapes the archive root.`, {
2566
- entryName: rawName
2567
- });
2568
- }
2569
- entries.push({
2570
- name,
2571
- isDirectory: name.endsWith("/"),
2572
- encrypted: (flags & 1) !== 0,
2573
- method,
2574
- compressedSize,
2575
- size,
2576
- crc32,
2577
- localHeaderOffset
2578
- });
2579
- }
2580
- return new ZipArchive(bytes, entries, maxTotalSize);
2581
- }
2582
-
2583
2329
  // src/import/docx.ts
2584
2330
  var DOCX_MIME_TYPES = [
2585
2331
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
@@ -2587,6 +2333,8 @@ var DOCX_MIME_TYPES = [
2587
2333
  "application/vnd.ms-word.document.macroenabled.12"
2588
2334
  ];
2589
2335
  var DEFAULT_DOCX_MAX_IMAGE_SIZE = 10 * 1024 * 1024;
2336
+ var MAX_COMMENTS = 5e3;
2337
+ var MAX_PARENT_CHAIN = 64;
2590
2338
  var W_NAMESPACES = /* @__PURE__ */ new Set([
2591
2339
  "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
2592
2340
  "http://purl.oclc.org/ooxml/wordprocessingml/main"
@@ -2599,6 +2347,7 @@ var IMAGE_MIME_TYPES = {
2599
2347
  gif: "image/gif",
2600
2348
  webp: "image/webp"
2601
2349
  };
2350
+ var TASK_GLYPHS = { "\u2610": false, "\u2612": true, "\u2611": true };
2602
2351
  function isW(node, localName) {
2603
2352
  if (!node || node.nodeType !== 1) return false;
2604
2353
  const el = node;
@@ -2628,7 +2377,7 @@ function descendants(el, localName) {
2628
2377
  }
2629
2378
  function toggle(el) {
2630
2379
  if (!el) return void 0;
2631
- const value = _optionalChain([attr, 'call', _75 => _75(el, "val"), 'optionalAccess', _76 => _76.toLowerCase, 'call', _77 => _77()]);
2380
+ const value = _optionalChain([attr, 'call', _83 => _83(el, "val"), 'optionalAccess', _84 => _84.toLowerCase, 'call', _85 => _85()]);
2632
2381
  return value === void 0 || !["0", "false", "off", "none"].includes(value);
2633
2382
  }
2634
2383
  function parseXml(Parser, xml, partName) {
@@ -2669,7 +2418,7 @@ async function readRelationships(zip, Parser, partPath) {
2669
2418
  const id = attr(rel, "Id");
2670
2419
  const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
2671
2420
  if (!id) return;
2672
- const external = _optionalChain([attr, 'call', _78 => _78(rel, "TargetMode"), 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]) === "external";
2421
+ const external = _optionalChain([attr, 'call', _86 => _86(rel, "TargetMode"), 'optionalAccess', _87 => _87.toLowerCase, 'call', _88 => _88()]) === "external";
2673
2422
  rels.set(id, {
2674
2423
  type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
2675
2424
  target: external ? target : resolvePartPath(baseDir, target),
@@ -2702,7 +2451,7 @@ async function loadImages(zip, root, rels, options) {
2702
2451
  for (const id of ids) {
2703
2452
  const rel = rels.get(id);
2704
2453
  if (!rel || rel.external) continue;
2705
- const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access', _81 => _81.target, 'access', _82 => _82.split, 'call', _83 => _83("."), 'access', _84 => _84.pop, 'call', _85 => _85(), 'optionalAccess', _86 => _86.toLowerCase, 'call', _87 => _87()]), () => ( ""))];
2454
+ const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access', _89 => _89.target, 'access', _90 => _90.split, 'call', _91 => _91("."), 'access', _92 => _92.pop, 'call', _93 => _93(), 'optionalAccess', _94 => _94.toLowerCase, 'call', _95 => _95()]), () => ( ""))];
2706
2455
  const entry = zip.get(rel.target);
2707
2456
  if (!mime || !entry || entry.size > maxSize) continue;
2708
2457
  images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
@@ -2735,6 +2484,65 @@ function readNumPr(pPr) {
2735
2484
  if (numId === void 0) return void 0;
2736
2485
  return { numId, ilvl: Number(_nullishCoalesce(attr(wChild(numPr, "ilvl"), "val"), () => ( 0))) || 0 };
2737
2486
  }
2487
+ function twipsToCss(value) {
2488
+ const n = Number(value);
2489
+ return value !== void 0 && value !== "" && Number.isFinite(n) ? `${Math.round(n / 20 * 100) / 100}pt` : void 0;
2490
+ }
2491
+ var ALIGNMENTS = {
2492
+ left: "left",
2493
+ start: "left",
2494
+ center: "center",
2495
+ right: "right",
2496
+ end: "right",
2497
+ both: "justify",
2498
+ distribute: "justify"
2499
+ };
2500
+ function readParagraphFormat(pPr) {
2501
+ const format = {};
2502
+ if (!pPr) return format;
2503
+ const jc = attr(wChild(pPr, "jc"), "val");
2504
+ if (jc && ALIGNMENTS[jc]) format.textAlign = ALIGNMENTS[jc];
2505
+ const spacing = wChild(pPr, "spacing");
2506
+ const before = twipsToCss(attr(spacing, "before"));
2507
+ const after = twipsToCss(attr(spacing, "after"));
2508
+ if (before) format.spaceBefore = before;
2509
+ if (after) format.spaceAfter = after;
2510
+ const line = Number(attr(spacing, "line"));
2511
+ if (Number.isFinite(line) && line > 0) {
2512
+ const rule = _nullishCoalesce(attr(spacing, "lineRule"), () => ( "auto"));
2513
+ format.lineHeight = rule === "auto" ? String(Math.round(line / 240 * 100) / 100) : twipsToCss(String(line));
2514
+ }
2515
+ const ind = wChild(pPr, "ind");
2516
+ const left = twipsToCss(_nullishCoalesce(attr(ind, "left"), () => ( attr(ind, "start"))));
2517
+ const right = twipsToCss(_nullishCoalesce(attr(ind, "right"), () => ( attr(ind, "end"))));
2518
+ const first = attr(ind, "firstLine");
2519
+ const hanging = attr(ind, "hanging");
2520
+ if (left) format.indentLeft = left;
2521
+ if (right) format.indentRight = right;
2522
+ if (first !== void 0) format.indentFirstLine = twipsToCss(first);
2523
+ else if (hanging !== void 0 && Number.isFinite(Number(hanging))) format.indentFirstLine = twipsToCss(String(-Number(hanging)));
2524
+ return format;
2525
+ }
2526
+ function readCharacterFormat(rPr) {
2527
+ const format = {};
2528
+ if (!rPr) return format;
2529
+ const f = readFormat(rPr);
2530
+ if (f.b !== void 0) format.bold = f.b;
2531
+ if (f.i !== void 0) format.italic = f.i;
2532
+ if (f.u !== void 0) format.underline = f.u;
2533
+ if (f.s !== void 0) format.strike = f.s;
2534
+ const fonts = wChild(rPr, "rFonts");
2535
+ const font = _nullishCoalesce(attr(fonts, "ascii"), () => ( attr(fonts, "hAnsi")));
2536
+ if (font && /^[\w .-]{1,64}$/.test(font)) format.fontFamily = font;
2537
+ const size = Number(attr(wChild(rPr, "sz"), "val"));
2538
+ if (Number.isFinite(size) && size > 0 && size < 3300) format.fontSize = `${size / 2}pt`;
2539
+ const color = attr(wChild(rPr, "color"), "val");
2540
+ if (color && /^[0-9a-f]{6}$/i.test(color)) format.color = `#${color.toLowerCase()}`;
2541
+ if (toggle(wChild(rPr, "caps"))) format.textTransform = "uppercase";
2542
+ const smallCaps = toggle(wChild(rPr, "smallCaps"));
2543
+ if (smallCaps !== void 0) format.smallCaps = smallCaps;
2544
+ return format;
2545
+ }
2738
2546
  function readStyles(doc) {
2739
2547
  const styles = /* @__PURE__ */ new Map();
2740
2548
  if (!doc) return styles;
@@ -2742,17 +2550,85 @@ function readStyles(doc) {
2742
2550
  const id = attr(style, "styleId");
2743
2551
  if (!id) return;
2744
2552
  const pPr = wChild(style, "pPr");
2553
+ const rPr = wChild(style, "rPr");
2745
2554
  const outline = attr(wChild(pPr, "outlineLvl"), "val");
2555
+ const priority = Number(attr(wChild(style, "uiPriority"), "val"));
2746
2556
  styles.set(id, {
2747
2557
  name: _nullishCoalesce(attr(wChild(style, "name"), "val"), () => ( id)),
2558
+ type: _nullishCoalesce(attr(style, "type"), () => ( "paragraph")),
2748
2559
  basedOn: attr(wChild(style, "basedOn"), "val"),
2560
+ next: attr(wChild(style, "next"), "val"),
2561
+ link: attr(wChild(style, "link"), "val"),
2562
+ priority: Number.isFinite(priority) && attr(wChild(style, "uiPriority"), "val") !== void 0 ? priority : void 0,
2563
+ quick: toggle(wChild(style, "qFormat")),
2564
+ hidden: toggle(wChild(style, "semiHidden")) || toggle(wChild(style, "hidden")),
2749
2565
  outlineLevel: outline !== void 0 ? Number(outline) : void 0,
2750
2566
  numPr: readNumPr(pPr),
2751
- format: readFormat(wChild(style, "rPr"))
2567
+ format: readFormat(rPr),
2568
+ paragraph: readParagraphFormat(pPr),
2569
+ character: readCharacterFormat(rPr)
2752
2570
  });
2753
2571
  });
2754
2572
  return styles;
2755
2573
  }
2574
+ function displayStyleName(name) {
2575
+ const heading = /^heading ([1-9])$/.exec(name);
2576
+ return heading ? `Heading ${heading[1]}` : name;
2577
+ }
2578
+ function mapStyleIds(styles) {
2579
+ const ids = /* @__PURE__ */ new Map();
2580
+ const used = /* @__PURE__ */ new Set();
2581
+ styles.forEach((style, fileId) => {
2582
+ if (style.type !== "paragraph" && style.type !== "character") return;
2583
+ let id = fileId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 60);
2584
+ if (!/^[A-Za-z]/.test(id)) id = `S${id}`;
2585
+ let unique = id;
2586
+ for (let n = 2; used.has(unique); n++) unique = `${id}${n}`;
2587
+ if (!_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, unique)) return;
2588
+ used.add(unique);
2589
+ ids.set(fileId, unique);
2590
+ });
2591
+ return ids;
2592
+ }
2593
+ var styleKind = (style) => _optionalChain([style, 'optionalAccess', _96 => _96.type]) === "character" ? "character" : "paragraph";
2594
+ function styleDefinitions(styles, ids) {
2595
+ const out = [];
2596
+ styles.forEach((style, fileId) => {
2597
+ const id = ids.get(fileId);
2598
+ if (!id) return;
2599
+ const kind = styleKind(style);
2600
+ const sameKind = (other) => other && ids.has(other) && styleKind(styles.get(other)) === kind ? ids.get(other) : void 0;
2601
+ const definition = { id, name: displayStyleName(style.name || fileId), kind };
2602
+ const basedOn = sameKind(style.basedOn);
2603
+ if (basedOn) definition.basedOn = basedOn;
2604
+ if (kind === "paragraph") {
2605
+ const next = sameKind(style.next);
2606
+ if (next) definition.next = next;
2607
+ }
2608
+ const linked = style.link ? ids.get(style.link) : void 0;
2609
+ if (linked) definition.linked = linked;
2610
+ if (kind === "paragraph" && Object.keys(style.paragraph).length) definition.paragraph = style.paragraph;
2611
+ if (Object.keys(style.character).length) definition.character = style.character;
2612
+ if (kind === "paragraph") {
2613
+ const heading = _nullishCoalesce(/^heading([1-6])$/i.exec(fileId), () => ( /^heading ([1-6])$/i.exec(style.name)));
2614
+ if (heading) definition.block = { type: "heading", attrs: { level: Number(heading[1]) } };
2615
+ else if (style.outlineLevel !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
2616
+ definition.block = { type: "heading", attrs: { level: style.outlineLevel + 1 } };
2617
+ } else if (id === "Code") definition.block = { type: "codeBlock" };
2618
+ else if (id === _chunk3CC7OPUQcjs.NORMAL_STYLE_ID) definition.block = { type: "paragraph" };
2619
+ }
2620
+ if (style.priority !== void 0) definition.priority = style.priority;
2621
+ if (style.quick) definition.quick = true;
2622
+ if (style.hidden) definition.hidden = true;
2623
+ const builtin = _chunk3CC7OPUQcjs.DEFAULT_STYLES.find((s) => s.id === id && s.kind === kind);
2624
+ if (builtin) {
2625
+ definition.builtin = true;
2626
+ definition.block ??= builtin.block;
2627
+ }
2628
+ out.push(definition);
2629
+ });
2630
+ return out;
2631
+ }
2756
2632
  function styleChain(styles, id) {
2757
2633
  const chain = [];
2758
2634
  const seen = /* @__PURE__ */ new Set();
@@ -2778,6 +2654,16 @@ function styleHeadingLevel(styles, id) {
2778
2654
  if (id && /^title$/i.test(id)) return 1;
2779
2655
  return void 0;
2780
2656
  }
2657
+ function specialStyle(styles, id) {
2658
+ if (!id) return void 0;
2659
+ for (const style of styleChain(styles, id)) {
2660
+ if (/^block ?text$/i.test(style.name)) return "quote";
2661
+ if (/^code$/i.test(style.name)) return "code";
2662
+ }
2663
+ if (/^blocktext$/i.test(id)) return "quote";
2664
+ if (id === "Code") return "code";
2665
+ return void 0;
2666
+ }
2781
2667
  function readNumbering(doc) {
2782
2668
  const numbering = { abstracts: /* @__PURE__ */ new Map(), nums: /* @__PURE__ */ new Map() };
2783
2669
  if (!doc) return numbering;
@@ -2807,7 +2693,184 @@ function readNumbering(doc) {
2807
2693
  });
2808
2694
  return numbering;
2809
2695
  }
2810
- var formatKey = (f) => `${f.b ? 1 : 0}${f.i ? 1 : 0}${f.u ? 1 : 0}${f.s ? 1 : 0}${f.sup ? 1 : 0}${f.sub ? 1 : 0}|${_nullishCoalesce(f.href, () => ( ""))}`;
2696
+ function readPeople(doc) {
2697
+ const people = /* @__PURE__ */ new Map();
2698
+ if (!doc) return people;
2699
+ descendants(doc, "person").forEach((person) => {
2700
+ const author = attr(person, "author");
2701
+ const userId = attr(descendants(person, "presenceInfo")[0], "userId");
2702
+ if (author && userId && !people.has(author)) people.set(author, userId);
2703
+ });
2704
+ return people;
2705
+ }
2706
+ function dateOf(value) {
2707
+ const ms = value ? Date.parse(value) : NaN;
2708
+ return Number.isFinite(ms) ? ms : 0;
2709
+ }
2710
+ function authorOf(ctx, name) {
2711
+ const authorName = (_nullishCoalesce(name, () => ( ""))).trim() || "Unknown";
2712
+ return { id: _nullishCoalesce(ctx.people.get(authorName), () => ( authorName)), name: authorName };
2713
+ }
2714
+ function commentBody(comment) {
2715
+ const lines = [];
2716
+ const walk = (el, line) => {
2717
+ for (const child of childElements(el)) {
2718
+ if (!isW(child)) continue;
2719
+ switch (child.localName) {
2720
+ case "t":
2721
+ line.push(_nullishCoalesce(child.textContent, () => ( "")));
2722
+ break;
2723
+ case "tab":
2724
+ line.push(" ");
2725
+ break;
2726
+ case "br":
2727
+ case "cr":
2728
+ line.push("\n");
2729
+ break;
2730
+ case "delText":
2731
+ case "del":
2732
+ case "moveFrom":
2733
+ break;
2734
+ default:
2735
+ walk(child, line);
2736
+ }
2737
+ }
2738
+ };
2739
+ for (const block of childElements(comment)) {
2740
+ if (!isW(block)) continue;
2741
+ const paragraphs = block.localName === "p" ? [block] : descendants(block, "p").filter((p) => isW(p));
2742
+ for (const p of paragraphs) {
2743
+ const line = [];
2744
+ walk(p, line);
2745
+ lines.push(line.join(""));
2746
+ }
2747
+ }
2748
+ return lines.join("\n").trim();
2749
+ }
2750
+ function readComments(commentsXml, extendedXml, people) {
2751
+ const byFileId = /* @__PURE__ */ new Map();
2752
+ if (!commentsXml) return { threads: [], byFileId };
2753
+ const entries = /* @__PURE__ */ new Map();
2754
+ const byParaId = /* @__PURE__ */ new Map();
2755
+ for (const comment of descendants(commentsXml, "comment").filter((el) => isW(el))) {
2756
+ if (entries.size >= MAX_COMMENTS) break;
2757
+ const fileId = attr(comment, "id");
2758
+ if (fileId === void 0 || entries.has(fileId)) continue;
2759
+ entries.set(fileId, {
2760
+ fileId,
2761
+ author: authorOf({ people }, attr(comment, "author")),
2762
+ createdAt: dateOf(attr(comment, "date")),
2763
+ body: commentBody(comment),
2764
+ done: false
2765
+ });
2766
+ const paragraphs = descendants(comment, "p");
2767
+ const paraId = attr(paragraphs[paragraphs.length - 1], "paraId");
2768
+ if (paraId) byParaId.set(paraId, fileId);
2769
+ }
2770
+ if (extendedXml) {
2771
+ for (const ex of descendants(extendedXml, "commentEx")) {
2772
+ const fileId = byParaId.get(_nullishCoalesce(attr(ex, "paraId"), () => ( "")));
2773
+ const entry = fileId !== void 0 ? entries.get(fileId) : void 0;
2774
+ if (!entry) continue;
2775
+ const parent = byParaId.get(_nullishCoalesce(attr(ex, "paraIdParent"), () => ( "")));
2776
+ if (parent !== void 0 && parent !== fileId) entry.parent = parent;
2777
+ const done = attr(ex, "done");
2778
+ entry.done = done === "1" || done === "true";
2779
+ }
2780
+ }
2781
+ const rootOf = (entry) => {
2782
+ let current = entry;
2783
+ for (let i = 0; i < MAX_PARENT_CHAIN && current.parent !== void 0; i++) {
2784
+ const parent = entries.get(current.parent);
2785
+ if (!parent || parent === entry) break;
2786
+ current = parent;
2787
+ }
2788
+ return current;
2789
+ };
2790
+ const threads = /* @__PURE__ */ new Map();
2791
+ for (const entry of entries.values()) {
2792
+ if (rootOf(entry) !== entry) continue;
2793
+ const id = _chunkIFHKKVXHcjs.createReviewId.call(void 0, "comment");
2794
+ byFileId.set(entry.fileId, id);
2795
+ threads.set(entry.fileId, {
2796
+ id,
2797
+ anchor: null,
2798
+ author: entry.author,
2799
+ createdAt: entry.createdAt,
2800
+ body: entry.body,
2801
+ replies: [],
2802
+ resolved: entry.done,
2803
+ orphaned: false
2804
+ });
2805
+ }
2806
+ for (const entry of entries.values()) {
2807
+ const root = rootOf(entry);
2808
+ if (root === entry) continue;
2809
+ const thread = threads.get(root.fileId);
2810
+ if (!thread) continue;
2811
+ byFileId.set(entry.fileId, thread.id);
2812
+ const reply = {
2813
+ id: _chunkIFHKKVXHcjs.createReviewId.call(void 0, "reply"),
2814
+ author: entry.author,
2815
+ body: entry.body,
2816
+ createdAt: entry.createdAt
2817
+ };
2818
+ thread.replies.push(reply);
2819
+ }
2820
+ return { threads: Array.from(threads.values()), byFileId };
2821
+ }
2822
+ function applyMarker(el, ctx) {
2823
+ switch (el.localName) {
2824
+ case "commentRangeStart": {
2825
+ const thread = ctx.commentThreads.get(_nullishCoalesce(attr(el, "id"), () => ( "")));
2826
+ if (thread) ctx.openComments.set(thread, (_nullishCoalesce(ctx.openComments.get(thread), () => ( 0))) + 1);
2827
+ return true;
2828
+ }
2829
+ case "commentRangeEnd": {
2830
+ const thread = ctx.commentThreads.get(_nullishCoalesce(attr(el, "id"), () => ( "")));
2831
+ const open = thread ? ctx.openComments.get(thread) : void 0;
2832
+ if (thread && open !== void 0) {
2833
+ if (open <= 1) ctx.openComments.delete(thread);
2834
+ else ctx.openComments.set(thread, open - 1);
2835
+ }
2836
+ return true;
2837
+ }
2838
+ case "moveFromRangeStart":
2839
+ case "moveToRangeStart": {
2840
+ const id = attr(el, "id");
2841
+ const name = _nullishCoalesce(attr(el, "name"), () => ( `range-${id}`));
2842
+ let moveId = ctx.moveIds.get(name);
2843
+ if (!moveId) {
2844
+ moveId = _chunkIFHKKVXHcjs.createReviewId.call(void 0, "move");
2845
+ ctx.moveIds.set(name, moveId);
2846
+ }
2847
+ if (id !== void 0) {
2848
+ ctx.moveRanges.delete(id);
2849
+ ctx.moveRanges.set(id, { moveId, to: el.localName === "moveToRangeStart" });
2850
+ }
2851
+ return true;
2852
+ }
2853
+ case "moveFromRangeEnd":
2854
+ case "moveToRangeEnd":
2855
+ ctx.moveRanges.delete(_nullishCoalesce(attr(el, "id"), () => ( "")));
2856
+ return true;
2857
+ default:
2858
+ return false;
2859
+ }
2860
+ }
2861
+ var FORMAT_MARK_TYPES = [
2862
+ ["b", "bold"],
2863
+ ["i", "italic"],
2864
+ ["u", "underline"],
2865
+ ["s", "strike"],
2866
+ ["sub", "subscript"],
2867
+ ["sup", "superscript"]
2868
+ ];
2869
+ var formatMarks = (f) => FORMAT_MARK_TYPES.filter(([key]) => f[key]).map(([, type]) => ({ type }));
2870
+ var formatKey = (f) => `${f.b ? 1 : 0}${f.i ? 1 : 0}${f.u ? 1 : 0}${f.s ? 1 : 0}${f.sup ? 1 : 0}${f.sub ? 1 : 0}|${_nullishCoalesce(f.href, () => ( ""))}` + (f.rev ? `|${f.rev.kind}:${f.rev.changeId}:${_nullishCoalesce(f.rev.moveId, () => ( ""))}` : "") + (f.fmt ? `|f:${f.fmt.changeId}` : "") + (f.comments ? `|c:${f.comments.join(",")}` : "");
2871
+ function changeAttrs(change) {
2872
+ return ` data-change-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.changeId)}" data-author-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.authorId)}" data-author-name="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.authorName)}" data-created-at="${change.createdAt}"`;
2873
+ }
2811
2874
  function wrapFormat(inner, f) {
2812
2875
  let html = inner;
2813
2876
  if (f.sup) html = `<sup>${html}</sup>`;
@@ -2816,10 +2879,19 @@ function wrapFormat(inner, f) {
2816
2879
  if (f.u) html = `<u>${html}</u>`;
2817
2880
  if (f.i) html = `<em>${html}</em>`;
2818
2881
  if (f.b) html = `<strong>${html}</strong>`;
2819
- if (f.href) html = `<a href="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2882
+ if (f.fmt) {
2883
+ html = `<span data-change-type="format"${changeAttrs(f.fmt)} data-format-before="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.before))}" data-format-after="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.after))}">${html}</span>`;
2884
+ }
2885
+ if (f.rev) {
2886
+ const tag = f.rev.kind === "insertion" ? "ins" : "del";
2887
+ const move = f.rev.moveId ? ` data-move-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, f.rev.moveId)}"` : "";
2888
+ html = `<${tag} data-change-type="${f.rev.kind}"${changeAttrs(f.rev)}${move}>${html}</${tag}>`;
2889
+ }
2890
+ for (const id of [..._nullishCoalesce(f.comments, () => ( []))].reverse()) html = `<span data-comment-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, id)}">${html}</span>`;
2891
+ if (f.href) html = `<a href="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2820
2892
  return html;
2821
2893
  }
2822
- function renderSegments(segments) {
2894
+ function renderSegments(segments, code = false) {
2823
2895
  let html = "";
2824
2896
  let i = 0;
2825
2897
  while (i < segments.length) {
@@ -2828,12 +2900,13 @@ function renderSegments(segments) {
2828
2900
  let j = i;
2829
2901
  for (; j < segments.length && formatKey(segments[j].format) === key; j++) {
2830
2902
  const seg = segments[j];
2831
- if (seg.kind === "text") inner += _chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.text);
2832
- else if (seg.kind === "br") inner += "<br>";
2833
- else if (seg.kind === "img") inner += `<img src="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.alt)}">`;
2903
+ if (seg.kind === "text") inner += _chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.text);
2904
+ else if (seg.kind === "br") inner += code ? "\n" : "<br>";
2905
+ else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.alt)}">`;
2834
2906
  else inner += `<sup>${seg.n}</sup>`;
2835
2907
  }
2836
- html += wrapFormat(inner, segments[i].format);
2908
+ const format = segments[i].format;
2909
+ html += wrapFormat(inner, code ? { rev: format.rev, comments: format.comments } : format);
2837
2910
  i = j;
2838
2911
  }
2839
2912
  return html;
@@ -2842,25 +2915,49 @@ function parseHyperlinkInstruction(instr) {
2842
2915
  const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
2843
2916
  if (!match) return void 0;
2844
2917
  const rest = match[1];
2845
- const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _88 => _88.exec, 'call', _89 => _89(rest), 'optionalAccess', _90 => _90[1]]);
2918
+ const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _97 => _97.exec, 'call', _98 => _98(rest), 'optionalAccess', _99 => _99[1]]);
2846
2919
  const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
2847
- const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _91 => _91[1]]), () => ( _optionalChain([target, 'optionalAccess', _92 => _92[2]])));
2920
+ const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _100 => _100[1]]), () => ( _optionalChain([target, 'optionalAccess', _101 => _101[2]])));
2848
2921
  if (url) return anchor ? `${url}#${anchor}` : url;
2849
2922
  return anchor ? `#${anchor}` : void 0;
2850
2923
  }
2851
- var ParagraphRenderer = (_class3 = class {
2852
- constructor(ctx, part) {;_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);
2924
+ var ParagraphRenderer = (_class2 = class {
2925
+ constructor(ctx, part) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
2853
2926
  this.ctx = ctx;
2854
2927
  this.part = part;
2855
2928
  }
2856
2929
 
2857
2930
 
2858
- __init4() {this.segments = []}
2931
+ __init2() {this.segments = []}
2859
2932
  /** Open complex fields (`w:fldChar`), innermost last. */
2860
- __init5() {this.fields = []}
2861
- render(p) {
2933
+ __init3() {this.fields = []}
2934
+ collect(p) {
2862
2935
  this.walk(p, {});
2863
- return renderSegments(this.segments);
2936
+ return this;
2937
+ }
2938
+ render(p) {
2939
+ return this.collect(p).html();
2940
+ }
2941
+ html(code = false) {
2942
+ return renderSegments(this.segments, code);
2943
+ }
2944
+ /** Removes a leading task-list glyph (`☐ ` / `☒ `) and returns its checked state. */
2945
+ takeTaskGlyph() {
2946
+ const first = this.segments[0];
2947
+ if (!first || first.kind !== "text") return void 0;
2948
+ const glyph = first.text.charAt(0);
2949
+ if (!(glyph in TASK_GLYPHS)) return void 0;
2950
+ const rest = first.text.slice(1).replace(/^ /, "");
2951
+ if (rest) first.text = rest;
2952
+ else {
2953
+ this.segments.shift();
2954
+ const next = this.segments[0];
2955
+ if (_optionalChain([next, 'optionalAccess', _102 => _102.kind]) === "text") {
2956
+ next.text = next.text.replace(/^ /, "");
2957
+ if (!next.text) this.segments.shift();
2958
+ }
2959
+ }
2960
+ return TASK_GLYPHS[glyph];
2864
2961
  }
2865
2962
  fieldHref() {
2866
2963
  for (let i = this.fields.length - 1; i >= 0; i--) {
@@ -2871,8 +2968,38 @@ var ParagraphRenderer = (_class3 = class {
2871
2968
  inFieldInstruction() {
2872
2969
  return this.fields.some((field) => !field.separated);
2873
2970
  }
2971
+ /** A tracked change id shared with the previous change when adjacent and by the same author at the same time. */
2972
+ changeId(key) {
2973
+ const last = this.ctx.lastChange;
2974
+ if (last && last.key === key && last.end === this.ctx.segmentCount) return last.changeId;
2975
+ return _chunkIFHKKVXHcjs.createReviewId.call(void 0, "change");
2976
+ }
2977
+ change(el, kind, extra = "") {
2978
+ const author = authorOf(this.ctx, attr(el, "author"));
2979
+ const createdAt = dateOf(attr(el, "date"));
2980
+ const key = `${kind}|${author.name}|${createdAt}|${extra}`;
2981
+ return {
2982
+ key,
2983
+ info: { changeId: this.changeId(key), authorId: author.id, authorName: author.name, createdAt }
2984
+ };
2985
+ }
2986
+ revision(el, kind) {
2987
+ let moveId;
2988
+ if (el.localName === "moveFrom" || el.localName === "moveTo") {
2989
+ const to = el.localName === "moveTo";
2990
+ for (const range of this.ctx.moveRanges.values()) if (range.to === to) moveId = range.moveId;
2991
+ moveId ??= _chunkIFHKKVXHcjs.createReviewId.call(void 0, "move");
2992
+ }
2993
+ const { info, key } = this.change(el, kind, _nullishCoalesce(moveId, () => ( "")));
2994
+ return { rev: { ...info, kind, ...moveId ? { moveId } : {} }, key };
2995
+ }
2996
+ walkChange(el, base, kind) {
2997
+ const { rev, key } = this.revision(el, kind);
2998
+ this.walk(el, { ...base, rev });
2999
+ this.ctx.lastChange = { key, changeId: rev.changeId, end: this.ctx.segmentCount };
3000
+ }
2874
3001
  walk(el, base) {
2875
- const accepted = this.ctx.tracked === "accepted";
3002
+ const tracked = this.ctx.tracked;
2876
3003
  for (const child of childElements(el)) {
2877
3004
  if (!isW(child)) {
2878
3005
  continue;
@@ -2896,11 +3023,13 @@ var ParagraphRenderer = (_class3 = class {
2896
3023
  }
2897
3024
  case "ins":
2898
3025
  case "moveTo":
2899
- if (accepted) this.walk(child, base);
3026
+ if (tracked === "accepted") this.walk(child, base);
3027
+ else if (tracked === "marks") this.walkChange(child, base, "insertion");
2900
3028
  break;
2901
3029
  case "del":
2902
3030
  case "moveFrom":
2903
- if (!accepted) this.walk(child, base);
3031
+ if (tracked === "original") this.walk(child, base);
3032
+ else if (tracked === "marks") this.walkChange(child, base, "deletion");
2904
3033
  break;
2905
3034
  case "sdt":
2906
3035
  this.walk(_nullishCoalesce(wChild(child, "sdtContent"), () => ( child)), base);
@@ -2913,24 +3042,42 @@ var ParagraphRenderer = (_class3 = class {
2913
3042
  this.walk(child, base);
2914
3043
  break;
2915
3044
  default:
3045
+ applyMarker(child, this.ctx);
2916
3046
  break;
2917
3047
  }
2918
3048
  }
2919
3049
  }
2920
3050
  run(r, base) {
2921
3051
  const rPr = wChild(r, "rPr");
2922
- const styleFormat = _nullishCoalesce(_optionalChain([this, 'access', _93 => _93.ctx, 'access', _94 => _94.styles, 'access', _95 => _95.get, 'call', _96 => _96(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( ""))), 'optionalAccess', _97 => _97.format]), () => ( {}));
3052
+ const runStyle = this.ctx.styles.get(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( "")));
3053
+ const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess', _103 => _103.format]), () => ( {}));
2923
3054
  const own = readFormat(rPr);
2924
3055
  const format = { ...base, ...styleFormat, ...own };
3056
+ const rPrChange = wChild(rPr, "rPrChange");
3057
+ let changeKey;
3058
+ if (rPrChange && this.ctx.tracked === "marks") {
3059
+ const { info, key } = this.change(rPrChange, "format");
3060
+ const before = { ...styleFormat, ...readFormat(wChild(rPrChange, "rPr")) };
3061
+ format.fmt = { ...info, before: formatMarks(before), after: formatMarks(format) };
3062
+ changeKey = key;
3063
+ }
2925
3064
  for (const child of childElements(r)) {
2926
3065
  this.runChild(child, format);
2927
3066
  }
3067
+ if (format.fmt && changeKey) {
3068
+ this.ctx.lastChange = { key: changeKey, changeId: format.fmt.changeId, end: this.ctx.segmentCount };
3069
+ }
2928
3070
  }
2929
3071
  runChild(child, format) {
2930
3072
  const push = (segment) => {
2931
3073
  if (this.inFieldInstruction()) return;
2932
3074
  const href = _nullishCoalesce(format.href, () => ( this.fieldHref()));
2933
- this.segments.push(href && !format.href ? { ...segment, format: { ...format, href } } : segment);
3075
+ let out = href && !format.href ? { ...segment, format: { ...format, href } } : segment;
3076
+ if (this.ctx.openComments.size) {
3077
+ out = { ...out, format: { ...out.format, comments: Array.from(this.ctx.openComments.keys()) } };
3078
+ }
3079
+ this.segments.push(out);
3080
+ this.ctx.segmentCount++;
2934
3081
  };
2935
3082
  if (child.localName === "AlternateContent") {
2936
3083
  const branch = childElements(child).find(
@@ -2945,7 +3092,7 @@ var ParagraphRenderer = (_class3 = class {
2945
3092
  push({ kind: "text", text: _nullishCoalesce(child.textContent, () => ( "")), format });
2946
3093
  break;
2947
3094
  case "delText":
2948
- if (this.ctx.tracked === "original") push({ kind: "text", text: _nullishCoalesce(child.textContent, () => ( "")), format });
3095
+ if (this.ctx.tracked !== "accepted") push({ kind: "text", text: _nullishCoalesce(child.textContent, () => ( "")), format });
2949
3096
  break;
2950
3097
  case "tab":
2951
3098
  case "ptab":
@@ -3008,9 +3155,17 @@ var ParagraphRenderer = (_class3 = class {
3008
3155
  const alt = attr(docPr, "descr") || attr(docPr, "title") || attr(imageData, "title") || "";
3009
3156
  push({ kind: "img", src, alt, format });
3010
3157
  }
3011
- }, _class3);
3158
+ }, _class2);
3159
+ var MARKERS = /* @__PURE__ */ new Set([
3160
+ "commentRangeStart",
3161
+ "commentRangeEnd",
3162
+ "moveFromRangeStart",
3163
+ "moveFromRangeEnd",
3164
+ "moveToRangeStart",
3165
+ "moveToRangeEnd"
3166
+ ]);
3012
3167
  function flattenBlocks(container, ctx, out = []) {
3013
- const accepted = ctx.tracked === "accepted";
3168
+ const tracked = ctx.tracked;
3014
3169
  for (const child of childElements(container)) {
3015
3170
  if (!isW(child)) continue;
3016
3171
  switch (child.localName) {
@@ -3027,13 +3182,14 @@ function flattenBlocks(container, ctx, out = []) {
3027
3182
  break;
3028
3183
  case "ins":
3029
3184
  case "moveTo":
3030
- if (accepted) flattenBlocks(child, ctx, out);
3185
+ if (tracked !== "original") flattenBlocks(child, ctx, out);
3031
3186
  break;
3032
3187
  case "del":
3033
3188
  case "moveFrom":
3034
- if (!accepted) flattenBlocks(child, ctx, out);
3189
+ if (tracked !== "accepted") flattenBlocks(child, ctx, out);
3035
3190
  break;
3036
3191
  default:
3192
+ if (MARKERS.has(child.localName)) out.push(child);
3037
3193
  break;
3038
3194
  }
3039
3195
  }
@@ -3051,20 +3207,41 @@ function paragraphInfo(p, ctx) {
3051
3207
  heading = styleHeadingLevel(ctx.styles, styleId);
3052
3208
  }
3053
3209
  let numPr = readNumPr(pPr);
3054
- if (!numPr) numPr = _optionalChain([styleChain, 'call', _98 => _98(ctx.styles, styleId), 'access', _99 => _99.find, 'call', _100 => _100((style) => style.numPr), 'optionalAccess', _101 => _101.numPr]);
3210
+ if (!numPr) numPr = _optionalChain([styleChain, 'call', _104 => _104(ctx.styles, styleId), 'access', _105 => _105.find, 'call', _106 => _106((style) => style.numPr), 'optionalAccess', _107 => _107.numPr]);
3055
3211
  let list;
3056
3212
  if (numPr && numPr.numId !== "0" && heading === void 0) {
3057
3213
  const num = ctx.numbering.nums.get(numPr.numId);
3058
- const def = num ? _optionalChain([ctx, 'access', _102 => _102.numbering, 'access', _103 => _103.abstracts, 'access', _104 => _104.get, 'call', _105 => _105(num.abstractId), 'optionalAccess', _106 => _106.get, 'call', _107 => _107(numPr.ilvl)]) : void 0;
3214
+ const def = num ? _optionalChain([ctx, 'access', _108 => _108.numbering, 'access', _109 => _109.abstracts, 'access', _110 => _110.get, 'call', _111 => _111(num.abstractId), 'optionalAccess', _112 => _112.get, 'call', _113 => _113(numPr.ilvl)]) : void 0;
3059
3215
  list = {
3060
3216
  level: Math.max(0, Math.min(numPr.ilvl, 8)),
3061
- ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _108 => _108.ordered]), () => ( false)),
3062
- start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _109 => _109.starts, 'access', _110 => _110.get, 'call', _111 => _111(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _112 => _112.start]))), () => ( 1))
3217
+ ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _114 => _114.ordered]), () => ( false)),
3218
+ start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _115 => _115.starts, 'access', _116 => _116.get, 'call', _117 => _117(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _118 => _118.start]))), () => ( 1))
3063
3219
  };
3064
3220
  }
3065
- return { heading, list };
3221
+ const special = heading === void 0 && !list ? specialStyle(ctx.styles, styleId) : void 0;
3222
+ return { heading, list, styleId, special, pPr };
3223
+ }
3224
+ function blockChangeAttr(pPr, ctx) {
3225
+ const change = wChild(pPr, "pPrChange");
3226
+ if (!change) return "";
3227
+ const oldPPr = wChild(change, "pPr");
3228
+ const oldStyle = attr(wChild(oldPPr, "pStyle"), "val");
3229
+ const oldOutline = attr(wChild(oldPPr, "outlineLvl"), "val");
3230
+ const level = oldOutline !== void 0 ? Number(oldOutline) >= 0 && Number(oldOutline) <= 5 ? Number(oldOutline) + 1 : void 0 : styleHeadingLevel(ctx.styles, oldStyle);
3231
+ const mappedStyle = oldStyle ? ctx.styleIds.get(oldStyle) : void 0;
3232
+ const previous = level !== void 0 ? { type: "heading", attrs: { level }, wrappers: [] } : specialStyle(ctx.styles, oldStyle) === "code" ? { type: "codeBlock", attrs: {}, wrappers: [] } : { type: "paragraph", attrs: mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? { styleId: mappedStyle } : {}, wrappers: [] };
3233
+ const author = authorOf(ctx, attr(change, "author"));
3234
+ const record = {
3235
+ changeId: _chunkIFHKKVXHcjs.createReviewId.call(void 0, "change"),
3236
+ authorId: author.id,
3237
+ authorName: author.name,
3238
+ authorColor: null,
3239
+ createdAt: dateOf(attr(change, "date")),
3240
+ previous
3241
+ };
3242
+ return ` data-block-change="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(record))}"`;
3066
3243
  }
3067
- function renderBlocks(container, ctx, part) {
3244
+ function renderBlocks(container, ctx, part, topLevel = false) {
3068
3245
  let html = "";
3069
3246
  const stack = [];
3070
3247
  const closeList = () => {
@@ -3074,34 +3251,62 @@ function renderBlocks(container, ctx, part) {
3074
3251
  const closeAll = () => {
3075
3252
  while (stack.length) closeList();
3076
3253
  };
3254
+ let group = null;
3255
+ const flush = () => {
3256
+ if (!group) return;
3257
+ html += group.kind === "quote" ? `<blockquote>${group.parts.join("")}</blockquote>` : `<pre><code>${group.parts.join("\n")}</code></pre>`;
3258
+ group = null;
3259
+ };
3077
3260
  for (const block of flattenBlocks(container, ctx)) {
3261
+ if (MARKERS.has(block.localName)) {
3262
+ applyMarker(block, ctx);
3263
+ continue;
3264
+ }
3078
3265
  if (block.localName === "tbl") {
3079
3266
  closeAll();
3267
+ flush();
3080
3268
  html += renderTable(block, ctx, part);
3081
3269
  continue;
3082
3270
  }
3083
- const { heading, list } = paragraphInfo(block, ctx);
3084
- const inner = new ParagraphRenderer(ctx, part).render(block);
3085
- const blockHtml = heading ? `<h${heading}>${inner}</h${heading}>` : `<p>${inner}</p>`;
3271
+ const { heading, list, styleId, special, pPr } = paragraphInfo(block, ctx);
3272
+ const renderer = new ParagraphRenderer(ctx, part).collect(block);
3273
+ if (special) {
3274
+ closeAll();
3275
+ if (group && group.kind !== special) flush();
3276
+ group ??= { kind: special, parts: [] };
3277
+ group.parts.push(special === "code" ? renderer.html(true) : `<p>${renderer.html()}</p>`);
3278
+ continue;
3279
+ }
3280
+ flush();
3281
+ const task = list && !list.ordered ? renderer.takeTaskGlyph() : void 0;
3282
+ const inner = renderer.html();
3283
+ const mappedStyle = styleId ? ctx.styleIds.get(styleId) : void 0;
3284
+ const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
3285
+ const changeAttr = topLevel && !list && ctx.tracked === "marks" ? blockChangeAttr(pPr, ctx) : "";
3286
+ const blockHtml = heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`;
3086
3287
  if (!list) {
3087
3288
  closeAll();
3088
3289
  html += blockHtml;
3089
3290
  continue;
3090
3291
  }
3091
3292
  const tag = list.ordered ? "ol" : "ul";
3293
+ const isTask = task !== void 0;
3294
+ const item = isTask ? `<li data-type="taskItem" data-checked="${task ? "true" : "false"}">` : "<li>";
3092
3295
  while (stack.length && stack[stack.length - 1].level > list.level) closeList();
3093
3296
  const top = stack[stack.length - 1];
3094
- if (top && top.level === list.level && top.tag === tag) {
3095
- html += "</li><li>";
3297
+ if (top && top.level === list.level && top.tag === tag && top.task === isTask) {
3298
+ html += `</li>${item}`;
3096
3299
  } else {
3097
3300
  if (top && top.level === list.level) closeList();
3098
3301
  const start2 = tag === "ol" && list.start !== 1 ? ` start="${list.start}"` : "";
3099
- html += `<${tag}${start2}><li>`;
3100
- stack.push({ level: list.level, tag });
3302
+ const type = isTask ? ' data-type="taskList"' : "";
3303
+ html += `<${tag}${type}${start2}>${item}`;
3304
+ stack.push({ level: list.level, tag, task: isTask });
3101
3305
  }
3102
3306
  html += blockHtml;
3103
3307
  }
3104
3308
  closeAll();
3309
+ flush();
3105
3310
  return html;
3106
3311
  }
3107
3312
  function renderTable(tbl, ctx, part) {
@@ -3143,7 +3348,7 @@ function renderTable(tbl, ctx, part) {
3143
3348
  if (cell.merge === "restart") {
3144
3349
  for (let r = rowIndex + 1; r < rows.length; r++) {
3145
3350
  const below = rows[r].find((c) => c.col === cell.col);
3146
- if (_optionalChain([below, 'optionalAccess', _113 => _113.merge]) !== "continue") break;
3351
+ if (_optionalChain([below, 'optionalAccess', _119 => _119.merge]) !== "continue") break;
3147
3352
  rowspan++;
3148
3353
  }
3149
3354
  }
@@ -3156,7 +3361,7 @@ function renderTable(tbl, ctx, part) {
3156
3361
  return `${html}</tbody></table>`;
3157
3362
  }
3158
3363
  function getDomParser(options) {
3159
- const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _114 => _114.window, 'optionalAccess', _115 => _115.DOMParser])));
3364
+ const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _120 => _120.window, 'optionalAccess', _121 => _121.DOMParser])));
3160
3365
  if (typeof Parser !== "function") {
3161
3366
  throw new ImportError(
3162
3367
  "unsupported_environment",
@@ -3169,9 +3374,9 @@ async function docxToDocumentImport(data, options = {}) {
3169
3374
  const Parser = getDomParser(options);
3170
3375
  let zip;
3171
3376
  try {
3172
- zip = await readZip(data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
3377
+ zip = await _chunk3CC7OPUQcjs.readZip.call(void 0, data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
3173
3378
  } catch (error) {
3174
- if (_optionalChain([error, 'optionalAccess', _116 => _116.code]) === "invalid_archive") {
3379
+ if (_optionalChain([error, 'optionalAccess', _122 => _122.code]) === "invalid_archive") {
3175
3380
  throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
3176
3381
  }
3177
3382
  throw error;
@@ -3191,16 +3396,42 @@ async function docxToDocumentImport(data, options = {}) {
3191
3396
  throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
3192
3397
  }
3193
3398
  const rels = await readRelationships(zip, Parser, mainPath);
3194
- const partByType = (suffix) => _optionalChain([Array, 'access', _117 => _117.from, 'call', _118 => _118(rels.values()), 'access', _119 => _119.find, 'call', _120 => _120((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _121 => _121.target]);
3399
+ const partByType = (suffix) => _optionalChain([Array, 'access', _123 => _123.from, 'call', _124 => _124(rels.values()), 'access', _125 => _125.find, 'call', _126 => _126((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _127 => _127.target]);
3195
3400
  const baseDir = dirname(mainPath);
3196
3401
  const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
3197
3402
  const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
3403
+ const styles = readStyles(await readXmlPart(zip, Parser, stylesPath));
3404
+ const useStyles = options.paragraphStyles !== false;
3405
+ const styleIds = useStyles ? mapStyleIds(styles) : /* @__PURE__ */ new Map();
3406
+ const peoplePath = partByType("people");
3407
+ const people = readPeople(peoplePath ? await readXmlPart(zip, Parser, peoplePath) : null);
3408
+ let threads = [];
3409
+ let commentThreads = /* @__PURE__ */ new Map();
3410
+ if (options.comments !== false) {
3411
+ const commentsPath = partByType("comments");
3412
+ const extendedPath = partByType("commentsExtended");
3413
+ const read = readComments(
3414
+ commentsPath ? await readXmlPart(zip, Parser, commentsPath) : null,
3415
+ extendedPath ? await readXmlPart(zip, Parser, extendedPath) : null,
3416
+ people
3417
+ );
3418
+ threads = read.threads;
3419
+ commentThreads = read.byFileId;
3420
+ }
3198
3421
  const ctx = {
3199
- styles: readStyles(await readXmlPart(zip, Parser, stylesPath)),
3422
+ styles,
3200
3423
  numbering: readNumbering(await readXmlPart(zip, Parser, numberingPath)),
3201
3424
  notes: /* @__PURE__ */ new Map(),
3202
3425
  noteOrder: [],
3203
- tracked: _nullishCoalesce(options.trackedChanges, () => ( "accepted"))
3426
+ tracked: _nullishCoalesce(options.trackedChanges, () => ( "accepted")),
3427
+ styleIds,
3428
+ people,
3429
+ commentThreads,
3430
+ openComments: /* @__PURE__ */ new Map(),
3431
+ moveRanges: /* @__PURE__ */ new Map(),
3432
+ moveIds: /* @__PURE__ */ new Map(),
3433
+ segmentCount: 0,
3434
+ lastChange: null
3204
3435
  };
3205
3436
  for (const kind of ["footnote", "endnote"]) {
3206
3437
  const path = _nullishCoalesce(partByType(`${kind}s`), () => ( `${baseDir}${kind}s.xml`));
@@ -3215,7 +3446,7 @@ async function docxToDocumentImport(data, options = {}) {
3215
3446
  });
3216
3447
  }
3217
3448
  const part = { rels, images: await loadImages(zip, documentXml, rels, options) };
3218
- let html = renderBlocks(body, ctx, part);
3449
+ let html = renderBlocks(body, ctx, part, true);
3219
3450
  if (ctx.noteOrder.length) {
3220
3451
  let notesHtml = "";
3221
3452
  for (let i = 0; i < ctx.noteOrder.length; i++) {
@@ -3224,8 +3455,14 @@ async function docxToDocumentImport(data, options = {}) {
3224
3455
  }
3225
3456
  html += `<hr><ol>${notesHtml}</ol>`;
3226
3457
  }
3227
- const sanitized = _chunkSML64VJGcjs.sanitizeImportedHtml.call(void 0, html);
3228
- return { html: sanitized, text: _chunkXNORY7M6cjs.htmlToPlainText.call(void 0, sanitized) };
3458
+ const sanitized = _chunkRRREAOVMcjs.sanitizeImportedHtml.call(void 0, html);
3459
+ const result = { html: sanitized, text: _chunkNFVBT3UZcjs.htmlToPlainText.call(void 0, sanitized) };
3460
+ if (threads.length) result.comments = { version: 1, threads };
3461
+ if (useStyles) {
3462
+ const definitions = styleDefinitions(styles, styleIds);
3463
+ if (definitions.length) result.styles = _chunk3CC7OPUQcjs.createStyleRegistry.call(void 0, { styles: definitions });
3464
+ }
3465
+ return result;
3229
3466
  }
3230
3467
  function createDocxImportAdapter(options = {}) {
3231
3468
  return {
@@ -3250,7 +3487,7 @@ var markdownImportAdapter = {
3250
3487
  target: "document",
3251
3488
  async import(_input, context) {
3252
3489
  const text = await context.readText();
3253
- return { html: _chunkXNORY7M6cjs.markdownToTipTapHtml.call(void 0, text), text };
3490
+ return { html: _chunkNFVBT3UZcjs.markdownToTipTapHtml.call(void 0, text), text };
3254
3491
  }
3255
3492
  };
3256
3493
  var htmlImportAdapter = {
@@ -3260,8 +3497,8 @@ var htmlImportAdapter = {
3260
3497
  extensions: [".html", ".htm", ".xhtml"],
3261
3498
  target: "document",
3262
3499
  async import(_input, context) {
3263
- const html = _chunkSML64VJGcjs.sanitizeImportedHtml.call(void 0, await context.readText());
3264
- return { html, text: _chunkXNORY7M6cjs.htmlToPlainText.call(void 0, html) };
3500
+ const html = _chunkRRREAOVMcjs.sanitizeImportedHtml.call(void 0, await context.readText());
3501
+ return { html, text: _chunkNFVBT3UZcjs.htmlToPlainText.call(void 0, html) };
3265
3502
  }
3266
3503
  };
3267
3504
  var plainTextImportAdapter = {
@@ -3272,7 +3509,7 @@ var plainTextImportAdapter = {
3272
3509
  target: "document",
3273
3510
  async import(_input, context) {
3274
3511
  const text = (await context.readText()).replace(/\r\n?/g, "\n");
3275
- return { html: _chunkSML64VJGcjs.plainTextToParagraphHtml.call(void 0, text), text };
3512
+ return { html: _chunkRRREAOVMcjs.plainTextToParagraphHtml.call(void 0, text), text };
3276
3513
  }
3277
3514
  };
3278
3515
  var rtfImportAdapter = {
@@ -3282,8 +3519,8 @@ var rtfImportAdapter = {
3282
3519
  extensions: [".rtf"],
3283
3520
  target: "document",
3284
3521
  async import(_input, context) {
3285
- const text = _chunkSML64VJGcjs.rtfToPlainText.call(void 0, await context.readText());
3286
- return { html: _chunkSML64VJGcjs.plainTextToParagraphHtml.call(void 0, text), text };
3522
+ const text = _chunkRRREAOVMcjs.rtfToPlainText.call(void 0, await context.readText());
3523
+ return { html: _chunkRRREAOVMcjs.plainTextToParagraphHtml.call(void 0, text), text };
3287
3524
  }
3288
3525
  };
3289
3526
  var BUILT_IN_IMPORT_ADAPTERS = [
@@ -3322,7 +3559,7 @@ function getImportAccept(target) {
3322
3559
 
3323
3560
  var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
3324
3561
  function htmlToSlice(html, schema) {
3325
- const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _122 => _122.window, 'optionalAccess', _123 => _123.DOMParser])));
3562
+ const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _128 => _128.window, 'optionalAccess', _129 => _129.DOMParser])));
3326
3563
  if (!Parser) return null;
3327
3564
  const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
3328
3565
  return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
@@ -3337,23 +3574,53 @@ function insertImportedDocument(target, content, options = {}) {
3337
3574
  if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
3338
3575
  from = to = _state.Selection.near(state.doc.resolve(from)).from;
3339
3576
  }
3340
- const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunkXNORY7M6cjs.plainTextToSlice.call(void 0, content.text, state.schema));
3577
+ const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunkNFVBT3UZcjs.plainTextToSlice.call(void 0, content.text, state.schema));
3341
3578
  const end = tr.mapping.map(to, 1);
3342
3579
  view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "drop"));
3343
3580
  return end;
3344
3581
  }
3582
+ function applyImportedReviewData(editor, content) {
3583
+ const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _130 => _130.storage]), () => ( {}));
3584
+ let comments = 0;
3585
+ let styles = 0;
3586
+ const store = _optionalChain([storage, 'access', _131 => _131.comment, 'optionalAccess', _132 => _132.store]);
3587
+ const threads = _nullishCoalesce(_optionalChain([content, 'access', _133 => _133.comments, 'optionalAccess', _134 => _134.threads]), () => ( []));
3588
+ if (store && threads.length) {
3589
+ const existing = store.toJSON().threads;
3590
+ const fresh = threads.filter((thread) => !existing.some((t) => t.id === thread.id));
3591
+ if (fresh.length) {
3592
+ store.load({ version: 1, threads: [...existing, ...fresh] });
3593
+ comments = fresh.length;
3594
+ }
3595
+ }
3596
+ const registry = _optionalChain([storage, 'access', _135 => _135.paragraphStyles, 'optionalAccess', _136 => _136.registry]);
3597
+ if (registry && content.styles) {
3598
+ for (const style of content.styles.list()) {
3599
+ if (registry.get(style.id)) continue;
3600
+ registry.upsert(style);
3601
+ styles++;
3602
+ }
3603
+ }
3604
+ return { comments, styles };
3605
+ }
3345
3606
  async function importFilesIntoEditor(target, files, options = {}) {
3346
3607
  const registry = _nullishCoalesce(options.registry, () => ( defaultImportRegistry));
3347
3608
  const outcomes = [];
3348
3609
  let at = options.at;
3349
3610
  for (const file of Array.from(files)) {
3350
3611
  try {
3351
- const outcome = await registry.importFile(file, { target: "document" });
3612
+ const outcome = await registry.importFile(file, {
3613
+ target: "document",
3614
+ adapterOptions: options.adapterOptions
3615
+ });
3352
3616
  const view = toView(target);
3353
3617
  if (view.isDestroyed) break;
3354
3618
  at = insertImportedDocument(view, outcome.result, { at, asPlainText: options.asPlainText });
3619
+ if (!options.asPlainText && "storage" in target) {
3620
+ applyImportedReviewData(target, outcome.result);
3621
+ }
3355
3622
  outcomes.push(outcome);
3356
- _optionalChain([options, 'access', _124 => _124.onImport, 'optionalCall', _125 => _125(outcome, file)]);
3623
+ _optionalChain([options, 'access', _137 => _137.onImport, 'optionalCall', _138 => _138(outcome, file)]);
3357
3624
  } catch (error) {
3358
3625
  const err = error instanceof Error ? error : new Error(String(error));
3359
3626
  if (options.onError) options.onError(err, file);
@@ -3372,7 +3639,7 @@ function getImportableFiles(files, registry) {
3372
3639
  }
3373
3640
  function dropPosition(view, event) {
3374
3641
  try {
3375
- return _optionalChain([view, 'access', _126 => _126.posAtCoords, 'call', _127 => _127({ left: event.clientX, top: event.clientY }), 'optionalAccess', _128 => _128.pos]);
3642
+ return _optionalChain([view, 'access', _139 => _139.posAtCoords, 'call', _140 => _140({ left: event.clientX, top: event.clientY }), 'optionalAccess', _141 => _141.pos]);
3376
3643
  } catch (e2) {
3377
3644
  return void 0;
3378
3645
  }
@@ -3382,6 +3649,7 @@ var FileImport = _core.Extension.create({
3382
3649
  addOptions() {
3383
3650
  return {
3384
3651
  registry: void 0,
3652
+ adapterOptions: void 0,
3385
3653
  asPlainText: false,
3386
3654
  enableDrop: true,
3387
3655
  enablePaste: true,
@@ -3397,6 +3665,7 @@ var FileImport = _core.Extension.create({
3397
3665
  registry: registry(),
3398
3666
  at,
3399
3667
  asPlainText: options.asPlainText,
3668
+ adapterOptions: options.adapterOptions,
3400
3669
  onImport: options.onImport,
3401
3670
  onError: options.onImportError
3402
3671
  });
@@ -3407,7 +3676,7 @@ var FileImport = _core.Extension.create({
3407
3676
  props: {
3408
3677
  handleDrop(view, event, _slice, moved) {
3409
3678
  if (!options.enableDrop || moved) return false;
3410
- const files = getImportableFiles(_optionalChain([event, 'access', _129 => _129.dataTransfer, 'optionalAccess', _130 => _130.files]), registry());
3679
+ const files = getImportableFiles(_optionalChain([event, 'access', _142 => _142.dataTransfer, 'optionalAccess', _143 => _143.files]), registry());
3411
3680
  if (!files) return false;
3412
3681
  event.preventDefault();
3413
3682
  run(view, files, dropPosition(view, event));
@@ -3415,7 +3684,7 @@ var FileImport = _core.Extension.create({
3415
3684
  },
3416
3685
  handlePaste(view, event) {
3417
3686
  if (!options.enablePaste) return false;
3418
- const files = getImportableFiles(_optionalChain([event, 'access', _131 => _131.clipboardData, 'optionalAccess', _132 => _132.files]), registry());
3687
+ const files = getImportableFiles(_optionalChain([event, 'access', _144 => _144.clipboardData, 'optionalAccess', _145 => _145.files]), registry());
3419
3688
  if (!files) return false;
3420
3689
  event.preventDefault();
3421
3690
  run(view, files);
@@ -3434,15 +3703,15 @@ var richClipboardPluginKey = new (0, _state.PluginKey)("richClipboard");
3434
3703
  function writeRichClipboard(view, event, options = {}) {
3435
3704
  const { state } = view;
3436
3705
  if (state.selection.empty) return false;
3437
- const data = _chunkSML64VJGcjs.getClipboardData.call(void 0, event);
3706
+ const data = _chunkRRREAOVMcjs.getClipboardData.call(void 0, event);
3438
3707
  if (!data || typeof data.setData !== "function") return false;
3439
3708
  const slice = state.selection.content();
3440
3709
  const { dom, text } = view.serializeForClipboard(slice);
3441
3710
  event.preventDefault();
3442
- _optionalChain([data, 'access', _133 => _133.clearData, 'optionalCall', _134 => _134()]);
3711
+ _optionalChain([data, 'access', _146 => _146.clearData, 'optionalCall', _147 => _147()]);
3443
3712
  data.setData("text/html", dom.innerHTML);
3444
3713
  data.setData("text/plain", text);
3445
- data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME)), _chunkSML64VJGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3714
+ data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME)), _chunkRRREAOVMcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3446
3715
  if (options.cut && view.editable) {
3447
3716
  view.dispatch(state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
3448
3717
  }
@@ -3452,7 +3721,7 @@ var RichClipboard = _core.Extension.create({
3452
3721
  name: "richClipboard",
3453
3722
  addOptions() {
3454
3723
  return {
3455
- mimeType: _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME,
3724
+ mimeType: _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME,
3456
3725
  plainTextMode: false
3457
3726
  };
3458
3727
  },
@@ -3460,7 +3729,7 @@ var RichClipboard = _core.Extension.create({
3460
3729
  return { plainTextMode: !!this.options.plainTextMode };
3461
3730
  },
3462
3731
  addProseMirrorPlugins() {
3463
- const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME));
3732
+ const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME));
3464
3733
  const storage = this.storage;
3465
3734
  return [
3466
3735
  new (0, _state.Plugin)({
@@ -3472,7 +3741,7 @@ var RichClipboard = _core.Extension.create({
3472
3741
  },
3473
3742
  handlePaste(view, event) {
3474
3743
  if (storage.plainTextMode) return false;
3475
- const slice = _chunkSML64VJGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3744
+ const slice = _chunkRRREAOVMcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3476
3745
  if (!slice) return false;
3477
3746
  event.preventDefault();
3478
3747
  view.dispatch(
@@ -3667,7 +3936,7 @@ var Autocorrect = _core.Extension.create({
3667
3936
  addCommands() {
3668
3937
  return {
3669
3938
  undoAutocorrect: () => ({ state, tr, dispatch }) => {
3670
- const last = _optionalChain([autocorrectPluginKey, 'access', _135 => _135.getState, 'call', _136 => _136(state), 'optionalAccess', _137 => _137.last]);
3939
+ const last = _optionalChain([autocorrectPluginKey, 'access', _148 => _148.getState, 'call', _149 => _149(state), 'optionalAccess', _150 => _150.last]);
3671
3940
  if (!last) return false;
3672
3941
  if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
3673
3942
  if (dispatch) {
@@ -3717,7 +3986,7 @@ var Autocorrect = _core.Extension.create({
3717
3986
  }
3718
3987
  const insertTyped = () => {
3719
3988
  const tr2 = state.tr.insertText(text, from, to);
3720
- if (_optionalChain([pluginState, 'optionalAccess', _138 => _138.closePending])) _history.closeHistory.call(void 0, tr2);
3989
+ if (_optionalChain([pluginState, 'optionalAccess', _151 => _151.closePending])) _history.closeHistory.call(void 0, tr2);
3721
3990
  view.dispatch(tr2);
3722
3991
  };
3723
3992
  if (isIgnored(state, from, to)) return false;
@@ -3725,7 +3994,7 @@ var Autocorrect = _core.Extension.create({
3725
3994
  if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
3726
3995
  return false;
3727
3996
  }
3728
- const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _139 => _139.exec, 'call', _140 => _140(textBefore), 'optionalAccess', _141 => _141[0]]), () => ( ""));
3997
+ const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _152 => _152.exec, 'call', _153 => _153(textBefore), 'optionalAccess', _154 => _154[0]]), () => ( ""));
3729
3998
  if (/:\/\/|^www\./i.test(currentWord)) return false;
3730
3999
  const exceptions = extension.storage.exceptions;
3731
4000
  const found = findAutocorrection(textBefore, extension.options.rules, {
@@ -3733,7 +4002,7 @@ var Autocorrect = _core.Extension.create({
3733
4002
  isException: (value) => exceptions.has(value.toLowerCase())
3734
4003
  });
3735
4004
  if (!found) {
3736
- if (!_optionalChain([pluginState, 'optionalAccess', _142 => _142.closePending])) return false;
4005
+ if (!_optionalChain([pluginState, 'optionalAccess', _155 => _155.closePending])) return false;
3737
4006
  insertTyped();
3738
4007
  return true;
3739
4008
  }
@@ -3770,7 +4039,7 @@ var Autocorrect = _core.Extension.create({
3770
4039
  _history.closeHistory.call(void 0, tr);
3771
4040
  tr.setMeta(autocorrectPluginKey, { correction });
3772
4041
  view.dispatch(tr);
3773
- _optionalChain([extension, 'access', _143 => _143.options, 'access', _144 => _144.onCorrection, 'optionalCall', _145 => _145(correction)]);
4042
+ _optionalChain([extension, 'access', _156 => _156.options, 'access', _157 => _157.onCorrection, 'optionalCall', _158 => _158(correction)]);
3774
4043
  return true;
3775
4044
  };
3776
4045
  return [
@@ -3780,8 +4049,8 @@ var Autocorrect = _core.Extension.create({
3780
4049
  init: () => ({ last: null, closePending: false }),
3781
4050
  apply: (tr, prev) => {
3782
4051
  const meta = tr.getMeta(autocorrectPluginKey);
3783
- if (_optionalChain([meta, 'optionalAccess', _146 => _146.correction])) return { last: meta.correction, closePending: true };
3784
- if (_optionalChain([meta, 'optionalAccess', _147 => _147.undo])) return { last: null, closePending: true };
4052
+ if (_optionalChain([meta, 'optionalAccess', _159 => _159.correction])) return { last: meta.correction, closePending: true };
4053
+ if (_optionalChain([meta, 'optionalAccess', _160 => _160.undo])) return { last: null, closePending: true };
3785
4054
  if (!tr.docChanged) return prev;
3786
4055
  if (!prev.last && !prev.closePending) return prev;
3787
4056
  return { last: null, closePending: false };
@@ -3862,7 +4131,7 @@ function arraysEqual(a, b, eq) {
3862
4131
  }
3863
4132
  function scrollDomAtPos(view, pos, behavior = "smooth") {
3864
4133
  try {
3865
- const dom = _optionalChain([view, 'optionalAccess', _148 => _148.nodeDOM, 'optionalCall', _149 => _149(pos)]);
4134
+ const dom = _optionalChain([view, 'optionalAccess', _161 => _161.nodeDOM, 'optionalCall', _162 => _162(pos)]);
3866
4135
  if (dom && typeof dom.scrollIntoView === "function") {
3867
4136
  dom.scrollIntoView({ block: "start", behavior });
3868
4137
  }
@@ -3877,7 +4146,7 @@ function syncInitialContent(editor, sync) {
3877
4146
  errorOnInvalidContent: false
3878
4147
  });
3879
4148
  const tr = sync(_state.EditorState.create({ doc }));
3880
- if (_optionalChain([tr, 'optionalAccess', _150 => _150.docChanged])) editor.options.content = tr.doc;
4149
+ if (_optionalChain([tr, 'optionalAccess', _163 => _163.docChanged])) editor.options.content = tr.doc;
3881
4150
  } catch (e4) {
3882
4151
  }
3883
4152
  }
@@ -3958,7 +4227,7 @@ function createOutlineStore(editor) {
3958
4227
  const compute = () => {
3959
4228
  if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
3960
4229
  const headings = getOutline(editor);
3961
- const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _151 => _151(editor, headings), 'optionalAccess', _152 => _152.id]), () => ( null));
4230
+ const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _164 => _164(editor, headings), 'optionalAccess', _165 => _165.id]), () => ( null));
3962
4231
  const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
3963
4232
  if (sameStructure && snapshot.activeId === activeId) return snapshot;
3964
4233
  return {
@@ -3983,16 +4252,16 @@ function createOutlineStore(editor) {
3983
4252
  subscribe(listener) {
3984
4253
  if (!listeners.size) {
3985
4254
  snapshot = compute();
3986
- _optionalChain([editor, 'optionalAccess', _153 => _153.on, 'call', _154 => _154("transaction", onTransaction)]);
4255
+ _optionalChain([editor, 'optionalAccess', _166 => _166.on, 'call', _167 => _167("transaction", onTransaction)]);
3987
4256
  }
3988
4257
  listeners.add(listener);
3989
4258
  return () => {
3990
4259
  listeners.delete(listener);
3991
- if (!listeners.size) _optionalChain([editor, 'optionalAccess', _155 => _155.off, 'call', _156 => _156("transaction", onTransaction)]);
4260
+ if (!listeners.size) _optionalChain([editor, 'optionalAccess', _168 => _168.off, 'call', _169 => _169("transaction", onTransaction)]);
3992
4261
  };
3993
4262
  },
3994
4263
  destroy() {
3995
- _optionalChain([editor, 'optionalAccess', _157 => _157.off, 'call', _158 => _158("transaction", onTransaction)]);
4264
+ _optionalChain([editor, 'optionalAccess', _170 => _170.off, 'call', _171 => _171("transaction", onTransaction)]);
3996
4265
  listeners.clear();
3997
4266
  }
3998
4267
  };
@@ -4067,7 +4336,7 @@ var Outline = _core.Extension.create({
4067
4336
  if (options.focus !== false) {
4068
4337
  tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
4069
4338
  tr.scrollIntoView();
4070
- _optionalChain([view, 'optionalAccess', _159 => _159.focus, 'optionalCall', _160 => _160()]);
4339
+ _optionalChain([view, 'optionalAccess', _172 => _172.focus, 'optionalCall', _173 => _173()]);
4071
4340
  }
4072
4341
  scrollDomAtPos(view, heading.pos, options.behavior);
4073
4342
  }
@@ -4099,7 +4368,7 @@ var Outline = _core.Extension.create({
4099
4368
  const next = computeOutline(newState.doc, types);
4100
4369
  if (arraysEqual(prev, next, sameHeading)) return prev;
4101
4370
  storage.headings = next;
4102
- _optionalChain([onUpdate, 'call', _161 => _161(), 'optionalCall', _162 => _162(next)]);
4371
+ _optionalChain([onUpdate, 'call', _174 => _174(), 'optionalCall', _175 => _175(next)]);
4103
4372
  return next;
4104
4373
  }
4105
4374
  }
@@ -4418,7 +4687,7 @@ var TableOfContents = _core.Node.create({
4418
4687
  handleDOMEvents: {
4419
4688
  click: (view, event) => {
4420
4689
  const target = event.target;
4421
- const link = _optionalChain([target, 'optionalAccess', _163 => _163.closest, 'optionalCall', _164 => _164(
4690
+ const link = _optionalChain([target, 'optionalAccess', _176 => _176.closest, 'optionalCall', _177 => _177(
4422
4691
  'nav[data-type="table-of-contents"] a[data-heading-id]'
4423
4692
  )]);
4424
4693
  if (!link) return false;
@@ -4491,7 +4760,7 @@ function getFootnotes(doc) {
4491
4760
  number: index + 1,
4492
4761
  text: footnote ? footnoteText(footnote.node) : "",
4493
4762
  referencePos: ref.pos,
4494
- footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _165 => _165.pos]), () => ( null))
4763
+ footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _178 => _178.pos]), () => ( null))
4495
4764
  };
4496
4765
  });
4497
4766
  }
@@ -4533,7 +4802,7 @@ function syncFootnotes(tr, options = {}) {
4533
4802
  });
4534
4803
  const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
4535
4804
  const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
4536
- const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _166 => _166.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _167 => _167.contents, 'optionalAccess', _168 => _168[id]]), () => ( "")))));
4805
+ const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _179 => _179.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _180 => _180.contents, 'optionalAccess', _181 => _181[id]]), () => ( "")))));
4537
4806
  if (source && source.attrs.id === id && source.attrs.number === number) {
4538
4807
  return source;
4539
4808
  }
@@ -4736,7 +5005,7 @@ var FootnoteReference = _core.Node.create({
4736
5005
  handleClickOn: (_view, _pos, node, _nodePos, event) => {
4737
5006
  if (node.type.name !== REFERENCE || !node.attrs.id) return false;
4738
5007
  const target = event.target;
4739
- if (!_optionalChain([target, 'optionalAccess', _169 => _169.closest, 'optionalCall', _170 => _170("a")])) return false;
5008
+ if (!_optionalChain([target, 'optionalAccess', _182 => _182.closest, 'optionalCall', _183 => _183("a")])) return false;
4740
5009
  event.preventDefault();
4741
5010
  return editor.commands.goToFootnote(node.attrs.id);
4742
5011
  }
@@ -4934,7 +5203,7 @@ var Bookmark = _core.Mark.create({
4934
5203
  }
4935
5204
  if (!dispatch) return true;
4936
5205
  const sameName = getBookmarks(state.doc).find((b) => b.name === name);
4937
- const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _171 => _171.id]))), () => ( this.options.generateId()));
5206
+ const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _184 => _184.id]))), () => ( this.options.generateId()));
4938
5207
  if (sameName) {
4939
5208
  forEachBookmarkRange(
4940
5209
  tr.doc,
@@ -5176,7 +5445,7 @@ var CrossReference = _core.Node.create({
5176
5445
  // src/extensions/document-structure/command-items.ts
5177
5446
  var start = (editor, args) => {
5178
5447
  const chain = editor.chain().focus();
5179
- return _optionalChain([args, 'optionalAccess', _172 => _172.range]) ? chain.deleteRange(args.range) : chain;
5448
+ return _optionalChain([args, 'optionalAccess', _185 => _185.range]) ? chain.deleteRange(args.range) : chain;
5180
5449
  };
5181
5450
  var documentStructureCommandItems = [
5182
5451
  {
@@ -5193,7 +5462,7 @@ var documentStructureCommandItems = [
5193
5462
  description: "Insert a numbered footnote",
5194
5463
  keywords: ["footnote", "note", "fn", "citation"],
5195
5464
  extension: "footnoteReference",
5196
- run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _173 => _173.content]) }).run()
5465
+ run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _186 => _186.content]) }).run()
5197
5466
  },
5198
5467
  {
5199
5468
  id: "bookmark",
@@ -5202,7 +5471,7 @@ var documentStructureCommandItems = [
5202
5471
  keywords: ["bookmark", "anchor", "name"],
5203
5472
  extension: "bookmark",
5204
5473
  requires: "name",
5205
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _174 => _174.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5474
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _187 => _187.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5206
5475
  },
5207
5476
  {
5208
5477
  id: "cross-reference",
@@ -5211,7 +5480,7 @@ var documentStructureCommandItems = [
5211
5480
  keywords: ["cross", "reference", "xref", "link", "ref"],
5212
5481
  extension: "crossReference",
5213
5482
  requires: "target",
5214
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _175 => _175.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5483
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _188 => _188.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5215
5484
  }
5216
5485
  ];
5217
5486
  function getDocumentStructureCommandItems(editor, query = "") {
@@ -6115,17 +6384,17 @@ var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
6115
6384
  lastReplaceCount: null,
6116
6385
  focusRequest: 0
6117
6386
  });
6118
- var FindReplaceStore = (_class4 = class {constructor() { _class4.prototype.__init6.call(this);_class4.prototype.__init7.call(this);_class4.prototype.__init8.call(this);_class4.prototype.__init9.call(this); }
6119
- __init6() {this.snapshot = EMPTY_FIND_REPLACE_SNAPSHOT}
6120
- __init7() {this.listeners = /* @__PURE__ */ new Set()}
6121
- __init8() {this.subscribe = (listener) => {
6387
+ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this); }
6388
+ __init4() {this.snapshot = EMPTY_FIND_REPLACE_SNAPSHOT}
6389
+ __init5() {this.listeners = /* @__PURE__ */ new Set()}
6390
+ __init6() {this.subscribe = (listener) => {
6122
6391
  this.listeners.add(listener);
6123
6392
  listener(this.snapshot);
6124
6393
  return () => {
6125
6394
  this.listeners.delete(listener);
6126
6395
  };
6127
6396
  }}
6128
- __init9() {this.getSnapshot = () => this.snapshot}
6397
+ __init7() {this.getSnapshot = () => this.snapshot}
6129
6398
  /** @internal Called by the extension's plugin view. */
6130
6399
  set(snapshot) {
6131
6400
  if (snapshot === this.snapshot) return;
@@ -6138,16 +6407,16 @@ var FindReplaceStore = (_class4 = class {constructor() { _class4.prototype.__ini
6138
6407
  }
6139
6408
  });
6140
6409
  }
6141
- }, _class4);
6410
+ }, _class3);
6142
6411
  var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
6143
6412
  function getFindReplaceState(source) {
6144
- const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.state]), () => ( source));
6413
+ const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _189 => _189.state]), () => ( source));
6145
6414
  if (!state || typeof state.plugins === "undefined") return null;
6146
6415
  const plugin = findReplacePluginKey.getState(state);
6147
6416
  return plugin ? toSnapshot(plugin) : null;
6148
6417
  }
6149
6418
  function getFindReplaceStore(editor) {
6150
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _177 => _177.storage, 'optionalAccess', _178 => _178.findReplace, 'optionalAccess', _179 => _179.store]), () => ( null));
6419
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _190 => _190.storage, 'optionalAccess', _191 => _191.findReplace, 'optionalAccess', _192 => _192.store]), () => ( null));
6151
6420
  }
6152
6421
  var snapshotCache = /* @__PURE__ */ new WeakMap();
6153
6422
  function toSnapshot(s) {
@@ -6318,7 +6587,7 @@ var FindReplace = _core.Extension.create({
6318
6587
  const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
6319
6588
  const step = (forward) => () => {
6320
6589
  const s = findReplacePluginKey.getState(this.editor.state);
6321
- if (!_optionalChain([s, 'optionalAccess', _180 => _180.active]) || !s.matches.length) return false;
6590
+ if (!_optionalChain([s, 'optionalAccess', _193 => _193.active]) || !s.matches.length) return false;
6322
6591
  return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
6323
6592
  };
6324
6593
  return {
@@ -6431,7 +6700,7 @@ var FindReplace = _core.Extension.create({
6431
6700
  s = {
6432
6701
  ...s,
6433
6702
  currentIndex: m.index,
6434
- anchor: _nullishCoalesce(_optionalChain([s, 'access', _181 => _181.matches, 'access', _182 => _182[m.index], 'optionalAccess', _183 => _183.from]), () => ( s.anchor))
6703
+ anchor: _nullishCoalesce(_optionalChain([s, 'access', _194 => _194.matches, 'access', _195 => _195[m.index], 'optionalAccess', _196 => _196.from]), () => ( s.anchor))
6435
6704
  };
6436
6705
  redecorate = true;
6437
6706
  break;
@@ -6447,7 +6716,7 @@ var FindReplace = _core.Extension.create({
6447
6716
  }
6448
6717
  },
6449
6718
  props: {
6450
- decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _184 => _184.getState, 'call', _185 => _185(state), 'optionalAccess', _186 => _186.decorations]), () => ( _view2.DecorationSet.empty))
6719
+ decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _197 => _197.getState, 'call', _198 => _198(state), 'optionalAccess', _199 => _199.decorations]), () => ( _view2.DecorationSet.empty))
6451
6720
  },
6452
6721
  view: (view) => {
6453
6722
  const sync = () => {
@@ -6469,8 +6738,367 @@ function safeClipboard(get) {
6469
6738
  }
6470
6739
  }
6471
6740
 
6741
+ // src/extensions/paragraph-styles/extension.ts
6742
+
6743
+
6744
+ var STYLE_ID_ATTRIBUTE = "styleId";
6745
+ var CHARACTER_STYLE_MARK_NAME = "characterStyle";
6746
+ var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
6747
+ function getStyleRegistry(editor) {
6748
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _200 => _200.storage, 'optionalAccess', _201 => _201.paragraphStyles, 'optionalAccess', _202 => _202.registry]), () => ( null));
6749
+ }
6750
+ function headingLevels(editor) {
6751
+ const heading = _optionalChain([editor, 'optionalAccess', _203 => _203.extensionManager, 'optionalAccess', _204 => _204.extensions, 'access', _205 => _205.find, 'call', _206 => _206((e) => e.name === "heading")]);
6752
+ const levels = _optionalChain([heading, 'optionalAccess', _207 => _207.options, 'optionalAccess', _208 => _208.levels]);
6753
+ return Array.isArray(levels) ? levels : null;
6754
+ }
6755
+ function isParagraphStyleAvailable(editor, registry, id) {
6756
+ const style = registry.get(id);
6757
+ if (!style || style.kind !== "paragraph") return false;
6758
+ const block = registry.resolve(id).block;
6759
+ if (!editor.schema.nodes[block.type]) return false;
6760
+ if (block.type === "heading") {
6761
+ const levels = headingLevels(editor);
6762
+ if (levels && !levels.includes(Number(_optionalChain([block, 'access', _209 => _209.attrs, 'optionalAccess', _210 => _210.level])))) return false;
6763
+ }
6764
+ return true;
6765
+ }
6766
+ function getParagraphStyleAt(state, registry, pos = state.selection.from) {
6767
+ const $pos = state.doc.resolve(Math.max(0, Math.min(pos, state.doc.content.size)));
6768
+ const block = $pos.parent;
6769
+ if (!block.isTextblock) return null;
6770
+ return registry.styleOfBlock(block.type.name, block.attrs);
6771
+ }
6772
+ var MARK_FORMAT = {
6773
+ bold: "bold",
6774
+ italic: "italic",
6775
+ underline: "underline",
6776
+ strike: "strike"
6777
+ };
6778
+ function selectionMarks(state) {
6779
+ const { from, to, empty, $from } = state.selection;
6780
+ if (empty) return _nullishCoalesce(state.storedMarks, () => ( $from.marks()));
6781
+ let common = null;
6782
+ state.doc.nodesBetween(from, to, (node) => {
6783
+ if (!node.isText) return true;
6784
+ common = common === null ? node.marks : common.filter((m) => m.isInSet(node.marks));
6785
+ return false;
6786
+ });
6787
+ return _nullishCoalesce(common, () => ( $from.marks()));
6788
+ }
6789
+ function captureSelectionFormat(state) {
6790
+ const character = {};
6791
+ selectionMarks(state).forEach((mark) => {
6792
+ const name = mark.type.name;
6793
+ if (MARK_FORMAT[name]) character[MARK_FORMAT[name]] = true;
6794
+ if (name === "textStyle") {
6795
+ if (mark.attrs.fontFamily) character.fontFamily = mark.attrs.fontFamily;
6796
+ if (mark.attrs.fontSize) character.fontSize = mark.attrs.fontSize;
6797
+ if (mark.attrs.color) character.color = mark.attrs.color;
6798
+ }
6799
+ if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
6800
+ });
6801
+ const paragraph = {};
6802
+ const align = _optionalChain([state, 'access', _211 => _211.selection, 'access', _212 => _212.$from, 'access', _213 => _213.parent, 'access', _214 => _214.attrs, 'optionalAccess', _215 => _215.textAlign]);
6803
+ if (align && align !== "left") paragraph.textAlign = align;
6804
+ return { paragraph, character };
6805
+ }
6806
+ function carriedAttributes(node, type) {
6807
+ const spec = _nullishCoalesce(type.spec.attrs, () => ( {}));
6808
+ return Object.fromEntries(Object.entries(node.attrs).filter(([key]) => key in spec));
6809
+ }
6810
+ function applyStyleToBlock(tr, pos, id, registry) {
6811
+ const node = tr.doc.nodeAt(pos);
6812
+ if (!node || !node.isTextblock) return false;
6813
+ const resolved = registry.resolve(id);
6814
+ const type = tr.doc.type.schema.nodes[resolved.block.type];
6815
+ if (!type) return false;
6816
+ const blockAttrs = _nullishCoalesce(resolved.block.attrs, () => ( {}));
6817
+ const isDefault = registry.defaultStyleFor(resolved.block.type, blockAttrs) === id;
6818
+ const attrs = { ...carriedAttributes(node, type), ...blockAttrs };
6819
+ if (STYLE_ID_ATTRIBUTE in (_nullishCoalesce(type.spec.attrs, () => ( {})))) attrs[STYLE_ID_ATTRIBUTE] = isDefault ? null : id;
6820
+ if ("textAlign" in (_nullishCoalesce(type.spec.attrs, () => ( {})))) {
6821
+ const fallback = _nullishCoalesce(type.spec.attrs.textAlign.default, () => ( null));
6822
+ attrs.textAlign = fallback === null ? null : _nullishCoalesce(resolved.paragraph.textAlign, () => ( fallback));
6823
+ }
6824
+ if (node.type === type && Object.entries(attrs).every(([k, v]) => node.attrs[k] === v)) return false;
6825
+ try {
6826
+ tr.setNodeMarkup(pos, type, attrs);
6827
+ } catch (e6) {
6828
+ try {
6829
+ tr.setBlockType(pos + 1, pos + 1, type, attrs);
6830
+ } catch (e7) {
6831
+ return false;
6832
+ }
6833
+ }
6834
+ return true;
6835
+ }
6836
+ function selectedBlocks(state) {
6837
+ const { from, to } = state.selection;
6838
+ const positions = [];
6839
+ state.doc.nodesBetween(from, to, (node, pos) => {
6840
+ if (node.isTextblock) {
6841
+ positions.push(pos);
6842
+ return false;
6843
+ }
6844
+ return true;
6845
+ });
6846
+ if (positions.length === 0 && state.selection.$from.parent.isTextblock) {
6847
+ positions.push(state.selection.$from.before());
6848
+ }
6849
+ return positions;
6850
+ }
6851
+ function setParagraphStyle(tr, state, id, registry) {
6852
+ const start2 = tr.steps.length;
6853
+ selectedBlocks(state).forEach((pos) => {
6854
+ applyStyleToBlock(tr, tr.mapping.slice(start2).map(pos), id, registry);
6855
+ });
6856
+ }
6857
+ function nextStyleTransaction(transactions, oldState, newState, registry) {
6858
+ if (transactions.length !== 1) return null;
6859
+ const [tr] = transactions;
6860
+ if (!tr.docChanged || tr.getMeta("uiEvent") || tr.getMeta("history$") || tr.getMeta("y-sync$")) {
6861
+ return null;
6862
+ }
6863
+ const old = oldState.selection;
6864
+ const $old = old.$from;
6865
+ if (!old.empty || !$old.parent.isTextblock || $old.parent.type.spec.code) return null;
6866
+ if ($old.parentOffset !== $old.parent.content.size) return null;
6867
+ if (newState.doc.content.size !== oldState.doc.content.size + 2) return null;
6868
+ const $new = newState.selection.$from;
6869
+ if (!newState.selection.empty || !$new.parent.isTextblock || $new.parent.content.size !== 0) return null;
6870
+ const depth = $new.depth;
6871
+ const index = $new.index(depth - 1);
6872
+ if (index === 0 || $new.depth !== $old.depth) return null;
6873
+ const previous = $new.node(depth - 1).child(index - 1);
6874
+ if (!previous.isTextblock || !previous.eq($old.parent)) return null;
6875
+ const style = registry.styleOfBlock($old.parent.type.name, $old.parent.attrs);
6876
+ if (!style) return null;
6877
+ const next = registry.nextStyleId(style);
6878
+ const current = registry.styleOfBlock($new.parent.type.name, $new.parent.attrs);
6879
+ const target = registry.resolve(next).block;
6880
+ const typeMatches = $new.parent.type.name === target.type && Object.entries(_nullishCoalesce(target.attrs, () => ( {}))).every(([k, v]) => $new.parent.attrs[k] === v);
6881
+ if (current === next && typeMatches) return null;
6882
+ const out = newState.tr;
6883
+ if (!applyStyleToBlock(out, $new.before(), next, registry)) return null;
6884
+ return out;
6885
+ }
6886
+ var CharacterStyle = _core.Mark.create({
6887
+ name: CHARACTER_STYLE_MARK_NAME,
6888
+ addAttributes() {
6889
+ return {
6890
+ [STYLE_ID_ATTRIBUTE]: {
6891
+ default: null,
6892
+ parseHTML: (el) => {
6893
+ const id = el.getAttribute("data-char-style");
6894
+ return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? id : null;
6895
+ },
6896
+ renderHTML: (attrs) => attrs[STYLE_ID_ATTRIBUTE] ? { "data-char-style": attrs[STYLE_ID_ATTRIBUTE] } : {}
6897
+ }
6898
+ };
6899
+ },
6900
+ parseHTML() {
6901
+ return [{ tag: "span[data-char-style]" }];
6902
+ },
6903
+ renderHTML({ HTMLAttributes }) {
6904
+ return ["span", _core.mergeAttributes.call(void 0, HTMLAttributes), 0];
6905
+ }
6906
+ });
6907
+ var ParagraphStyles = _core.Extension.create({
6908
+ name: "paragraphStyles",
6909
+ addOptions() {
6910
+ return {
6911
+ registry: null,
6912
+ types: ["paragraph", "heading", "codeBlock"],
6913
+ injectCSS: true,
6914
+ cssScope: ".ProseMirror",
6915
+ cssNonce: void 0,
6916
+ linkedCharacterStyles: true
6917
+ };
6918
+ },
6919
+ addStorage() {
6920
+ return { registry: _nullishCoalesce(this.options.registry, () => ( _chunk3CC7OPUQcjs.createStyleRegistry.call(void 0, ))) };
6921
+ },
6922
+ addExtensions() {
6923
+ return [CharacterStyle];
6924
+ },
6925
+ addGlobalAttributes() {
6926
+ return [
6927
+ {
6928
+ types: this.options.types,
6929
+ attributes: {
6930
+ [STYLE_ID_ATTRIBUTE]: {
6931
+ default: null,
6932
+ keepOnSplit: true,
6933
+ parseHTML: (el) => {
6934
+ const id = el.getAttribute("data-style");
6935
+ return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? id : null;
6936
+ },
6937
+ renderHTML: (attrs) => {
6938
+ const id = attrs[STYLE_ID_ATTRIBUTE];
6939
+ return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? { "data-style": id, class: `pixerate-style-${id}` } : {};
6940
+ }
6941
+ }
6942
+ }
6943
+ }
6944
+ ];
6945
+ },
6946
+ addCommands() {
6947
+ const registry = () => this.storage.registry;
6948
+ const editor = () => this.editor;
6949
+ return {
6950
+ setParagraphStyle: (id) => ({ state, tr, dispatch }) => {
6951
+ const reg = registry();
6952
+ if (!isParagraphStyleAvailable(editor(), reg, id)) return false;
6953
+ const { $from, $to, empty } = state.selection;
6954
+ const linked = this.options.linkedCharacterStyles ? reg.linkedCharacterStyle(id) : void 0;
6955
+ const partial = !empty && $from.sameParent($to) && $from.parent.isTextblock && ($from.parentOffset > 0 || $to.parentOffset < $from.parent.content.size);
6956
+ const markType = state.schema.marks[CHARACTER_STYLE_MARK_NAME];
6957
+ if (partial && linked && markType) {
6958
+ if (dispatch) {
6959
+ tr.addMark($from.pos, $to.pos, markType.create({ [STYLE_ID_ATTRIBUTE]: linked.id }));
6960
+ }
6961
+ return true;
6962
+ }
6963
+ if (dispatch) setParagraphStyle(tr, state, id, reg);
6964
+ return true;
6965
+ },
6966
+ clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunk3CC7OPUQcjs.NORMAL_STYLE_ID),
6967
+ setCharacterStyle: (id) => ({ commands }) => {
6968
+ if (_optionalChain([registry, 'call', _216 => _216(), 'access', _217 => _217.get, 'call', _218 => _218(id), 'optionalAccess', _219 => _219.kind]) !== "character") return false;
6969
+ return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
6970
+ },
6971
+ unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
6972
+ updateParagraphStyleFromSelection: (id) => ({ state, dispatch }) => {
6973
+ const reg = registry();
6974
+ const target = _nullishCoalesce(id, () => ( getParagraphStyleAt(state, reg)));
6975
+ const style = target ? reg.get(target) : void 0;
6976
+ if (!style || style.kind !== "paragraph") return false;
6977
+ if (dispatch) {
6978
+ const captured = captureSelectionFormat(state);
6979
+ reg.update(style.id, captured);
6980
+ }
6981
+ return true;
6982
+ },
6983
+ createParagraphStyleFromSelection: (name, options = {}) => ({ state, tr, dispatch }) => {
6984
+ const reg = registry();
6985
+ const trimmed = name.trim();
6986
+ if (!trimmed) return false;
6987
+ const id = _nullishCoalesce(options.id, () => ( reg.newId(trimmed)));
6988
+ if (!_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) || reg.get(id)) return false;
6989
+ const basedOn = options.basedOn === void 0 ? getParagraphStyleAt(state, reg) : options.basedOn;
6990
+ if (dispatch) {
6991
+ const captured = captureSelectionFormat(state);
6992
+ const definition = {
6993
+ id,
6994
+ name: trimmed,
6995
+ kind: "paragraph",
6996
+ basedOn: _nullishCoalesce(basedOn, () => ( _chunk3CC7OPUQcjs.NORMAL_STYLE_ID)),
6997
+ paragraph: captured.paragraph,
6998
+ character: captured.character,
6999
+ priority: 50,
7000
+ quick: true
7001
+ };
7002
+ reg.upsert(definition);
7003
+ if (options.apply !== false) setParagraphStyle(tr, state, id, reg);
7004
+ }
7005
+ return true;
7006
+ }
7007
+ };
7008
+ },
7009
+ addProseMirrorPlugins() {
7010
+ const registry = this.storage.registry;
7011
+ return [
7012
+ new (0, _state.Plugin)({
7013
+ key: paragraphStylesPluginKey,
7014
+ appendTransaction: (transactions, oldState, newState) => nextStyleTransaction(transactions, oldState, newState, registry)
7015
+ })
7016
+ ];
7017
+ },
7018
+ onBeforeCreate() {
7019
+ if (!this.options.injectCSS || typeof document === "undefined") return;
7020
+ const element = document.createElement("style");
7021
+ element.setAttribute("data-pixerate-paragraph-styles", "");
7022
+ if (this.options.cssNonce) element.nonce = this.options.cssNonce;
7023
+ document.head.appendChild(element);
7024
+ const scope = this.options.cssScope;
7025
+ const unsubscribe = this.storage.registry.subscribe(() => {
7026
+ element.textContent = this.storage.registry.toCSS({ scope });
7027
+ });
7028
+ this.storage.cleanup = () => {
7029
+ unsubscribe();
7030
+ element.remove();
7031
+ };
7032
+ },
7033
+ onDestroy() {
7034
+ _optionalChain([this, 'access', _220 => _220.storage, 'access', _221 => _221.cleanup, 'optionalCall', _222 => _222()]);
7035
+ }
7036
+ });
7037
+ var EMPTY_STYLES = Object.freeze({
7038
+ gallery: [],
7039
+ styles: [],
7040
+ characterStyles: [],
7041
+ currentStyleId: null,
7042
+ version: -1
7043
+ });
7044
+ function createParagraphStylesStore(editor) {
7045
+ const registry = getStyleRegistry(editor);
7046
+ const listeners = /* @__PURE__ */ new Set();
7047
+ let snapshot = EMPTY_STYLES;
7048
+ let unsubscribeRegistry = null;
7049
+ const compute = () => {
7050
+ if (!editor || editor.isDestroyed || !registry) return EMPTY_STYLES;
7051
+ const { version } = registry.getSnapshot();
7052
+ const currentStyleId = getParagraphStyleAt(editor.state, registry);
7053
+ if (snapshot.version === version && snapshot.currentStyleId === currentStyleId) return snapshot;
7054
+ if (snapshot.version === version) return { ...snapshot, currentStyleId };
7055
+ const styles = registry.list("paragraph").filter((style) => !style.hidden && isParagraphStyleAvailable(editor, registry, style.id));
7056
+ return {
7057
+ gallery: styles.filter((style) => style.quick),
7058
+ styles,
7059
+ characterStyles: registry.list("character").filter((style) => !style.hidden),
7060
+ currentStyleId,
7061
+ version
7062
+ };
7063
+ };
7064
+ const update = () => {
7065
+ const next = compute();
7066
+ if (next !== snapshot) {
7067
+ snapshot = next;
7068
+ listeners.forEach((listener) => listener());
7069
+ }
7070
+ };
7071
+ const detach = () => {
7072
+ _optionalChain([editor, 'optionalAccess', _223 => _223.off, 'call', _224 => _224("transaction", update)]);
7073
+ _optionalChain([unsubscribeRegistry, 'optionalCall', _225 => _225()]);
7074
+ unsubscribeRegistry = null;
7075
+ };
7076
+ return {
7077
+ getSnapshot: () => {
7078
+ if (!listeners.size) snapshot = compute();
7079
+ return snapshot;
7080
+ },
7081
+ subscribe(listener) {
7082
+ if (!listeners.size) {
7083
+ snapshot = compute();
7084
+ _optionalChain([editor, 'optionalAccess', _226 => _226.on, 'call', _227 => _227("transaction", update)]);
7085
+ unsubscribeRegistry = registry ? registry.subscribe(update) : null;
7086
+ }
7087
+ listeners.add(listener);
7088
+ return () => {
7089
+ listeners.delete(listener);
7090
+ if (!listeners.size) detach();
7091
+ };
7092
+ },
7093
+ destroy() {
7094
+ detach();
7095
+ listeners.clear();
7096
+ }
7097
+ };
7098
+ }
7099
+
6472
7100
  // src/extensions/rich-text-preset.ts
6473
- var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _187 => _187[name]]) || _optionalChain([mod, 'optionalAccess', _188 => _188.default, 'optionalAccess', _189 => _189[name]]) || _optionalChain([mod, 'optionalAccess', _190 => _190.default, 'optionalAccess', _191 => _191.default]) || _optionalChain([mod, 'optionalAccess', _192 => _192.default]) || mod;
7101
+ var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _228 => _228[name]]) || _optionalChain([mod, 'optionalAccess', _229 => _229.default, 'optionalAccess', _230 => _230[name]]) || _optionalChain([mod, 'optionalAccess', _231 => _231.default, 'optionalAccess', _232 => _232.default]) || _optionalChain([mod, 'optionalAccess', _233 => _233.default]) || mod;
6474
7102
  var StarterKit = resolveExt3(_StarterKit, "StarterKit");
6475
7103
  var Color = resolveExt3(_Color, "Color");
6476
7104
  var Highlight = resolveExt3(_Highlight, "Highlight");
@@ -6491,7 +7119,7 @@ function createRichTextPreset(options = {}) {
6491
7119
  openLinksOnClick = false,
6492
7120
  enableSmilies = true,
6493
7121
  enableColorHighlighter = true,
6494
- headingLevels = [1, 2, 3, 4]
7122
+ headingLevels: headingLevels2 = [1, 2, 3, 4]
6495
7123
  } = options;
6496
7124
  const extensions2 = [
6497
7125
  StarterKit.configure({
@@ -6506,7 +7134,7 @@ function createRichTextPreset(options = {}) {
6506
7134
  }
6507
7135
  },
6508
7136
  heading: {
6509
- levels: headingLevels,
7137
+ levels: headingLevels2,
6510
7138
  HTMLAttributes: {
6511
7139
  class: "font-bold tracking-tight"
6512
7140
  }
@@ -6551,7 +7179,7 @@ function createRichTextPreset(options = {}) {
6551
7179
  find: /^\s*(\[([ |x])?\])\s$/i,
6552
7180
  type: this.type,
6553
7181
  getAttributes: (match) => ({
6554
- checked: _optionalChain([match, 'access', _193 => _193[2], 'optionalAccess', _194 => _194.toLowerCase, 'call', _195 => _195()]) === "x"
7182
+ checked: _optionalChain([match, 'access', _234 => _234[2], 'optionalAccess', _235 => _235.toLowerCase, 'call', _236 => _236()]) === "x"
6555
7183
  })
6556
7184
  })
6557
7185
  ];
@@ -6565,6 +7193,9 @@ function createRichTextPreset(options = {}) {
6565
7193
  placeholder: typeof placeholder === "function" ? placeholder : () => placeholder
6566
7194
  })
6567
7195
  ];
7196
+ if (options.table !== false) {
7197
+ extensions2.push(..._chunkHDYMLS3Xcjs.createTableExtensions.call(void 0, optionObject(options.table)));
7198
+ }
6568
7199
  if (characterLimit) {
6569
7200
  extensions2.push(
6570
7201
  CharacterCount.configure({
@@ -6625,7 +7256,7 @@ function createRichTextPreset(options = {}) {
6625
7256
  }
6626
7257
  if (options.trackChanges) {
6627
7258
  extensions2.push(
6628
- typeof options.trackChanges === "object" ? _chunkD27YFC46cjs.TrackChanges.configure(options.trackChanges) : _chunkD27YFC46cjs.TrackChanges,
7259
+ typeof options.trackChanges === "object" ? _chunkIFHKKVXHcjs.TrackChanges.configure(options.trackChanges) : _chunkIFHKKVXHcjs.TrackChanges,
6629
7260
  DocumentCompare
6630
7261
  );
6631
7262
  }
@@ -6668,6 +7299,9 @@ function createRichTextPreset(options = {}) {
6668
7299
  if (options.findReplace) {
6669
7300
  extensions2.push(FindReplace.configure(optionObject(options.findReplace)));
6670
7301
  }
7302
+ if (options.paragraphStyles) {
7303
+ extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
7304
+ }
6671
7305
  return extensions2;
6672
7306
  }
6673
7307
 
@@ -6716,7 +7350,7 @@ function createFindReplaceCommands(editor, options = {}) {
6716
7350
  const hasMatches = () => {
6717
7351
  const ok = usable(editor);
6718
7352
  if (ok !== true) return ok;
6719
- return _optionalChain([state, 'call', _196 => _196(), 'optionalAccess', _197 => _197.matches, 'access', _198 => _198.length]) ? true : "No matches.";
7353
+ return _optionalChain([state, 'call', _237 => _237(), 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]) ? true : "No matches.";
6720
7354
  };
6721
7355
  const apply = (params) => {
6722
7356
  const split = splitParams(params);
@@ -6724,7 +7358,7 @@ function createFindReplaceCommands(editor, options = {}) {
6724
7358
  };
6725
7359
  const failIfInvalid = () => {
6726
7360
  const s = state();
6727
- if (_optionalChain([s, 'optionalAccess', _199 => _199.error])) throw new Error(s.error.message);
7361
+ if (_optionalChain([s, 'optionalAccess', _240 => _240.error])) throw new Error(s.error.message);
6728
7362
  };
6729
7363
  return [
6730
7364
  {
@@ -6763,9 +7397,9 @@ function createFindReplaceCommands(editor, options = {}) {
6763
7397
  failIfInvalid();
6764
7398
  const s = state();
6765
7399
  return {
6766
- count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _200 => _200.matches, 'access', _201 => _201.length]), () => ( 0)),
6767
- truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _202 => _202.truncated]), () => ( false)),
6768
- matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _203 => _203.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
7400
+ count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches, 'access', _242 => _242.length]), () => ( 0)),
7401
+ truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _243 => _243.truncated]), () => ( false)),
7402
+ matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _244 => _244.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6769
7403
  };
6770
7404
  }
6771
7405
  },
@@ -6792,11 +7426,11 @@ function createFindReplaceCommands(editor, options = {}) {
6792
7426
  description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
6793
7427
  params: searchParams(true),
6794
7428
  ...scope,
6795
- enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _204 => _204.query]) !== void 0 ? usable(editor) : hasMatches(),
7429
+ enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _245 => _245.query]) !== void 0 ? usable(editor) : hasMatches(),
6796
7430
  run: (_ctx, params) => {
6797
7431
  apply(params);
6798
7432
  failIfInvalid();
6799
- const count = _nullishCoalesce(_optionalChain([state, 'call', _205 => _205(), 'optionalAccess', _206 => _206.matches, 'access', _207 => _207.length]), () => ( 0));
7433
+ const count = _nullishCoalesce(_optionalChain([state, 'call', _246 => _246(), 'optionalAccess', _247 => _247.matches, 'access', _248 => _248.length]), () => ( 0));
6800
7434
  if (count) editor.commands.replaceAll();
6801
7435
  return { replaced: count };
6802
7436
  }
@@ -6808,6 +7442,76 @@ function validateFindPattern(query, options = {}) {
6808
7442
  return result.ok ? null : result.error;
6809
7443
  }
6810
7444
 
7445
+ // src/extensions/table/commands.ts
7446
+ var PARAMS = {
7447
+ insertTable: {
7448
+ type: "object",
7449
+ properties: {
7450
+ rows: { type: "integer", minimum: 1, maximum: _chunkHDYMLS3Xcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
7451
+ cols: { type: "integer", minimum: 1, maximum: _chunkHDYMLS3Xcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
7452
+ withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
7453
+ },
7454
+ additionalProperties: false
7455
+ },
7456
+ setCellAlignment: {
7457
+ type: "object",
7458
+ properties: {
7459
+ align: {
7460
+ type: ["string", "null"],
7461
+ enum: ["left", "center", "right", "justify", null],
7462
+ description: "Horizontal alignment; null clears it."
7463
+ }
7464
+ },
7465
+ required: ["align"],
7466
+ additionalProperties: false
7467
+ },
7468
+ setCellBackground: {
7469
+ type: "object",
7470
+ properties: {
7471
+ color: { type: ["string", "null"], description: "CSS color (e.g. #fde68a); null clears it." }
7472
+ },
7473
+ required: ["color"],
7474
+ additionalProperties: false
7475
+ }
7476
+ };
7477
+ function createTableCommands(editor, options = {}) {
7478
+ const prefix = _nullishCoalesce(options.prefix, () => ( "table."));
7479
+ const group = _nullishCoalesce(options.group, () => ( "Table"));
7480
+ const scope = options.scope ? { scope: options.scope } : {};
7481
+ const focus = _nullishCoalesce(options.focus, () => ( true));
7482
+ return _chunkHDYMLS3Xcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
7483
+ const params = PARAMS[action];
7484
+ return {
7485
+ id: `${prefix}${action}`,
7486
+ label,
7487
+ group,
7488
+ keywords: [...keywords],
7489
+ description,
7490
+ ...params ? { params } : {},
7491
+ ...scope,
7492
+ enabled: (_ctx, p) => _chunkHDYMLS3Xcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
7493
+ run: (_ctx, p) => {
7494
+ if (!_chunkHDYMLS3Xcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
7495
+ const reason = _chunkHDYMLS3Xcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
7496
+ throw new Error(reason === true ? `${label} did not change the document.` : reason);
7497
+ }
7498
+ const state = _chunkHDYMLS3Xcjs.getTableState.call(void 0, editor);
7499
+ return {
7500
+ done: true,
7501
+ table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
7502
+ };
7503
+ }
7504
+ };
7505
+ });
7506
+ }
7507
+
7508
+
7509
+
7510
+
7511
+
7512
+
7513
+
7514
+
6811
7515
 
6812
7516
 
6813
7517
 
@@ -6932,5 +7636,5 @@ function validateFindPattern(query, options = {}) {
6932
7636
 
6933
7637
 
6934
7638
 
6935
- exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.ZipError = ZipError; exports.DEFAULT_ZIP_MAX_ENTRIES = DEFAULT_ZIP_MAX_ENTRIES; exports.DEFAULT_ZIP_MAX_TOTAL_SIZE = DEFAULT_ZIP_MAX_TOTAL_SIZE; exports.zipCrc32 = zipCrc32; exports.isUnsafeZipPath = isUnsafeZipPath; exports.ZipArchive = ZipArchive; exports.readZip = readZip; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern;
6936
- //# sourceMappingURL=chunk-SBCZ6RN5.cjs.map
7639
+ exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
7640
+ //# sourceMappingURL=chunk-YOMYSFJU.cjs.map