@pixerate/editor 0.235.0 → 0.236.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.
@@ -34,7 +34,8 @@ var _chunkHMGWFXECcjs = require('./chunk-HMGWFXEC.cjs');
34
34
 
35
35
 
36
36
 
37
- var _chunkO7QXVGMPcjs = require('./chunk-O7QXVGMP.cjs');
37
+
38
+ var _chunkWV5WTOC6cjs = require('./chunk-WV5WTOC6.cjs');
38
39
 
39
40
 
40
41
  var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
@@ -59,7 +60,6 @@ var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
59
60
 
60
61
 
61
62
 
62
-
63
63
  var _chunk34RQAGWIcjs = require('./chunk-34RQAGWI.cjs');
64
64
 
65
65
 
@@ -1870,254 +1870,10 @@ var Image2 = BaseImage.extend({
1870
1870
  }
1871
1871
  });
1872
1872
 
1873
- // src/extensions/comments.ts
1874
-
1875
-
1876
-
1877
- var commentsPluginKey = new (0, _state.PluginKey)("comments");
1878
- var COMMENT_MARK_NAME = "comment";
1879
- function findCommentRanges(doc) {
1880
- const result = /* @__PURE__ */ new Map();
1881
- doc.descendants((node, pos) => {
1882
- if (!node.isInline) return;
1883
- node.marks.forEach((mark) => {
1884
- if (mark.type.name !== COMMENT_MARK_NAME) return;
1885
- const id = mark.attrs.commentId;
1886
- if (!id) return;
1887
- const ranges = _nullishCoalesce(result.get(id), () => ( []));
1888
- const last = ranges[ranges.length - 1];
1889
- const end = pos + node.nodeSize;
1890
- if (last && last.to === pos) {
1891
- last.to = end;
1892
- } else {
1893
- ranges.push({ from: pos, to: end });
1894
- }
1895
- result.set(id, ranges);
1896
- });
1897
- });
1898
- return result;
1899
- }
1900
- function getCommentAnchors(doc) {
1901
- const anchors = /* @__PURE__ */ new Map();
1902
- findCommentRanges(doc).forEach((ranges, id) => {
1903
- const from = ranges[0].from;
1904
- const to = ranges[ranges.length - 1].to;
1905
- anchors.set(id, {
1906
- from,
1907
- to,
1908
- quote: ranges.map((r) => doc.textBetween(r.from, r.to, " ", " ")).join(" ")
1909
- });
1910
- });
1911
- return anchors;
1912
- }
1913
- function getCommentIdsAt(state, pos = state.selection.from) {
1914
- const $pos = state.doc.resolve(pos);
1915
- const marks = [
1916
- ..._nullishCoalesce(_optionalChain([$pos, 'access', _62 => _62.nodeAfter, 'optionalAccess', _63 => _63.marks]), () => ( [])),
1917
- ..._nullishCoalesce(_optionalChain([$pos, 'access', _64 => _64.nodeBefore, 'optionalAccess', _65 => _65.marks]), () => ( []))
1918
- ];
1919
- const ids = [];
1920
- marks.forEach((m) => {
1921
- if (m.type.name === COMMENT_MARK_NAME && m.attrs.commentId && !ids.includes(m.attrs.commentId)) {
1922
- ids.push(m.attrs.commentId);
1923
- }
1924
- });
1925
- return ids;
1926
- }
1927
- function getCommentStore(editor) {
1928
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _66 => _66.storage, 'optionalAccess', _67 => _67[COMMENT_MARK_NAME], 'optionalAccess', _68 => _68.store]), () => ( null));
1929
- }
1930
- function resolveAuthor(author) {
1931
- return typeof author === "function" ? author() : author;
1932
- }
1933
- var Comments = _core.Mark.create({
1934
- name: COMMENT_MARK_NAME,
1935
- // Typing at the edge of a comment does not extend it.
1936
- inclusive: false,
1937
- // Allow several comment marks (different threads) on the same text.
1938
- excludes: "",
1939
- addOptions() {
1940
- return {
1941
- store: null,
1942
- author: { id: "anonymous", name: "Anonymous" },
1943
- HTMLAttributes: {},
1944
- commentClass: "pixerate-comment bg-amber-100 border-b-2 border-amber-400 dark:bg-amber-500/20 cursor-pointer",
1945
- activeClass: "pixerate-comment-active bg-amber-200 dark:bg-amber-500/40",
1946
- resolvedClass: "",
1947
- activateOnSelection: true
1948
- };
1949
- },
1950
- addStorage() {
1951
- return {
1952
- store: _nullishCoalesce(this.options.store, () => ( new (0, _chunk34RQAGWIcjs.CommentStore)())),
1953
- // tiptap-markdown: comments are not part of the exported markdown.
1954
- markdown: { serialize: { open: "", close: "" }, parse: {} }
1955
- };
1956
- },
1957
- addAttributes() {
1958
- return {
1959
- commentId: {
1960
- default: null,
1961
- parseHTML: (el) => el.getAttribute("data-comment-id"),
1962
- renderHTML: (attrs) => attrs.commentId ? { "data-comment-id": attrs.commentId } : {}
1963
- }
1964
- };
1965
- },
1966
- parseHTML() {
1967
- return [{ tag: "span[data-comment-id]" }];
1968
- },
1969
- renderHTML({ HTMLAttributes }) {
1970
- return ["span", _chunk34RQAGWIcjs.safeMergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes), 0];
1971
- },
1972
- addCommands() {
1973
- const store = () => this.storage.store;
1974
- return {
1975
- addComment: (options = {}) => ({ state, tr, dispatch }) => {
1976
- const { from, to, empty } = state.selection;
1977
- if (empty) return false;
1978
- if (dispatch) {
1979
- const id = _nullishCoalesce(options.id, () => ( _chunk34RQAGWIcjs.createReviewId.call(void 0, "comment")));
1980
- tr.addMark(from, to, this.type.create({ commentId: id }));
1981
- tr.setMeta(commentsPluginKey, "refresh");
1982
- store().createThread({
1983
- id,
1984
- body: _nullishCoalesce(options.body, () => ( "")),
1985
- author: _nullishCoalesce(options.author, () => ( resolveAuthor(this.options.author))),
1986
- anchor: { from, to, quote: state.doc.textBetween(from, to, " ", " ") }
1987
- });
1988
- store().setActiveThread(id);
1989
- }
1990
- return true;
1991
- },
1992
- resolveComment: (id, resolved = true) => ({ tr, dispatch }) => {
1993
- if (!store().getThread(id)) return false;
1994
- if (dispatch) {
1995
- store().resolveThread(id, resolved, resolveAuthor(this.options.author));
1996
- tr.setMeta(commentsPluginKey, "refresh");
1997
- }
1998
- return true;
1999
- },
2000
- deleteComment: (id) => ({ state, tr, dispatch }) => {
2001
- const ranges = _nullishCoalesce(findCommentRanges(state.doc).get(id), () => ( []));
2002
- if (ranges.length === 0 && !store().getThread(id)) return false;
2003
- if (dispatch) {
2004
- ranges.forEach(({ from, to }) => {
2005
- state.doc.nodesBetween(from, to, (node, pos) => {
2006
- const mark = node.marks.find(
2007
- (m) => m.type === this.type && m.attrs.commentId === id
2008
- );
2009
- if (mark) {
2010
- tr.removeMark(Math.max(pos, from), Math.min(pos + node.nodeSize, to), mark);
2011
- }
2012
- });
2013
- });
2014
- tr.setMeta(commentsPluginKey, "refresh");
2015
- store().deleteThread(id);
2016
- }
2017
- return true;
2018
- },
2019
- setActiveComment: (id) => ({ tr, dispatch }) => {
2020
- if (id !== null && !store().getThread(id)) return false;
2021
- if (dispatch) {
2022
- store().setActiveThread(id);
2023
- tr.setMeta(commentsPluginKey, "refresh");
2024
- }
2025
- return true;
2026
- },
2027
- focusComment: (id) => ({ state, tr, dispatch }) => {
2028
- const ranges = findCommentRanges(state.doc).get(id);
2029
- if (!ranges || ranges.length === 0) return false;
2030
- if (dispatch) {
2031
- const from = ranges[0].from;
2032
- const to = ranges[ranges.length - 1].to;
2033
- tr.setSelection(_state.TextSelection.create(tr.doc, from, to)).scrollIntoView();
2034
- store().setActiveThread(id);
2035
- tr.setMeta(commentsPluginKey, "refresh");
2036
- }
2037
- return true;
2038
- }
2039
- };
2040
- },
2041
- addProseMirrorPlugins() {
2042
- const store = this.storage.store;
2043
- const options = this.options;
2044
- let cache = null;
2045
- const buildDecorations = (doc) => {
2046
- const snapshot = store.getSnapshot();
2047
- if (cache && cache.doc === doc && cache.snapshot === snapshot) return cache.set;
2048
- const decorations = [];
2049
- findCommentRanges(doc).forEach((ranges, id) => {
2050
- const thread = store.getThread(id);
2051
- const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _69 => _69.resolved]), () => ( false));
2052
- const active = snapshot.activeThreadId === id;
2053
- const cls = [
2054
- resolved ? options.resolvedClass : options.commentClass,
2055
- active ? options.activeClass : ""
2056
- ].filter(Boolean).join(" ");
2057
- if (!cls) return;
2058
- ranges.forEach(({ from, to }) => {
2059
- decorations.push(_view2.Decoration.inline(from, to, { class: cls }));
2060
- });
2061
- });
2062
- const set = _view2.DecorationSet.create(doc, decorations);
2063
- cache = { doc, snapshot, set };
2064
- return set;
2065
- };
2066
- return [
2067
- new (0, _state.Plugin)({
2068
- key: commentsPluginKey,
2069
- props: {
2070
- decorations: (state) => buildDecorations(state.doc)
2071
- },
2072
- view: (view) => {
2073
- let destroyed = false;
2074
- let scheduled = false;
2075
- const sync = () => store.syncAnchors(getCommentAnchors(view.state.doc));
2076
- sync();
2077
- const unsubscribe = store.subscribe(() => {
2078
- if (scheduled) return;
2079
- scheduled = true;
2080
- queueMicrotask(() => {
2081
- scheduled = false;
2082
- if (destroyed) return;
2083
- sync();
2084
- if (_optionalChain([cache, 'optionalAccess', _70 => _70.snapshot]) !== store.getSnapshot()) {
2085
- view.dispatch(
2086
- view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
2087
- );
2088
- }
2089
- });
2090
- });
2091
- return {
2092
- update(view2, prevState) {
2093
- if (!prevState.doc.eq(view2.state.doc)) sync();
2094
- if (options.activateOnSelection && !prevState.selection.eq(view2.state.selection)) {
2095
- const ids = getCommentIdsAt(view2.state);
2096
- const active = store.getSnapshot().activeThreadId;
2097
- if (!active || !ids.includes(active)) {
2098
- store.setActiveThread(_nullishCoalesce(ids[0], () => ( null)));
2099
- }
2100
- }
2101
- },
2102
- destroy() {
2103
- destroyed = true;
2104
- unsubscribe();
2105
- }
2106
- };
2107
- }
2108
- })
2109
- ];
2110
- }
2111
- });
2112
- function getCommentAuthor(editor) {
2113
- 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)]);
2114
- return ext ? resolveAuthor(ext.options.author) : null;
2115
- }
2116
-
2117
1873
  // src/extensions/document-compare.ts
2118
1874
 
2119
1875
  function trackChangesAuthor(state) {
2120
- return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access', _75 => _75.getState, 'call', _76 => _76(state), 'optionalAccess', _77 => _77.author]);
1876
+ return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access', _62 => _62.getState, 'call', _63 => _63(state), 'optionalAccess', _64 => _64.author]);
2121
1877
  }
2122
1878
  function compareInEditor(editor, original, revised, options = {}) {
2123
1879
  return _chunkHMGWFXECcjs.compareDocuments.call(void 0, original, revised, {
@@ -2251,7 +2007,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2251
2007
  * wildcards, then higher `priority`, then the most recently registered.
2252
2008
  */
2253
2009
  find(query) {
2254
- const fileName = _nullishCoalesce(_optionalChain([query, 'access', _78 => _78.fileName, 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]), () => ( ""));
2010
+ const fileName = _nullishCoalesce(_optionalChain([query, 'access', _65 => _65.fileName, 'optionalAccess', _66 => _66.toLowerCase, 'call', _67 => _67()]), () => ( ""));
2255
2011
  const mime = normalizeMimeType(query.mimeType);
2256
2012
  let best;
2257
2013
  let bestScore = 0;
@@ -2332,7 +2088,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
2332
2088
  mimeType,
2333
2089
  target: adapter.target,
2334
2090
  registry: this,
2335
- options: _optionalChain([options, 'access', _81 => _81.adapterOptions, 'optionalAccess', _82 => _82[adapter.id]])
2091
+ options: _optionalChain([options, 'access', _68 => _68.adapterOptions, 'optionalAccess', _69 => _69[adapter.id]])
2336
2092
  });
2337
2093
  try {
2338
2094
  const result = await adapter.import(input, context);
@@ -2402,7 +2158,7 @@ function descendants(el, localName) {
2402
2158
  }
2403
2159
  function toggle(el) {
2404
2160
  if (!el) return void 0;
2405
- const value = _optionalChain([attr, 'call', _83 => _83(el, "val"), 'optionalAccess', _84 => _84.toLowerCase, 'call', _85 => _85()]);
2161
+ const value = _optionalChain([attr, 'call', _70 => _70(el, "val"), 'optionalAccess', _71 => _71.toLowerCase, 'call', _72 => _72()]);
2406
2162
  return value === void 0 || !["0", "false", "off", "none"].includes(value);
2407
2163
  }
2408
2164
  function parseXml(Parser, xml, partName) {
@@ -2443,7 +2199,7 @@ async function readRelationships(zip, Parser, partPath) {
2443
2199
  const id = attr(rel, "Id");
2444
2200
  const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
2445
2201
  if (!id) return;
2446
- const external = _optionalChain([attr, 'call', _86 => _86(rel, "TargetMode"), 'optionalAccess', _87 => _87.toLowerCase, 'call', _88 => _88()]) === "external";
2202
+ const external = _optionalChain([attr, 'call', _73 => _73(rel, "TargetMode"), 'optionalAccess', _74 => _74.toLowerCase, 'call', _75 => _75()]) === "external";
2447
2203
  rels.set(id, {
2448
2204
  type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
2449
2205
  target: external ? target : resolvePartPath(baseDir, target),
@@ -2506,7 +2262,7 @@ async function loadImages(zip, root, rels, options) {
2506
2262
  for (const id of ids) {
2507
2263
  const rel = rels.get(id);
2508
2264
  if (!rel || rel.external) continue;
2509
- 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()]), () => ( ""))];
2265
+ const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access', _76 => _76.target, 'access', _77 => _77.split, 'call', _78 => _78("."), 'access', _79 => _79.pop, 'call', _80 => _80(), 'optionalAccess', _81 => _81.toLowerCase, 'call', _82 => _82()]), () => ( ""))];
2510
2266
  const entry = zip.get(rel.target);
2511
2267
  if (!mime || !entry || entry.size > maxSize) continue;
2512
2268
  images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
@@ -2645,7 +2401,7 @@ function mapStyleIds(styles) {
2645
2401
  });
2646
2402
  return ids;
2647
2403
  }
2648
- var styleKind = (style) => _optionalChain([style, 'optionalAccess', _96 => _96.type]) === "character" ? "character" : "paragraph";
2404
+ var styleKind = (style) => _optionalChain([style, 'optionalAccess', _83 => _83.type]) === "character" ? "character" : "paragraph";
2649
2405
  function styleDefinitions(styles, ids) {
2650
2406
  const out = [];
2651
2407
  styles.forEach((style, fileId) => {
@@ -2971,9 +2727,9 @@ function parseHyperlinkInstruction(instr) {
2971
2727
  const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
2972
2728
  if (!match) return void 0;
2973
2729
  const rest = match[1];
2974
- const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _97 => _97.exec, 'call', _98 => _98(rest), 'optionalAccess', _99 => _99[1]]);
2730
+ const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _84 => _84.exec, 'call', _85 => _85(rest), 'optionalAccess', _86 => _86[1]]);
2975
2731
  const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
2976
- const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _100 => _100[1]]), () => ( _optionalChain([target, 'optionalAccess', _101 => _101[2]])));
2732
+ const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _87 => _87[1]]), () => ( _optionalChain([target, 'optionalAccess', _88 => _88[2]])));
2977
2733
  if (url) return anchor ? `${url}#${anchor}` : url;
2978
2734
  return anchor ? `#${anchor}` : void 0;
2979
2735
  }
@@ -3008,7 +2764,7 @@ var ParagraphRenderer = (_class2 = class {
3008
2764
  else {
3009
2765
  this.segments.shift();
3010
2766
  const next = this.segments[0];
3011
- if (_optionalChain([next, 'optionalAccess', _102 => _102.kind]) === "text") {
2767
+ if (_optionalChain([next, 'optionalAccess', _89 => _89.kind]) === "text") {
3012
2768
  next.text = next.text.replace(/^ /, "");
3013
2769
  if (!next.text) this.segments.shift();
3014
2770
  }
@@ -3106,7 +2862,7 @@ var ParagraphRenderer = (_class2 = class {
3106
2862
  run(r, base) {
3107
2863
  const rPr = wChild(r, "rPr");
3108
2864
  const runStyle = this.ctx.styles.get(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( "")));
3109
- const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess', _103 => _103.format]), () => ( {}));
2865
+ const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess', _90 => _90.format]), () => ( {}));
3110
2866
  const own = readFormat(rPr);
3111
2867
  const format = { ...base, ...styleFormat, ...own };
3112
2868
  const rPrChange = wChild(rPr, "rPrChange");
@@ -3273,15 +3029,15 @@ function paragraphInfo(p, ctx) {
3273
3029
  heading = styleHeadingLevel(ctx.styles, styleId);
3274
3030
  }
3275
3031
  let numPr = readNumPr(pPr);
3276
- if (!numPr) numPr = _optionalChain([styleChain, 'call', _104 => _104(ctx.styles, styleId), 'access', _105 => _105.find, 'call', _106 => _106((style) => style.numPr), 'optionalAccess', _107 => _107.numPr]);
3032
+ if (!numPr) numPr = _optionalChain([styleChain, 'call', _91 => _91(ctx.styles, styleId), 'access', _92 => _92.find, 'call', _93 => _93((style) => style.numPr), 'optionalAccess', _94 => _94.numPr]);
3277
3033
  let list;
3278
3034
  if (numPr && numPr.numId !== "0" && heading === void 0) {
3279
3035
  const num = ctx.numbering.nums.get(numPr.numId);
3280
- const def = num ? _optionalChain([ctx, 'access', _108 => _108.numbering, 'access', _109 => _109.abstracts, 'access', _110 => _110.get, 'call', _111 => _111(num.abstractId), 'optionalAccess', _112 => _112.get, 'call', _113 => _113(numPr.ilvl)]) : void 0;
3036
+ const def = num ? _optionalChain([ctx, 'access', _95 => _95.numbering, 'access', _96 => _96.abstracts, 'access', _97 => _97.get, 'call', _98 => _98(num.abstractId), 'optionalAccess', _99 => _99.get, 'call', _100 => _100(numPr.ilvl)]) : void 0;
3281
3037
  list = {
3282
3038
  level: Math.max(0, Math.min(numPr.ilvl, 8)),
3283
- ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _114 => _114.ordered]), () => ( false)),
3284
- start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _115 => _115.starts, 'access', _116 => _116.get, 'call', _117 => _117(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _118 => _118.start]))), () => ( 1))
3039
+ ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _101 => _101.ordered]), () => ( false)),
3040
+ start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _102 => _102.starts, 'access', _103 => _103.get, 'call', _104 => _104(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _105 => _105.start]))), () => ( 1))
3285
3041
  };
3286
3042
  }
3287
3043
  const special = heading === void 0 && !list ? specialStyle(ctx.styles, styleId) : void 0;
@@ -3415,7 +3171,7 @@ function renderTable(tbl, ctx, part) {
3415
3171
  if (cell.merge === "restart") {
3416
3172
  for (let r = rowIndex + 1; r < rows.length; r++) {
3417
3173
  const below = rows[r].find((c) => c.col === cell.col);
3418
- if (_optionalChain([below, 'optionalAccess', _119 => _119.merge]) !== "continue") break;
3174
+ if (_optionalChain([below, 'optionalAccess', _106 => _106.merge]) !== "continue") break;
3419
3175
  rowspan++;
3420
3176
  }
3421
3177
  }
@@ -3428,7 +3184,7 @@ function renderTable(tbl, ctx, part) {
3428
3184
  return `${html}</tbody></table>`;
3429
3185
  }
3430
3186
  function getDomParser(options) {
3431
- const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _120 => _120.window, 'optionalAccess', _121 => _121.DOMParser])));
3187
+ const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _107 => _107.window, 'optionalAccess', _108 => _108.DOMParser])));
3432
3188
  if (typeof Parser !== "function") {
3433
3189
  throw new ImportError(
3434
3190
  "unsupported_environment",
@@ -3443,7 +3199,7 @@ async function docxToDocumentImport(data, options = {}) {
3443
3199
  try {
3444
3200
  zip = await _chunkALNIFK5Gcjs.readZip.call(void 0, data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
3445
3201
  } catch (error) {
3446
- if (_optionalChain([error, 'optionalAccess', _122 => _122.code]) === "invalid_archive") {
3202
+ if (_optionalChain([error, 'optionalAccess', _109 => _109.code]) === "invalid_archive") {
3447
3203
  throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
3448
3204
  }
3449
3205
  throw error;
@@ -3463,7 +3219,7 @@ async function docxToDocumentImport(data, options = {}) {
3463
3219
  throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
3464
3220
  }
3465
3221
  const rels = await readRelationships(zip, Parser, mainPath);
3466
- const partByType = (suffix) => _optionalChain([Array, 'access', _123 => _123.from, 'call', _124 => _124(rels.values()), 'access', _125 => _125.find, 'call', _126 => _126((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _127 => _127.target]);
3222
+ const partByType = (suffix) => _optionalChain([Array, 'access', _110 => _110.from, 'call', _111 => _111(rels.values()), 'access', _112 => _112.find, 'call', _113 => _113((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _114 => _114.target]);
3467
3223
  const baseDir = dirname(mainPath);
3468
3224
  const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
3469
3225
  const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
@@ -3628,7 +3384,7 @@ function getImportAccept(target) {
3628
3384
 
3629
3385
  var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
3630
3386
  function htmlToSlice(html, schema) {
3631
- const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _128 => _128.window, 'optionalAccess', _129 => _129.DOMParser])));
3387
+ const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _115 => _115.window, 'optionalAccess', _116 => _116.DOMParser])));
3632
3388
  if (!Parser) return null;
3633
3389
  const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
3634
3390
  return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
@@ -3643,9 +3399,9 @@ function insertImportedDocument(target, content, options = {}) {
3643
3399
  if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
3644
3400
  from = to = _state.Selection.near(state.doc.resolve(from)).from;
3645
3401
  }
3646
- if (htmlSlice && _chunkO7QXVGMPcjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkO7QXVGMPcjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
3402
+ if (htmlSlice && _chunkWV5WTOC6cjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkWV5WTOC6cjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
3647
3403
  const tr2 = state.tr;
3648
- const end2 = _chunkO7QXVGMPcjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
3404
+ const end2 = _chunkWV5WTOC6cjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
3649
3405
  if (end2 !== null) {
3650
3406
  if (options.at === void 0) tr2.setSelection(_state.Selection.near(tr2.doc.resolve(end2), -1));
3651
3407
  view.dispatch(tr2.scrollIntoView().setMeta("uiEvent", "drop"));
@@ -3658,11 +3414,11 @@ function insertImportedDocument(target, content, options = {}) {
3658
3414
  return end;
3659
3415
  }
3660
3416
  function applyImportedReviewData(editor, content) {
3661
- const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _130 => _130.storage]), () => ( {}));
3417
+ const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _117 => _117.storage]), () => ( {}));
3662
3418
  let comments = 0;
3663
3419
  let styles = 0;
3664
- const store = _optionalChain([storage, 'access', _131 => _131.comment, 'optionalAccess', _132 => _132.store]);
3665
- const threads = _nullishCoalesce(_optionalChain([content, 'access', _133 => _133.comments, 'optionalAccess', _134 => _134.threads]), () => ( []));
3420
+ const store = _optionalChain([storage, 'access', _118 => _118.comment, 'optionalAccess', _119 => _119.store]);
3421
+ const threads = _nullishCoalesce(_optionalChain([content, 'access', _120 => _120.comments, 'optionalAccess', _121 => _121.threads]), () => ( []));
3666
3422
  if (store && threads.length) {
3667
3423
  const existing = store.toJSON().threads;
3668
3424
  const fresh = threads.filter((thread) => !existing.some((t) => t.id === thread.id));
@@ -3671,7 +3427,7 @@ function applyImportedReviewData(editor, content) {
3671
3427
  comments = fresh.length;
3672
3428
  }
3673
3429
  }
3674
- const registry = _optionalChain([storage, 'access', _135 => _135.paragraphStyles, 'optionalAccess', _136 => _136.registry]);
3430
+ const registry = _optionalChain([storage, 'access', _122 => _122.paragraphStyles, 'optionalAccess', _123 => _123.registry]);
3675
3431
  if (registry && content.styles) {
3676
3432
  for (const style of content.styles.list()) {
3677
3433
  if (registry.get(style.id)) continue;
@@ -3698,7 +3454,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
3698
3454
  applyImportedReviewData(target, outcome.result);
3699
3455
  }
3700
3456
  outcomes.push(outcome);
3701
- _optionalChain([options, 'access', _137 => _137.onImport, 'optionalCall', _138 => _138(outcome, file)]);
3457
+ _optionalChain([options, 'access', _124 => _124.onImport, 'optionalCall', _125 => _125(outcome, file)]);
3702
3458
  } catch (error) {
3703
3459
  const err = error instanceof Error ? error : new Error(String(error));
3704
3460
  if (options.onError) options.onError(err, file);
@@ -3717,7 +3473,7 @@ function getImportableFiles(files, registry) {
3717
3473
  }
3718
3474
  function dropPosition(view, event) {
3719
3475
  try {
3720
- return _optionalChain([view, 'access', _139 => _139.posAtCoords, 'call', _140 => _140({ left: event.clientX, top: event.clientY }), 'optionalAccess', _141 => _141.pos]);
3476
+ return _optionalChain([view, 'access', _126 => _126.posAtCoords, 'call', _127 => _127({ left: event.clientX, top: event.clientY }), 'optionalAccess', _128 => _128.pos]);
3721
3477
  } catch (e2) {
3722
3478
  return void 0;
3723
3479
  }
@@ -3754,7 +3510,7 @@ var FileImport = _core.Extension.create({
3754
3510
  props: {
3755
3511
  handleDrop(view, event, _slice, moved) {
3756
3512
  if (!options.enableDrop || moved) return false;
3757
- const files = getImportableFiles(_optionalChain([event, 'access', _142 => _142.dataTransfer, 'optionalAccess', _143 => _143.files]), registry());
3513
+ const files = getImportableFiles(_optionalChain([event, 'access', _129 => _129.dataTransfer, 'optionalAccess', _130 => _130.files]), registry());
3758
3514
  if (!files) return false;
3759
3515
  event.preventDefault();
3760
3516
  run(view, files, dropPosition(view, event));
@@ -3762,7 +3518,7 @@ var FileImport = _core.Extension.create({
3762
3518
  },
3763
3519
  handlePaste(view, event) {
3764
3520
  if (!options.enablePaste) return false;
3765
- const files = getImportableFiles(_optionalChain([event, 'access', _144 => _144.clipboardData, 'optionalAccess', _145 => _145.files]), registry());
3521
+ const files = getImportableFiles(_optionalChain([event, 'access', _131 => _131.clipboardData, 'optionalAccess', _132 => _132.files]), registry());
3766
3522
  if (!files) return false;
3767
3523
  event.preventDefault();
3768
3524
  run(view, files);
@@ -3786,7 +3542,7 @@ function writeRichClipboard(view, event, options = {}) {
3786
3542
  const slice = state.selection.content();
3787
3543
  const { dom, text } = view.serializeForClipboard(slice);
3788
3544
  event.preventDefault();
3789
- _optionalChain([data, 'access', _146 => _146.clearData, 'optionalCall', _147 => _147()]);
3545
+ _optionalChain([data, 'access', _133 => _133.clearData, 'optionalCall', _134 => _134()]);
3790
3546
  data.setData("text/html", dom.innerHTML);
3791
3547
  data.setData("text/plain", text);
3792
3548
  data.setData(_nullishCoalesce(options.mimeType, () => ( _chunk3AJMR7EGcjs.PIXERATE_DOCUMENT_MIME)), _chunk3AJMR7EGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
@@ -3822,7 +3578,7 @@ var RichClipboard = _core.Extension.create({
3822
3578
  const slice = _chunk3AJMR7EGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3823
3579
  if (!slice) return false;
3824
3580
  event.preventDefault();
3825
- if (_chunkO7QXVGMPcjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
3581
+ if (_chunkWV5WTOC6cjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
3826
3582
  view.dispatch(
3827
3583
  view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")
3828
3584
  );
@@ -4015,7 +3771,7 @@ var Autocorrect = _core.Extension.create({
4015
3771
  addCommands() {
4016
3772
  return {
4017
3773
  undoAutocorrect: () => ({ state, tr, dispatch }) => {
4018
- const last = _optionalChain([autocorrectPluginKey, 'access', _148 => _148.getState, 'call', _149 => _149(state), 'optionalAccess', _150 => _150.last]);
3774
+ const last = _optionalChain([autocorrectPluginKey, 'access', _135 => _135.getState, 'call', _136 => _136(state), 'optionalAccess', _137 => _137.last]);
4019
3775
  if (!last) return false;
4020
3776
  if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
4021
3777
  if (dispatch) {
@@ -4065,7 +3821,7 @@ var Autocorrect = _core.Extension.create({
4065
3821
  }
4066
3822
  const insertTyped = () => {
4067
3823
  const tr2 = state.tr.insertText(text, from, to);
4068
- if (_optionalChain([pluginState, 'optionalAccess', _151 => _151.closePending])) _history.closeHistory.call(void 0, tr2);
3824
+ if (_optionalChain([pluginState, 'optionalAccess', _138 => _138.closePending])) _history.closeHistory.call(void 0, tr2);
4069
3825
  view.dispatch(tr2);
4070
3826
  };
4071
3827
  if (isIgnored(state, from, to)) return false;
@@ -4073,7 +3829,7 @@ var Autocorrect = _core.Extension.create({
4073
3829
  if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
4074
3830
  return false;
4075
3831
  }
4076
- const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _152 => _152.exec, 'call', _153 => _153(textBefore), 'optionalAccess', _154 => _154[0]]), () => ( ""));
3832
+ const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _139 => _139.exec, 'call', _140 => _140(textBefore), 'optionalAccess', _141 => _141[0]]), () => ( ""));
4077
3833
  if (/:\/\/|^www\./i.test(currentWord)) return false;
4078
3834
  const exceptions = extension.storage.exceptions;
4079
3835
  const found = findAutocorrection(textBefore, extension.options.rules, {
@@ -4081,7 +3837,7 @@ var Autocorrect = _core.Extension.create({
4081
3837
  isException: (value) => exceptions.has(value.toLowerCase())
4082
3838
  });
4083
3839
  if (!found) {
4084
- if (!_optionalChain([pluginState, 'optionalAccess', _155 => _155.closePending])) return false;
3840
+ if (!_optionalChain([pluginState, 'optionalAccess', _142 => _142.closePending])) return false;
4085
3841
  insertTyped();
4086
3842
  return true;
4087
3843
  }
@@ -4118,7 +3874,7 @@ var Autocorrect = _core.Extension.create({
4118
3874
  _history.closeHistory.call(void 0, tr);
4119
3875
  tr.setMeta(autocorrectPluginKey, { correction });
4120
3876
  view.dispatch(tr);
4121
- _optionalChain([extension, 'access', _156 => _156.options, 'access', _157 => _157.onCorrection, 'optionalCall', _158 => _158(correction)]);
3877
+ _optionalChain([extension, 'access', _143 => _143.options, 'access', _144 => _144.onCorrection, 'optionalCall', _145 => _145(correction)]);
4122
3878
  return true;
4123
3879
  };
4124
3880
  return [
@@ -4128,8 +3884,8 @@ var Autocorrect = _core.Extension.create({
4128
3884
  init: () => ({ last: null, closePending: false }),
4129
3885
  apply: (tr, prev) => {
4130
3886
  const meta = tr.getMeta(autocorrectPluginKey);
4131
- if (_optionalChain([meta, 'optionalAccess', _159 => _159.correction])) return { last: meta.correction, closePending: true };
4132
- if (_optionalChain([meta, 'optionalAccess', _160 => _160.undo])) return { last: null, closePending: true };
3887
+ if (_optionalChain([meta, 'optionalAccess', _146 => _146.correction])) return { last: meta.correction, closePending: true };
3888
+ if (_optionalChain([meta, 'optionalAccess', _147 => _147.undo])) return { last: null, closePending: true };
4133
3889
  if (!tr.docChanged) return prev;
4134
3890
  if (!prev.last && !prev.closePending) return prev;
4135
3891
  return { last: null, closePending: false };
@@ -4222,8 +3978,8 @@ function createOutlineStore(editor) {
4222
3978
  const compute = () => {
4223
3979
  if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
4224
3980
  const headings = getOutline(editor);
4225
- const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _161 => _161(editor, headings), 'optionalAccess', _162 => _162.id]), () => ( null));
4226
- const sameStructure = _chunkO7QXVGMPcjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
3981
+ const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _148 => _148(editor, headings), 'optionalAccess', _149 => _149.id]), () => ( null));
3982
+ const sameStructure = _chunkWV5WTOC6cjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
4227
3983
  if (sameStructure && snapshot.activeId === activeId) return snapshot;
4228
3984
  return {
4229
3985
  headings: sameStructure ? snapshot.headings : headings,
@@ -4247,16 +4003,16 @@ function createOutlineStore(editor) {
4247
4003
  subscribe(listener) {
4248
4004
  if (!listeners.size) {
4249
4005
  snapshot = compute();
4250
- _optionalChain([editor, 'optionalAccess', _163 => _163.on, 'call', _164 => _164("transaction", onTransaction)]);
4006
+ _optionalChain([editor, 'optionalAccess', _150 => _150.on, 'call', _151 => _151("transaction", onTransaction)]);
4251
4007
  }
4252
4008
  listeners.add(listener);
4253
4009
  return () => {
4254
4010
  listeners.delete(listener);
4255
- if (!listeners.size) _optionalChain([editor, 'optionalAccess', _165 => _165.off, 'call', _166 => _166("transaction", onTransaction)]);
4011
+ if (!listeners.size) _optionalChain([editor, 'optionalAccess', _152 => _152.off, 'call', _153 => _153("transaction", onTransaction)]);
4256
4012
  };
4257
4013
  },
4258
4014
  destroy() {
4259
- _optionalChain([editor, 'optionalAccess', _167 => _167.off, 'call', _168 => _168("transaction", onTransaction)]);
4015
+ _optionalChain([editor, 'optionalAccess', _154 => _154.off, 'call', _155 => _155("transaction", onTransaction)]);
4260
4016
  listeners.clear();
4261
4017
  }
4262
4018
  };
@@ -4271,7 +4027,7 @@ function navigateToHeading(editor, heading, options = {}) {
4271
4027
  editor.view.dispatch(tr);
4272
4028
  editor.view.focus();
4273
4029
  }
4274
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
4030
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
4275
4031
  return true;
4276
4032
  }
4277
4033
  function assignHeadingIds(state, types, generateId) {
@@ -4296,11 +4052,11 @@ function assignHeadingIds(state, types, generateId) {
4296
4052
  }
4297
4053
  var Outline = _core.Extension.create({
4298
4054
  name: "outline",
4299
- priority: _chunkO7QXVGMPcjs.STRUCTURE_PRIORITY,
4055
+ priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY,
4300
4056
  addOptions() {
4301
4057
  return {
4302
4058
  types: ["heading"],
4303
- generateId: () => _chunkO7QXVGMPcjs.generateStructureId.call(void 0, "h"),
4059
+ generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "h"),
4304
4060
  onUpdate: void 0
4305
4061
  };
4306
4062
  },
@@ -4331,16 +4087,16 @@ var Outline = _core.Extension.create({
4331
4087
  if (options.focus !== false) {
4332
4088
  tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
4333
4089
  tr.scrollIntoView();
4334
- _optionalChain([view, 'optionalAccess', _169 => _169.focus, 'optionalCall', _170 => _170()]);
4090
+ _optionalChain([view, 'optionalAccess', _156 => _156.focus, 'optionalCall', _157 => _157()]);
4335
4091
  }
4336
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4092
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4337
4093
  }
4338
4094
  return true;
4339
4095
  },
4340
4096
  scrollToHeading: (id, options = {}) => ({ state, dispatch, view }) => {
4341
4097
  const heading = findHeading(state, id);
4342
4098
  if (!heading) return false;
4343
- if (dispatch) _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4099
+ if (dispatch) _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4344
4100
  return true;
4345
4101
  }
4346
4102
  };
@@ -4361,9 +4117,9 @@ var Outline = _core.Extension.create({
4361
4117
  apply: (tr, prev, _oldState, newState) => {
4362
4118
  if (!tr.docChanged) return prev;
4363
4119
  const next = computeOutline(newState.doc, types);
4364
- if (_chunkO7QXVGMPcjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
4120
+ if (_chunkWV5WTOC6cjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
4365
4121
  storage.headings = next;
4366
- _optionalChain([onUpdate, 'call', _171 => _171(), 'optionalCall', _172 => _172(next)]);
4122
+ _optionalChain([onUpdate, 'call', _158 => _158(), 'optionalCall', _159 => _159(next)]);
4367
4123
  return next;
4368
4124
  }
4369
4125
  }
@@ -4379,7 +4135,7 @@ var Outline = _core.Extension.create({
4379
4135
  },
4380
4136
  onBeforeCreate() {
4381
4137
  const { types, generateId } = this.options;
4382
- _chunkO7QXVGMPcjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
4138
+ _chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
4383
4139
  }
4384
4140
  });
4385
4141
 
@@ -4549,7 +4305,7 @@ function syncTableOfContents(state, headingTypes) {
4549
4305
  node.attrs.minLevel,
4550
4306
  node.attrs.maxLevel
4551
4307
  );
4552
- if (!_chunkO7QXVGMPcjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
4308
+ if (!_chunkWV5WTOC6cjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
4553
4309
  tr = _nullishCoalesce(tr, () => ( state.tr));
4554
4310
  tr.setNodeMarkup(pos, void 0, { ...node.attrs, entries });
4555
4311
  }
@@ -4561,7 +4317,7 @@ function syncTableOfContents(state, headingTypes) {
4561
4317
  }
4562
4318
  var TableOfContents = _core.Node.create({
4563
4319
  name: "tableOfContents",
4564
- priority: _chunkO7QXVGMPcjs.STRUCTURE_PRIORITY - 5,
4320
+ priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
4565
4321
  group: "block",
4566
4322
  atom: true,
4567
4323
  selectable: true,
@@ -4672,7 +4428,7 @@ var TableOfContents = _core.Node.create({
4672
4428
  return [
4673
4429
  new (0, _state.Plugin)({
4674
4430
  key: tableOfContentsPluginKey,
4675
- state: _chunkO7QXVGMPcjs.presenceStateSpec.call(void 0, [this.name]),
4431
+ state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [this.name]),
4676
4432
  appendTransaction: (transactions, _oldState, newState) => {
4677
4433
  if (!transactions.some((tr) => tr.docChanged)) return null;
4678
4434
  if (!tableOfContentsPluginKey.getState(newState)) return null;
@@ -4682,7 +4438,7 @@ var TableOfContents = _core.Node.create({
4682
4438
  handleDOMEvents: {
4683
4439
  click: (view, event) => {
4684
4440
  const target = event.target;
4685
- const link = _optionalChain([target, 'optionalAccess', _173 => _173.closest, 'optionalCall', _174 => _174(
4441
+ const link = _optionalChain([target, 'optionalAccess', _160 => _160.closest, 'optionalCall', _161 => _161(
4686
4442
  'nav[data-type="table-of-contents"] a[data-heading-id]'
4687
4443
  )]);
4688
4444
  if (!link) return false;
@@ -4696,7 +4452,7 @@ var TableOfContents = _core.Node.create({
4696
4452
  );
4697
4453
  view.focus();
4698
4454
  }
4699
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, heading.pos);
4455
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos);
4700
4456
  return true;
4701
4457
  }
4702
4458
  }
@@ -4706,7 +4462,7 @@ var TableOfContents = _core.Node.create({
4706
4462
  },
4707
4463
  onBeforeCreate() {
4708
4464
  const { headingTypes } = this.options;
4709
- _chunkO7QXVGMPcjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
4465
+ _chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
4710
4466
  }
4711
4467
  });
4712
4468
 
@@ -4755,7 +4511,7 @@ function getFootnotes(doc) {
4755
4511
  number: index + 1,
4756
4512
  text: footnote ? footnoteText(footnote.node) : "",
4757
4513
  referencePos: ref.pos,
4758
- footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _175 => _175.pos]), () => ( null))
4514
+ footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _162 => _162.pos]), () => ( null))
4759
4515
  };
4760
4516
  });
4761
4517
  }
@@ -4764,7 +4520,7 @@ function syncFootnotes(tr, options = {}) {
4764
4520
  const listType = schema.nodes[LIST];
4765
4521
  const itemType = schema.nodes[ITEM];
4766
4522
  if (!listType || !itemType) return false;
4767
- const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunkO7QXVGMPcjs.generateStructureId.call(void 0, "fn"))));
4523
+ const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "fn"))));
4768
4524
  const refs = [];
4769
4525
  const lists = [];
4770
4526
  const existing = /* @__PURE__ */ new Map();
@@ -4797,7 +4553,7 @@ function syncFootnotes(tr, options = {}) {
4797
4553
  });
4798
4554
  const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
4799
4555
  const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
4800
- const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _177 => _177.contents, 'optionalAccess', _178 => _178[id]]), () => ( "")))));
4556
+ const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _163 => _163.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _164 => _164.contents, 'optionalAccess', _165 => _165[id]]), () => ( "")))));
4801
4557
  if (source && source.attrs.id === id && source.attrs.number === number) {
4802
4558
  return source;
4803
4559
  }
@@ -4848,7 +4604,7 @@ function findReferences(doc, id) {
4848
4604
  }
4849
4605
  var FootnoteReference = _core.Node.create({
4850
4606
  name: REFERENCE,
4851
- priority: _chunkO7QXVGMPcjs.STRUCTURE_PRIORITY - 5,
4607
+ priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
4852
4608
  group: "inline",
4853
4609
  inline: true,
4854
4610
  atom: true,
@@ -4856,7 +4612,7 @@ var FootnoteReference = _core.Node.create({
4856
4612
  addOptions() {
4857
4613
  return {
4858
4614
  HTMLAttributes: {},
4859
- generateId: () => _chunkO7QXVGMPcjs.generateStructureId.call(void 0, "fn")
4615
+ generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "fn")
4860
4616
  };
4861
4617
  },
4862
4618
  addAttributes() {
@@ -4967,7 +4723,7 @@ var FootnoteReference = _core.Node.create({
4967
4723
  _state.TextSelection.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
4968
4724
  );
4969
4725
  tr.scrollIntoView();
4970
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, footnote.pos);
4726
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, footnote.pos);
4971
4727
  }
4972
4728
  return true;
4973
4729
  },
@@ -4977,7 +4733,7 @@ var FootnoteReference = _core.Node.create({
4977
4733
  if (dispatch) {
4978
4734
  tr.setSelection(_state.NodeSelection.create(tr.doc, ref.pos));
4979
4735
  tr.scrollIntoView();
4980
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, ref.pos);
4736
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, ref.pos);
4981
4737
  }
4982
4738
  return true;
4983
4739
  }
@@ -4989,7 +4745,7 @@ var FootnoteReference = _core.Node.create({
4989
4745
  return [
4990
4746
  new (0, _state.Plugin)({
4991
4747
  key: footnotesPluginKey,
4992
- state: _chunkO7QXVGMPcjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
4748
+ state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
4993
4749
  appendTransaction: (transactions, _oldState, newState) => {
4994
4750
  if (!transactions.some((tr2) => tr2.docChanged)) return null;
4995
4751
  if (!footnotesPluginKey.getState(newState)) return null;
@@ -5000,7 +4756,7 @@ var FootnoteReference = _core.Node.create({
5000
4756
  handleClickOn: (_view, _pos, node, _nodePos, event) => {
5001
4757
  if (node.type.name !== REFERENCE || !node.attrs.id) return false;
5002
4758
  const target = event.target;
5003
- if (!_optionalChain([target, 'optionalAccess', _179 => _179.closest, 'optionalCall', _180 => _180("a")])) return false;
4759
+ if (!_optionalChain([target, 'optionalAccess', _166 => _166.closest, 'optionalCall', _167 => _167("a")])) return false;
5004
4760
  event.preventDefault();
5005
4761
  return editor.commands.goToFootnote(node.attrs.id);
5006
4762
  }
@@ -5010,7 +4766,7 @@ var FootnoteReference = _core.Node.create({
5010
4766
  },
5011
4767
  onBeforeCreate() {
5012
4768
  const { generateId } = this.options;
5013
- _chunkO7QXVGMPcjs.syncInitialContent.call(void 0, this.editor, (state) => {
4769
+ _chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => {
5014
4770
  const tr = state.tr;
5015
4771
  return syncFootnotes(tr, { generateId }) ? tr : null;
5016
4772
  });
@@ -5150,7 +4906,7 @@ var Bookmark = _core.Mark.create({
5150
4906
  addOptions() {
5151
4907
  return {
5152
4908
  HTMLAttributes: {},
5153
- generateId: () => _chunkO7QXVGMPcjs.generateStructureId.call(void 0, "bm")
4909
+ generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "bm")
5154
4910
  };
5155
4911
  },
5156
4912
  addAttributes() {
@@ -5198,7 +4954,7 @@ var Bookmark = _core.Mark.create({
5198
4954
  }
5199
4955
  if (!dispatch) return true;
5200
4956
  const sameName = getBookmarks(state.doc).find((b) => b.name === name);
5201
- const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _181 => _181.id]))), () => ( this.options.generateId()));
4957
+ const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _168 => _168.id]))), () => ( this.options.generateId()));
5202
4958
  if (sameName) {
5203
4959
  forEachBookmarkRange(
5204
4960
  tr.doc,
@@ -5235,7 +4991,7 @@ var Bookmark = _core.Mark.create({
5235
4991
  tr.setSelection(_state.TextSelection.create(tr.doc, bookmark.from, bookmark.to));
5236
4992
  tr.scrollIntoView();
5237
4993
  const domPos = state.doc.resolve(bookmark.from);
5238
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
4994
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
5239
4995
  }
5240
4996
  return true;
5241
4997
  }
@@ -5300,7 +5056,7 @@ function syncCrossReferences(state, headingTypes) {
5300
5056
  }
5301
5057
  var CrossReference = _core.Node.create({
5302
5058
  name: NAME,
5303
- priority: _chunkO7QXVGMPcjs.STRUCTURE_PRIORITY - 5,
5059
+ priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
5304
5060
  group: "inline",
5305
5061
  inline: true,
5306
5062
  atom: true,
@@ -5402,7 +5158,7 @@ var CrossReference = _core.Node.create({
5402
5158
  if (dispatch) {
5403
5159
  tr.setSelection(_state.TextSelection.create(tr.doc, range.from, range.to));
5404
5160
  tr.scrollIntoView();
5405
- _chunkO7QXVGMPcjs.scrollDomAtPos.call(void 0, view, range.blockPos);
5161
+ _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, range.blockPos);
5406
5162
  }
5407
5163
  return true;
5408
5164
  }
@@ -5414,7 +5170,7 @@ var CrossReference = _core.Node.create({
5414
5170
  return [
5415
5171
  new (0, _state.Plugin)({
5416
5172
  key: crossReferencePluginKey,
5417
- state: _chunkO7QXVGMPcjs.presenceStateSpec.call(void 0, [NAME]),
5173
+ state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [NAME]),
5418
5174
  appendTransaction: (transactions, _oldState, newState) => {
5419
5175
  if (!transactions.some((tr) => tr.docChanged)) return null;
5420
5176
  if (!crossReferencePluginKey.getState(newState)) return null;
@@ -5433,14 +5189,14 @@ var CrossReference = _core.Node.create({
5433
5189
  },
5434
5190
  onBeforeCreate() {
5435
5191
  const { headingTypes } = this.options;
5436
- _chunkO7QXVGMPcjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
5192
+ _chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
5437
5193
  }
5438
5194
  });
5439
5195
 
5440
5196
  // src/extensions/document-structure/command-items.ts
5441
5197
  var start = (editor, args) => {
5442
5198
  const chain = editor.chain().focus();
5443
- return _optionalChain([args, 'optionalAccess', _182 => _182.range]) ? chain.deleteRange(args.range) : chain;
5199
+ return _optionalChain([args, 'optionalAccess', _169 => _169.range]) ? chain.deleteRange(args.range) : chain;
5444
5200
  };
5445
5201
  var documentStructureCommandItems = [
5446
5202
  {
@@ -5457,7 +5213,7 @@ var documentStructureCommandItems = [
5457
5213
  description: "Insert a numbered footnote",
5458
5214
  keywords: ["footnote", "note", "fn", "citation"],
5459
5215
  extension: "footnoteReference",
5460
- run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _183 => _183.content]) }).run()
5216
+ run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _170 => _170.content]) }).run()
5461
5217
  },
5462
5218
  {
5463
5219
  id: "bookmark",
@@ -5466,7 +5222,7 @@ var documentStructureCommandItems = [
5466
5222
  keywords: ["bookmark", "anchor", "name"],
5467
5223
  extension: "bookmark",
5468
5224
  requires: "name",
5469
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _184 => _184.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5225
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _171 => _171.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5470
5226
  },
5471
5227
  {
5472
5228
  id: "cross-reference",
@@ -5475,7 +5231,7 @@ var documentStructureCommandItems = [
5475
5231
  keywords: ["cross", "reference", "xref", "link", "ref"],
5476
5232
  extension: "crossReference",
5477
5233
  requires: "target",
5478
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _185 => _185.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5234
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _172 => _172.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5479
5235
  }
5480
5236
  ];
5481
5237
  function getDocumentStructureCommandItems(editor, query = "") {
@@ -5534,13 +5290,13 @@ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__ini
5534
5290
  }, _class3);
5535
5291
  var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
5536
5292
  function getFindReplaceState(source) {
5537
- const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _186 => _186.state]), () => ( source));
5293
+ const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _173 => _173.state]), () => ( source));
5538
5294
  if (!state || typeof state.plugins === "undefined") return null;
5539
5295
  const plugin = findReplacePluginKey.getState(state);
5540
5296
  return plugin ? toSnapshot(plugin) : null;
5541
5297
  }
5542
5298
  function getFindReplaceStore(editor) {
5543
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _187 => _187.storage, 'optionalAccess', _188 => _188.findReplace, 'optionalAccess', _189 => _189.store]), () => ( null));
5299
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _174 => _174.storage, 'optionalAccess', _175 => _175.findReplace, 'optionalAccess', _176 => _176.store]), () => ( null));
5544
5300
  }
5545
5301
  var snapshotCache = /* @__PURE__ */ new WeakMap();
5546
5302
  function toSnapshot(s) {
@@ -5688,7 +5444,7 @@ var FindReplace = _core.Extension.create({
5688
5444
  if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
5689
5445
  if (dispatch) {
5690
5446
  _history.closeHistory.call(void 0, tr);
5691
- const [end] = _chunkO7QXVGMPcjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
5447
+ const [end] = _chunkWV5WTOC6cjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
5692
5448
  tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
5693
5449
  meta(tr, { type: "replaced", anchor: end, count: 1 });
5694
5450
  }
@@ -5699,7 +5455,7 @@ var FindReplace = _core.Extension.create({
5699
5455
  if (!s || !s.active || !s.matches.length) return false;
5700
5456
  if (dispatch) {
5701
5457
  _history.closeHistory.call(void 0, tr);
5702
- const ends = _chunkO7QXVGMPcjs.applyReplacements.call(void 0, tr, s.matches);
5458
+ const ends = _chunkWV5WTOC6cjs.applyReplacements.call(void 0, tr, s.matches);
5703
5459
  meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
5704
5460
  }
5705
5461
  return true;
@@ -5711,7 +5467,7 @@ var FindReplace = _core.Extension.create({
5711
5467
  const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
5712
5468
  const step = (forward) => () => {
5713
5469
  const s = findReplacePluginKey.getState(this.editor.state);
5714
- if (!_optionalChain([s, 'optionalAccess', _190 => _190.active]) || !s.matches.length) return false;
5470
+ if (!_optionalChain([s, 'optionalAccess', _177 => _177.active]) || !s.matches.length) return false;
5715
5471
  return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
5716
5472
  };
5717
5473
  return {
@@ -5731,7 +5487,7 @@ var FindReplace = _core.Extension.create({
5731
5487
  if (!s.active || !s.query) {
5732
5488
  return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
5733
5489
  }
5734
- const result = _chunkO7QXVGMPcjs.searchDocument.call(void 0, doc, s.query, s.options, {
5490
+ const result = _chunkWV5WTOC6cjs.searchDocument.call(void 0, doc, s.query, s.options, {
5735
5491
  replacement: s.replacement,
5736
5492
  clipboardText: safeClipboard(options.getClipboardText),
5737
5493
  timeLimitMs: options.timeLimitMs,
@@ -5824,7 +5580,7 @@ var FindReplace = _core.Extension.create({
5824
5580
  s = {
5825
5581
  ...s,
5826
5582
  currentIndex: m.index,
5827
- anchor: _nullishCoalesce(_optionalChain([s, 'access', _191 => _191.matches, 'access', _192 => _192[m.index], 'optionalAccess', _193 => _193.from]), () => ( s.anchor))
5583
+ anchor: _nullishCoalesce(_optionalChain([s, 'access', _178 => _178.matches, 'access', _179 => _179[m.index], 'optionalAccess', _180 => _180.from]), () => ( s.anchor))
5828
5584
  };
5829
5585
  redecorate = true;
5830
5586
  break;
@@ -5840,7 +5596,7 @@ var FindReplace = _core.Extension.create({
5840
5596
  }
5841
5597
  },
5842
5598
  props: {
5843
- decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _194 => _194.getState, 'call', _195 => _195(state), 'optionalAccess', _196 => _196.decorations]), () => ( _view2.DecorationSet.empty))
5599
+ decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _181 => _181.getState, 'call', _182 => _182(state), 'optionalAccess', _183 => _183.decorations]), () => ( _view2.DecorationSet.empty))
5844
5600
  },
5845
5601
  view: (view) => {
5846
5602
  const sync = () => {
@@ -5869,11 +5625,11 @@ var STYLE_ID_ATTRIBUTE = "styleId";
5869
5625
  var CHARACTER_STYLE_MARK_NAME = "characterStyle";
5870
5626
  var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
5871
5627
  function getStyleRegistry(editor) {
5872
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _197 => _197.storage, 'optionalAccess', _198 => _198.paragraphStyles, 'optionalAccess', _199 => _199.registry]), () => ( null));
5628
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _184 => _184.storage, 'optionalAccess', _185 => _185.paragraphStyles, 'optionalAccess', _186 => _186.registry]), () => ( null));
5873
5629
  }
5874
5630
  function headingLevels(editor) {
5875
- const heading = _optionalChain([editor, 'optionalAccess', _200 => _200.extensionManager, 'optionalAccess', _201 => _201.extensions, 'access', _202 => _202.find, 'call', _203 => _203((e) => e.name === "heading")]);
5876
- const levels = _optionalChain([heading, 'optionalAccess', _204 => _204.options, 'optionalAccess', _205 => _205.levels]);
5631
+ const heading = _optionalChain([editor, 'optionalAccess', _187 => _187.extensionManager, 'optionalAccess', _188 => _188.extensions, 'access', _189 => _189.find, 'call', _190 => _190((e) => e.name === "heading")]);
5632
+ const levels = _optionalChain([heading, 'optionalAccess', _191 => _191.options, 'optionalAccess', _192 => _192.levels]);
5877
5633
  return Array.isArray(levels) ? levels : null;
5878
5634
  }
5879
5635
  function isParagraphStyleAvailable(editor, registry, id) {
@@ -5883,7 +5639,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
5883
5639
  if (!editor.schema.nodes[block.type]) return false;
5884
5640
  if (block.type === "heading") {
5885
5641
  const levels = headingLevels(editor);
5886
- if (levels && !levels.includes(Number(_optionalChain([block, 'access', _206 => _206.attrs, 'optionalAccess', _207 => _207.level])))) return false;
5642
+ if (levels && !levels.includes(Number(_optionalChain([block, 'access', _193 => _193.attrs, 'optionalAccess', _194 => _194.level])))) return false;
5887
5643
  }
5888
5644
  return true;
5889
5645
  }
@@ -5923,7 +5679,7 @@ function captureSelectionFormat(state) {
5923
5679
  if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
5924
5680
  });
5925
5681
  const paragraph = {};
5926
- const align = _optionalChain([state, 'access', _208 => _208.selection, 'access', _209 => _209.$from, 'access', _210 => _210.parent, 'access', _211 => _211.attrs, 'optionalAccess', _212 => _212.textAlign]);
5682
+ const align = _optionalChain([state, 'access', _195 => _195.selection, 'access', _196 => _196.$from, 'access', _197 => _197.parent, 'access', _198 => _198.attrs, 'optionalAccess', _199 => _199.textAlign]);
5927
5683
  if (align && align !== "left") paragraph.textAlign = align;
5928
5684
  return { paragraph, character };
5929
5685
  }
@@ -6089,7 +5845,7 @@ var ParagraphStyles = _core.Extension.create({
6089
5845
  },
6090
5846
  clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunkYN6JKAUEcjs.NORMAL_STYLE_ID),
6091
5847
  setCharacterStyle: (id) => ({ commands }) => {
6092
- if (_optionalChain([registry, 'call', _213 => _213(), 'access', _214 => _214.get, 'call', _215 => _215(id), 'optionalAccess', _216 => _216.kind]) !== "character") return false;
5848
+ if (_optionalChain([registry, 'call', _200 => _200(), 'access', _201 => _201.get, 'call', _202 => _202(id), 'optionalAccess', _203 => _203.kind]) !== "character") return false;
6093
5849
  return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
6094
5850
  },
6095
5851
  unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
@@ -6155,7 +5911,7 @@ var ParagraphStyles = _core.Extension.create({
6155
5911
  };
6156
5912
  },
6157
5913
  onDestroy() {
6158
- _optionalChain([this, 'access', _217 => _217.storage, 'access', _218 => _218.cleanup, 'optionalCall', _219 => _219()]);
5914
+ _optionalChain([this, 'access', _204 => _204.storage, 'access', _205 => _205.cleanup, 'optionalCall', _206 => _206()]);
6159
5915
  }
6160
5916
  });
6161
5917
  var EMPTY_STYLES = Object.freeze({
@@ -6193,8 +5949,8 @@ function createParagraphStylesStore(editor) {
6193
5949
  }
6194
5950
  };
6195
5951
  const detach = () => {
6196
- _optionalChain([editor, 'optionalAccess', _220 => _220.off, 'call', _221 => _221("transaction", update)]);
6197
- _optionalChain([unsubscribeRegistry, 'optionalCall', _222 => _222()]);
5952
+ _optionalChain([editor, 'optionalAccess', _207 => _207.off, 'call', _208 => _208("transaction", update)]);
5953
+ _optionalChain([unsubscribeRegistry, 'optionalCall', _209 => _209()]);
6198
5954
  unsubscribeRegistry = null;
6199
5955
  };
6200
5956
  return {
@@ -6205,7 +5961,7 @@ function createParagraphStylesStore(editor) {
6205
5961
  subscribe(listener) {
6206
5962
  if (!listeners.size) {
6207
5963
  snapshot = compute();
6208
- _optionalChain([editor, 'optionalAccess', _223 => _223.on, 'call', _224 => _224("transaction", update)]);
5964
+ _optionalChain([editor, 'optionalAccess', _210 => _210.on, 'call', _211 => _211("transaction", update)]);
6209
5965
  unsubscribeRegistry = registry ? registry.subscribe(update) : null;
6210
5966
  }
6211
5967
  listeners.add(listener);
@@ -6222,7 +5978,7 @@ function createParagraphStylesStore(editor) {
6222
5978
  }
6223
5979
 
6224
5980
  // src/extensions/rich-text-preset.ts
6225
- var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _225 => _225[name]]) || _optionalChain([mod, 'optionalAccess', _226 => _226.default, 'optionalAccess', _227 => _227[name]]) || _optionalChain([mod, 'optionalAccess', _228 => _228.default, 'optionalAccess', _229 => _229.default]) || _optionalChain([mod, 'optionalAccess', _230 => _230.default]) || mod;
5981
+ var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _212 => _212[name]]) || _optionalChain([mod, 'optionalAccess', _213 => _213.default, 'optionalAccess', _214 => _214[name]]) || _optionalChain([mod, 'optionalAccess', _215 => _215.default, 'optionalAccess', _216 => _216.default]) || _optionalChain([mod, 'optionalAccess', _217 => _217.default]) || mod;
6226
5982
  var StarterKit = resolveExt3(_StarterKit, "StarterKit");
6227
5983
  var Color = resolveExt3(_Color, "Color");
6228
5984
  var Highlight = resolveExt3(_Highlight, "Highlight");
@@ -6303,7 +6059,7 @@ function createRichTextPreset(options = {}) {
6303
6059
  find: /^\s*(\[([ |x])?\])\s$/i,
6304
6060
  type: this.type,
6305
6061
  getAttributes: (match) => ({
6306
- checked: _optionalChain([match, 'access', _231 => _231[2], 'optionalAccess', _232 => _232.toLowerCase, 'call', _233 => _233()]) === "x"
6062
+ checked: _optionalChain([match, 'access', _218 => _218[2], 'optionalAccess', _219 => _219.toLowerCase, 'call', _220 => _220()]) === "x"
6307
6063
  })
6308
6064
  })
6309
6065
  ];
@@ -6318,7 +6074,7 @@ function createRichTextPreset(options = {}) {
6318
6074
  })
6319
6075
  ];
6320
6076
  if (options.table !== false) {
6321
- extensions2.push(..._chunkO7QXVGMPcjs.createTableExtensions.call(void 0, optionObject(options.table)));
6077
+ extensions2.push(..._chunkWV5WTOC6cjs.createTableExtensions.call(void 0, optionObject(options.table)));
6322
6078
  }
6323
6079
  if (characterLimit) {
6324
6080
  extensions2.push(
@@ -6375,7 +6131,7 @@ function createRichTextPreset(options = {}) {
6375
6131
  }
6376
6132
  if (options.comments) {
6377
6133
  extensions2.push(
6378
- typeof options.comments === "object" ? Comments.configure(options.comments) : Comments
6134
+ typeof options.comments === "object" ? _chunkWV5WTOC6cjs.Comments.configure(options.comments) : _chunkWV5WTOC6cjs.Comments
6379
6135
  );
6380
6136
  }
6381
6137
  if (options.trackChanges) {
@@ -6425,8 +6181,8 @@ function createRichTextPreset(options = {}) {
6425
6181
  }
6426
6182
  if (options.chart) {
6427
6183
  const { sparkline = true, ...chartOptions } = optionObject(options.chart);
6428
- extensions2.push(_chunkO7QXVGMPcjs.Chart.configure(chartOptions));
6429
- if (sparkline) extensions2.push(_chunkO7QXVGMPcjs.Sparkline.configure(optionObject(sparkline)));
6184
+ extensions2.push(_chunkWV5WTOC6cjs.Chart.configure(chartOptions));
6185
+ if (sparkline) extensions2.push(_chunkWV5WTOC6cjs.Sparkline.configure(optionObject(sparkline)));
6430
6186
  }
6431
6187
  if (options.paragraphStyles) {
6432
6188
  extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
@@ -6479,7 +6235,7 @@ function createFindReplaceCommands(editor, options = {}) {
6479
6235
  const hasMatches = () => {
6480
6236
  const ok = usable(editor);
6481
6237
  if (ok !== true) return ok;
6482
- return _optionalChain([state, 'call', _234 => _234(), 'optionalAccess', _235 => _235.matches, 'access', _236 => _236.length]) ? true : "No matches.";
6238
+ return _optionalChain([state, 'call', _221 => _221(), 'optionalAccess', _222 => _222.matches, 'access', _223 => _223.length]) ? true : "No matches.";
6483
6239
  };
6484
6240
  const apply = (params) => {
6485
6241
  const split = splitParams(params);
@@ -6487,7 +6243,7 @@ function createFindReplaceCommands(editor, options = {}) {
6487
6243
  };
6488
6244
  const failIfInvalid = () => {
6489
6245
  const s = state();
6490
- if (_optionalChain([s, 'optionalAccess', _237 => _237.error])) throw new Error(s.error.message);
6246
+ if (_optionalChain([s, 'optionalAccess', _224 => _224.error])) throw new Error(s.error.message);
6491
6247
  };
6492
6248
  return [
6493
6249
  {
@@ -6526,9 +6282,9 @@ function createFindReplaceCommands(editor, options = {}) {
6526
6282
  failIfInvalid();
6527
6283
  const s = state();
6528
6284
  return {
6529
- count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]), () => ( 0)),
6530
- truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _240 => _240.truncated]), () => ( false)),
6531
- matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6285
+ count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _225 => _225.matches, 'access', _226 => _226.length]), () => ( 0)),
6286
+ truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _227 => _227.truncated]), () => ( false)),
6287
+ matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _228 => _228.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6532
6288
  };
6533
6289
  }
6534
6290
  },
@@ -6555,11 +6311,11 @@ function createFindReplaceCommands(editor, options = {}) {
6555
6311
  description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
6556
6312
  params: searchParams(true),
6557
6313
  ...scope,
6558
- enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _242 => _242.query]) !== void 0 ? usable(editor) : hasMatches(),
6314
+ enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _229 => _229.query]) !== void 0 ? usable(editor) : hasMatches(),
6559
6315
  run: (_ctx, params) => {
6560
6316
  apply(params);
6561
6317
  failIfInvalid();
6562
- const count = _nullishCoalesce(_optionalChain([state, 'call', _243 => _243(), 'optionalAccess', _244 => _244.matches, 'access', _245 => _245.length]), () => ( 0));
6318
+ const count = _nullishCoalesce(_optionalChain([state, 'call', _230 => _230(), 'optionalAccess', _231 => _231.matches, 'access', _232 => _232.length]), () => ( 0));
6563
6319
  if (count) editor.commands.replaceAll();
6564
6320
  return { replaced: count };
6565
6321
  }
@@ -6567,7 +6323,7 @@ function createFindReplaceCommands(editor, options = {}) {
6567
6323
  ];
6568
6324
  }
6569
6325
  function validateFindPattern(query, options = {}) {
6570
- const result = _chunkO7QXVGMPcjs.compileFindPattern.call(void 0, query, options);
6326
+ const result = _chunkWV5WTOC6cjs.compileFindPattern.call(void 0, query, options);
6571
6327
  return result.ok ? null : result.error;
6572
6328
  }
6573
6329
 
@@ -6576,8 +6332,8 @@ var PARAMS = {
6576
6332
  insertTable: {
6577
6333
  type: "object",
6578
6334
  properties: {
6579
- rows: { type: "integer", minimum: 1, maximum: _chunkO7QXVGMPcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
6580
- cols: { type: "integer", minimum: 1, maximum: _chunkO7QXVGMPcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
6335
+ rows: { type: "integer", minimum: 1, maximum: _chunkWV5WTOC6cjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
6336
+ cols: { type: "integer", minimum: 1, maximum: _chunkWV5WTOC6cjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
6581
6337
  withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
6582
6338
  },
6583
6339
  additionalProperties: false
@@ -6608,7 +6364,7 @@ function createTableCommands(editor, options = {}) {
6608
6364
  const group = _nullishCoalesce(options.group, () => ( "Table"));
6609
6365
  const scope = options.scope ? { scope: options.scope } : {};
6610
6366
  const focus = _nullishCoalesce(options.focus, () => ( true));
6611
- return _chunkO7QXVGMPcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
6367
+ return _chunkWV5WTOC6cjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
6612
6368
  const params = PARAMS[action];
6613
6369
  return {
6614
6370
  id: `${prefix}${action}`,
@@ -6618,13 +6374,13 @@ function createTableCommands(editor, options = {}) {
6618
6374
  description,
6619
6375
  ...params ? { params } : {},
6620
6376
  ...scope,
6621
- enabled: (_ctx, p) => _chunkO7QXVGMPcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
6377
+ enabled: (_ctx, p) => _chunkWV5WTOC6cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
6622
6378
  run: (_ctx, p) => {
6623
- if (!_chunkO7QXVGMPcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
6624
- const reason = _chunkO7QXVGMPcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
6379
+ if (!_chunkWV5WTOC6cjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
6380
+ const reason = _chunkWV5WTOC6cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
6625
6381
  throw new Error(reason === true ? `${label} did not change the document.` : reason);
6626
6382
  }
6627
- const state = _chunkO7QXVGMPcjs.getTableState.call(void 0, editor);
6383
+ const state = _chunkWV5WTOC6cjs.getTableState.call(void 0, editor);
6628
6384
  return {
6629
6385
  done: true,
6630
6386
  table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
@@ -6747,12 +6503,4 @@ function createTableCommands(editor, options = {}) {
6747
6503
 
6748
6504
 
6749
6505
 
6750
-
6751
-
6752
-
6753
-
6754
-
6755
-
6756
-
6757
-
6758
- exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
6506
+ 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.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;