@pixerate/editor 0.24.0 → 0.25.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 (133) hide show
  1. package/README.md +71 -1
  2. package/THIRD_PARTY_NOTICES.md +29 -0
  3. package/dist/agent/index.cjs +10 -9
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +1 -1
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +4 -3
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +3173 -340
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +617 -4
  12. package/dist/canvas/index.d.ts +617 -4
  13. package/dist/canvas/index.js +3105 -272
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  16. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  17. package/dist/{chunk-XNORY7M6.cjs → chunk-7WISYZFO.cjs} +105 -50
  18. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  19. package/dist/{chunk-OLZJXL4R.cjs → chunk-AL6JMGWW.cjs} +59 -25
  20. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  21. package/dist/chunk-BVP3TSLH.cjs +69 -0
  22. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  23. package/dist/{chunk-MCSJFWAO.cjs → chunk-C7P22VIP.cjs} +670 -96
  24. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  25. package/dist/{chunk-PGNZKFQS.js → chunk-ECCCYKGL.js} +76 -21
  26. package/dist/chunk-ECCCYKGL.js.map +1 -0
  27. package/dist/{chunk-3CN2WD3X.js → chunk-FH6F67DN.js} +646 -72
  28. package/dist/chunk-FH6F67DN.js.map +1 -0
  29. package/dist/chunk-HRMEDT2L.js +1406 -0
  30. package/dist/chunk-HRMEDT2L.js.map +1 -0
  31. package/dist/{chunk-ITBSKI26.js → chunk-IXHSYOVY.js} +941 -9
  32. package/dist/chunk-IXHSYOVY.js.map +1 -0
  33. package/dist/{chunk-FODNLX5N.js → chunk-NAXVVS5I.js} +38 -4
  34. package/dist/chunk-NAXVVS5I.js.map +1 -0
  35. package/dist/chunk-O5RYH2PG.js +69 -0
  36. package/dist/chunk-O5RYH2PG.js.map +1 -0
  37. package/dist/{chunk-SBCZ6RN5.cjs → chunk-PO6A6QQH.cjs} +1039 -107
  38. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  39. package/dist/{chunk-3LV6RRPH.js → chunk-QGYDWPRM.js} +2 -2
  40. package/dist/{chunk-U5KWZU4X.js → chunk-RR7F5GUM.js} +2632 -129
  41. package/dist/chunk-RR7F5GUM.js.map +1 -0
  42. package/dist/{chunk-5S3Z4PPF.js → chunk-UAKDG62Z.js} +232 -25
  43. package/dist/chunk-UAKDG62Z.js.map +1 -0
  44. package/dist/{chunk-SML64VJG.cjs → chunk-V3CHHWOE.cjs} +4 -4
  45. package/dist/{chunk-SML64VJG.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  46. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  47. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  48. package/dist/{chunk-D27YFC46.cjs → chunk-X4N4WUKB.cjs} +267 -60
  49. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  50. package/dist/commands/index.cjs +74 -1
  51. package/dist/commands/index.cjs.map +1 -1
  52. package/dist/commands/index.d.cts +34 -1
  53. package/dist/commands/index.d.ts +34 -1
  54. package/dist/commands/index.js +73 -0
  55. package/dist/commands/index.js.map +1 -1
  56. package/dist/compare/index.cjs +3 -3
  57. package/dist/compare/index.d.cts +1 -1
  58. package/dist/compare/index.d.ts +1 -1
  59. package/dist/compare/index.js +2 -2
  60. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  61. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  62. package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
  63. package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
  64. package/dist/extensions/index.cjs +53 -6
  65. package/dist/extensions/index.cjs.map +1 -1
  66. package/dist/extensions/index.d.cts +12 -4
  67. package/dist/extensions/index.d.ts +12 -4
  68. package/dist/extensions/index.js +53 -6
  69. package/dist/generation/index.cjs +1013 -69
  70. package/dist/generation/index.cjs.map +1 -1
  71. package/dist/generation/index.d.cts +474 -13
  72. package/dist/generation/index.d.ts +474 -13
  73. package/dist/generation/index.js +976 -32
  74. package/dist/generation/index.js.map +1 -1
  75. package/dist/image-editor/index.cjs +3385 -1275
  76. package/dist/image-editor/index.cjs.map +1 -1
  77. package/dist/image-editor/index.d.cts +693 -128
  78. package/dist/image-editor/index.d.ts +693 -128
  79. package/dist/image-editor/index.js +3325 -1215
  80. package/dist/image-editor/index.js.map +1 -1
  81. package/dist/{index-fJrlkJCd.d.ts → index-7a6bHTLy.d.ts} +494 -5
  82. package/dist/{index-BhJBSm2d.d.cts → index-Csd5qI8u.d.cts} +494 -5
  83. package/dist/index.cjs +1491 -45
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.d.cts +110 -19
  86. package/dist/index.d.ts +110 -19
  87. package/dist/index.js +1464 -18
  88. package/dist/index.js.map +1 -1
  89. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  90. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  91. package/dist/model-C1zApQM8.d.cts +219 -0
  92. package/dist/model-C1zApQM8.d.ts +219 -0
  93. package/dist/persistence/index.d.cts +3 -120
  94. package/dist/persistence/index.d.ts +3 -120
  95. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
  96. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
  97. package/dist/serializers/index.cjs +12 -4
  98. package/dist/serializers/index.cjs.map +1 -1
  99. package/dist/serializers/index.d.cts +39 -12
  100. package/dist/serializers/index.d.ts +39 -12
  101. package/dist/serializers/index.js +12 -4
  102. package/dist/spreadsheet/index.cjs +127 -3
  103. package/dist/spreadsheet/index.cjs.map +1 -1
  104. package/dist/spreadsheet/index.d.cts +431 -11
  105. package/dist/spreadsheet/index.d.ts +431 -11
  106. package/dist/spreadsheet/index.js +127 -3
  107. package/dist/storage-BpFfspHm.d.cts +120 -0
  108. package/dist/storage-BpFfspHm.d.ts +120 -0
  109. package/dist/tokens/index.cjs +115 -0
  110. package/dist/tokens/index.cjs.map +1 -0
  111. package/dist/tokens/index.d.cts +212 -0
  112. package/dist/tokens/index.d.ts +212 -0
  113. package/dist/tokens/index.js +115 -0
  114. package/dist/tokens/index.js.map +1 -0
  115. package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
  116. package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
  117. package/package.json +6 -1
  118. package/dist/chunk-3CN2WD3X.js.map +0 -1
  119. package/dist/chunk-5S3Z4PPF.js.map +0 -1
  120. package/dist/chunk-D27YFC46.cjs.map +0 -1
  121. package/dist/chunk-FODNLX5N.js.map +0 -1
  122. package/dist/chunk-ITBSKI26.js.map +0 -1
  123. package/dist/chunk-MA2F5KHF.cjs +0 -3223
  124. package/dist/chunk-MA2F5KHF.cjs.map +0 -1
  125. package/dist/chunk-MCSJFWAO.cjs.map +0 -1
  126. package/dist/chunk-OLZJXL4R.cjs.map +0 -1
  127. package/dist/chunk-PGNZKFQS.js.map +0 -1
  128. package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
  129. package/dist/chunk-U5KWZU4X.js.map +0 -1
  130. package/dist/chunk-XNORY7M6.cjs.map +0 -1
  131. package/dist/controller-BhLLAoi8.d.cts +0 -1000
  132. package/dist/controller-BhLLAoi8.d.ts +0 -1000
  133. /package/dist/{chunk-3LV6RRPH.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -1,6 +1,6 @@
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; var _class4; var _class5;
2
2
 
3
- var _chunkOLZJXL4Rcjs = require('./chunk-OLZJXL4R.cjs');
3
+ var _chunkAL6JMGWWcjs = require('./chunk-AL6JMGWW.cjs');
4
4
 
5
5
 
6
6
 
@@ -16,20 +16,20 @@ var _chunkMKA3AHLVcjs = require('./chunk-MKA3AHLV.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkSML64VJGcjs = require('./chunk-SML64VJG.cjs');
19
+ var _chunkV3CHHWOEcjs = require('./chunk-V3CHHWOE.cjs');
20
20
 
21
21
 
22
22
 
23
23
 
24
24
 
25
- var _chunkXNORY7M6cjs = require('./chunk-XNORY7M6.cjs');
25
+ var _chunk7WISYZFOcjs = require('./chunk-7WISYZFO.cjs');
26
26
 
27
27
 
28
28
 
29
29
 
30
30
 
31
31
 
32
- var _chunkD27YFC46cjs = require('./chunk-D27YFC46.cjs');
32
+ var _chunkX4N4WUKBcjs = require('./chunk-X4N4WUKB.cjs');
33
33
 
34
34
  // src/extensions/gradient-text.ts
35
35
  var _core = require('@tiptap/core');
@@ -601,10 +601,47 @@ var Mention = BaseMention.extend({
601
601
  if (!attributes.color) return {};
602
602
  return { "data-color": attributes.color };
603
603
  }
604
+ },
605
+ // Role of an asset mention (`reference`, `style`, `start_frame`, …). The
606
+ // node attribute is `assetRole` so entities that already carry a `role`
607
+ // (e.g. a user's job title) passed as suggestion props do not set it.
608
+ assetRole: {
609
+ default: null,
610
+ parseHTML: (element) => {
611
+ const role = element.getAttribute("data-role");
612
+ return role && MENTION_ROLE_PATTERN.test(role) ? role : null;
613
+ },
614
+ renderHTML: (attributes) => {
615
+ if (!attributes.assetRole) return {};
616
+ return { "data-role": attributes.assetRole };
617
+ }
604
618
  }
605
619
  };
606
620
  }
607
621
  });
622
+ var MENTION_ROLE_PATTERN = /^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9])?$/;
623
+ function getMentionNodes(editor) {
624
+ const result = [];
625
+ editor.state.doc.descendants((node, pos) => {
626
+ if (_optionalChain([node, 'access', _36 => _36.type, 'optionalAccess', _37 => _37.name]) !== "mention") return;
627
+ result.push({
628
+ pos,
629
+ id: _nullishCoalesce(node.attrs.id, () => ( "")),
630
+ label: _nullishCoalesce(node.attrs.label, () => ( "")),
631
+ ...node.attrs.type ? { type: node.attrs.type } : {},
632
+ ...node.attrs.assetRole ? { role: node.attrs.assetRole } : {}
633
+ });
634
+ });
635
+ return result;
636
+ }
637
+ function setMentionRoleAt(editor, pos, role) {
638
+ const node = _optionalChain([editor, 'optionalAccess', _38 => _38.state, 'optionalAccess', _39 => _39.doc, 'optionalAccess', _40 => _40.nodeAt, 'call', _41 => _41(pos)]);
639
+ if (!node || node.type.name !== "mention") return false;
640
+ if (role !== null && !MENTION_ROLE_PATTERN.test(role)) return false;
641
+ const tr = editor.state.tr.setNodeMarkup(pos, void 0, { ...node.attrs, assetRole: role });
642
+ editor.view.dispatch(tr);
643
+ return true;
644
+ }
608
645
  function createMentionExtension(options = {}) {
609
646
  const { HTMLAttributes = {}, ...rest } = options;
610
647
  return Mention.configure({
@@ -1626,13 +1663,13 @@ var Markdown = _core.Extension.create({
1626
1663
  });
1627
1664
 
1628
1665
  // 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;
1666
+ 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
1667
  var Markdown2 = resolveExt(Markdown, "Markdown");
1631
1668
 
1632
1669
  // src/extensions/image.ts
1633
1670
  var _extensionimage = require('@tiptap/extension-image'); var _Image = _interopRequireWildcard(_extensionimage);
1634
1671
 
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;
1672
+ 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
1673
  var BaseImage = resolveExt2(_Image, "Image");
1637
1674
  var imagePastePluginKey = new (0, _state.PluginKey)("imagePasteHandler");
1638
1675
  function insertImageNode(view, src, alt) {
@@ -1739,7 +1776,7 @@ function handleImageInsertion(view, file, options) {
1739
1776
  var Image2 = BaseImage.extend({
1740
1777
  addOptions() {
1741
1778
  return {
1742
- ..._optionalChain([this, 'access', _48 => _48.parent, 'optionalCall', _49 => _49()]),
1779
+ ..._optionalChain([this, 'access', _54 => _54.parent, 'optionalCall', _55 => _55()]),
1743
1780
  allowBase64: true,
1744
1781
  maxBase64Size: 65536,
1745
1782
  enablePaste: true,
@@ -1752,7 +1789,7 @@ var Image2 = BaseImage.extend({
1752
1789
  };
1753
1790
  },
1754
1791
  addProseMirrorPlugins() {
1755
- const parentPlugins = _optionalChain([this, 'access', _50 => _50.parent, 'optionalCall', _51 => _51()]) || [];
1792
+ const parentPlugins = _optionalChain([this, 'access', _56 => _56.parent, 'optionalCall', _57 => _57()]) || [];
1756
1793
  const options = this.options;
1757
1794
  if (!options.enablePaste && !options.enableDrop) {
1758
1795
  return parentPlugins;
@@ -1762,7 +1799,7 @@ var Image2 = BaseImage.extend({
1762
1799
  props: {
1763
1800
  handlePaste(view, event) {
1764
1801
  if (!options.enablePaste) return false;
1765
- const items = Array.from(_optionalChain([event, 'access', _52 => _52.clipboardData, 'optionalAccess', _53 => _53.items]) || []);
1802
+ const items = Array.from(_optionalChain([event, 'access', _58 => _58.clipboardData, 'optionalAccess', _59 => _59.items]) || []);
1766
1803
  const imageItems = items.filter(
1767
1804
  (item) => item.kind === "file" && item.type.startsWith("image/")
1768
1805
  );
@@ -1777,7 +1814,7 @@ var Image2 = BaseImage.extend({
1777
1814
  },
1778
1815
  handleDrop(view, event) {
1779
1816
  if (!options.enableDrop) return false;
1780
- const files = Array.from(_optionalChain([event, 'access', _54 => _54.dataTransfer, 'optionalAccess', _55 => _55.files]) || []);
1817
+ const files = Array.from(_optionalChain([event, 'access', _60 => _60.dataTransfer, 'optionalAccess', _61 => _61.files]) || []);
1781
1818
  const imageFiles = files.filter((f) => f.type.startsWith("image/"));
1782
1819
  if (imageFiles.length === 0) return false;
1783
1820
  event.preventDefault();
@@ -1835,8 +1872,8 @@ function getCommentAnchors(doc) {
1835
1872
  function getCommentIdsAt(state, pos = state.selection.from) {
1836
1873
  const $pos = state.doc.resolve(pos);
1837
1874
  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]), () => ( []))
1875
+ ..._nullishCoalesce(_optionalChain([$pos, 'access', _62 => _62.nodeAfter, 'optionalAccess', _63 => _63.marks]), () => ( [])),
1876
+ ..._nullishCoalesce(_optionalChain([$pos, 'access', _64 => _64.nodeBefore, 'optionalAccess', _65 => _65.marks]), () => ( []))
1840
1877
  ];
1841
1878
  const ids = [];
1842
1879
  marks.forEach((m) => {
@@ -1847,7 +1884,7 @@ function getCommentIdsAt(state, pos = state.selection.from) {
1847
1884
  return ids;
1848
1885
  }
1849
1886
  function getCommentStore(editor) {
1850
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _60 => _60.storage, 'optionalAccess', _61 => _61[COMMENT_MARK_NAME], 'optionalAccess', _62 => _62.store]), () => ( null));
1887
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _66 => _66.storage, 'optionalAccess', _67 => _67[COMMENT_MARK_NAME], 'optionalAccess', _68 => _68.store]), () => ( null));
1851
1888
  }
1852
1889
  function resolveAuthor(author) {
1853
1890
  return typeof author === "function" ? author() : author;
@@ -1871,7 +1908,7 @@ var Comments = _core.Mark.create({
1871
1908
  },
1872
1909
  addStorage() {
1873
1910
  return {
1874
- store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkD27YFC46cjs.CommentStore)())),
1911
+ store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkX4N4WUKBcjs.CommentStore)())),
1875
1912
  // tiptap-markdown: comments are not part of the exported markdown.
1876
1913
  markdown: { serialize: { open: "", close: "" }, parse: {} }
1877
1914
  };
@@ -1898,7 +1935,7 @@ var Comments = _core.Mark.create({
1898
1935
  const { from, to, empty } = state.selection;
1899
1936
  if (empty) return false;
1900
1937
  if (dispatch) {
1901
- const id = _nullishCoalesce(options.id, () => ( _chunkD27YFC46cjs.createReviewId.call(void 0, "comment")));
1938
+ const id = _nullishCoalesce(options.id, () => ( _chunkX4N4WUKBcjs.createReviewId.call(void 0, "comment")));
1902
1939
  tr.addMark(from, to, this.type.create({ commentId: id }));
1903
1940
  tr.setMeta(commentsPluginKey, "refresh");
1904
1941
  store().createThread({
@@ -1970,7 +2007,7 @@ var Comments = _core.Mark.create({
1970
2007
  const decorations = [];
1971
2008
  findCommentRanges(doc).forEach((ranges, id) => {
1972
2009
  const thread = store.getThread(id);
1973
- const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _63 => _63.resolved]), () => ( false));
2010
+ const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _69 => _69.resolved]), () => ( false));
1974
2011
  const active = snapshot.activeThreadId === id;
1975
2012
  const cls = [
1976
2013
  resolved ? options.resolvedClass : options.commentClass,
@@ -2003,7 +2040,7 @@ var Comments = _core.Mark.create({
2003
2040
  scheduled = false;
2004
2041
  if (destroyed) return;
2005
2042
  sync();
2006
- if (_optionalChain([cache, 'optionalAccess', _64 => _64.snapshot]) !== store.getSnapshot()) {
2043
+ if (_optionalChain([cache, 'optionalAccess', _70 => _70.snapshot]) !== store.getSnapshot()) {
2007
2044
  view.dispatch(
2008
2045
  view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
2009
2046
  );
@@ -2032,17 +2069,17 @@ var Comments = _core.Mark.create({
2032
2069
  }
2033
2070
  });
2034
2071
  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)]);
2072
+ 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
2073
  return ext ? resolveAuthor(ext.options.author) : null;
2037
2074
  }
2038
2075
 
2039
2076
  // src/extensions/document-compare.ts
2040
2077
 
2041
2078
  function trackChangesAuthor(state) {
2042
- return _optionalChain([_chunkD27YFC46cjs.trackChangesPluginKey, 'access', _69 => _69.getState, 'call', _70 => _70(state), 'optionalAccess', _71 => _71.author]);
2079
+ return _optionalChain([_chunkX4N4WUKBcjs.trackChangesPluginKey, 'access', _75 => _75.getState, 'call', _76 => _76(state), 'optionalAccess', _77 => _77.author]);
2043
2080
  }
2044
2081
  function compareInEditor(editor, original, revised, options = {}) {
2045
- return _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
2082
+ return _chunkAL6JMGWWcjs.compareDocuments.call(void 0, original, revised, {
2046
2083
  ...options,
2047
2084
  author: _nullishCoalesce(options.author, () => ( trackChangesAuthor(editor.state))),
2048
2085
  schema: editor.schema
@@ -2052,7 +2089,7 @@ function applyDocumentComparison(editor, original, revised, options = {}) {
2052
2089
  const result = compareInEditor(editor, original, revised, options);
2053
2090
  const { state } = editor;
2054
2091
  const tr = state.tr.replaceWith(0, state.doc.content.size, result.doc.content);
2055
- tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
2092
+ tr.setMeta(_chunkX4N4WUKBcjs.TRACK_CHANGES_SKIP_META, true);
2056
2093
  editor.view.dispatch(tr);
2057
2094
  return result;
2058
2095
  }
@@ -2068,14 +2105,14 @@ var DocumentCompare = _core.Extension.create({
2068
2105
  return {
2069
2106
  setContentFromComparison: (original, revised, options = {}) => ({ state, tr, dispatch }) => {
2070
2107
  const merged = { ...this.options.compare, ...options };
2071
- const result = _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
2108
+ const result = _chunkAL6JMGWWcjs.compareDocuments.call(void 0, original, revised, {
2072
2109
  ...merged,
2073
2110
  author: _nullishCoalesce(merged.author, () => ( trackChangesAuthor(state))),
2074
2111
  schema: state.schema
2075
2112
  });
2076
2113
  if (dispatch) {
2077
2114
  tr.replaceWith(0, tr.doc.content.size, result.doc.content);
2078
- tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
2115
+ tr.setMeta(_chunkX4N4WUKBcjs.TRACK_CHANGES_SKIP_META, true);
2079
2116
  this.storage.lastResult = result;
2080
2117
  }
2081
2118
  return true;
@@ -2173,7 +2210,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2173
2210
  * wildcards, then higher `priority`, then the most recently registered.
2174
2211
  */
2175
2212
  find(query) {
2176
- const fileName = _nullishCoalesce(_optionalChain([query, 'access', _72 => _72.fileName, 'optionalAccess', _73 => _73.toLowerCase, 'call', _74 => _74()]), () => ( ""));
2213
+ const fileName = _nullishCoalesce(_optionalChain([query, 'access', _78 => _78.fileName, 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]), () => ( ""));
2177
2214
  const mime = normalizeMimeType(query.mimeType);
2178
2215
  let best;
2179
2216
  let bestScore = 0;
@@ -2249,7 +2286,13 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2249
2286
  { fileName }
2250
2287
  );
2251
2288
  }
2252
- const context = createImportContext(input, { fileName, mimeType, target: adapter.target, registry: this });
2289
+ const context = createImportContext(input, {
2290
+ fileName,
2291
+ mimeType,
2292
+ target: adapter.target,
2293
+ registry: this,
2294
+ options: _optionalChain([options, 'access', _81 => _81.adapterOptions, 'optionalAccess', _82 => _82[adapter.id]])
2295
+ });
2253
2296
  try {
2254
2297
  const result = await adapter.import(input, context);
2255
2298
  return { adapterId: adapter.id, target: adapter.target, fileName, mimeType, result };
@@ -2628,7 +2671,7 @@ function descendants(el, localName) {
2628
2671
  }
2629
2672
  function toggle(el) {
2630
2673
  if (!el) return void 0;
2631
- const value = _optionalChain([attr, 'call', _75 => _75(el, "val"), 'optionalAccess', _76 => _76.toLowerCase, 'call', _77 => _77()]);
2674
+ const value = _optionalChain([attr, 'call', _83 => _83(el, "val"), 'optionalAccess', _84 => _84.toLowerCase, 'call', _85 => _85()]);
2632
2675
  return value === void 0 || !["0", "false", "off", "none"].includes(value);
2633
2676
  }
2634
2677
  function parseXml(Parser, xml, partName) {
@@ -2669,7 +2712,7 @@ async function readRelationships(zip, Parser, partPath) {
2669
2712
  const id = attr(rel, "Id");
2670
2713
  const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
2671
2714
  if (!id) return;
2672
- const external = _optionalChain([attr, 'call', _78 => _78(rel, "TargetMode"), 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]) === "external";
2715
+ const external = _optionalChain([attr, 'call', _86 => _86(rel, "TargetMode"), 'optionalAccess', _87 => _87.toLowerCase, 'call', _88 => _88()]) === "external";
2673
2716
  rels.set(id, {
2674
2717
  type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
2675
2718
  target: external ? target : resolvePartPath(baseDir, target),
@@ -2702,7 +2745,7 @@ async function loadImages(zip, root, rels, options) {
2702
2745
  for (const id of ids) {
2703
2746
  const rel = rels.get(id);
2704
2747
  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()]), () => ( ""))];
2748
+ 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
2749
  const entry = zip.get(rel.target);
2707
2750
  if (!mime || !entry || entry.size > maxSize) continue;
2708
2751
  images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
@@ -2816,7 +2859,7 @@ function wrapFormat(inner, f) {
2816
2859
  if (f.u) html = `<u>${html}</u>`;
2817
2860
  if (f.i) html = `<em>${html}</em>`;
2818
2861
  if (f.b) html = `<strong>${html}</strong>`;
2819
- if (f.href) html = `<a href="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2862
+ if (f.href) html = `<a href="${_chunk7WISYZFOcjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2820
2863
  return html;
2821
2864
  }
2822
2865
  function renderSegments(segments) {
@@ -2828,9 +2871,9 @@ function renderSegments(segments) {
2828
2871
  let j = i;
2829
2872
  for (; j < segments.length && formatKey(segments[j].format) === key; j++) {
2830
2873
  const seg = segments[j];
2831
- if (seg.kind === "text") inner += _chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.text);
2874
+ if (seg.kind === "text") inner += _chunk7WISYZFOcjs.escapeHtml.call(void 0, seg.text);
2832
2875
  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)}">`;
2876
+ else if (seg.kind === "img") inner += `<img src="${_chunk7WISYZFOcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunk7WISYZFOcjs.escapeHtml.call(void 0, seg.alt)}">`;
2834
2877
  else inner += `<sup>${seg.n}</sup>`;
2835
2878
  }
2836
2879
  html += wrapFormat(inner, segments[i].format);
@@ -2842,9 +2885,9 @@ function parseHyperlinkInstruction(instr) {
2842
2885
  const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
2843
2886
  if (!match) return void 0;
2844
2887
  const rest = match[1];
2845
- const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _88 => _88.exec, 'call', _89 => _89(rest), 'optionalAccess', _90 => _90[1]]);
2888
+ const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _96 => _96.exec, 'call', _97 => _97(rest), 'optionalAccess', _98 => _98[1]]);
2846
2889
  const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
2847
- const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _91 => _91[1]]), () => ( _optionalChain([target, 'optionalAccess', _92 => _92[2]])));
2890
+ const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _99 => _99[1]]), () => ( _optionalChain([target, 'optionalAccess', _100 => _100[2]])));
2848
2891
  if (url) return anchor ? `${url}#${anchor}` : url;
2849
2892
  return anchor ? `#${anchor}` : void 0;
2850
2893
  }
@@ -2919,7 +2962,7 @@ var ParagraphRenderer = (_class3 = class {
2919
2962
  }
2920
2963
  run(r, base) {
2921
2964
  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]), () => ( {}));
2965
+ const styleFormat = _nullishCoalesce(_optionalChain([this, 'access', _101 => _101.ctx, 'access', _102 => _102.styles, 'access', _103 => _103.get, 'call', _104 => _104(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( ""))), 'optionalAccess', _105 => _105.format]), () => ( {}));
2923
2966
  const own = readFormat(rPr);
2924
2967
  const format = { ...base, ...styleFormat, ...own };
2925
2968
  for (const child of childElements(r)) {
@@ -3051,15 +3094,15 @@ function paragraphInfo(p, ctx) {
3051
3094
  heading = styleHeadingLevel(ctx.styles, styleId);
3052
3095
  }
3053
3096
  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]);
3097
+ if (!numPr) numPr = _optionalChain([styleChain, 'call', _106 => _106(ctx.styles, styleId), 'access', _107 => _107.find, 'call', _108 => _108((style) => style.numPr), 'optionalAccess', _109 => _109.numPr]);
3055
3098
  let list;
3056
3099
  if (numPr && numPr.numId !== "0" && heading === void 0) {
3057
3100
  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;
3101
+ const def = num ? _optionalChain([ctx, 'access', _110 => _110.numbering, 'access', _111 => _111.abstracts, 'access', _112 => _112.get, 'call', _113 => _113(num.abstractId), 'optionalAccess', _114 => _114.get, 'call', _115 => _115(numPr.ilvl)]) : void 0;
3059
3102
  list = {
3060
3103
  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))
3104
+ ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _116 => _116.ordered]), () => ( false)),
3105
+ start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _117 => _117.starts, 'access', _118 => _118.get, 'call', _119 => _119(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _120 => _120.start]))), () => ( 1))
3063
3106
  };
3064
3107
  }
3065
3108
  return { heading, list };
@@ -3143,7 +3186,7 @@ function renderTable(tbl, ctx, part) {
3143
3186
  if (cell.merge === "restart") {
3144
3187
  for (let r = rowIndex + 1; r < rows.length; r++) {
3145
3188
  const below = rows[r].find((c) => c.col === cell.col);
3146
- if (_optionalChain([below, 'optionalAccess', _113 => _113.merge]) !== "continue") break;
3189
+ if (_optionalChain([below, 'optionalAccess', _121 => _121.merge]) !== "continue") break;
3147
3190
  rowspan++;
3148
3191
  }
3149
3192
  }
@@ -3156,7 +3199,7 @@ function renderTable(tbl, ctx, part) {
3156
3199
  return `${html}</tbody></table>`;
3157
3200
  }
3158
3201
  function getDomParser(options) {
3159
- const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _114 => _114.window, 'optionalAccess', _115 => _115.DOMParser])));
3202
+ const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _122 => _122.window, 'optionalAccess', _123 => _123.DOMParser])));
3160
3203
  if (typeof Parser !== "function") {
3161
3204
  throw new ImportError(
3162
3205
  "unsupported_environment",
@@ -3171,7 +3214,7 @@ async function docxToDocumentImport(data, options = {}) {
3171
3214
  try {
3172
3215
  zip = await readZip(data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
3173
3216
  } catch (error) {
3174
- if (_optionalChain([error, 'optionalAccess', _116 => _116.code]) === "invalid_archive") {
3217
+ if (_optionalChain([error, 'optionalAccess', _124 => _124.code]) === "invalid_archive") {
3175
3218
  throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
3176
3219
  }
3177
3220
  throw error;
@@ -3191,7 +3234,7 @@ async function docxToDocumentImport(data, options = {}) {
3191
3234
  throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
3192
3235
  }
3193
3236
  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]);
3237
+ const partByType = (suffix) => _optionalChain([Array, 'access', _125 => _125.from, 'call', _126 => _126(rels.values()), 'access', _127 => _127.find, 'call', _128 => _128((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _129 => _129.target]);
3195
3238
  const baseDir = dirname(mainPath);
3196
3239
  const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
3197
3240
  const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
@@ -3224,8 +3267,8 @@ async function docxToDocumentImport(data, options = {}) {
3224
3267
  }
3225
3268
  html += `<hr><ol>${notesHtml}</ol>`;
3226
3269
  }
3227
- const sanitized = _chunkSML64VJGcjs.sanitizeImportedHtml.call(void 0, html);
3228
- return { html: sanitized, text: _chunkXNORY7M6cjs.htmlToPlainText.call(void 0, sanitized) };
3270
+ const sanitized = _chunkV3CHHWOEcjs.sanitizeImportedHtml.call(void 0, html);
3271
+ return { html: sanitized, text: _chunk7WISYZFOcjs.htmlToPlainText.call(void 0, sanitized) };
3229
3272
  }
3230
3273
  function createDocxImportAdapter(options = {}) {
3231
3274
  return {
@@ -3250,7 +3293,7 @@ var markdownImportAdapter = {
3250
3293
  target: "document",
3251
3294
  async import(_input, context) {
3252
3295
  const text = await context.readText();
3253
- return { html: _chunkXNORY7M6cjs.markdownToTipTapHtml.call(void 0, text), text };
3296
+ return { html: _chunk7WISYZFOcjs.markdownToTipTapHtml.call(void 0, text), text };
3254
3297
  }
3255
3298
  };
3256
3299
  var htmlImportAdapter = {
@@ -3260,8 +3303,8 @@ var htmlImportAdapter = {
3260
3303
  extensions: [".html", ".htm", ".xhtml"],
3261
3304
  target: "document",
3262
3305
  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) };
3306
+ const html = _chunkV3CHHWOEcjs.sanitizeImportedHtml.call(void 0, await context.readText());
3307
+ return { html, text: _chunk7WISYZFOcjs.htmlToPlainText.call(void 0, html) };
3265
3308
  }
3266
3309
  };
3267
3310
  var plainTextImportAdapter = {
@@ -3272,7 +3315,7 @@ var plainTextImportAdapter = {
3272
3315
  target: "document",
3273
3316
  async import(_input, context) {
3274
3317
  const text = (await context.readText()).replace(/\r\n?/g, "\n");
3275
- return { html: _chunkSML64VJGcjs.plainTextToParagraphHtml.call(void 0, text), text };
3318
+ return { html: _chunkV3CHHWOEcjs.plainTextToParagraphHtml.call(void 0, text), text };
3276
3319
  }
3277
3320
  };
3278
3321
  var rtfImportAdapter = {
@@ -3282,8 +3325,8 @@ var rtfImportAdapter = {
3282
3325
  extensions: [".rtf"],
3283
3326
  target: "document",
3284
3327
  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 };
3328
+ const text = _chunkV3CHHWOEcjs.rtfToPlainText.call(void 0, await context.readText());
3329
+ return { html: _chunkV3CHHWOEcjs.plainTextToParagraphHtml.call(void 0, text), text };
3287
3330
  }
3288
3331
  };
3289
3332
  var BUILT_IN_IMPORT_ADAPTERS = [
@@ -3322,7 +3365,7 @@ function getImportAccept(target) {
3322
3365
 
3323
3366
  var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
3324
3367
  function htmlToSlice(html, schema) {
3325
- const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _122 => _122.window, 'optionalAccess', _123 => _123.DOMParser])));
3368
+ const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _130 => _130.window, 'optionalAccess', _131 => _131.DOMParser])));
3326
3369
  if (!Parser) return null;
3327
3370
  const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
3328
3371
  return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
@@ -3337,7 +3380,7 @@ function insertImportedDocument(target, content, options = {}) {
3337
3380
  if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
3338
3381
  from = to = _state.Selection.near(state.doc.resolve(from)).from;
3339
3382
  }
3340
- const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunkXNORY7M6cjs.plainTextToSlice.call(void 0, content.text, state.schema));
3383
+ const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunk7WISYZFOcjs.plainTextToSlice.call(void 0, content.text, state.schema));
3341
3384
  const end = tr.mapping.map(to, 1);
3342
3385
  view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "drop"));
3343
3386
  return end;
@@ -3348,12 +3391,15 @@ async function importFilesIntoEditor(target, files, options = {}) {
3348
3391
  let at = options.at;
3349
3392
  for (const file of Array.from(files)) {
3350
3393
  try {
3351
- const outcome = await registry.importFile(file, { target: "document" });
3394
+ const outcome = await registry.importFile(file, {
3395
+ target: "document",
3396
+ adapterOptions: options.adapterOptions
3397
+ });
3352
3398
  const view = toView(target);
3353
3399
  if (view.isDestroyed) break;
3354
3400
  at = insertImportedDocument(view, outcome.result, { at, asPlainText: options.asPlainText });
3355
3401
  outcomes.push(outcome);
3356
- _optionalChain([options, 'access', _124 => _124.onImport, 'optionalCall', _125 => _125(outcome, file)]);
3402
+ _optionalChain([options, 'access', _132 => _132.onImport, 'optionalCall', _133 => _133(outcome, file)]);
3357
3403
  } catch (error) {
3358
3404
  const err = error instanceof Error ? error : new Error(String(error));
3359
3405
  if (options.onError) options.onError(err, file);
@@ -3372,7 +3418,7 @@ function getImportableFiles(files, registry) {
3372
3418
  }
3373
3419
  function dropPosition(view, event) {
3374
3420
  try {
3375
- return _optionalChain([view, 'access', _126 => _126.posAtCoords, 'call', _127 => _127({ left: event.clientX, top: event.clientY }), 'optionalAccess', _128 => _128.pos]);
3421
+ return _optionalChain([view, 'access', _134 => _134.posAtCoords, 'call', _135 => _135({ left: event.clientX, top: event.clientY }), 'optionalAccess', _136 => _136.pos]);
3376
3422
  } catch (e2) {
3377
3423
  return void 0;
3378
3424
  }
@@ -3382,6 +3428,7 @@ var FileImport = _core.Extension.create({
3382
3428
  addOptions() {
3383
3429
  return {
3384
3430
  registry: void 0,
3431
+ adapterOptions: void 0,
3385
3432
  asPlainText: false,
3386
3433
  enableDrop: true,
3387
3434
  enablePaste: true,
@@ -3397,6 +3444,7 @@ var FileImport = _core.Extension.create({
3397
3444
  registry: registry(),
3398
3445
  at,
3399
3446
  asPlainText: options.asPlainText,
3447
+ adapterOptions: options.adapterOptions,
3400
3448
  onImport: options.onImport,
3401
3449
  onError: options.onImportError
3402
3450
  });
@@ -3407,7 +3455,7 @@ var FileImport = _core.Extension.create({
3407
3455
  props: {
3408
3456
  handleDrop(view, event, _slice, moved) {
3409
3457
  if (!options.enableDrop || moved) return false;
3410
- const files = getImportableFiles(_optionalChain([event, 'access', _129 => _129.dataTransfer, 'optionalAccess', _130 => _130.files]), registry());
3458
+ const files = getImportableFiles(_optionalChain([event, 'access', _137 => _137.dataTransfer, 'optionalAccess', _138 => _138.files]), registry());
3411
3459
  if (!files) return false;
3412
3460
  event.preventDefault();
3413
3461
  run(view, files, dropPosition(view, event));
@@ -3415,7 +3463,7 @@ var FileImport = _core.Extension.create({
3415
3463
  },
3416
3464
  handlePaste(view, event) {
3417
3465
  if (!options.enablePaste) return false;
3418
- const files = getImportableFiles(_optionalChain([event, 'access', _131 => _131.clipboardData, 'optionalAccess', _132 => _132.files]), registry());
3466
+ const files = getImportableFiles(_optionalChain([event, 'access', _139 => _139.clipboardData, 'optionalAccess', _140 => _140.files]), registry());
3419
3467
  if (!files) return false;
3420
3468
  event.preventDefault();
3421
3469
  run(view, files);
@@ -3434,15 +3482,15 @@ var richClipboardPluginKey = new (0, _state.PluginKey)("richClipboard");
3434
3482
  function writeRichClipboard(view, event, options = {}) {
3435
3483
  const { state } = view;
3436
3484
  if (state.selection.empty) return false;
3437
- const data = _chunkSML64VJGcjs.getClipboardData.call(void 0, event);
3485
+ const data = _chunkV3CHHWOEcjs.getClipboardData.call(void 0, event);
3438
3486
  if (!data || typeof data.setData !== "function") return false;
3439
3487
  const slice = state.selection.content();
3440
3488
  const { dom, text } = view.serializeForClipboard(slice);
3441
3489
  event.preventDefault();
3442
- _optionalChain([data, 'access', _133 => _133.clearData, 'optionalCall', _134 => _134()]);
3490
+ _optionalChain([data, 'access', _141 => _141.clearData, 'optionalCall', _142 => _142()]);
3443
3491
  data.setData("text/html", dom.innerHTML);
3444
3492
  data.setData("text/plain", text);
3445
- data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME)), _chunkSML64VJGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3493
+ data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkV3CHHWOEcjs.PIXERATE_DOCUMENT_MIME)), _chunkV3CHHWOEcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3446
3494
  if (options.cut && view.editable) {
3447
3495
  view.dispatch(state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
3448
3496
  }
@@ -3452,7 +3500,7 @@ var RichClipboard = _core.Extension.create({
3452
3500
  name: "richClipboard",
3453
3501
  addOptions() {
3454
3502
  return {
3455
- mimeType: _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME,
3503
+ mimeType: _chunkV3CHHWOEcjs.PIXERATE_DOCUMENT_MIME,
3456
3504
  plainTextMode: false
3457
3505
  };
3458
3506
  },
@@ -3460,7 +3508,7 @@ var RichClipboard = _core.Extension.create({
3460
3508
  return { plainTextMode: !!this.options.plainTextMode };
3461
3509
  },
3462
3510
  addProseMirrorPlugins() {
3463
- const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME));
3511
+ const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkV3CHHWOEcjs.PIXERATE_DOCUMENT_MIME));
3464
3512
  const storage = this.storage;
3465
3513
  return [
3466
3514
  new (0, _state.Plugin)({
@@ -3472,7 +3520,7 @@ var RichClipboard = _core.Extension.create({
3472
3520
  },
3473
3521
  handlePaste(view, event) {
3474
3522
  if (storage.plainTextMode) return false;
3475
- const slice = _chunkSML64VJGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3523
+ const slice = _chunkV3CHHWOEcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3476
3524
  if (!slice) return false;
3477
3525
  event.preventDefault();
3478
3526
  view.dispatch(
@@ -3667,7 +3715,7 @@ var Autocorrect = _core.Extension.create({
3667
3715
  addCommands() {
3668
3716
  return {
3669
3717
  undoAutocorrect: () => ({ state, tr, dispatch }) => {
3670
- const last = _optionalChain([autocorrectPluginKey, 'access', _135 => _135.getState, 'call', _136 => _136(state), 'optionalAccess', _137 => _137.last]);
3718
+ const last = _optionalChain([autocorrectPluginKey, 'access', _143 => _143.getState, 'call', _144 => _144(state), 'optionalAccess', _145 => _145.last]);
3671
3719
  if (!last) return false;
3672
3720
  if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
3673
3721
  if (dispatch) {
@@ -3717,7 +3765,7 @@ var Autocorrect = _core.Extension.create({
3717
3765
  }
3718
3766
  const insertTyped = () => {
3719
3767
  const tr2 = state.tr.insertText(text, from, to);
3720
- if (_optionalChain([pluginState, 'optionalAccess', _138 => _138.closePending])) _history.closeHistory.call(void 0, tr2);
3768
+ if (_optionalChain([pluginState, 'optionalAccess', _146 => _146.closePending])) _history.closeHistory.call(void 0, tr2);
3721
3769
  view.dispatch(tr2);
3722
3770
  };
3723
3771
  if (isIgnored(state, from, to)) return false;
@@ -3725,7 +3773,7 @@ var Autocorrect = _core.Extension.create({
3725
3773
  if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
3726
3774
  return false;
3727
3775
  }
3728
- const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _139 => _139.exec, 'call', _140 => _140(textBefore), 'optionalAccess', _141 => _141[0]]), () => ( ""));
3776
+ const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _147 => _147.exec, 'call', _148 => _148(textBefore), 'optionalAccess', _149 => _149[0]]), () => ( ""));
3729
3777
  if (/:\/\/|^www\./i.test(currentWord)) return false;
3730
3778
  const exceptions = extension.storage.exceptions;
3731
3779
  const found = findAutocorrection(textBefore, extension.options.rules, {
@@ -3733,7 +3781,7 @@ var Autocorrect = _core.Extension.create({
3733
3781
  isException: (value) => exceptions.has(value.toLowerCase())
3734
3782
  });
3735
3783
  if (!found) {
3736
- if (!_optionalChain([pluginState, 'optionalAccess', _142 => _142.closePending])) return false;
3784
+ if (!_optionalChain([pluginState, 'optionalAccess', _150 => _150.closePending])) return false;
3737
3785
  insertTyped();
3738
3786
  return true;
3739
3787
  }
@@ -3770,7 +3818,7 @@ var Autocorrect = _core.Extension.create({
3770
3818
  _history.closeHistory.call(void 0, tr);
3771
3819
  tr.setMeta(autocorrectPluginKey, { correction });
3772
3820
  view.dispatch(tr);
3773
- _optionalChain([extension, 'access', _143 => _143.options, 'access', _144 => _144.onCorrection, 'optionalCall', _145 => _145(correction)]);
3821
+ _optionalChain([extension, 'access', _151 => _151.options, 'access', _152 => _152.onCorrection, 'optionalCall', _153 => _153(correction)]);
3774
3822
  return true;
3775
3823
  };
3776
3824
  return [
@@ -3780,8 +3828,8 @@ var Autocorrect = _core.Extension.create({
3780
3828
  init: () => ({ last: null, closePending: false }),
3781
3829
  apply: (tr, prev) => {
3782
3830
  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 };
3831
+ if (_optionalChain([meta, 'optionalAccess', _154 => _154.correction])) return { last: meta.correction, closePending: true };
3832
+ if (_optionalChain([meta, 'optionalAccess', _155 => _155.undo])) return { last: null, closePending: true };
3785
3833
  if (!tr.docChanged) return prev;
3786
3834
  if (!prev.last && !prev.closePending) return prev;
3787
3835
  return { last: null, closePending: false };
@@ -3862,7 +3910,7 @@ function arraysEqual(a, b, eq) {
3862
3910
  }
3863
3911
  function scrollDomAtPos(view, pos, behavior = "smooth") {
3864
3912
  try {
3865
- const dom = _optionalChain([view, 'optionalAccess', _148 => _148.nodeDOM, 'optionalCall', _149 => _149(pos)]);
3913
+ const dom = _optionalChain([view, 'optionalAccess', _156 => _156.nodeDOM, 'optionalCall', _157 => _157(pos)]);
3866
3914
  if (dom && typeof dom.scrollIntoView === "function") {
3867
3915
  dom.scrollIntoView({ block: "start", behavior });
3868
3916
  }
@@ -3877,7 +3925,7 @@ function syncInitialContent(editor, sync) {
3877
3925
  errorOnInvalidContent: false
3878
3926
  });
3879
3927
  const tr = sync(_state.EditorState.create({ doc }));
3880
- if (_optionalChain([tr, 'optionalAccess', _150 => _150.docChanged])) editor.options.content = tr.doc;
3928
+ if (_optionalChain([tr, 'optionalAccess', _158 => _158.docChanged])) editor.options.content = tr.doc;
3881
3929
  } catch (e4) {
3882
3930
  }
3883
3931
  }
@@ -3958,7 +4006,7 @@ function createOutlineStore(editor) {
3958
4006
  const compute = () => {
3959
4007
  if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
3960
4008
  const headings = getOutline(editor);
3961
- const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _151 => _151(editor, headings), 'optionalAccess', _152 => _152.id]), () => ( null));
4009
+ const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _159 => _159(editor, headings), 'optionalAccess', _160 => _160.id]), () => ( null));
3962
4010
  const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
3963
4011
  if (sameStructure && snapshot.activeId === activeId) return snapshot;
3964
4012
  return {
@@ -3983,16 +4031,16 @@ function createOutlineStore(editor) {
3983
4031
  subscribe(listener) {
3984
4032
  if (!listeners.size) {
3985
4033
  snapshot = compute();
3986
- _optionalChain([editor, 'optionalAccess', _153 => _153.on, 'call', _154 => _154("transaction", onTransaction)]);
4034
+ _optionalChain([editor, 'optionalAccess', _161 => _161.on, 'call', _162 => _162("transaction", onTransaction)]);
3987
4035
  }
3988
4036
  listeners.add(listener);
3989
4037
  return () => {
3990
4038
  listeners.delete(listener);
3991
- if (!listeners.size) _optionalChain([editor, 'optionalAccess', _155 => _155.off, 'call', _156 => _156("transaction", onTransaction)]);
4039
+ if (!listeners.size) _optionalChain([editor, 'optionalAccess', _163 => _163.off, 'call', _164 => _164("transaction", onTransaction)]);
3992
4040
  };
3993
4041
  },
3994
4042
  destroy() {
3995
- _optionalChain([editor, 'optionalAccess', _157 => _157.off, 'call', _158 => _158("transaction", onTransaction)]);
4043
+ _optionalChain([editor, 'optionalAccess', _165 => _165.off, 'call', _166 => _166("transaction", onTransaction)]);
3996
4044
  listeners.clear();
3997
4045
  }
3998
4046
  };
@@ -4067,7 +4115,7 @@ var Outline = _core.Extension.create({
4067
4115
  if (options.focus !== false) {
4068
4116
  tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
4069
4117
  tr.scrollIntoView();
4070
- _optionalChain([view, 'optionalAccess', _159 => _159.focus, 'optionalCall', _160 => _160()]);
4118
+ _optionalChain([view, 'optionalAccess', _167 => _167.focus, 'optionalCall', _168 => _168()]);
4071
4119
  }
4072
4120
  scrollDomAtPos(view, heading.pos, options.behavior);
4073
4121
  }
@@ -4099,7 +4147,7 @@ var Outline = _core.Extension.create({
4099
4147
  const next = computeOutline(newState.doc, types);
4100
4148
  if (arraysEqual(prev, next, sameHeading)) return prev;
4101
4149
  storage.headings = next;
4102
- _optionalChain([onUpdate, 'call', _161 => _161(), 'optionalCall', _162 => _162(next)]);
4150
+ _optionalChain([onUpdate, 'call', _169 => _169(), 'optionalCall', _170 => _170(next)]);
4103
4151
  return next;
4104
4152
  }
4105
4153
  }
@@ -4418,7 +4466,7 @@ var TableOfContents = _core.Node.create({
4418
4466
  handleDOMEvents: {
4419
4467
  click: (view, event) => {
4420
4468
  const target = event.target;
4421
- const link = _optionalChain([target, 'optionalAccess', _163 => _163.closest, 'optionalCall', _164 => _164(
4469
+ const link = _optionalChain([target, 'optionalAccess', _171 => _171.closest, 'optionalCall', _172 => _172(
4422
4470
  'nav[data-type="table-of-contents"] a[data-heading-id]'
4423
4471
  )]);
4424
4472
  if (!link) return false;
@@ -4491,7 +4539,7 @@ function getFootnotes(doc) {
4491
4539
  number: index + 1,
4492
4540
  text: footnote ? footnoteText(footnote.node) : "",
4493
4541
  referencePos: ref.pos,
4494
- footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _165 => _165.pos]), () => ( null))
4542
+ footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _173 => _173.pos]), () => ( null))
4495
4543
  };
4496
4544
  });
4497
4545
  }
@@ -4533,7 +4581,7 @@ function syncFootnotes(tr, options = {}) {
4533
4581
  });
4534
4582
  const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
4535
4583
  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]]), () => ( "")))));
4584
+ const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _174 => _174.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _175 => _175.contents, 'optionalAccess', _176 => _176[id]]), () => ( "")))));
4537
4585
  if (source && source.attrs.id === id && source.attrs.number === number) {
4538
4586
  return source;
4539
4587
  }
@@ -4736,7 +4784,7 @@ var FootnoteReference = _core.Node.create({
4736
4784
  handleClickOn: (_view, _pos, node, _nodePos, event) => {
4737
4785
  if (node.type.name !== REFERENCE || !node.attrs.id) return false;
4738
4786
  const target = event.target;
4739
- if (!_optionalChain([target, 'optionalAccess', _169 => _169.closest, 'optionalCall', _170 => _170("a")])) return false;
4787
+ if (!_optionalChain([target, 'optionalAccess', _177 => _177.closest, 'optionalCall', _178 => _178("a")])) return false;
4740
4788
  event.preventDefault();
4741
4789
  return editor.commands.goToFootnote(node.attrs.id);
4742
4790
  }
@@ -4934,7 +4982,7 @@ var Bookmark = _core.Mark.create({
4934
4982
  }
4935
4983
  if (!dispatch) return true;
4936
4984
  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()));
4985
+ const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _179 => _179.id]))), () => ( this.options.generateId()));
4938
4986
  if (sameName) {
4939
4987
  forEachBookmarkRange(
4940
4988
  tr.doc,
@@ -5176,7 +5224,7 @@ var CrossReference = _core.Node.create({
5176
5224
  // src/extensions/document-structure/command-items.ts
5177
5225
  var start = (editor, args) => {
5178
5226
  const chain = editor.chain().focus();
5179
- return _optionalChain([args, 'optionalAccess', _172 => _172.range]) ? chain.deleteRange(args.range) : chain;
5227
+ return _optionalChain([args, 'optionalAccess', _180 => _180.range]) ? chain.deleteRange(args.range) : chain;
5180
5228
  };
5181
5229
  var documentStructureCommandItems = [
5182
5230
  {
@@ -5193,7 +5241,7 @@ var documentStructureCommandItems = [
5193
5241
  description: "Insert a numbered footnote",
5194
5242
  keywords: ["footnote", "note", "fn", "citation"],
5195
5243
  extension: "footnoteReference",
5196
- run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _173 => _173.content]) }).run()
5244
+ run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _181 => _181.content]) }).run()
5197
5245
  },
5198
5246
  {
5199
5247
  id: "bookmark",
@@ -5202,7 +5250,7 @@ var documentStructureCommandItems = [
5202
5250
  keywords: ["bookmark", "anchor", "name"],
5203
5251
  extension: "bookmark",
5204
5252
  requires: "name",
5205
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _174 => _174.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5253
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _182 => _182.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5206
5254
  },
5207
5255
  {
5208
5256
  id: "cross-reference",
@@ -5211,7 +5259,7 @@ var documentStructureCommandItems = [
5211
5259
  keywords: ["cross", "reference", "xref", "link", "ref"],
5212
5260
  extension: "crossReference",
5213
5261
  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()
5262
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _183 => _183.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5215
5263
  }
5216
5264
  ];
5217
5265
  function getDocumentStructureCommandItems(editor, query = "") {
@@ -6141,13 +6189,13 @@ var FindReplaceStore = (_class4 = class {constructor() { _class4.prototype.__ini
6141
6189
  }, _class4);
6142
6190
  var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
6143
6191
  function getFindReplaceState(source) {
6144
- const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.state]), () => ( source));
6192
+ const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _184 => _184.state]), () => ( source));
6145
6193
  if (!state || typeof state.plugins === "undefined") return null;
6146
6194
  const plugin = findReplacePluginKey.getState(state);
6147
6195
  return plugin ? toSnapshot(plugin) : null;
6148
6196
  }
6149
6197
  function getFindReplaceStore(editor) {
6150
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _177 => _177.storage, 'optionalAccess', _178 => _178.findReplace, 'optionalAccess', _179 => _179.store]), () => ( null));
6198
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _185 => _185.storage, 'optionalAccess', _186 => _186.findReplace, 'optionalAccess', _187 => _187.store]), () => ( null));
6151
6199
  }
6152
6200
  var snapshotCache = /* @__PURE__ */ new WeakMap();
6153
6201
  function toSnapshot(s) {
@@ -6318,7 +6366,7 @@ var FindReplace = _core.Extension.create({
6318
6366
  const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
6319
6367
  const step = (forward) => () => {
6320
6368
  const s = findReplacePluginKey.getState(this.editor.state);
6321
- if (!_optionalChain([s, 'optionalAccess', _180 => _180.active]) || !s.matches.length) return false;
6369
+ if (!_optionalChain([s, 'optionalAccess', _188 => _188.active]) || !s.matches.length) return false;
6322
6370
  return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
6323
6371
  };
6324
6372
  return {
@@ -6431,7 +6479,7 @@ var FindReplace = _core.Extension.create({
6431
6479
  s = {
6432
6480
  ...s,
6433
6481
  currentIndex: m.index,
6434
- anchor: _nullishCoalesce(_optionalChain([s, 'access', _181 => _181.matches, 'access', _182 => _182[m.index], 'optionalAccess', _183 => _183.from]), () => ( s.anchor))
6482
+ anchor: _nullishCoalesce(_optionalChain([s, 'access', _189 => _189.matches, 'access', _190 => _190[m.index], 'optionalAccess', _191 => _191.from]), () => ( s.anchor))
6435
6483
  };
6436
6484
  redecorate = true;
6437
6485
  break;
@@ -6447,7 +6495,7 @@ var FindReplace = _core.Extension.create({
6447
6495
  }
6448
6496
  },
6449
6497
  props: {
6450
- decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _184 => _184.getState, 'call', _185 => _185(state), 'optionalAccess', _186 => _186.decorations]), () => ( _view2.DecorationSet.empty))
6498
+ decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _192 => _192.getState, 'call', _193 => _193(state), 'optionalAccess', _194 => _194.decorations]), () => ( _view2.DecorationSet.empty))
6451
6499
  },
6452
6500
  view: (view) => {
6453
6501
  const sync = () => {
@@ -6469,8 +6517,871 @@ function safeClipboard(get) {
6469
6517
  }
6470
6518
  }
6471
6519
 
6520
+ // src/extensions/paragraph-styles/extension.ts
6521
+
6522
+
6523
+
6524
+ // src/extensions/paragraph-styles/registry.ts
6525
+ var MAX_CHAIN = 32;
6526
+ var STYLE_ID = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
6527
+ var UNSAFE_CSS = /[;{}<>\\]|\/\*|url\s*\(|expression\s*\(|@import|javascript:/i;
6528
+ var NORMAL_STYLE_ID = "Normal";
6529
+ var PREVIEW_PROPERTIES = /* @__PURE__ */ new Set([
6530
+ "font-family",
6531
+ "font-weight",
6532
+ "font-style",
6533
+ "color",
6534
+ "text-decoration-line",
6535
+ "text-transform",
6536
+ "letter-spacing",
6537
+ "font-variant-caps"
6538
+ ]);
6539
+ function isValidStyleId(id) {
6540
+ return typeof id === "string" && STYLE_ID.test(id);
6541
+ }
6542
+ var MUTED = "var(--pixerate-style-muted, #6b7280)";
6543
+ var HEADING_SIZES = ["2em", "1.5em", "1.25em", "1.1em", "1em", "0.9em"];
6544
+ function builtinStyles() {
6545
+ const styles = [
6546
+ {
6547
+ id: NORMAL_STYLE_ID,
6548
+ name: "Normal",
6549
+ kind: "paragraph",
6550
+ block: { type: "paragraph" },
6551
+ priority: 0,
6552
+ quick: true,
6553
+ builtin: true
6554
+ },
6555
+ {
6556
+ id: "Title",
6557
+ name: "Title",
6558
+ kind: "paragraph",
6559
+ basedOn: NORMAL_STYLE_ID,
6560
+ next: NORMAL_STYLE_ID,
6561
+ linked: "TitleChar",
6562
+ paragraph: { spaceAfter: "0.25em", lineHeight: "1.15" },
6563
+ character: { fontSize: "2.5em", bold: true, letterSpacing: "-0.01em" },
6564
+ priority: 10,
6565
+ quick: true,
6566
+ builtin: true
6567
+ },
6568
+ {
6569
+ id: "Subtitle",
6570
+ name: "Subtitle",
6571
+ kind: "paragraph",
6572
+ basedOn: NORMAL_STYLE_ID,
6573
+ next: NORMAL_STYLE_ID,
6574
+ linked: "SubtitleChar",
6575
+ paragraph: { spaceAfter: "0.75em" },
6576
+ character: { fontSize: "1.25em", color: MUTED },
6577
+ priority: 11,
6578
+ quick: true,
6579
+ builtin: true
6580
+ }
6581
+ ];
6582
+ HEADING_SIZES.forEach((fontSize, i) => {
6583
+ const level = i + 1;
6584
+ styles.push({
6585
+ id: `Heading${level}`,
6586
+ name: `Heading ${level}`,
6587
+ kind: "paragraph",
6588
+ basedOn: NORMAL_STYLE_ID,
6589
+ next: NORMAL_STYLE_ID,
6590
+ linked: `Heading${level}Char`,
6591
+ block: { type: "heading", attrs: { level } },
6592
+ paragraph: { spaceBefore: level <= 2 ? "1em" : "0.75em", spaceAfter: "0.25em" },
6593
+ character: { fontSize, bold: true },
6594
+ priority: 11 + level,
6595
+ quick: level <= 3,
6596
+ builtin: true
6597
+ });
6598
+ });
6599
+ styles.push(
6600
+ {
6601
+ id: "Quote",
6602
+ name: "Quote",
6603
+ kind: "paragraph",
6604
+ basedOn: NORMAL_STYLE_ID,
6605
+ next: NORMAL_STYLE_ID,
6606
+ linked: "QuoteChar",
6607
+ paragraph: { indentLeft: "1em", paddingLeft: "0.75em", borderLeft: "3px solid currentColor" },
6608
+ character: { italic: true, color: MUTED },
6609
+ priority: 29,
6610
+ quick: true,
6611
+ builtin: true
6612
+ },
6613
+ {
6614
+ id: "Code",
6615
+ name: "Code",
6616
+ kind: "paragraph",
6617
+ basedOn: NORMAL_STYLE_ID,
6618
+ next: NORMAL_STYLE_ID,
6619
+ block: { type: "codeBlock" },
6620
+ character: {
6621
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
6622
+ fontSize: "0.9em"
6623
+ },
6624
+ priority: 30,
6625
+ quick: true,
6626
+ builtin: true
6627
+ },
6628
+ {
6629
+ id: "ListParagraph",
6630
+ name: "List Paragraph",
6631
+ kind: "paragraph",
6632
+ basedOn: NORMAL_STYLE_ID,
6633
+ paragraph: { indentLeft: "2em" },
6634
+ priority: 34,
6635
+ quick: true,
6636
+ builtin: true
6637
+ }
6638
+ );
6639
+ const linked = ["Title", "Subtitle", "Quote", ...HEADING_SIZES.map((_, i) => `Heading${i + 1}`)];
6640
+ linked.forEach((paragraphId) => {
6641
+ const name = styles.find((s) => s.id === paragraphId).name;
6642
+ styles.push({
6643
+ id: `${paragraphId}Char`,
6644
+ name: `${name} Char`,
6645
+ kind: "character",
6646
+ linked: paragraphId,
6647
+ priority: 99,
6648
+ hidden: true,
6649
+ builtin: true
6650
+ });
6651
+ });
6652
+ styles.push(
6653
+ {
6654
+ id: "Emphasis",
6655
+ name: "Emphasis",
6656
+ kind: "character",
6657
+ character: { italic: true },
6658
+ priority: 20,
6659
+ quick: true,
6660
+ builtin: true
6661
+ },
6662
+ {
6663
+ id: "Strong",
6664
+ name: "Strong",
6665
+ kind: "character",
6666
+ character: { bold: true },
6667
+ priority: 22,
6668
+ quick: true,
6669
+ builtin: true
6670
+ }
6671
+ );
6672
+ return styles;
6673
+ }
6674
+ var DEFAULT_STYLES = Object.freeze(builtinStyles());
6675
+ var clone = (value) => value === void 0 ? value : JSON.parse(JSON.stringify(value));
6676
+ function overlay(base, patch) {
6677
+ if (!patch) return base;
6678
+ const out = { ...base };
6679
+ Object.entries(patch).forEach(([key, value]) => {
6680
+ if (value !== void 0 && value !== null) out[key] = value;
6681
+ });
6682
+ return out;
6683
+ }
6684
+ function sameBlock(a, type, attrs) {
6685
+ if (a.type !== type) return false;
6686
+ return Object.entries(_nullishCoalesce(a.attrs, () => ( {}))).every(([key, value]) => attrs[key] === value);
6687
+ }
6688
+ var StyleRegistry = (_class5 = class {
6689
+ __init10() {this.styles = /* @__PURE__ */ new Map()}
6690
+
6691
+ __init11() {this.version = 0}
6692
+ __init12() {this.snapshot = null}
6693
+ __init13() {this.listeners = /* @__PURE__ */ new Set()}
6694
+ constructor(options = {}) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);
6695
+ this.defaults = clone(_nullishCoalesce(options.defaults, () => ( {})));
6696
+ if (options.builtins !== false) DEFAULT_STYLES.forEach((style) => this.styles.set(style.id, clone(style)));
6697
+ (_nullishCoalesce(options.styles, () => ( []))).forEach((style) => this.put(style));
6698
+ }
6699
+ // -- Reading --------------------------------------------------------------
6700
+ get(id) {
6701
+ return id ? this.styles.get(id) : void 0;
6702
+ }
6703
+ /** Finds a style by id or display name (case-insensitive). */
6704
+ find(nameOrId) {
6705
+ const direct = this.styles.get(nameOrId);
6706
+ if (direct) return direct;
6707
+ const lower = nameOrId.toLowerCase();
6708
+ return this.list().find((style) => style.name.toLowerCase() === lower);
6709
+ }
6710
+ /** All styles (optionally of one kind) in gallery order. */
6711
+ list(kind) {
6712
+ return Array.from(this.styles.values()).filter((style) => !kind || style.kind === kind).sort((a, b) => (_nullishCoalesce(a.priority, () => ( 99))) - (_nullishCoalesce(b.priority, () => ( 99))) || a.name.localeCompare(b.name));
6713
+ }
6714
+ /** Styles shown in the gallery (`quick`, not hidden), paragraph styles by default. */
6715
+ gallery(kind = "paragraph") {
6716
+ return this.list(kind).filter((style) => style.quick && !style.hidden);
6717
+ }
6718
+ /** The `basedOn` chain from the root style down to `id` (cycle-safe, bounded). */
6719
+ chain(id) {
6720
+ const out = [];
6721
+ let current = this.styles.get(id);
6722
+ while (current && out.length < MAX_CHAIN && !out.includes(current)) {
6723
+ out.push(current);
6724
+ current = current.basedOn ? this.styles.get(current.basedOn) : void 0;
6725
+ }
6726
+ return out.reverse();
6727
+ }
6728
+ /**
6729
+ * Resolves a paragraph style: defaults, then each style of the chain (base
6730
+ * first). Unknown ids resolve to the defaults in a `paragraph` block.
6731
+ */
6732
+ resolve(id) {
6733
+ let paragraph = overlay({}, this.defaults.paragraph);
6734
+ let character = overlay({}, this.defaults.character);
6735
+ let block = { type: "paragraph" };
6736
+ this.chain(id).forEach((style) => {
6737
+ if (style.kind !== "paragraph") return;
6738
+ paragraph = overlay(paragraph, style.paragraph);
6739
+ character = overlay(character, style.character);
6740
+ if (style.block) block = clone(style.block);
6741
+ });
6742
+ return { id, paragraph, character, block, next: this.nextStyleId(id) };
6743
+ }
6744
+ /** Character formatting a paragraph style's chain sets (without defaults). */
6745
+ paragraphCharacter(id) {
6746
+ let character = {};
6747
+ this.chain(id).forEach((style) => {
6748
+ if (style.kind === "paragraph") character = overlay(character, style.character);
6749
+ });
6750
+ return character;
6751
+ }
6752
+ /**
6753
+ * Character formatting of a character style's chain. A style linked to a
6754
+ * paragraph style takes that style's character formatting first.
6755
+ */
6756
+ resolveCharacterStyle(id) {
6757
+ let character = {};
6758
+ this.chain(id).forEach((style) => {
6759
+ if (style.kind === "character" && style.linked && _optionalChain([this, 'access', _195 => _195.get, 'call', _196 => _196(style.linked), 'optionalAccess', _197 => _197.kind]) === "paragraph") {
6760
+ character = overlay(character, this.paragraphCharacter(style.linked));
6761
+ }
6762
+ character = overlay(character, style.character);
6763
+ });
6764
+ return character;
6765
+ }
6766
+ /**
6767
+ * Character formatting of text: defaults → paragraph style chain →
6768
+ * character style chain → direct formatting.
6769
+ */
6770
+ resolveText(input) {
6771
+ let character = this.resolve(input.paragraphStyle || NORMAL_STYLE_ID).character;
6772
+ if (input.characterStyle) character = overlay(character, this.resolveCharacterStyle(input.characterStyle));
6773
+ return overlay(character, input.direct);
6774
+ }
6775
+ /** The style after Enter at the end of a paragraph of `id` (itself when unset or unknown). */
6776
+ nextStyleId(id) {
6777
+ const next = _optionalChain([this, 'access', _198 => _198.styles, 'access', _199 => _199.get, 'call', _200 => _200(id), 'optionalAccess', _201 => _201.next]);
6778
+ return next && _optionalChain([this, 'access', _202 => _202.styles, 'access', _203 => _203.get, 'call', _204 => _204(next), 'optionalAccess', _205 => _205.kind]) === "paragraph" ? next : id;
6779
+ }
6780
+ /** The linked character style of a paragraph style, if any. */
6781
+ linkedCharacterStyle(id) {
6782
+ const style = this.styles.get(id);
6783
+ const linked = _optionalChain([style, 'optionalAccess', _206 => _206.linked]) ? this.styles.get(style.linked) : void 0;
6784
+ return _optionalChain([style, 'optionalAccess', _207 => _207.kind]) === "paragraph" && _optionalChain([linked, 'optionalAccess', _208 => _208.kind]) === "character" ? linked : void 0;
6785
+ }
6786
+ /**
6787
+ * The style a block uses when it names none: Normal for paragraphs,
6788
+ * Heading N for headings of level N, Code for code blocks (the built-in
6789
+ * style whose own `block` matches).
6790
+ */
6791
+ defaultStyleFor(type, attrs = {}) {
6792
+ if (type === "paragraph" && this.styles.get(NORMAL_STYLE_ID)) return NORMAL_STYLE_ID;
6793
+ const candidates = this.list("paragraph").filter(
6794
+ (style) => style.block && sameBlock(style.block, type, attrs)
6795
+ );
6796
+ return _nullishCoalesce(_optionalChain([(_nullishCoalesce(candidates.find((s) => s.builtin), () => ( candidates[0]))), 'optionalAccess', _209 => _209.id]), () => ( null));
6797
+ }
6798
+ /** The style of a block: its `styleId` when known, otherwise the block's default style. */
6799
+ styleOfBlock(type, attrs = {}) {
6800
+ const id = attrs.styleId;
6801
+ if (id && _optionalChain([this, 'access', _210 => _210.styles, 'access', _211 => _211.get, 'call', _212 => _212(id), 'optionalAccess', _213 => _213.kind]) === "paragraph") return id;
6802
+ return this.defaultStyleFor(type, attrs);
6803
+ }
6804
+ __init14() {this.getSnapshot = () => {
6805
+ if (!this.snapshot) {
6806
+ this.snapshot = Object.freeze({
6807
+ styles: Object.freeze(this.list()),
6808
+ defaults: this.defaults,
6809
+ version: this.version
6810
+ });
6811
+ }
6812
+ return this.snapshot;
6813
+ }}
6814
+ __init15() {this.subscribe = (listener) => {
6815
+ this.listeners.add(listener);
6816
+ listener(this.getSnapshot());
6817
+ return () => {
6818
+ this.listeners.delete(listener);
6819
+ };
6820
+ }}
6821
+ toJSON() {
6822
+ return { styles: clone(Array.from(this.styles.values())), defaults: clone(this.defaults) };
6823
+ }
6824
+ // -- Writing --------------------------------------------------------------
6825
+ /** Adds or replaces a style. Throws on an invalid id. */
6826
+ upsert(style) {
6827
+ const stored = this.put(style);
6828
+ this.changed();
6829
+ return stored;
6830
+ }
6831
+ /** Merges `patch` into a style (formats are merged key by key). Returns `undefined` for unknown ids. */
6832
+ update(id, patch) {
6833
+ const current = this.styles.get(id);
6834
+ if (!current) return void 0;
6835
+ const next = {
6836
+ ...current,
6837
+ ...patch,
6838
+ id,
6839
+ paragraph: patch.paragraph ? { ...current.paragraph, ...patch.paragraph } : current.paragraph,
6840
+ character: patch.character ? { ...current.character, ...patch.character } : current.character
6841
+ };
6842
+ return this.upsert(next);
6843
+ }
6844
+ /**
6845
+ * Removes a style and returns it. Built-in styles cannot be removed. Styles
6846
+ * based on it are rebased onto its own base, and `next`/`linked`
6847
+ * references to it are dropped.
6848
+ */
6849
+ remove(id) {
6850
+ const gone = this.styles.get(id);
6851
+ if (!gone || gone.builtin) return void 0;
6852
+ this.styles.delete(id);
6853
+ this.styles.forEach((style, key) => {
6854
+ let changed = style;
6855
+ if (style.basedOn === id) {
6856
+ changed = { ...changed, basedOn: gone.basedOn && gone.basedOn !== key ? gone.basedOn : null };
6857
+ }
6858
+ if (style.next === id) changed = { ...changed, next: null };
6859
+ if (style.linked === id) changed = { ...changed, linked: null };
6860
+ if (changed !== style) this.styles.set(key, changed);
6861
+ });
6862
+ this.changed();
6863
+ return gone;
6864
+ }
6865
+ /** Replaces the document defaults. */
6866
+ setDefaults(defaults) {
6867
+ this.defaults = clone(defaults);
6868
+ this.changed();
6869
+ }
6870
+ /** An unused id derived from a display name (`My Style` → `MyStyle`, then `MyStyle1`, …). */
6871
+ newId(name) {
6872
+ let base = name.replace(/[^A-Za-z0-9_-]+/g, "").replace(/^[^A-Za-z]+/, "").slice(0, 56);
6873
+ if (!base) base = "Style";
6874
+ if (!this.styles.has(base)) return base;
6875
+ for (let i = 1; i < 1e5; i++) {
6876
+ const id = `${base}${i}`;
6877
+ if (!this.styles.has(id)) return id;
6878
+ }
6879
+ return `${base}${Date.now()}`;
6880
+ }
6881
+ // -- CSS --------------------------------------------------------------------
6882
+ /** CSS declarations (`property: value`) of a resolved paragraph or character style. */
6883
+ cssDeclarations(id) {
6884
+ const style = this.styles.get(id);
6885
+ if (_optionalChain([style, 'optionalAccess', _214 => _214.kind]) === "character") return characterCSS(this.resolveCharacterStyle(id));
6886
+ const resolved = this.resolve(id);
6887
+ return { ...paragraphCSS(resolved.paragraph), ...characterCSS(resolved.character) };
6888
+ }
6889
+ /**
6890
+ * Declarations for previewing a style in a menu or gallery: font family,
6891
+ * weight, style, color, decoration, case and letter spacing (no sizes,
6892
+ * margins or borders).
6893
+ */
6894
+ previewDeclarations(id) {
6895
+ return Object.fromEntries(
6896
+ Object.entries(this.cssDeclarations(id)).filter(([property]) => PREVIEW_PROPERTIES.has(property))
6897
+ );
6898
+ }
6899
+ /**
6900
+ * A stylesheet for the styles: `[data-style="Id"]` rules for paragraph
6901
+ * styles (plus the plain element of blocks that use their default style,
6902
+ * e.g. `h2:not([data-style])`), `[data-char-style="Id"]` for character
6903
+ * styles and the defaults on the scope element.
6904
+ */
6905
+ toCSS(options = {}) {
6906
+ const scope = _nullishCoalesce(options.scope, () => ( ".ProseMirror"));
6907
+ const tagFor = _nullishCoalesce(options.tagFor, () => ( defaultTagFor));
6908
+ const rules = [];
6909
+ const rule = (selectors, declarations) => {
6910
+ const body = Object.entries(declarations).map(([property, value]) => `${property}: ${value};`).join(" ");
6911
+ if (body) rules.push(`${selectors.join(", ")} { ${body} }`);
6912
+ };
6913
+ rule([scope], {
6914
+ ...paragraphCSS(_nullishCoalesce(this.defaults.paragraph, () => ( {}))),
6915
+ ...characterCSS(_nullishCoalesce(this.defaults.character, () => ( {})))
6916
+ });
6917
+ this.list().forEach((style) => {
6918
+ if (style.kind === "character") {
6919
+ rule([`${scope} [data-char-style="${style.id}"]`], this.cssDeclarations(style.id));
6920
+ return;
6921
+ }
6922
+ const selectors = [`${scope} [data-style="${style.id}"]`];
6923
+ const block = this.resolve(style.id).block;
6924
+ if (this.defaultStyleFor(block.type, _nullishCoalesce(block.attrs, () => ( {}))) === style.id) {
6925
+ const tag = tagFor(block);
6926
+ if (tag) selectors.push(`${scope} ${tag}:not([data-style])`);
6927
+ }
6928
+ const resolved = this.resolve(style.id);
6929
+ const own = {
6930
+ ...paragraphCSS(withoutDefaults(resolved.paragraph, this.defaults.paragraph)),
6931
+ ...characterCSS(withoutDefaults(resolved.character, this.defaults.character))
6932
+ };
6933
+ rule(selectors, own);
6934
+ });
6935
+ return rules.join("\n");
6936
+ }
6937
+ // -- Internals --------------------------------------------------------------
6938
+ put(style) {
6939
+ if (!isValidStyleId(style.id)) throw new Error(`Invalid style id: ${String(style.id)}`);
6940
+ if (style.kind !== "paragraph" && style.kind !== "character") {
6941
+ throw new Error(`Invalid style kind: ${String(style.kind)}`);
6942
+ }
6943
+ const stored = clone({ ...style, name: style.name || style.id });
6944
+ this.styles.set(style.id, stored);
6945
+ return stored;
6946
+ }
6947
+ changed() {
6948
+ this.version++;
6949
+ this.snapshot = null;
6950
+ const snapshot = this.getSnapshot();
6951
+ this.listeners.forEach((listener) => {
6952
+ try {
6953
+ listener(snapshot);
6954
+ } catch (err) {
6955
+ console.error("[StyleRegistry] Error in listener:", err);
6956
+ }
6957
+ });
6958
+ }
6959
+ }, _class5);
6960
+ function withoutDefaults(format, defaults) {
6961
+ if (!defaults) return format;
6962
+ const out = {};
6963
+ Object.entries(format).forEach(([key, value]) => {
6964
+ if (defaults[key] !== value) out[key] = value;
6965
+ });
6966
+ return out;
6967
+ }
6968
+ function defaultTagFor(block) {
6969
+ if (block.type === "paragraph") return "p";
6970
+ if (block.type === "heading") {
6971
+ const level = Number(_optionalChain([block, 'access', _215 => _215.attrs, 'optionalAccess', _216 => _216.level]));
6972
+ return level >= 1 && level <= 6 ? `h${level}` : null;
6973
+ }
6974
+ if (block.type === "codeBlock") return "pre";
6975
+ return null;
6976
+ }
6977
+ function safeCSSValue(value) {
6978
+ if (typeof value !== "string") return void 0;
6979
+ const trimmed = value.trim();
6980
+ if (!trimmed || trimmed.length > 200 || UNSAFE_CSS.test(trimmed)) return void 0;
6981
+ return trimmed;
6982
+ }
6983
+ function paragraphCSS(format) {
6984
+ const out = {};
6985
+ const set = (property, value) => {
6986
+ const safe = safeCSSValue(value);
6987
+ if (safe) out[property] = safe;
6988
+ };
6989
+ set("text-align", format.textAlign);
6990
+ set("line-height", format.lineHeight);
6991
+ set("margin-top", format.spaceBefore);
6992
+ set("margin-bottom", format.spaceAfter);
6993
+ set("margin-left", format.indentLeft);
6994
+ set("margin-right", format.indentRight);
6995
+ set("text-indent", format.indentFirstLine);
6996
+ set("border-left", format.borderLeft);
6997
+ set("padding-left", format.paddingLeft);
6998
+ set("background-color", format.backgroundColor);
6999
+ return out;
7000
+ }
7001
+ function characterCSS(format) {
7002
+ const out = {};
7003
+ const set = (property, value) => {
7004
+ const safe = safeCSSValue(value);
7005
+ if (safe) out[property] = safe;
7006
+ };
7007
+ set("font-family", format.fontFamily);
7008
+ set("font-size", format.fontSize);
7009
+ if (format.bold !== void 0) out["font-weight"] = format.bold ? "700" : "400";
7010
+ if (format.italic !== void 0) out["font-style"] = format.italic ? "italic" : "normal";
7011
+ const lines = [format.underline && "underline", format.strike && "line-through"].filter(Boolean);
7012
+ if (format.underline !== void 0 || format.strike !== void 0) {
7013
+ out["text-decoration-line"] = lines.length ? lines.join(" ") : "none";
7014
+ }
7015
+ set("color", format.color);
7016
+ set("background-color", format.backgroundColor);
7017
+ set("letter-spacing", format.letterSpacing);
7018
+ set("text-transform", format.textTransform);
7019
+ if (format.smallCaps !== void 0) out["font-variant-caps"] = format.smallCaps ? "small-caps" : "normal";
7020
+ return out;
7021
+ }
7022
+ function createStyleRegistry(options = {}) {
7023
+ return new StyleRegistry(options);
7024
+ }
7025
+
7026
+ // src/extensions/paragraph-styles/extension.ts
7027
+ var STYLE_ID_ATTRIBUTE = "styleId";
7028
+ var CHARACTER_STYLE_MARK_NAME = "characterStyle";
7029
+ var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
7030
+ function getStyleRegistry(editor) {
7031
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _217 => _217.storage, 'optionalAccess', _218 => _218.paragraphStyles, 'optionalAccess', _219 => _219.registry]), () => ( null));
7032
+ }
7033
+ function headingLevels(editor) {
7034
+ const heading = _optionalChain([editor, 'optionalAccess', _220 => _220.extensionManager, 'optionalAccess', _221 => _221.extensions, 'access', _222 => _222.find, 'call', _223 => _223((e) => e.name === "heading")]);
7035
+ const levels = _optionalChain([heading, 'optionalAccess', _224 => _224.options, 'optionalAccess', _225 => _225.levels]);
7036
+ return Array.isArray(levels) ? levels : null;
7037
+ }
7038
+ function isParagraphStyleAvailable(editor, registry, id) {
7039
+ const style = registry.get(id);
7040
+ if (!style || style.kind !== "paragraph") return false;
7041
+ const block = registry.resolve(id).block;
7042
+ if (!editor.schema.nodes[block.type]) return false;
7043
+ if (block.type === "heading") {
7044
+ const levels = headingLevels(editor);
7045
+ if (levels && !levels.includes(Number(_optionalChain([block, 'access', _226 => _226.attrs, 'optionalAccess', _227 => _227.level])))) return false;
7046
+ }
7047
+ return true;
7048
+ }
7049
+ function getParagraphStyleAt(state, registry, pos = state.selection.from) {
7050
+ const $pos = state.doc.resolve(Math.max(0, Math.min(pos, state.doc.content.size)));
7051
+ const block = $pos.parent;
7052
+ if (!block.isTextblock) return null;
7053
+ return registry.styleOfBlock(block.type.name, block.attrs);
7054
+ }
7055
+ var MARK_FORMAT = {
7056
+ bold: "bold",
7057
+ italic: "italic",
7058
+ underline: "underline",
7059
+ strike: "strike"
7060
+ };
7061
+ function selectionMarks(state) {
7062
+ const { from, to, empty, $from } = state.selection;
7063
+ if (empty) return _nullishCoalesce(state.storedMarks, () => ( $from.marks()));
7064
+ let common = null;
7065
+ state.doc.nodesBetween(from, to, (node) => {
7066
+ if (!node.isText) return true;
7067
+ common = common === null ? node.marks : common.filter((m) => m.isInSet(node.marks));
7068
+ return false;
7069
+ });
7070
+ return _nullishCoalesce(common, () => ( $from.marks()));
7071
+ }
7072
+ function captureSelectionFormat(state) {
7073
+ const character = {};
7074
+ selectionMarks(state).forEach((mark) => {
7075
+ const name = mark.type.name;
7076
+ if (MARK_FORMAT[name]) character[MARK_FORMAT[name]] = true;
7077
+ if (name === "textStyle") {
7078
+ if (mark.attrs.fontFamily) character.fontFamily = mark.attrs.fontFamily;
7079
+ if (mark.attrs.fontSize) character.fontSize = mark.attrs.fontSize;
7080
+ if (mark.attrs.color) character.color = mark.attrs.color;
7081
+ }
7082
+ if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
7083
+ });
7084
+ const paragraph = {};
7085
+ const align = _optionalChain([state, 'access', _228 => _228.selection, 'access', _229 => _229.$from, 'access', _230 => _230.parent, 'access', _231 => _231.attrs, 'optionalAccess', _232 => _232.textAlign]);
7086
+ if (align && align !== "left") paragraph.textAlign = align;
7087
+ return { paragraph, character };
7088
+ }
7089
+ function carriedAttributes(node, type) {
7090
+ const spec = _nullishCoalesce(type.spec.attrs, () => ( {}));
7091
+ return Object.fromEntries(Object.entries(node.attrs).filter(([key]) => key in spec));
7092
+ }
7093
+ function applyStyleToBlock(tr, pos, id, registry) {
7094
+ const node = tr.doc.nodeAt(pos);
7095
+ if (!node || !node.isTextblock) return false;
7096
+ const resolved = registry.resolve(id);
7097
+ const type = tr.doc.type.schema.nodes[resolved.block.type];
7098
+ if (!type) return false;
7099
+ const blockAttrs = _nullishCoalesce(resolved.block.attrs, () => ( {}));
7100
+ const isDefault = registry.defaultStyleFor(resolved.block.type, blockAttrs) === id;
7101
+ const attrs = { ...carriedAttributes(node, type), ...blockAttrs };
7102
+ if (STYLE_ID_ATTRIBUTE in (_nullishCoalesce(type.spec.attrs, () => ( {})))) attrs[STYLE_ID_ATTRIBUTE] = isDefault ? null : id;
7103
+ if ("textAlign" in (_nullishCoalesce(type.spec.attrs, () => ( {})))) {
7104
+ const fallback = _nullishCoalesce(type.spec.attrs.textAlign.default, () => ( null));
7105
+ attrs.textAlign = fallback === null ? null : _nullishCoalesce(resolved.paragraph.textAlign, () => ( fallback));
7106
+ }
7107
+ if (node.type === type && Object.entries(attrs).every(([k, v]) => node.attrs[k] === v)) return false;
7108
+ try {
7109
+ tr.setNodeMarkup(pos, type, attrs);
7110
+ } catch (e6) {
7111
+ try {
7112
+ tr.setBlockType(pos + 1, pos + 1, type, attrs);
7113
+ } catch (e7) {
7114
+ return false;
7115
+ }
7116
+ }
7117
+ return true;
7118
+ }
7119
+ function selectedBlocks(state) {
7120
+ const { from, to } = state.selection;
7121
+ const positions = [];
7122
+ state.doc.nodesBetween(from, to, (node, pos) => {
7123
+ if (node.isTextblock) {
7124
+ positions.push(pos);
7125
+ return false;
7126
+ }
7127
+ return true;
7128
+ });
7129
+ if (positions.length === 0 && state.selection.$from.parent.isTextblock) {
7130
+ positions.push(state.selection.$from.before());
7131
+ }
7132
+ return positions;
7133
+ }
7134
+ function setParagraphStyle(tr, state, id, registry) {
7135
+ const start2 = tr.steps.length;
7136
+ selectedBlocks(state).forEach((pos) => {
7137
+ applyStyleToBlock(tr, tr.mapping.slice(start2).map(pos), id, registry);
7138
+ });
7139
+ }
7140
+ function nextStyleTransaction(transactions, oldState, newState, registry) {
7141
+ if (transactions.length !== 1) return null;
7142
+ const [tr] = transactions;
7143
+ if (!tr.docChanged || tr.getMeta("uiEvent") || tr.getMeta("history$") || tr.getMeta("y-sync$")) {
7144
+ return null;
7145
+ }
7146
+ const old = oldState.selection;
7147
+ const $old = old.$from;
7148
+ if (!old.empty || !$old.parent.isTextblock || $old.parent.type.spec.code) return null;
7149
+ if ($old.parentOffset !== $old.parent.content.size) return null;
7150
+ if (newState.doc.content.size !== oldState.doc.content.size + 2) return null;
7151
+ const $new = newState.selection.$from;
7152
+ if (!newState.selection.empty || !$new.parent.isTextblock || $new.parent.content.size !== 0) return null;
7153
+ const depth = $new.depth;
7154
+ const index = $new.index(depth - 1);
7155
+ if (index === 0 || $new.depth !== $old.depth) return null;
7156
+ const previous = $new.node(depth - 1).child(index - 1);
7157
+ if (!previous.isTextblock || !previous.eq($old.parent)) return null;
7158
+ const style = registry.styleOfBlock($old.parent.type.name, $old.parent.attrs);
7159
+ if (!style) return null;
7160
+ const next = registry.nextStyleId(style);
7161
+ const current = registry.styleOfBlock($new.parent.type.name, $new.parent.attrs);
7162
+ const target = registry.resolve(next).block;
7163
+ const typeMatches = $new.parent.type.name === target.type && Object.entries(_nullishCoalesce(target.attrs, () => ( {}))).every(([k, v]) => $new.parent.attrs[k] === v);
7164
+ if (current === next && typeMatches) return null;
7165
+ const out = newState.tr;
7166
+ if (!applyStyleToBlock(out, $new.before(), next, registry)) return null;
7167
+ return out;
7168
+ }
7169
+ var CharacterStyle = _core.Mark.create({
7170
+ name: CHARACTER_STYLE_MARK_NAME,
7171
+ addAttributes() {
7172
+ return {
7173
+ [STYLE_ID_ATTRIBUTE]: {
7174
+ default: null,
7175
+ parseHTML: (el) => {
7176
+ const id = el.getAttribute("data-char-style");
7177
+ return isValidStyleId(id) ? id : null;
7178
+ },
7179
+ renderHTML: (attrs) => attrs[STYLE_ID_ATTRIBUTE] ? { "data-char-style": attrs[STYLE_ID_ATTRIBUTE] } : {}
7180
+ }
7181
+ };
7182
+ },
7183
+ parseHTML() {
7184
+ return [{ tag: "span[data-char-style]" }];
7185
+ },
7186
+ renderHTML({ HTMLAttributes }) {
7187
+ return ["span", _core.mergeAttributes.call(void 0, HTMLAttributes), 0];
7188
+ }
7189
+ });
7190
+ var ParagraphStyles = _core.Extension.create({
7191
+ name: "paragraphStyles",
7192
+ addOptions() {
7193
+ return {
7194
+ registry: null,
7195
+ types: ["paragraph", "heading", "codeBlock"],
7196
+ injectCSS: true,
7197
+ cssScope: ".ProseMirror",
7198
+ cssNonce: void 0,
7199
+ linkedCharacterStyles: true
7200
+ };
7201
+ },
7202
+ addStorage() {
7203
+ return { registry: _nullishCoalesce(this.options.registry, () => ( createStyleRegistry())) };
7204
+ },
7205
+ addExtensions() {
7206
+ return [CharacterStyle];
7207
+ },
7208
+ addGlobalAttributes() {
7209
+ return [
7210
+ {
7211
+ types: this.options.types,
7212
+ attributes: {
7213
+ [STYLE_ID_ATTRIBUTE]: {
7214
+ default: null,
7215
+ keepOnSplit: true,
7216
+ parseHTML: (el) => {
7217
+ const id = el.getAttribute("data-style");
7218
+ return isValidStyleId(id) ? id : null;
7219
+ },
7220
+ renderHTML: (attrs) => {
7221
+ const id = attrs[STYLE_ID_ATTRIBUTE];
7222
+ return isValidStyleId(id) ? { "data-style": id, class: `pixerate-style-${id}` } : {};
7223
+ }
7224
+ }
7225
+ }
7226
+ }
7227
+ ];
7228
+ },
7229
+ addCommands() {
7230
+ const registry = () => this.storage.registry;
7231
+ const editor = () => this.editor;
7232
+ return {
7233
+ setParagraphStyle: (id) => ({ state, tr, dispatch }) => {
7234
+ const reg = registry();
7235
+ if (!isParagraphStyleAvailable(editor(), reg, id)) return false;
7236
+ const { $from, $to, empty } = state.selection;
7237
+ const linked = this.options.linkedCharacterStyles ? reg.linkedCharacterStyle(id) : void 0;
7238
+ const partial = !empty && $from.sameParent($to) && $from.parent.isTextblock && ($from.parentOffset > 0 || $to.parentOffset < $from.parent.content.size);
7239
+ const markType = state.schema.marks[CHARACTER_STYLE_MARK_NAME];
7240
+ if (partial && linked && markType) {
7241
+ if (dispatch) {
7242
+ tr.addMark($from.pos, $to.pos, markType.create({ [STYLE_ID_ATTRIBUTE]: linked.id }));
7243
+ }
7244
+ return true;
7245
+ }
7246
+ if (dispatch) setParagraphStyle(tr, state, id, reg);
7247
+ return true;
7248
+ },
7249
+ clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(NORMAL_STYLE_ID),
7250
+ setCharacterStyle: (id) => ({ commands }) => {
7251
+ if (_optionalChain([registry, 'call', _233 => _233(), 'access', _234 => _234.get, 'call', _235 => _235(id), 'optionalAccess', _236 => _236.kind]) !== "character") return false;
7252
+ return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
7253
+ },
7254
+ unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
7255
+ updateParagraphStyleFromSelection: (id) => ({ state, dispatch }) => {
7256
+ const reg = registry();
7257
+ const target = _nullishCoalesce(id, () => ( getParagraphStyleAt(state, reg)));
7258
+ const style = target ? reg.get(target) : void 0;
7259
+ if (!style || style.kind !== "paragraph") return false;
7260
+ if (dispatch) {
7261
+ const captured = captureSelectionFormat(state);
7262
+ reg.update(style.id, captured);
7263
+ }
7264
+ return true;
7265
+ },
7266
+ createParagraphStyleFromSelection: (name, options = {}) => ({ state, tr, dispatch }) => {
7267
+ const reg = registry();
7268
+ const trimmed = name.trim();
7269
+ if (!trimmed) return false;
7270
+ const id = _nullishCoalesce(options.id, () => ( reg.newId(trimmed)));
7271
+ if (!isValidStyleId(id) || reg.get(id)) return false;
7272
+ const basedOn = options.basedOn === void 0 ? getParagraphStyleAt(state, reg) : options.basedOn;
7273
+ if (dispatch) {
7274
+ const captured = captureSelectionFormat(state);
7275
+ const definition = {
7276
+ id,
7277
+ name: trimmed,
7278
+ kind: "paragraph",
7279
+ basedOn: _nullishCoalesce(basedOn, () => ( NORMAL_STYLE_ID)),
7280
+ paragraph: captured.paragraph,
7281
+ character: captured.character,
7282
+ priority: 50,
7283
+ quick: true
7284
+ };
7285
+ reg.upsert(definition);
7286
+ if (options.apply !== false) setParagraphStyle(tr, state, id, reg);
7287
+ }
7288
+ return true;
7289
+ }
7290
+ };
7291
+ },
7292
+ addProseMirrorPlugins() {
7293
+ const registry = this.storage.registry;
7294
+ return [
7295
+ new (0, _state.Plugin)({
7296
+ key: paragraphStylesPluginKey,
7297
+ appendTransaction: (transactions, oldState, newState) => nextStyleTransaction(transactions, oldState, newState, registry)
7298
+ })
7299
+ ];
7300
+ },
7301
+ onBeforeCreate() {
7302
+ if (!this.options.injectCSS || typeof document === "undefined") return;
7303
+ const element = document.createElement("style");
7304
+ element.setAttribute("data-pixerate-paragraph-styles", "");
7305
+ if (this.options.cssNonce) element.nonce = this.options.cssNonce;
7306
+ document.head.appendChild(element);
7307
+ const scope = this.options.cssScope;
7308
+ const unsubscribe = this.storage.registry.subscribe(() => {
7309
+ element.textContent = this.storage.registry.toCSS({ scope });
7310
+ });
7311
+ this.storage.cleanup = () => {
7312
+ unsubscribe();
7313
+ element.remove();
7314
+ };
7315
+ },
7316
+ onDestroy() {
7317
+ _optionalChain([this, 'access', _237 => _237.storage, 'access', _238 => _238.cleanup, 'optionalCall', _239 => _239()]);
7318
+ }
7319
+ });
7320
+ var EMPTY_STYLES = Object.freeze({
7321
+ gallery: [],
7322
+ styles: [],
7323
+ characterStyles: [],
7324
+ currentStyleId: null,
7325
+ version: -1
7326
+ });
7327
+ function createParagraphStylesStore(editor) {
7328
+ const registry = getStyleRegistry(editor);
7329
+ const listeners = /* @__PURE__ */ new Set();
7330
+ let snapshot = EMPTY_STYLES;
7331
+ let unsubscribeRegistry = null;
7332
+ const compute = () => {
7333
+ if (!editor || editor.isDestroyed || !registry) return EMPTY_STYLES;
7334
+ const { version } = registry.getSnapshot();
7335
+ const currentStyleId = getParagraphStyleAt(editor.state, registry);
7336
+ if (snapshot.version === version && snapshot.currentStyleId === currentStyleId) return snapshot;
7337
+ if (snapshot.version === version) return { ...snapshot, currentStyleId };
7338
+ const styles = registry.list("paragraph").filter((style) => !style.hidden && isParagraphStyleAvailable(editor, registry, style.id));
7339
+ return {
7340
+ gallery: styles.filter((style) => style.quick),
7341
+ styles,
7342
+ characterStyles: registry.list("character").filter((style) => !style.hidden),
7343
+ currentStyleId,
7344
+ version
7345
+ };
7346
+ };
7347
+ const update = () => {
7348
+ const next = compute();
7349
+ if (next !== snapshot) {
7350
+ snapshot = next;
7351
+ listeners.forEach((listener) => listener());
7352
+ }
7353
+ };
7354
+ const detach = () => {
7355
+ _optionalChain([editor, 'optionalAccess', _240 => _240.off, 'call', _241 => _241("transaction", update)]);
7356
+ _optionalChain([unsubscribeRegistry, 'optionalCall', _242 => _242()]);
7357
+ unsubscribeRegistry = null;
7358
+ };
7359
+ return {
7360
+ getSnapshot: () => {
7361
+ if (!listeners.size) snapshot = compute();
7362
+ return snapshot;
7363
+ },
7364
+ subscribe(listener) {
7365
+ if (!listeners.size) {
7366
+ snapshot = compute();
7367
+ _optionalChain([editor, 'optionalAccess', _243 => _243.on, 'call', _244 => _244("transaction", update)]);
7368
+ unsubscribeRegistry = registry ? registry.subscribe(update) : null;
7369
+ }
7370
+ listeners.add(listener);
7371
+ return () => {
7372
+ listeners.delete(listener);
7373
+ if (!listeners.size) detach();
7374
+ };
7375
+ },
7376
+ destroy() {
7377
+ detach();
7378
+ listeners.clear();
7379
+ }
7380
+ };
7381
+ }
7382
+
6472
7383
  // 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;
7384
+ var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _245 => _245[name]]) || _optionalChain([mod, 'optionalAccess', _246 => _246.default, 'optionalAccess', _247 => _247[name]]) || _optionalChain([mod, 'optionalAccess', _248 => _248.default, 'optionalAccess', _249 => _249.default]) || _optionalChain([mod, 'optionalAccess', _250 => _250.default]) || mod;
6474
7385
  var StarterKit = resolveExt3(_StarterKit, "StarterKit");
6475
7386
  var Color = resolveExt3(_Color, "Color");
6476
7387
  var Highlight = resolveExt3(_Highlight, "Highlight");
@@ -6491,7 +7402,7 @@ function createRichTextPreset(options = {}) {
6491
7402
  openLinksOnClick = false,
6492
7403
  enableSmilies = true,
6493
7404
  enableColorHighlighter = true,
6494
- headingLevels = [1, 2, 3, 4]
7405
+ headingLevels: headingLevels2 = [1, 2, 3, 4]
6495
7406
  } = options;
6496
7407
  const extensions2 = [
6497
7408
  StarterKit.configure({
@@ -6506,7 +7417,7 @@ function createRichTextPreset(options = {}) {
6506
7417
  }
6507
7418
  },
6508
7419
  heading: {
6509
- levels: headingLevels,
7420
+ levels: headingLevels2,
6510
7421
  HTMLAttributes: {
6511
7422
  class: "font-bold tracking-tight"
6512
7423
  }
@@ -6551,7 +7462,7 @@ function createRichTextPreset(options = {}) {
6551
7462
  find: /^\s*(\[([ |x])?\])\s$/i,
6552
7463
  type: this.type,
6553
7464
  getAttributes: (match) => ({
6554
- checked: _optionalChain([match, 'access', _193 => _193[2], 'optionalAccess', _194 => _194.toLowerCase, 'call', _195 => _195()]) === "x"
7465
+ checked: _optionalChain([match, 'access', _251 => _251[2], 'optionalAccess', _252 => _252.toLowerCase, 'call', _253 => _253()]) === "x"
6555
7466
  })
6556
7467
  })
6557
7468
  ];
@@ -6625,7 +7536,7 @@ function createRichTextPreset(options = {}) {
6625
7536
  }
6626
7537
  if (options.trackChanges) {
6627
7538
  extensions2.push(
6628
- typeof options.trackChanges === "object" ? _chunkD27YFC46cjs.TrackChanges.configure(options.trackChanges) : _chunkD27YFC46cjs.TrackChanges,
7539
+ typeof options.trackChanges === "object" ? _chunkX4N4WUKBcjs.TrackChanges.configure(options.trackChanges) : _chunkX4N4WUKBcjs.TrackChanges,
6629
7540
  DocumentCompare
6630
7541
  );
6631
7542
  }
@@ -6668,6 +7579,9 @@ function createRichTextPreset(options = {}) {
6668
7579
  if (options.findReplace) {
6669
7580
  extensions2.push(FindReplace.configure(optionObject(options.findReplace)));
6670
7581
  }
7582
+ if (options.paragraphStyles) {
7583
+ extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
7584
+ }
6671
7585
  return extensions2;
6672
7586
  }
6673
7587
 
@@ -6716,7 +7630,7 @@ function createFindReplaceCommands(editor, options = {}) {
6716
7630
  const hasMatches = () => {
6717
7631
  const ok = usable(editor);
6718
7632
  if (ok !== true) return ok;
6719
- return _optionalChain([state, 'call', _196 => _196(), 'optionalAccess', _197 => _197.matches, 'access', _198 => _198.length]) ? true : "No matches.";
7633
+ return _optionalChain([state, 'call', _254 => _254(), 'optionalAccess', _255 => _255.matches, 'access', _256 => _256.length]) ? true : "No matches.";
6720
7634
  };
6721
7635
  const apply = (params) => {
6722
7636
  const split = splitParams(params);
@@ -6724,7 +7638,7 @@ function createFindReplaceCommands(editor, options = {}) {
6724
7638
  };
6725
7639
  const failIfInvalid = () => {
6726
7640
  const s = state();
6727
- if (_optionalChain([s, 'optionalAccess', _199 => _199.error])) throw new Error(s.error.message);
7641
+ if (_optionalChain([s, 'optionalAccess', _257 => _257.error])) throw new Error(s.error.message);
6728
7642
  };
6729
7643
  return [
6730
7644
  {
@@ -6763,9 +7677,9 @@ function createFindReplaceCommands(editor, options = {}) {
6763
7677
  failIfInvalid();
6764
7678
  const s = state();
6765
7679
  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 }))
7680
+ count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _258 => _258.matches, 'access', _259 => _259.length]), () => ( 0)),
7681
+ truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _260 => _260.truncated]), () => ( false)),
7682
+ matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _261 => _261.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6769
7683
  };
6770
7684
  }
6771
7685
  },
@@ -6792,11 +7706,11 @@ function createFindReplaceCommands(editor, options = {}) {
6792
7706
  description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
6793
7707
  params: searchParams(true),
6794
7708
  ...scope,
6795
- enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _204 => _204.query]) !== void 0 ? usable(editor) : hasMatches(),
7709
+ enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _262 => _262.query]) !== void 0 ? usable(editor) : hasMatches(),
6796
7710
  run: (_ctx, params) => {
6797
7711
  apply(params);
6798
7712
  failIfInvalid();
6799
- const count = _nullishCoalesce(_optionalChain([state, 'call', _205 => _205(), 'optionalAccess', _206 => _206.matches, 'access', _207 => _207.length]), () => ( 0));
7713
+ const count = _nullishCoalesce(_optionalChain([state, 'call', _263 => _263(), 'optionalAccess', _264 => _264.matches, 'access', _265 => _265.length]), () => ( 0));
6800
7714
  if (count) editor.commands.replaceAll();
6801
7715
  return { replaced: count };
6802
7716
  }
@@ -6932,5 +7846,23 @@ function validateFindPattern(query, options = {}) {
6932
7846
 
6933
7847
 
6934
7848
 
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
7849
+
7850
+
7851
+
7852
+
7853
+
7854
+
7855
+
7856
+
7857
+
7858
+
7859
+
7860
+
7861
+
7862
+
7863
+
7864
+
7865
+
7866
+
7867
+ 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.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.NORMAL_STYLE_ID = NORMAL_STYLE_ID; exports.isValidStyleId = isValidStyleId; exports.DEFAULT_STYLES = DEFAULT_STYLES; exports.StyleRegistry = StyleRegistry; exports.safeCSSValue = safeCSSValue; exports.createStyleRegistry = createStyleRegistry; 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;
7868
+ //# sourceMappingURL=chunk-PO6A6QQH.cjs.map