stilo-editor 0.2.0 → 0.3.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.
@@ -5,9 +5,9 @@ import { DOMParser as p, DOMSerializer as m, Fragment as h, NodeRange as g, Sche
5
5
  import { Mapping as ne, StepMap as _, Transform as re, canJoin as ie, findWrapping as ae } from "prosemirror-transform";
6
6
  import { baseKeymap as oe, lift as se, newlineInCode as ce, selectAll as le, wrapIn as ue } from "prosemirror-commands";
7
7
  import { InputRule as v, inputRules as de, undoInputRule as fe, wrappingInputRule as y } from "prosemirror-inputrules";
8
- import { keymap as b } from "prosemirror-keymap";
9
- import pe from "dompurify";
10
- import { liftListItem as x, sinkListItem as me, splitListItem as he, wrapInList as ge } from "prosemirror-schema-list";
8
+ import { keymap as pe } from "prosemirror-keymap";
9
+ import me from "dompurify";
10
+ import { liftListItem as b, sinkListItem as he, splitListItem as x, wrapInList as ge } from "prosemirror-schema-list";
11
11
  import { dropCursor as _e } from "prosemirror-dropcursor";
12
12
  import { gapCursor as ve } from "prosemirror-gapcursor";
13
13
  import { SearchQuery as ye } from "prosemirror-search";
@@ -154,14 +154,14 @@ var Ke = class {
154
154
  for (let [e, t] of c) T(this.commandFactories.has(e), "command", e), this.commandFactories.set(e, t);
155
155
  n.push(...o.inputRules?.(s) ?? []);
156
156
  let l = o.keymap?.(s);
157
- l && r.push(b(l)), i.push(...o.plugins?.(s) ?? []);
157
+ l && r.push(pe(l)), i.push(...o.plugins?.(s) ?? []);
158
158
  }
159
159
  return [
160
160
  de({ rules: n }),
161
- b({ Backspace: fe }),
161
+ pe({ Backspace: fe }),
162
162
  ...r,
163
163
  ...i,
164
- b(oe)
164
+ pe(oe)
165
165
  ];
166
166
  }
167
167
  };
@@ -383,7 +383,7 @@ function mt(e) {
383
383
  }
384
384
  function ht() {
385
385
  let e = ft.get(window);
386
- return e || (e = pe(window), e.addHook("uponSanitizeAttribute", (e, t) => {
386
+ return e || (e = me(window), e.addHook("uponSanitizeAttribute", (e, t) => {
387
387
  let n = gt(t.attrName, t.attrValue);
388
388
  n === null ? t.keepAttr = !1 : t.attrValue = n;
389
389
  }), ft.set(window, e)), e;
@@ -581,7 +581,7 @@ function zt(e, t) {
581
581
  }
582
582
  //#endregion
583
583
  //#region src/core/editor.ts
584
- var Bt = "stiloSkipInput", Vt = "stiloLoad", Ht = class {
584
+ var Bt = "stiloSkipInput", Vt = "stiloEditable", Ht = "stiloLoad", Ut = class {
585
585
  view;
586
586
  schema;
587
587
  commands;
@@ -662,7 +662,7 @@ var Bt = "stiloSkipInput", Vt = "stiloLoad", Ht = class {
662
662
  return n ? Je(this.state, n) : {};
663
663
  }
664
664
  setEditable(e) {
665
- this.view.setProps({ editable: () => e });
665
+ e !== this.isEditable && (this.view.setProps({ editable: () => e }), this.view.dispatch(this.state.tr.setMeta(Vt, e)));
666
666
  }
667
667
  focus(e) {
668
668
  if (e) {
@@ -689,13 +689,20 @@ var Bt = "stiloSkipInput", Vt = "stiloLoad", Ht = class {
689
689
  doc: e,
690
690
  plugins: this.plugins
691
691
  });
692
- return t.applyTransaction(t.tr.setMeta(Vt, !0)).state;
692
+ return t.applyTransaction(t.tr.setMeta(Ht, !0)).state;
693
693
  }
694
694
  createRunners() {
695
695
  let e = {};
696
- for (let [t, n] of this.manager.commands) e[t] = Object.assign((...e) => n(...e)(this.state, (e) => this.view.dispatch(e), this.view), { can: (...e) => n(...e)(this.state, void 0, this.view) });
696
+ for (let [t, n] of this.manager.commands) e[t] = Object.assign((...e) => this.runCommand(n(...e), !0), { can: (...e) => this.runCommand(n(...e), !1) });
697
697
  return e;
698
698
  }
699
+ runCommand(e, t) {
700
+ if (this.isEditable) return e(this.state, t ? (e) => this.view.dispatch(e) : void 0, this.view);
701
+ let n = !1;
702
+ return e(this.state, (e) => {
703
+ e.docChanged || e.storedMarksSet ? n = !0 : t && this.view.dispatch(e);
704
+ }, this.view) && !n;
705
+ }
699
706
  setContent(t, n = {}) {
700
707
  let { resetHistory: r = !1, emitInput: i = !0 } = n;
701
708
  if (this.clearDOMSelection(), r) {
@@ -722,7 +729,7 @@ var Bt = "stiloSkipInput", Vt = "stiloLoad", Ht = class {
722
729
  };
723
730
  this.emitter.emit("transaction", i), r.some((e) => e.docChanged) ? e.getMeta(Bt) || this.emitter.emit("input", i) : t.selection.eq(n.selection) || this.emitter.emit("selectionchange", i);
724
731
  }
725
- }, Ut = 100;
732
+ }, Wt = 100;
726
733
  /* @__NO_SIDE_EFFECTS__ */
727
734
  function P(e) {
728
735
  return (t) => ({
@@ -737,25 +744,25 @@ function P(e) {
737
744
  }
738
745
  //#endregion
739
746
  //#region src/core/helpers/block-style.ts
740
- var Wt = ["textAlign", "lineHeight"];
741
- function Gt() {
747
+ var Gt = ["textAlign", "lineHeight"];
748
+ function Kt() {
742
749
  return {
743
750
  textAlign: { default: null },
744
751
  lineHeight: { default: null }
745
752
  };
746
753
  }
747
- function Kt(e, t) {
748
- let n = Wt.filter((t) => e.spec.attrs?.[t] !== void 0);
754
+ function qt(e, t) {
755
+ let n = Gt.filter((t) => e.spec.attrs?.[t] !== void 0);
749
756
  return Object.fromEntries(n.map((e) => [e, t.attrs[e] ?? null]));
750
757
  }
751
- function qt(e) {
758
+ function Jt(e) {
752
759
  let t = M(e, "text-align"), n = t === "left" ? null : t, r = M(e, "line-height");
753
760
  return n || r ? {
754
761
  textAlign: n,
755
762
  lineHeight: r
756
763
  } : null;
757
764
  }
758
- function Jt(e, t) {
765
+ function Yt(e, t) {
759
766
  let n = j({
760
767
  "text-align": t.attrs.textAlign,
761
768
  "line-height": t.attrs.lineHeight
@@ -777,11 +784,11 @@ function F(e, t, n = null) {
777
784
  return e.doc.resolve(d).parent.type.allowsMarkType(t) ? e.tr.delete(u, a).addMark(l, u, t.create(n)).delete(d, l).removeStoredMark(t) : null;
778
785
  });
779
786
  }
780
- function Yt(e, t, n = null) {
787
+ function Xt(e, t, n = null) {
781
788
  return new v(e, (e, r, i, a) => {
782
789
  let o = e.doc.resolve(i);
783
790
  if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), t)) return null;
784
- let s = Kt(t, o.parent), c = typeof n == "function" ? n(r) : n;
791
+ let s = qt(t, o.parent), c = typeof n == "function" ? n(r) : n;
785
792
  return e.tr.delete(i, a).setBlockType(i, i, t, {
786
793
  ...c,
787
794
  ...s
@@ -796,7 +803,7 @@ function I(e, t, n = null) {
796
803
  for (let o = a.depth; o > 0; o--) {
797
804
  let s = a.node(o);
798
805
  if (s.type.isInGroup("list")) {
799
- if (s.type === e) return x(t)(r, i);
806
+ if (s.type === e) return b(t)(r, i);
800
807
  if (i) {
801
808
  let c = a.before(o), l = r.tr;
802
809
  if (s.firstChild?.type === t) l.setNodeMarkup(c, e, n);
@@ -814,11 +821,11 @@ function I(e, t, n = null) {
814
821
  return ge(e, n)(r, i);
815
822
  };
816
823
  }
817
- function Xt(e) {
824
+ function Zt(e) {
818
825
  return (t, n) => {
819
826
  let { $from: r, empty: i } = t.selection;
820
827
  if (!i || !r.parent.isTextblock || r.parentOffset !== 0) return !1;
821
- if (r.depth >= 2 && r.node(-1).type === e && r.index(-1) === 0) return x(e)(t, n);
828
+ if (r.depth >= 2 && r.node(-1).type === e && r.index(-1) === 0) return b(e)(t, n);
822
829
  if (r.index(-1) === 0) return !1;
823
830
  let a = r.node(-1).child(r.index(-1) - 1);
824
831
  if (a.lastChild?.type !== e) return !1;
@@ -837,18 +844,18 @@ function Xt(e) {
837
844
  }
838
845
  //#endregion
839
846
  //#region src/core/helpers/marks.ts
840
- function Zt(e, t) {
847
+ function L(e, t) {
841
848
  return e.some((e) => e.type !== t && e.type.excludes(t) && !t.excludes(e.type));
842
849
  }
843
- function L(e, t = null) {
850
+ function R(e, t = null) {
844
851
  return (n, r) => {
845
852
  let { empty: i, $from: a, ranges: o } = n.selection;
846
853
  if (i) {
847
854
  let i = n.storedMarks ?? a.marks();
848
- return !a.parent.type.allowsMarkType(e) || Zt(i, e) ? !1 : (r?.(n.tr.addStoredMark(e.create(t))), !0);
855
+ return !a.parent.type.allowsMarkType(e) || L(i, e) ? !1 : (r?.(n.tr.addStoredMark(e.create(t))), !0);
849
856
  }
850
857
  let s = !1;
851
- for (let t of o) n.doc.nodesBetween(t.$from.pos, t.$to.pos, (t, n, r) => (s ||= t.isText && r?.type.allowsMarkType(e) === !0 && !Zt(t.marks, e), !s));
858
+ for (let t of o) n.doc.nodesBetween(t.$from.pos, t.$to.pos, (t, n, r) => (s ||= t.isText && r?.type.allowsMarkType(e) === !0 && !L(t.marks, e), !s));
852
859
  if (!s) return !1;
853
860
  if (r) {
854
861
  let i = n.tr;
@@ -858,7 +865,7 @@ function L(e, t = null) {
858
865
  return !0;
859
866
  };
860
867
  }
861
- function R(e) {
868
+ function z(e) {
862
869
  return (t, n) => {
863
870
  let { empty: r, $from: i, ranges: a } = t.selection;
864
871
  if (r) return e.isInSet(t.storedMarks ?? i.marks()) ? (n?.(t.tr.removeStoredMark(e)), !0) : !1;
@@ -871,10 +878,10 @@ function R(e) {
871
878
  return !0;
872
879
  };
873
880
  }
874
- function Qt(e, t) {
881
+ function B(e, t) {
875
882
  let n = (n, r) => {
876
883
  let i = typeof t == "function" ? t(r) : t;
877
- if (!i || Zt(n, e)) return;
884
+ if (!i || L(n, e)) return;
878
885
  let a = e.isInSet(n);
879
886
  if (!Object.values(i).some((e) => e !== null) && !Object.keys(i).some((e) => a?.attrs[e] != null)) return;
880
887
  let o = {
@@ -890,17 +897,18 @@ function Qt(e, t) {
890
897
  return i !== void 0 && (r?.(i ? t.tr.addStoredMark(i) : t.tr.removeStoredMark(e)), !0);
891
898
  }
892
899
  let s = [];
893
- for (let r of o) {
894
- let i = r.$from.pos, a = r.$to.pos;
895
- t.doc.nodesBetween(i, a, (t, r, o) => {
896
- if (!t.isText || !o?.type.allowsMarkType(e)) return;
897
- let c = Math.max(r, i), l = n(t.marks, c);
898
- if (l === void 0) return;
899
- let u = Math.min(r + t.nodeSize, a), d = s[s.length - 1];
900
- d?.to === c && (d.mark === l || d.mark && l?.eq(d.mark)) ? d.to = u : s.push({
901
- from: c,
902
- to: u,
903
- mark: l
900
+ for (let i of o) {
901
+ let a = i.$from.pos, o = i.$to.pos;
902
+ t.doc.nodesBetween(a, o, (t, i, c) => {
903
+ if (!r && s.length > 0) return !1;
904
+ if (!t.isText || !c?.type.allowsMarkType(e)) return;
905
+ let l = Math.max(i, a), u = n(t.marks, l);
906
+ if (u === void 0) return;
907
+ let d = Math.min(i + t.nodeSize, o), f = s[s.length - 1];
908
+ f?.to === l && (f.mark === u || f.mark && u?.eq(f.mark)) ? f.to = d : s.push({
909
+ from: l,
910
+ to: d,
911
+ mark: u
904
912
  });
905
913
  });
906
914
  }
@@ -913,10 +921,10 @@ function Qt(e, t) {
913
921
  return !0;
914
922
  };
915
923
  }
916
- function z(e, t = null) {
917
- return (n, r) => D(n, e, t ?? void 0) ? R(e)(n, r) : L(e, t)(n, r);
924
+ function V(e, t = null) {
925
+ return (n, r) => D(n, e, t ?? void 0) ? z(e)(n, r) : R(e, t)(n, r);
918
926
  }
919
- function $t(e, t) {
927
+ function Qt(e, t) {
920
928
  let n = t.isInSet(e.marks());
921
929
  if (!n) return null;
922
930
  let { parent: r } = e, i = e.textOffset === 0 && e.index() > 0 ? e.index() - 1 : e.index(), a = i + 1;
@@ -933,23 +941,23 @@ function $t(e, t) {
933
941
  }
934
942
  //#endregion
935
943
  //#region src/core/helpers/nodes.ts
936
- function B(e, t) {
944
+ function H(e, t) {
937
945
  if (e.replaceSelectionWith(t), e.selection instanceof a) {
938
946
  let t = e.selection.to;
939
947
  e.doc.resolve(t).nodeAfter?.isTextblock || e.insert(t, e.doc.type.schema.nodes.paragraph.create()), e.setSelection(l.create(e.doc, t + 1));
940
948
  }
941
949
  return e.scrollIntoView();
942
950
  }
943
- function en(e, t = null) {
951
+ function $t(e, t = null) {
944
952
  return (n, r) => {
945
953
  let { $from: i } = n.selection, a = i.parent.isTextblock ? i.depth - 1 : i.depth;
946
- return i.node(a).canReplaceWith(i.index(a), i.indexAfter(a), e) ? (r?.(B(n.tr, e.create(t))), !0) : !1;
954
+ return i.node(a).canReplaceWith(i.index(a), i.indexAfter(a), e) ? (r?.(H(n.tr, e.create(t))), !0) : !1;
947
955
  };
948
956
  }
949
- function V(e, t = {}) {
957
+ function U(e, t = {}) {
950
958
  let n = (n) => e.create({
951
959
  ...t,
952
- ...Kt(e, n)
960
+ ...qt(e, n)
953
961
  }).attrs;
954
962
  return (t, r) => {
955
963
  let i = !1;
@@ -968,7 +976,7 @@ function V(e, t = {}) {
968
976
  return !0;
969
977
  };
970
978
  }
971
- function H(e, t) {
979
+ function W(e, t) {
972
980
  return (n, r) => {
973
981
  let i = /* @__PURE__ */ new Set();
974
982
  for (let { $from: t, $to: r } of n.selection.ranges) n.doc.nodesBetween(t.pos, r.pos, (t, n) => !t.isTextblock || (t.type.spec.attrs?.[e] !== void 0 && i.add(n), !1));
@@ -983,7 +991,7 @@ function H(e, t) {
983
991
  }
984
992
  //#endregion
985
993
  //#region src/core/helpers/parse-rules.ts
986
- function U(e) {
994
+ function G(e) {
987
995
  return ["text-decoration", "text-decoration-line"].map((t) => ({
988
996
  style: t,
989
997
  consuming: !1,
@@ -992,31 +1000,31 @@ function U(e) {
992
1000
  }
993
1001
  //#endregion
994
1002
  //#region src/core/helpers/word-count.ts
995
- var tn = /\S*[\p{L}\p{N}]\S*/gu, nn = /* @__PURE__ */ new WeakMap();
996
- function rn(e) {
997
- let t = nn.get(e);
1003
+ var en = /\S*[\p{L}\p{N}]\S*/gu, tn = /* @__PURE__ */ new WeakMap();
1004
+ function nn(e) {
1005
+ let t = tn.get(e);
998
1006
  if (t) return t;
999
1007
  let n = e.textBetween(0, e.content.size, "\n", "\n"), r = 0;
1000
1008
  for (let e of n) e !== "\n" && r++;
1001
1009
  let i = {
1002
- words: n.match(tn)?.length ?? 0,
1010
+ words: n.match(en)?.length ?? 0,
1003
1011
  characters: r
1004
1012
  };
1005
- return nn.set(e, i), i;
1013
+ return tn.set(e, i), i;
1006
1014
  }
1007
- function an(e) {
1015
+ function rn(e) {
1008
1016
  let t = {
1009
1017
  words: 0,
1010
1018
  characters: 0
1011
1019
  };
1012
1020
  return e.state.doc.forEach((e) => {
1013
- let n = rn(e);
1021
+ let n = nn(e);
1014
1022
  t.words += n.words, t.characters += n.characters;
1015
1023
  }), t;
1016
1024
  }
1017
1025
  //#endregion
1018
1026
  //#region src/extensions/blockquote/index.ts
1019
- var on = /* @__PURE__ */ P({
1027
+ var an = /* @__PURE__ */ P({
1020
1028
  name: "blockquote",
1021
1029
  nodes: () => ({ blockquote: {
1022
1030
  group: "block",
@@ -1038,10 +1046,10 @@ var on = /* @__PURE__ */ P({
1038
1046
  });
1039
1047
  //#endregion
1040
1048
  //#region src/extensions/bold/index.ts
1041
- function sn(e) {
1049
+ function on(e) {
1042
1050
  return e === "bold" || Number(e) >= 600;
1043
1051
  }
1044
- var cn = /* @__PURE__ */ P({
1052
+ var sn = /* @__PURE__ */ P({
1045
1053
  name: "bold",
1046
1054
  marks: () => ({ bold: {
1047
1055
  parseDOM: [
@@ -1052,7 +1060,7 @@ var cn = /* @__PURE__ */ P({
1052
1060
  },
1053
1061
  {
1054
1062
  style: "font-weight",
1055
- getAttrs: (e) => sn(e) && null
1063
+ getAttrs: (e) => on(e) && null
1056
1064
  }
1057
1065
  ],
1058
1066
  group: "formatting",
@@ -1061,14 +1069,14 @@ var cn = /* @__PURE__ */ P({
1061
1069
  commands: ({ schema: e }) => {
1062
1070
  let t = e.marks.bold;
1063
1071
  return {
1064
- setBold: () => L(t),
1065
- unsetBold: () => R(t),
1066
- toggleBold: () => z(t)
1072
+ setBold: () => R(t),
1073
+ unsetBold: () => z(t),
1074
+ toggleBold: () => V(t)
1067
1075
  };
1068
1076
  },
1069
1077
  keymap: ({ editor: e }) => ({ "Mod-b": () => e.commands.toggleBold() }),
1070
1078
  inputRules: ({ schema: e }) => [F(/(?:^|[^*])\*\*([^*]+)\*\*$/, e.marks.bold)]
1071
- }), ln = /* @__PURE__ */ P({
1079
+ }), cn = /* @__PURE__ */ P({
1072
1080
  name: "bulletList",
1073
1081
  nodes: () => ({ bulletList: {
1074
1082
  group: "block list",
@@ -1082,14 +1090,16 @@ var cn = /* @__PURE__ */ P({
1082
1090
  });
1083
1091
  //#endregion
1084
1092
  //#region src/extensions/clear-formatting/index.ts
1085
- function un(e) {
1093
+ function ln(e) {
1086
1094
  return (t, n) => {
1087
1095
  let { empty: r, $from: i, ranges: a } = t.selection;
1088
1096
  if (r) {
1089
1097
  let r = t.storedMarks ?? i.marks(), a = r.filter((t) => !e.includes(t.type));
1090
1098
  return a.length !== r.length && (n?.(t.tr.setStoredMarks(a)), !0);
1091
1099
  }
1092
- if (!a.some((n) => e.some((e) => t.doc.rangeHasMark(n.$from.pos, n.$to.pos, e)))) return !1;
1100
+ let o = !1;
1101
+ for (let n of a) t.doc.nodesBetween(n.$from.pos, n.$to.pos, (t) => (o ||= t.marks.some((t) => e.includes(t.type)), !o));
1102
+ if (!o) return !1;
1093
1103
  if (n) {
1094
1104
  let r = t.tr;
1095
1105
  for (let t of a) for (let n of e) r.removeMark(t.$from.pos, t.$to.pos, n);
@@ -1098,14 +1108,14 @@ function un(e) {
1098
1108
  return !0;
1099
1109
  };
1100
1110
  }
1101
- var dn = /* @__PURE__ */ P({
1111
+ var un = /* @__PURE__ */ P({
1102
1112
  name: "clearFormatting",
1103
1113
  commands: ({ schema: e }) => {
1104
1114
  let t = Object.values(e.marks).filter((e) => (e.spec.group ?? "").split(" ").includes("formatting"));
1105
- return { clearFormatting: () => un(t) };
1115
+ return { clearFormatting: () => ln(t) };
1106
1116
  },
1107
1117
  keymap: ({ editor: e }) => ({ "Mod-\\": () => e.commands.clearFormatting() })
1108
- }), fn = /* @__PURE__ */ P({
1118
+ }), dn = /* @__PURE__ */ P({
1109
1119
  name: "code",
1110
1120
  marks: () => ({ code: {
1111
1121
  parseDOM: [{ tag: "code" }],
@@ -1117,27 +1127,27 @@ var dn = /* @__PURE__ */ P({
1117
1127
  commands: ({ schema: e }) => {
1118
1128
  let t = e.marks.code;
1119
1129
  return {
1120
- setCode: () => L(t),
1121
- unsetCode: () => R(t),
1122
- toggleCode: () => z(t)
1130
+ setCode: () => R(t),
1131
+ unsetCode: () => z(t),
1132
+ toggleCode: () => V(t)
1123
1133
  };
1124
1134
  },
1125
1135
  keymap: ({ editor: e }) => ({ "Mod-e": () => e.commands.toggleCode() }),
1126
1136
  inputRules: ({ schema: e }) => [F(/(?:^|[^`])`([^`]+)`$/, e.marks.code)]
1127
- }), pn = /^language-([\w-]+)$/, mn = /^[\w-]+$/;
1128
- function hn(e) {
1137
+ }), fn = /^language-([\w-]+)$/, pn = /^[\w-]+$/;
1138
+ function mn(e) {
1129
1139
  for (let t of e?.classList ?? []) {
1130
- let e = pn.exec(t);
1140
+ let e = fn.exec(t);
1131
1141
  if (e) return e[1];
1132
1142
  }
1133
1143
  return null;
1134
1144
  }
1135
- function gn(e, t, n, r) {
1145
+ function hn(e, t, n, r) {
1136
1146
  let i = [];
1137
1147
  e.doc.nodesBetween(n, r, (e, n, r, a) => (e.type === t && a > 0 && r?.child(a - 1).type === t && i.push(n), !e.isTextblock));
1138
1148
  for (let t of i.reverse()) e.join(t).insertText("\n", t - 1);
1139
1149
  }
1140
- var _n = /* @__PURE__ */ P({
1150
+ var gn = /* @__PURE__ */ P({
1141
1151
  name: "codeBlock",
1142
1152
  priority: 101,
1143
1153
  nodes: () => ({ codeBlock: {
@@ -1150,7 +1160,7 @@ var _n = /* @__PURE__ */ P({
1150
1160
  parseDOM: [{
1151
1161
  tag: "pre",
1152
1162
  preserveWhitespace: "full",
1153
- getAttrs: (e) => ({ language: hn(e.querySelector("code")) ?? hn(e) })
1163
+ getAttrs: (e) => ({ language: mn(e.querySelector("code")) ?? mn(e) })
1154
1164
  }],
1155
1165
  toDOM: (e) => ["pre", [
1156
1166
  "code",
@@ -1161,8 +1171,8 @@ var _n = /* @__PURE__ */ P({
1161
1171
  commands: ({ schema: e }) => {
1162
1172
  let t = e.nodes.codeBlock, n = e.nodes.paragraph, r = (e = {}) => {
1163
1173
  let n = e.language ?? null;
1164
- return n !== null && !mn.test(n) ? () => !1 : (e, r) => V(t, { language: n })(e, r && ((e) => {
1165
- gn(e, t, e.selection.from, e.selection.to), r(e);
1174
+ return n !== null && !pn.test(n) ? () => !1 : (e, r) => U(t, { language: n })(e, r && ((e) => {
1175
+ hn(e, t, e.selection.from, e.selection.to), r(e);
1166
1176
  }));
1167
1177
  }, i = () => (e, r) => {
1168
1178
  if (!O(e, t)) return !1;
@@ -1201,11 +1211,11 @@ var _n = /* @__PURE__ */ P({
1201
1211
  return !0;
1202
1212
  },
1203
1213
  "Shift-Enter": (e, t) => n(e) && ce(e, t),
1204
- Backspace: (e, r) => n(e) && e.selection.empty && e.selection.$from.parent.content.size === 0 && V(t.nodes.paragraph)(e, r)
1214
+ Backspace: (e, r) => n(e) && e.selection.empty && e.selection.$from.parent.content.size === 0 && U(t.nodes.paragraph)(e, r)
1205
1215
  };
1206
1216
  },
1207
- inputRules: ({ schema: e }) => [Yt(/^```([\w-]+)?\s$/, e.nodes.codeBlock, (e) => ({ language: e[1] ?? null }))]
1208
- }), vn = /* @__PURE__ */ P({
1217
+ inputRules: ({ schema: e }) => [Xt(/^```([\w-]+)?\s$/, e.nodes.codeBlock, (e) => ({ language: e[1] ?? null }))]
1218
+ }), _n = /* @__PURE__ */ P({
1209
1219
  name: "doc",
1210
1220
  nodes: () => ({ doc: { content: "block+" } }),
1211
1221
  commands: () => ({
@@ -1219,17 +1229,17 @@ var _n = /* @__PURE__ */ P({
1219
1229
  },
1220
1230
  selectAll: () => le
1221
1231
  })
1222
- }), yn = /* @__PURE__ */ P({
1232
+ }), vn = /* @__PURE__ */ P({
1223
1233
  name: "dropCursor",
1224
1234
  defaultOptions: {
1225
1235
  color: "currentColor",
1226
1236
  width: 1
1227
1237
  },
1228
1238
  plugins: ({ options: e }) => [_e(e)]
1229
- }), bn = /* @__PURE__ */ P({
1239
+ }), yn = /* @__PURE__ */ P({
1230
1240
  name: "gapCursor",
1231
1241
  plugins: () => [ve()]
1232
- }), xn = /* @__PURE__ */ P({
1242
+ }), bn = /* @__PURE__ */ P({
1233
1243
  name: "hardBreak",
1234
1244
  nodes: () => ({ hardBreak: {
1235
1245
  inline: !0,
@@ -1245,7 +1255,7 @@ var _n = /* @__PURE__ */ P({
1245
1255
  return i.parent.canReplaceWith(i.index(), i.index(), r) ? (n?.(t.tr.replaceSelectionWith(r.create()).scrollIntoView()), !0) : !1;
1246
1256
  } }),
1247
1257
  keymap: ({ editor: e }) => ({ "Shift-Enter": () => e.commands.setHardBreak() })
1248
- }), Sn = /* @__PURE__ */ P({
1258
+ }), xn = /* @__PURE__ */ P({
1249
1259
  name: "heading",
1250
1260
  defaultOptions: { levels: [
1251
1261
  1,
@@ -1261,50 +1271,50 @@ var _n = /* @__PURE__ */ P({
1261
1271
  defining: !0,
1262
1272
  attrs: {
1263
1273
  level: { default: e[0] ?? 1 },
1264
- ...Gt()
1274
+ ...Kt()
1265
1275
  },
1266
1276
  parseDOM: e.map((e) => ({
1267
1277
  tag: `h${e}`,
1268
1278
  getAttrs: (t) => ({
1269
1279
  level: e,
1270
- ...qt(t)
1280
+ ...Jt(t)
1271
1281
  })
1272
1282
  })),
1273
- toDOM: (e) => Jt(`h${e.attrs.level}`, e)
1283
+ toDOM: (e) => Yt(`h${e.attrs.level}`, e)
1274
1284
  } }),
1275
1285
  commands: ({ schema: e, options: t }) => {
1276
- let n = e.nodes.heading, r = (e) => t.levels.includes(e.level) ? V(n, { level: e.level }) : () => !1;
1286
+ let n = e.nodes.heading, r = (e) => t.levels.includes(e.level) ? U(n, { level: e.level }) : () => !1;
1277
1287
  return {
1278
1288
  setHeading: r,
1279
- toggleHeading: (t) => (i, a) => O(i, n, { level: t.level }) ? V(e.nodes.paragraph)(i, a) : r(t)(i, a)
1289
+ toggleHeading: (t) => (i, a) => O(i, n, { level: t.level }) ? U(e.nodes.paragraph)(i, a) : r(t)(i, a)
1280
1290
  };
1281
1291
  },
1282
1292
  keymap: ({ editor: e, options: t }) => Object.fromEntries(t.levels.map((t) => [`Mod-Alt-${t}`, () => e.commands.toggleHeading({ level: t })])),
1283
- inputRules: ({ schema: e, options: t }) => t.levels.map((t) => Yt(RegExp(`^#{${t}}\\s$`), e.nodes.heading, { level: t }))
1293
+ inputRules: ({ schema: e, options: t }) => t.levels.map((t) => Xt(RegExp(`^#{${t}}\\s$`), e.nodes.heading, { level: t }))
1284
1294
  });
1285
1295
  //#endregion
1286
1296
  //#region src/extensions/highlight/index.ts
1287
- function W(e) {
1297
+ function K(e) {
1288
1298
  let t = e == null ? null : A("background-color", e);
1289
1299
  return t === "transparent" ? null : t;
1290
1300
  }
1291
- function Cn({ color: e = null }) {
1301
+ function Sn({ color: e = null }) {
1292
1302
  if (e === null) return { color: e };
1293
- let t = W(e);
1303
+ let t = K(e);
1294
1304
  return t ? { color: t } : null;
1295
1305
  }
1296
- var wn = /* @__PURE__ */ P({
1306
+ var Cn = /* @__PURE__ */ P({
1297
1307
  name: "highlight",
1298
1308
  priority: 102,
1299
1309
  marks: () => ({ highlight: {
1300
1310
  attrs: { color: { default: null } },
1301
1311
  parseDOM: [{
1302
1312
  tag: "mark",
1303
- getAttrs: (e) => ({ color: W(M(e, "background-color")) })
1313
+ getAttrs: (e) => ({ color: K(M(e, "background-color")) })
1304
1314
  }, {
1305
1315
  style: "background-color",
1306
1316
  getAttrs: (e) => {
1307
- let t = W(e);
1317
+ let t = K(e);
1308
1318
  return t ? { color: t } : !1;
1309
1319
  }
1310
1320
  }],
@@ -1319,20 +1329,20 @@ var wn = /* @__PURE__ */ P({
1319
1329
  let t = e.marks.highlight;
1320
1330
  return {
1321
1331
  setHighlight: (e = {}) => {
1322
- let n = Cn(e);
1323
- return n ? L(t, n) : () => !1;
1332
+ let n = Sn(e);
1333
+ return n ? R(t, n) : () => !1;
1324
1334
  },
1325
- unsetHighlight: () => R(t),
1335
+ unsetHighlight: () => z(t),
1326
1336
  toggleHighlight: (e) => {
1327
- if (!e) return z(t);
1328
- let n = Cn(e);
1329
- return n ? z(t, n) : () => !1;
1337
+ if (!e) return V(t);
1338
+ let n = Sn(e);
1339
+ return n ? V(t, n) : () => !1;
1330
1340
  }
1331
1341
  };
1332
1342
  },
1333
1343
  keymap: ({ editor: e }) => ({ "Mod-Shift-h": () => e.commands.toggleHighlight() }),
1334
1344
  inputRules: ({ schema: e }) => [F(/(?:^|[^=])==([^=]+)==$/, e.marks.highlight)]
1335
- }), Tn = /* @__PURE__ */ P({
1345
+ }), wn = /* @__PURE__ */ P({
1336
1346
  name: "history",
1337
1347
  defaultOptions: {
1338
1348
  depth: 100,
@@ -1348,31 +1358,31 @@ var wn = /* @__PURE__ */ P({
1348
1358
  "Mod-y": () => e.commands.redo()
1349
1359
  }),
1350
1360
  plugins: ({ options: e }) => [t(e)]
1351
- }), En = /* @__PURE__ */ P({
1361
+ }), Tn = /* @__PURE__ */ P({
1352
1362
  name: "horizontalRule",
1353
1363
  nodes: () => ({ horizontalRule: {
1354
1364
  group: "block",
1355
1365
  parseDOM: [{ tag: "hr" }],
1356
1366
  toDOM: () => ["hr"]
1357
1367
  } }),
1358
- commands: ({ schema: e }) => ({ setHorizontalRule: () => en(e.nodes.horizontalRule) }),
1359
- inputRules: ({ schema: e }) => [new v(/^---$/, (t, n, r, i) => B(t.tr.delete(r, i), e.nodes.horizontalRule.create()))]
1360
- }), Dn = 32, On = [
1368
+ commands: ({ schema: e }) => ({ setHorizontalRule: () => $t(e.nodes.horizontalRule) }),
1369
+ inputRules: ({ schema: e }) => [new v(/^---$/, (t, n, r, i) => H(t.tr.delete(r, i), e.nodes.horizontalRule.create()))]
1370
+ }), En = 32, Dn = [
1361
1371
  "src",
1362
1372
  "alt",
1363
1373
  "title",
1364
1374
  "width",
1365
1375
  "height"
1366
1376
  ];
1367
- function kn(e) {
1377
+ function On(e) {
1368
1378
  let t = {};
1369
- for (let n of On) {
1379
+ for (let n of Dn) {
1370
1380
  let r = e.attrs[n];
1371
1381
  r != null && r !== "" && (t[n] = String(r));
1372
1382
  }
1373
1383
  return t;
1374
1384
  }
1375
- var An = class {
1385
+ var kn = class {
1376
1386
  view;
1377
1387
  getPos;
1378
1388
  dom;
@@ -1391,8 +1401,8 @@ var An = class {
1391
1401
  return !0;
1392
1402
  }
1393
1403
  render() {
1394
- let e = kn(this.node);
1395
- for (let t of On) {
1404
+ let e = On(this.node);
1405
+ for (let t of Dn) {
1396
1406
  let n = e[t];
1397
1407
  n === void 0 ? this.img.removeAttribute(t) : this.img.setAttribute(t, n);
1398
1408
  }
@@ -1406,7 +1416,7 @@ var An = class {
1406
1416
  e.preventDefault();
1407
1417
  let n = this.img.getBoundingClientRect(), { naturalWidth: r, naturalHeight: i } = this.img, a = r && i ? i / r : n.height / n.width, o = this.view.dom.clientWidth || Infinity, s = t === "left" ? -1 : 1, c = e.clientX, l = null, u = (e) => {
1408
1418
  let t = n.width + s * (e.clientX - c);
1409
- l = Math.round(Math.min(Math.max(t, Dn), o)), this.img.style.width = `${l}px`;
1419
+ l = Math.round(Math.min(Math.max(t, En), o)), this.img.style.width = `${l}px`;
1410
1420
  }, d = () => {
1411
1421
  document.removeEventListener("pointermove", u), document.removeEventListener("pointerup", d), document.removeEventListener("pointercancel", d), this.img.style.removeProperty("width"), l !== null && this.setSize(l, Number.isFinite(a) ? Math.round(l * a) : null);
1412
1422
  };
@@ -1421,20 +1431,20 @@ var An = class {
1421
1431
  };
1422
1432
  //#endregion
1423
1433
  //#region src/extensions/image/index.ts
1424
- function jn(e) {
1434
+ function An(e) {
1425
1435
  let t = e.clipboardData;
1426
1436
  return !t || t.getData("text/html") ? [] : [...t.files].filter((e) => e.type.startsWith("image/"));
1427
1437
  }
1428
- function Mn(e) {
1438
+ function jn(e) {
1429
1439
  return new Promise((t) => {
1430
1440
  let n = new FileReader();
1431
1441
  n.onload = () => t(String(n.result)), n.onerror = () => t(""), n.readAsDataURL(e);
1432
1442
  });
1433
1443
  }
1434
- function Nn(e) {
1444
+ function Mn(e) {
1435
1445
  return e && /^\d+$/.test(e) ? Number(e) : null;
1436
1446
  }
1437
- var Pn = /* @__PURE__ */ P({
1447
+ var Nn = /* @__PURE__ */ P({
1438
1448
  name: "image",
1439
1449
  defaultOptions: { maxInlineBytes: 5242880 },
1440
1450
  nodes: () => ({ image: {
@@ -1455,11 +1465,11 @@ var Pn = /* @__PURE__ */ P({
1455
1465
  src: e.getAttribute("src"),
1456
1466
  alt: e.getAttribute("alt") || null,
1457
1467
  title: e.getAttribute("title") || null,
1458
- width: Nn(e.getAttribute("width")),
1459
- height: Nn(e.getAttribute("height"))
1468
+ width: Mn(e.getAttribute("width")),
1469
+ height: Mn(e.getAttribute("height"))
1460
1470
  })
1461
1471
  }],
1462
- toDOM: (e) => ["img", kn(e)]
1472
+ toDOM: (e) => ["img", On(e)]
1463
1473
  } }),
1464
1474
  plugins: ({ schema: e, options: t, editor: n, emit: r }) => {
1465
1475
  let i = e.nodes.image;
@@ -1474,7 +1484,7 @@ var Pn = /* @__PURE__ */ P({
1474
1484
  });
1475
1485
  continue;
1476
1486
  }
1477
- let a = await Mn(e);
1487
+ let a = await jn(e);
1478
1488
  a && (mt(a) ? o.push(i.create({ src: a })) : r("imageRejected", {
1479
1489
  editor: n,
1480
1490
  file: e,
@@ -1487,13 +1497,13 @@ var Pn = /* @__PURE__ */ P({
1487
1497
  }
1488
1498
  return [new o({ props: {
1489
1499
  handlePaste: (e, t) => {
1490
- let n = jn(t);
1500
+ let n = An(t);
1491
1501
  return n.length !== 0 && (a(e, n), !0);
1492
1502
  },
1493
- nodeViews: { image: (e, t, n) => new An(e, t, n) }
1503
+ nodeViews: { image: (e, t, n) => new kn(e, t, n) }
1494
1504
  } })];
1495
1505
  }
1496
- }), Fn = /* @__PURE__ */ P({
1506
+ }), Pn = /* @__PURE__ */ P({
1497
1507
  name: "italic",
1498
1508
  marks: () => ({ italic: {
1499
1509
  parseDOM: [
@@ -1510,33 +1520,33 @@ var Pn = /* @__PURE__ */ P({
1510
1520
  commands: ({ schema: e }) => {
1511
1521
  let t = e.marks.italic;
1512
1522
  return {
1513
- setItalic: () => L(t),
1514
- unsetItalic: () => R(t),
1515
- toggleItalic: () => z(t)
1523
+ setItalic: () => R(t),
1524
+ unsetItalic: () => z(t),
1525
+ toggleItalic: () => V(t)
1516
1526
  };
1517
1527
  },
1518
1528
  keymap: ({ editor: e }) => ({ "Mod-i": () => e.commands.toggleItalic() }),
1519
1529
  inputRules: ({ schema: e }) => [F(/(?:^|[^*])\*([^*]+)\*$/, e.marks.italic), F(/(?:^|\s)_([^_]+)_$/, e.marks.italic)]
1520
- }), In = /* @__PURE__ */ P({
1530
+ }), Fn = /* @__PURE__ */ P({
1521
1531
  name: "lineHeight",
1522
1532
  commands: () => ({
1523
1533
  setLineHeight: (e) => {
1524
1534
  let t = A("line-height", String(e));
1525
- return t ? H("lineHeight", t) : () => !1;
1535
+ return t ? W("lineHeight", t) : () => !1;
1526
1536
  },
1527
- unsetLineHeight: () => H("lineHeight", null)
1537
+ unsetLineHeight: () => W("lineHeight", null)
1528
1538
  })
1529
1539
  });
1530
1540
  //#endregion
1531
1541
  //#region src/extensions/link/index.ts
1532
- function Ln(e) {
1542
+ function In(e) {
1533
1543
  let t = e.getAttribute("href")?.trim() ?? "";
1534
1544
  return !t || !N(t) ? !1 : {
1535
1545
  href: t,
1536
1546
  target: e.getAttribute("target") === "_blank" ? "_blank" : null
1537
1547
  };
1538
1548
  }
1539
- function Rn(e, { href: t, target: n = null }) {
1549
+ function Ln(e, { href: t, target: n = null }) {
1540
1550
  return (r, i) => {
1541
1551
  let a = t.trim();
1542
1552
  if (!a || !N(a)) return !1;
@@ -1544,19 +1554,19 @@ function Rn(e, { href: t, target: n = null }) {
1544
1554
  href: a,
1545
1555
  target: n
1546
1556
  };
1547
- if (!r.selection.empty) return L(e, o)(r, i);
1548
- let s = $t(r.selection.$from, e);
1557
+ if (!r.selection.empty) return R(e, o)(r, i);
1558
+ let s = Qt(r.selection.$from, e);
1549
1559
  return s ? (i?.(r.tr.addMark(s.from, s.to, e.create(o)).scrollIntoView()), !0) : !1;
1550
1560
  };
1551
1561
  }
1552
- function zn(e) {
1562
+ function Rn(e) {
1553
1563
  return (t, n) => {
1554
- if (!t.selection.empty) return R(e)(t, n);
1555
- let r = $t(t.selection.$from, e);
1564
+ if (!t.selection.empty) return z(e)(t, n);
1565
+ let r = Qt(t.selection.$from, e);
1556
1566
  return r ? (n?.(t.tr.removeMark(r.from, r.to, e).scrollIntoView()), !0) : !1;
1557
1567
  };
1558
1568
  }
1559
- var Bn = /* @__PURE__ */ P({
1569
+ var zn = /* @__PURE__ */ P({
1560
1570
  name: "link",
1561
1571
  priority: 103,
1562
1572
  marks: () => ({ link: {
@@ -1567,7 +1577,7 @@ var Bn = /* @__PURE__ */ P({
1567
1577
  inclusive: !1,
1568
1578
  parseDOM: [{
1569
1579
  tag: "a[href]",
1570
- getAttrs: Ln
1580
+ getAttrs: In
1571
1581
  }],
1572
1582
  toDOM: (e) => [
1573
1583
  "a",
@@ -1582,11 +1592,11 @@ var Bn = /* @__PURE__ */ P({
1582
1592
  commands: ({ schema: e }) => {
1583
1593
  let t = e.marks.link;
1584
1594
  return {
1585
- setLink: (e) => Rn(t, e),
1586
- unsetLink: () => zn(t)
1595
+ setLink: (e) => Ln(t, e),
1596
+ unsetLink: () => Rn(t)
1587
1597
  };
1588
1598
  }
1589
- }), Vn = /* @__PURE__ */ P({
1599
+ }), Bn = /* @__PURE__ */ P({
1590
1600
  name: "listItem",
1591
1601
  nodes: () => ({ listItem: {
1592
1602
  content: "paragraph block*",
@@ -1597,25 +1607,25 @@ var Bn = /* @__PURE__ */ P({
1597
1607
  commands: ({ schema: e }) => {
1598
1608
  let t = e.nodes.listItem;
1599
1609
  return {
1600
- splitListItem: () => he(t),
1601
- sinkListItem: () => me(t),
1602
- liftListItem: () => x(t)
1610
+ splitListItem: () => x(t),
1611
+ sinkListItem: () => he(t),
1612
+ liftListItem: () => b(t)
1603
1613
  };
1604
1614
  },
1605
1615
  keymap: ({ editor: e, schema: t }) => ({
1606
1616
  Enter: () => e.commands.splitListItem(),
1607
1617
  Tab: () => e.commands.sinkListItem(),
1608
1618
  "Shift-Tab": () => e.commands.liftListItem(),
1609
- Backspace: Xt(t.nodes.listItem)
1619
+ Backspace: Zt(t.nodes.listItem)
1610
1620
  })
1611
1621
  });
1612
1622
  //#endregion
1613
1623
  //#region src/extensions/move-block/index.ts
1614
- function Hn(e) {
1624
+ function Vn(e) {
1615
1625
  return e.type.isInGroup("list") || e.type.name === "doc" || e.type.name === "blockquote" || e.type.name === "tableCell" || e.type.name === "tableHeader";
1616
1626
  }
1617
- function Un(e, t, n, r) {
1618
- let i = e.blockRange(t, Hn);
1627
+ function Hn(e, t, n, r) {
1628
+ let i = e.blockRange(t, Vn);
1619
1629
  if (!i) return !1;
1620
1630
  let { parent: a, startIndex: o, start: s, end: c } = i;
1621
1631
  if (o === 0) return !1;
@@ -1624,8 +1634,8 @@ function Un(e, t, n, r) {
1624
1634
  let u = l.nodeSize, d = s - u, f = n.tr;
1625
1635
  return f.delete(d, d + u), f.insert(c - u, l), f.scrollIntoView(), r(f), !0;
1626
1636
  }
1627
- function Wn(e, t, n, r) {
1628
- let i = e.blockRange(t, Hn);
1637
+ function Un(e, t, n, r) {
1638
+ let i = e.blockRange(t, Vn);
1629
1639
  if (!i) return !1;
1630
1640
  let { parent: a, endIndex: o, start: s, end: c } = i;
1631
1641
  if (o >= a.childCount) return !1;
@@ -1634,23 +1644,23 @@ function Wn(e, t, n, r) {
1634
1644
  let u = l.nodeSize, d = c, f = d + u, p = n.tr;
1635
1645
  return p.delete(d, f), p.insert(s, l), p.scrollIntoView(), r(p), !0;
1636
1646
  }
1637
- var Gn = /* @__PURE__ */ P({
1647
+ var Wn = /* @__PURE__ */ P({
1638
1648
  name: "moveBlock",
1639
1649
  commands: ({ editor: e }) => ({
1640
1650
  moveBlockUp: () => (e, t) => {
1641
1651
  let { $from: n, $to: r } = e.selection;
1642
- return Un(n, r, e, t);
1652
+ return Hn(n, r, e, t);
1643
1653
  },
1644
1654
  moveBlockDown: () => (e, t) => {
1645
1655
  let { $from: n, $to: r } = e.selection;
1646
- return Wn(n, r, e, t);
1656
+ return Un(n, r, e, t);
1647
1657
  }
1648
1658
  }),
1649
1659
  keymap: ({ editor: e }) => ({
1650
1660
  "Alt-ArrowUp": () => e.commands.moveBlockUp(),
1651
1661
  "Alt-ArrowDown": () => e.commands.moveBlockDown()
1652
1662
  })
1653
- }), Kn = /* @__PURE__ */ P({
1663
+ }), Gn = /* @__PURE__ */ P({
1654
1664
  name: "orderedList",
1655
1665
  nodes: () => ({ orderedList: {
1656
1666
  group: "block list",
@@ -1658,7 +1668,7 @@ var Gn = /* @__PURE__ */ P({
1658
1668
  attrs: { start: { default: 1 } },
1659
1669
  parseDOM: [{
1660
1670
  tag: "ol",
1661
- getAttrs: (e) => ({ start: qn(e) })
1671
+ getAttrs: (e) => ({ start: Kn(e) })
1662
1672
  }],
1663
1673
  toDOM: (e) => e.attrs.start === 1 ? ["ol", 0] : [
1664
1674
  "ol",
@@ -1670,28 +1680,28 @@ var Gn = /* @__PURE__ */ P({
1670
1680
  keymap: ({ editor: e }) => ({ "Mod-Shift-7": () => e.commands.toggleOrderedList() }),
1671
1681
  inputRules: ({ schema: e }) => [y(/^(\d+)\.\s$/, e.nodes.orderedList, (e) => ({ start: Number(e[1]) }), (e, t) => t.childCount + t.attrs.start === Number(e[1]))]
1672
1682
  });
1673
- function qn(e) {
1683
+ function Kn(e) {
1674
1684
  let t = e.getAttribute("start")?.trim() ?? "";
1675
1685
  return /^\d+$/.test(t) ? Number(t) : 1;
1676
1686
  }
1677
1687
  //#endregion
1678
1688
  //#region src/extensions/paragraph/index.ts
1679
- var Jn = /* @__PURE__ */ P({
1689
+ var qn = /* @__PURE__ */ P({
1680
1690
  name: "paragraph",
1681
1691
  priority: 1e3,
1682
1692
  nodes: () => ({ paragraph: {
1683
1693
  group: "block",
1684
1694
  content: "inline*",
1685
- attrs: Gt(),
1695
+ attrs: Kt(),
1686
1696
  parseDOM: [{
1687
1697
  tag: "p",
1688
- getAttrs: qt
1698
+ getAttrs: Jt
1689
1699
  }],
1690
- toDOM: (e) => Jt("p", e)
1700
+ toDOM: (e) => Yt("p", e)
1691
1701
  } }),
1692
- commands: ({ schema: e }) => ({ setParagraph: () => V(e.nodes.paragraph) }),
1702
+ commands: ({ schema: e }) => ({ setParagraph: () => U(e.nodes.paragraph) }),
1693
1703
  keymap: ({ editor: e }) => ({ "Mod-Alt-0": () => e.commands.setParagraph() })
1694
- }), Yn = /* @__PURE__ */ P({
1704
+ }), Jn = /* @__PURE__ */ P({
1695
1705
  name: "placeholder",
1696
1706
  defaultOptions: { placeholder: "" },
1697
1707
  plugins: ({ options: e }) => [new o({ props: { decorations(t) {
@@ -1704,7 +1714,7 @@ var Jn = /* @__PURE__ */ P({
1704
1714
  "data-placeholder": e.placeholder
1705
1715
  })]);
1706
1716
  } } })]
1707
- }), Xn = "stilo-search-match", Zn = "stilo-search-match--current", G = new s("stiloSearch"), K = "stiloSearchReveal", Qn = new ye({ search: "" }), q = {
1717
+ }), Yn = "stilo-search-match", Xn = "stilo-search-match--current", q = new s("stiloSearch"), Zn = "stiloSearchReveal", Qn = new ye({ search: "" }), J = {
1708
1718
  query: Qn,
1709
1719
  matches: d.empty,
1710
1720
  total: 0,
@@ -1716,7 +1726,7 @@ function $n(e, t) {
1716
1726
  let n = e.textContent;
1717
1727
  return t.caseSensitive ? n.includes(t.search) : n.toLowerCase().includes(t.search.toLowerCase());
1718
1728
  }
1719
- function J(e, t, n, r) {
1729
+ function Y(e, t, n, r) {
1720
1730
  let { index: a, offset: o } = e.childAfter(n.from);
1721
1731
  for (let s = !0; s && a < e.childCount && o <= n.to; a++) {
1722
1732
  let c = e.child(a), l = o + 1;
@@ -1734,12 +1744,12 @@ function J(e, t, n, r) {
1734
1744
  }
1735
1745
  }
1736
1746
  }
1737
- function Y(e, t, n) {
1747
+ function X(e, t, n) {
1738
1748
  let r = 0;
1739
- return J(e, t, n, () => (r++, !0)), r;
1749
+ return Y(e, t, n, () => (r++, !0)), r;
1740
1750
  }
1741
1751
  function er(e) {
1742
- return u.inline(e.from, e.to, { class: Xn });
1752
+ return u.inline(e.from, e.to, { class: Yn });
1743
1753
  }
1744
1754
  function tr(e, t) {
1745
1755
  let { from: n, to: r, empty: i } = e.selection;
@@ -1766,30 +1776,30 @@ function rr(e) {
1766
1776
  });
1767
1777
  }), t > n ? null : nr(e.doc, t, n);
1768
1778
  }
1769
- function X(e) {
1779
+ function ir(e) {
1770
1780
  return e.find().sort((e, t) => e.from - t.from);
1771
1781
  }
1772
- function ir(e, t, n, r) {
1773
- let i = X(n), a = i.findIndex((e) => e.from === r.from);
1782
+ function ar(e, t, n, r) {
1783
+ let i = ir(n), a = i.findIndex((e) => e.from === r.from);
1774
1784
  if (a >= 0) return a + 1;
1775
1785
  let o = i[i.length - 1]?.to ?? 0;
1776
- return i.length + Y(e, t, {
1786
+ return i.length + X(e, t, {
1777
1787
  from: o,
1778
1788
  to: r.from
1779
1789
  }) + 1;
1780
1790
  }
1781
- function ar(e, t, n) {
1791
+ function or(e, t, n) {
1782
1792
  let { query: r } = e, i = rr(t), a = e.matches.map(t.mapping, t.doc);
1783
1793
  if (!i) return {
1784
1794
  ...e,
1785
1795
  matches: a
1786
1796
  };
1787
- let o = t.mapping.invert(), s = nr(t.before, o.map(i.from, -1), o.map(i.to, 1)), c = e.total - Y(t.before, r, s) + Y(t.doc, r, i), l = X(a);
1797
+ let o = t.mapping.invert(), s = nr(t.before, o.map(i.from, -1), o.map(i.to, 1)), c = e.total - X(t.before, r, s) + X(t.doc, r, i), l = ir(a);
1788
1798
  if (!(e.total > e.matches.find().length && i.from > (l[l.length - 1]?.to ?? 0))) {
1789
1799
  a = a.remove(a.find(i.from, i.to));
1790
1800
  let e = [];
1791
- J(t.doc, r, i, (t) => e.push(er(t)) < n), a = a.add(t.doc, e);
1792
- let o = X(a).slice(n);
1801
+ Y(t.doc, r, i, (t) => e.push(er(t)) < n), a = a.add(t.doc, e);
1802
+ let o = ir(a).slice(n);
1793
1803
  o.length > 0 && (a = a.remove(o));
1794
1804
  }
1795
1805
  return {
@@ -1798,20 +1808,20 @@ function ar(e, t, n) {
1798
1808
  total: c
1799
1809
  };
1800
1810
  }
1801
- function or(e, t, n) {
1802
- if (!t.valid) return q;
1811
+ function sr(e, t, n) {
1812
+ if (!t.valid) return J;
1803
1813
  let r = [], i = 0;
1804
- return J(e, t, {
1814
+ return Y(e, t, {
1805
1815
  from: 0,
1806
1816
  to: e.content.size
1807
1817
  }, (e) => (i++ < n && r.push(er(e)), !0)), {
1808
- ...q,
1818
+ ...J,
1809
1819
  query: t,
1810
1820
  matches: d.create(e, r),
1811
1821
  total: i
1812
1822
  };
1813
1823
  }
1814
- function sr(e) {
1824
+ function cr(e) {
1815
1825
  let t = e.someProp("scrollMargin") ?? 5, n = typeof t == "number" ? t : t.top, r = typeof t == "number" ? t : t.bottom, i = {
1816
1826
  top: n,
1817
1827
  bottom: window.innerHeight - r
@@ -1824,51 +1834,51 @@ function sr(e) {
1824
1834
  }
1825
1835
  return i;
1826
1836
  }
1827
- function cr(e) {
1828
- let t = e.dom.querySelector(`.${Zn}`);
1837
+ function lr(e) {
1838
+ let t = e.dom.querySelector(`.${Xn}`);
1829
1839
  if (!t) return;
1830
- let n = t.getBoundingClientRect(), r = sr(e);
1840
+ let n = t.getBoundingClientRect(), r = cr(e);
1831
1841
  n.top >= r.top && n.bottom <= r.bottom || t.scrollIntoView({
1832
1842
  block: "center",
1833
1843
  inline: "nearest"
1834
1844
  });
1835
1845
  }
1836
- function lr(e, t, n, r) {
1837
- let i = e.getMeta(G);
1838
- return i ? or(n.doc, i, r) : !t.query.valid || !e.docChanged ? t : ar(t, e, r);
1846
+ function ur(e, t, n, r) {
1847
+ let i = e.getMeta(q);
1848
+ return i ? sr(n.doc, i, r) : !t.query.valid || !e.docChanged ? t : or(t, e, r);
1839
1849
  }
1840
- function ur(e, t, n, r, i) {
1841
- return i.from >= n.to ? r + Y(e, t, {
1850
+ function dr(e, t, n, r, i) {
1851
+ return i.from >= n.to ? r + X(e, t, {
1842
1852
  from: n.to,
1843
1853
  to: i.from
1844
- }) + 1 : i.to <= n.from ? r - Y(e, t, {
1854
+ }) + 1 : i.to <= n.from ? r - X(e, t, {
1845
1855
  from: i.to,
1846
1856
  to: n.from
1847
1857
  }) - 1 : r;
1848
1858
  }
1849
- function dr(e, t, n, r) {
1859
+ function fr(e, t, n, r) {
1850
1860
  let { query: i } = e;
1851
- if (!i.valid || !n.docChanged && !n.selectionSet && !n.getMeta(G)) return e;
1861
+ if (!i.valid || !n.docChanged && !n.selectionSet && !n.getMeta(q)) return e;
1852
1862
  let a = tr(r, i);
1853
1863
  if (!a) return {
1854
1864
  ...e,
1855
1865
  current: a,
1856
1866
  index: 0
1857
1867
  };
1858
- let o = t.current, s = o && t.index > 0 && !n.docChanged && t.query === i ? ur(r.doc, i, o, t.index, a) : ir(r.doc, i, e.matches, a);
1868
+ let o = t.current, s = o && t.index > 0 && !n.docChanged && t.query === i ? dr(r.doc, i, o, t.index, a) : ar(r.doc, i, e.matches, a);
1859
1869
  return {
1860
1870
  ...e,
1861
1871
  current: a,
1862
1872
  index: s
1863
1873
  };
1864
1874
  }
1865
- function fr(e) {
1875
+ function pr(e) {
1866
1876
  return new o({
1867
- key: G,
1877
+ key: q,
1868
1878
  state: {
1869
- init: () => q,
1879
+ init: () => J,
1870
1880
  apply(t, n, r, i) {
1871
- let a = dr(lr(t, n, i, e), n, t, i), o = t.getMeta(K) === !0;
1881
+ let a = fr(ur(t, n, i, e), n, t, i), o = t.getMeta(Zn) === !0;
1872
1882
  return a.reveal === o ? a : {
1873
1883
  ...a,
1874
1884
  reveal: o
@@ -1876,29 +1886,29 @@ function fr(e) {
1876
1886
  }
1877
1887
  },
1878
1888
  view: () => ({ update(e, t) {
1879
- let n = G.getState(e.state);
1880
- n?.reveal && n !== G.getState(t) && cr(e);
1889
+ let n = q.getState(e.state);
1890
+ n?.reveal && n !== q.getState(t) && lr(e);
1881
1891
  } }),
1882
1892
  props: { decorations(e) {
1883
- let { matches: t, current: n } = G.getState(e) ?? q;
1893
+ let { matches: t, current: n } = q.getState(e) ?? J;
1884
1894
  if (!n) return t;
1885
- let r = u.inline(n.from, n.to, { class: Zn });
1895
+ let r = u.inline(n.from, n.to, { class: Xn });
1886
1896
  return t.add(e.doc, [r]);
1887
1897
  } }
1888
1898
  });
1889
1899
  }
1890
1900
  function Z(e) {
1891
- let t = G.getState(e)?.query;
1901
+ let t = q.getState(e)?.query;
1892
1902
  return t?.valid ? t : null;
1893
1903
  }
1894
- function pr(e, t, n) {
1904
+ function mr(e, t, n) {
1895
1905
  let r = l.create(e.doc, t.from, t.to);
1896
- return n?.(e.tr.setSelection(r).scrollIntoView().setMeta(K, !0)), !0;
1906
+ return n?.(e.tr.setSelection(r).scrollIntoView().setMeta(Zn, !0)), !0;
1897
1907
  }
1898
- function mr(e, t, n) {
1908
+ function hr(e, t, n) {
1899
1909
  return t.findNext(e, n) ?? t.findNext(e, 0, n);
1900
1910
  }
1901
- function hr(e, t, n) {
1911
+ function gr(e, t, n) {
1902
1912
  let r = e.mapping.map(t.from, 1), i = e.mapping.map(t.to, -1);
1903
1913
  if (!n) {
1904
1914
  e.delete(r, i);
@@ -1907,13 +1917,13 @@ function hr(e, t, n) {
1907
1917
  let a = e.doc.resolve(r).marksAcross(e.doc.resolve(i));
1908
1918
  e.replaceWith(r, i, e.doc.type.schema.text(n, a));
1909
1919
  }
1910
- function gr(e, t, n) {
1920
+ function _r(e, t, n) {
1911
1921
  let r = [], i = [], a = -1, o = 0, s = 0, c = 0;
1912
1922
  e.doc.forEach((e, l) => {
1913
1923
  let u = l + e.nodeSize, d = new re(e);
1914
1924
  for (; c < t.length && t[c].to <= u; c++) {
1915
1925
  let e = t[c];
1916
- hr(d, {
1926
+ gr(d, {
1917
1927
  from: e.from - l - 1,
1918
1928
  to: e.to - l - 1
1919
1929
  }, n), i.push(e.from, e.to - e.from, n.length);
@@ -1923,45 +1933,45 @@ function gr(e, t, n) {
1923
1933
  let l = e.tr.replaceWith(a, o, r.slice(0, s));
1924
1934
  return l.setSelection(e.selection.map(l.doc, new _(i)));
1925
1935
  }
1926
- var _r = (e, t) => {
1927
- let n = Z(e), r = n && mr(e, n, e.selection.to);
1928
- return r ? pr(e, r, t) : !1;
1929
- }, vr = (e, t) => {
1936
+ var vr = (e, t) => {
1937
+ let n = Z(e), r = n && hr(e, n, e.selection.to);
1938
+ return r ? mr(e, r, t) : !1;
1939
+ }, yr = (e, t) => {
1930
1940
  let n = Z(e), { from: r } = e.selection, i = n && (n.findPrev(e, r) ?? n.findPrev(e, e.doc.content.size, r));
1931
- return i ? pr(e, i, t) : !1;
1932
- }, yr = (e) => (t, n) => {
1941
+ return i ? mr(e, i, t) : !1;
1942
+ }, br = (e) => (t, n) => {
1933
1943
  let r = Z(t);
1934
1944
  if (!r) return !1;
1935
- let i = G.getState(t)?.current;
1936
- if (!i) return _r(t, n);
1945
+ let i = q.getState(t)?.current;
1946
+ if (!i) return vr(t, n);
1937
1947
  if (n) {
1938
- let a = mr(t, r, i.to), o = t.tr;
1939
- hr(o, i, e);
1948
+ let a = hr(t, r, i.to), o = t.tr;
1949
+ gr(o, i, e);
1940
1950
  let s = a && a.from !== i.from ? {
1941
1951
  from: o.mapping.map(a.from, 1),
1942
1952
  to: o.mapping.map(a.to, -1)
1943
1953
  } : null, c = o.mapping.map(i.to), u = s ? l.create(o.doc, s.from, s.to) : l.create(o.doc, c);
1944
- n(o.setSelection(u).scrollIntoView().setMeta(K, !0));
1954
+ n(o.setSelection(u).scrollIntoView().setMeta(Zn, !0));
1945
1955
  }
1946
1956
  return !0;
1947
- }, br = (e) => (t, n) => {
1957
+ }, xr = (e) => (t, n) => {
1948
1958
  let r = Z(t);
1949
1959
  if (!r) return !1;
1950
1960
  let i = [], a = {
1951
1961
  from: 0,
1952
1962
  to: t.doc.content.size
1953
1963
  };
1954
- return J(t.doc, r, a, (e) => (i.push(e), !0)), i.length !== 0 && (n?.(gr(t, i, e)), !0);
1964
+ return Y(t.doc, r, a, (e) => (i.push(e), !0)), i.length !== 0 && (n?.(_r(t, i, e)), !0);
1955
1965
  };
1956
- function xr(e) {
1957
- let { matches: t, total: n, index: r } = G.getState(e.state) ?? q;
1966
+ function Sr(e) {
1967
+ let { matches: t, total: n, index: r } = q.getState(e.state) ?? J;
1958
1968
  return {
1959
1969
  count: n,
1960
1970
  limited: n > t.find().length,
1961
1971
  current: r
1962
1972
  };
1963
1973
  }
1964
- var Sr = /* @__PURE__ */ P({
1974
+ var Cr = /* @__PURE__ */ P({
1965
1975
  name: "search",
1966
1976
  defaultOptions: { maxMatches: 1e3 },
1967
1977
  commands: () => ({
@@ -1972,23 +1982,23 @@ var Sr = /* @__PURE__ */ P({
1972
1982
  wholeWord: n,
1973
1983
  literal: !0
1974
1984
  });
1975
- return i?.(r.tr.setMeta(G, a)), !0;
1985
+ return i?.(r.tr.setMeta(q, a)), !0;
1976
1986
  },
1977
- clearSearch: () => (e, t) => (t?.(e.tr.setMeta(G, Qn)), !0),
1978
- findNext: () => _r,
1979
- findPrevious: () => vr,
1980
- replaceNext: yr,
1981
- replaceAll: br
1987
+ clearSearch: () => (e, t) => (t?.(e.tr.setMeta(q, Qn)), !0),
1988
+ findNext: () => vr,
1989
+ findPrevious: () => yr,
1990
+ replaceNext: br,
1991
+ replaceAll: xr
1982
1992
  }),
1983
- plugins: ({ options: e }) => [fr(e.maxMatches)]
1984
- }), Cr = /* @__PURE__ */ P({
1993
+ plugins: ({ options: e }) => [pr(e.maxMatches)]
1994
+ }), wr = /* @__PURE__ */ P({
1985
1995
  name: "strike",
1986
1996
  marks: () => ({ strike: {
1987
1997
  parseDOM: [
1988
1998
  { tag: "s" },
1989
1999
  { tag: "del" },
1990
2000
  { tag: "strike" },
1991
- ...U("line-through")
2001
+ ...G("line-through")
1992
2002
  ],
1993
2003
  group: "formatting",
1994
2004
  toDOM: () => ["s", 0]
@@ -1996,14 +2006,14 @@ var Sr = /* @__PURE__ */ P({
1996
2006
  commands: ({ schema: e }) => {
1997
2007
  let t = e.marks.strike;
1998
2008
  return {
1999
- setStrike: () => L(t),
2000
- unsetStrike: () => R(t),
2001
- toggleStrike: () => z(t)
2009
+ setStrike: () => R(t),
2010
+ unsetStrike: () => z(t),
2011
+ toggleStrike: () => V(t)
2002
2012
  };
2003
2013
  },
2004
2014
  keymap: ({ editor: e }) => ({ "Mod-Shift-s": () => e.commands.toggleStrike() }),
2005
2015
  inputRules: ({ schema: e }) => [F(/(?:^|[^~])~~([^~]+)~~$/, e.marks.strike)]
2006
- }), wr = /* @__PURE__ */ P({
2016
+ }), Tr = /* @__PURE__ */ P({
2007
2017
  name: "subscript",
2008
2018
  marks: () => ({ subscript: {
2009
2019
  parseDOM: [{ tag: "sub" }, {
@@ -2017,13 +2027,13 @@ var Sr = /* @__PURE__ */ P({
2017
2027
  commands: ({ schema: e }) => {
2018
2028
  let t = e.marks.subscript;
2019
2029
  return {
2020
- setSubscript: () => L(t),
2021
- unsetSubscript: () => R(t),
2022
- toggleSubscript: () => z(t)
2030
+ setSubscript: () => R(t),
2031
+ unsetSubscript: () => z(t),
2032
+ toggleSubscript: () => V(t)
2023
2033
  };
2024
2034
  },
2025
2035
  keymap: ({ editor: e }) => ({ "Mod-,": () => e.commands.toggleSubscript() })
2026
- }), Tr = /* @__PURE__ */ P({
2036
+ }), Er = /* @__PURE__ */ P({
2027
2037
  name: "superscript",
2028
2038
  marks: () => ({ superscript: {
2029
2039
  parseDOM: [{ tag: "sup" }, {
@@ -2037,26 +2047,26 @@ var Sr = /* @__PURE__ */ P({
2037
2047
  commands: ({ schema: e }) => {
2038
2048
  let t = e.marks.superscript;
2039
2049
  return {
2040
- setSuperscript: () => L(t),
2041
- unsetSuperscript: () => R(t),
2042
- toggleSuperscript: () => z(t)
2050
+ setSuperscript: () => R(t),
2051
+ unsetSuperscript: () => z(t),
2052
+ toggleSuperscript: () => V(t)
2043
2053
  };
2044
2054
  },
2045
2055
  keymap: ({ editor: e }) => ({ "Mod-.": () => e.commands.toggleSuperscript() })
2046
- }), Er = 1e3, Dr = 65534, Or = /^\d+(,\d+)*$/;
2047
- function kr(e, t) {
2056
+ }), Dr = 1e3, Or = 65534, kr = /^\d+(,\d+)*$/;
2057
+ function Ar(e, t) {
2048
2058
  let n = Number.parseInt(e ?? "", 10);
2049
2059
  return Number.isNaN(n) || n < 1 ? 1 : Math.min(n, t);
2050
2060
  }
2051
- function Ar(e) {
2052
- let t = kr(e.getAttribute("colspan"), Er), n = e.getAttribute("data-colwidth") ?? "", r = Or.test(n) ? n.split(",").map(Number) : null, i = r !== null && r.length === t && r.every((e) => e > 0);
2061
+ function jr(e) {
2062
+ let t = Ar(e.getAttribute("colspan"), Dr), n = e.getAttribute("data-colwidth") ?? "", r = kr.test(n) ? n.split(",").map(Number) : null, i = r !== null && r.length === t && r.every((e) => e > 0);
2053
2063
  return {
2054
2064
  colspan: t,
2055
- rowspan: kr(e.getAttribute("rowspan"), Dr),
2065
+ rowspan: Ar(e.getAttribute("rowspan"), Or),
2056
2066
  colwidth: i ? r : null
2057
2067
  };
2058
2068
  }
2059
- function jr(e, t) {
2069
+ function Mr(e, t) {
2060
2070
  let { colspan: n, rowspan: r, colwidth: i } = t.attrs, a = {};
2061
2071
  return n !== 1 && (a.colspan = String(n)), r !== 1 && (a.rowspan = String(r)), i && (a["data-colwidth"] = i.map(Math.round).join(",")), [
2062
2072
  e,
@@ -2064,15 +2074,15 @@ function jr(e, t) {
2064
2074
  0
2065
2075
  ];
2066
2076
  }
2067
- function Mr(e) {
2077
+ function Nr(e) {
2068
2078
  let t = [];
2069
2079
  return e.firstChild?.forEach((e) => {
2070
2080
  let n = e.attrs.colwidth;
2071
2081
  for (let r = 0; r < e.attrs.colspan; r++) t.push(n?.[r] ?? null);
2072
2082
  }), t.some((e) => e !== null) ? t : null;
2073
2083
  }
2074
- function Nr(e) {
2075
- let t = Mr(e);
2084
+ function Pr(e) {
2085
+ let t = Nr(e);
2076
2086
  return t ? [
2077
2087
  "table",
2078
2088
  ["colgroup", ...t.map((e) => {
@@ -2082,7 +2092,7 @@ function Nr(e) {
2082
2092
  ["tbody", 0]
2083
2093
  ] : ["table", ["tbody", 0]];
2084
2094
  }
2085
- function Pr(e, t) {
2095
+ function Fr(e, t) {
2086
2096
  return {
2087
2097
  content: "block+",
2088
2098
  attrs: {
@@ -2094,33 +2104,33 @@ function Pr(e, t) {
2094
2104
  isolating: !0,
2095
2105
  parseDOM: [{
2096
2106
  tag: e,
2097
- getAttrs: Ar
2107
+ getAttrs: jr
2098
2108
  }],
2099
- toDOM: (t) => jr(e, t)
2109
+ toDOM: (t) => Mr(e, t)
2100
2110
  };
2101
2111
  }
2102
- function Fr(e) {
2112
+ function Ir(e) {
2103
2113
  return Number.isInteger(e) && e >= 1;
2104
2114
  }
2105
- function Ir(e, t) {
2115
+ function Lr(e, t) {
2106
2116
  let n = e.doc.nodeAt(t), r = t + n.nodeSize - 1 - n.lastChild.nodeSize;
2107
2117
  return e.setSelection(c.near(e.doc.resolve(r + 1)));
2108
2118
  }
2109
- function Lr(e) {
2119
+ function Rr(e) {
2110
2120
  let { $from: t } = e;
2111
2121
  for (let e = t.depth; e > 0; e--) if (t.node(e).type.spec.tableRole === "table") return t.before(e);
2112
2122
  return -1;
2113
2123
  }
2114
- function Rr(e, t) {
2124
+ function zr(e, t) {
2115
2125
  let n = e.toJSON();
2116
2126
  for (let e of ["anchor", "head"]) typeof n[e] == "number" && (n[e] = n[e] + t);
2117
2127
  return n;
2118
2128
  }
2119
2129
  function Q(e) {
2120
2130
  return (t, n) => {
2121
- let r = Lr(t.selection);
2131
+ let r = Rr(t.selection);
2122
2132
  if (r < 0) return !1;
2123
- let a = t.doc.nodeAt(r), o = t.schema.topNodeType.create(null, a), s = c.fromJSON(o, Rr(t.selection, -r)), l, u = e(i.create({
2133
+ let a = t.doc.nodeAt(r), o = t.schema.topNodeType.create(null, a), s = c.fromJSON(o, zr(t.selection, -r)), l, u = e(i.create({
2124
2134
  doc: o,
2125
2135
  selection: s
2126
2136
  }), n && ((e) => {
@@ -2128,19 +2138,19 @@ function Q(e) {
2128
2138
  }));
2129
2139
  if (u && n && l) {
2130
2140
  let e = t.tr.replaceWith(r, r + a.nodeSize, l.doc.content);
2131
- e.setSelection(c.fromJSON(e.doc, Rr(l.selection, r))), n(e.scrollIntoView());
2141
+ e.setSelection(c.fromJSON(e.doc, zr(l.selection, r))), n(e.scrollIntoView());
2132
2142
  }
2133
2143
  return u;
2134
2144
  };
2135
2145
  }
2136
- function zr(e, t) {
2146
+ function Br(e, t) {
2137
2147
  return (n, r) => {
2138
2148
  if (!C(n)) return !1;
2139
2149
  let { top: i, bottom: a, left: o, right: s, map: c } = Ne(n);
2140
2150
  return !(e === "row" ? a - i === c.height : s - o === c.width) && t(n, r);
2141
2151
  };
2142
2152
  }
2143
- function Br(e, t) {
2153
+ function Vr(e, t) {
2144
2154
  return (n, r) => {
2145
2155
  let i = t ?? n.selection.head;
2146
2156
  if (i < 0 || i > n.doc.content.size) return !1;
@@ -2159,27 +2169,27 @@ function Br(e, t) {
2159
2169
  return !0;
2160
2170
  };
2161
2171
  }
2162
- function Vr(e) {
2172
+ function Hr(e) {
2163
2173
  let t = !1;
2164
2174
  return e.doc.descendants((e) => (e.type.spec.tableRole === "table" && (t = !0), !t && !e.isTextblock)), t;
2165
2175
  }
2166
- function Hr(e, t) {
2176
+ function Ur(e, t) {
2167
2177
  let n = e.content.findDiffStart(t.content);
2168
2178
  if (n === null) return !1;
2169
2179
  let r = Math.max(e.content.findDiffEnd(t.content).b, n), i = !1;
2170
2180
  return t.nodesBetween(n, r, (e) => (e.type.spec.tableRole === "table" && be.get(e).problems && (i = !0), !i && !e.isTextblock)), i;
2171
2181
  }
2172
- function Ur() {
2182
+ function Wr() {
2173
2183
  let e = Fe(), t = e.spec.appendTransaction;
2174
2184
  return new o({
2175
2185
  ...e.spec,
2176
- appendTransaction: (n, r, i) => t.call(e, n, Hr(r.doc, i.doc) ? r : i, i)
2186
+ appendTransaction: (n, r, i) => t.call(e, n, Ur(r.doc, i.doc) ? r : i, i)
2177
2187
  });
2178
2188
  }
2179
- function Wr() {
2180
- return new o({ appendTransaction: (e, t, n) => !e.some((e) => e.getMeta("stiloLoad")) || !Vr(n) ? null : Ae(n)?.setMeta("addToHistory", !1) ?? null });
2189
+ function Gr() {
2190
+ return new o({ appendTransaction: (e, t, n) => !e.some((e) => e.getMeta("stiloLoad")) || !Hr(n) ? null : Ae(n)?.setMeta("addToHistory", !1) ?? null });
2181
2191
  }
2182
- function Gr(e) {
2192
+ function Kr(e) {
2183
2193
  let { state: t } = e;
2184
2194
  if (!C(t)) return null;
2185
2195
  let { map: n, table: r } = Ne(t), i = (e, t) => n.cellsInRect({
@@ -2193,7 +2203,7 @@ function Gr(e) {
2193
2203
  column: i(1, n.height)
2194
2204
  };
2195
2205
  }
2196
- var Kr = /* @__PURE__ */ P({
2206
+ var qr = /* @__PURE__ */ P({
2197
2207
  name: "table",
2198
2208
  nodes: () => ({
2199
2209
  table: {
@@ -2202,7 +2212,7 @@ var Kr = /* @__PURE__ */ P({
2202
2212
  tableRole: "table",
2203
2213
  isolating: !0,
2204
2214
  parseDOM: [{ tag: "table" }],
2205
- toDOM: Nr
2215
+ toDOM: Pr
2206
2216
  },
2207
2217
  tableRow: {
2208
2218
  content: "(tableCell | tableHeader)*",
@@ -2210,15 +2220,15 @@ var Kr = /* @__PURE__ */ P({
2210
2220
  parseDOM: [{ tag: "tr" }],
2211
2221
  toDOM: () => ["tr", 0]
2212
2222
  },
2213
- tableCell: Pr("td", "cell"),
2214
- tableHeader: Pr("th", "header_cell")
2223
+ tableCell: Fr("td", "cell"),
2224
+ tableHeader: Fr("th", "header_cell")
2215
2225
  }),
2216
2226
  commands: ({ schema: e }) => {
2217
2227
  let t = e.nodes, n = (e, n, r) => {
2218
2228
  let i = (e) => t.tableRow.create(null, Array.from({ length: n }, () => e.createAndFill()));
2219
2229
  return t.table.create(null, Array.from({ length: e }, (e, n) => i(n === 0 && r ? t.tableHeader : t.tableCell)));
2220
2230
  }, r = ({ rows: e = 3, cols: r = 3, withHeaderRow: i = !0 } = {}) => (a, o) => {
2221
- if (!Fr(e) || !Fr(r) || C(a)) return !1;
2231
+ if (!Ir(e) || !Ir(r) || C(a)) return !1;
2222
2232
  let { $from: s } = a.selection, l = s.parent.isTextblock ? s.depth - 1 : s.depth;
2223
2233
  if (!s.node(l).canReplaceWith(s.index(l), s.indexAfter(l), t.table)) return !1;
2224
2234
  if (o) {
@@ -2230,23 +2240,23 @@ var Kr = /* @__PURE__ */ P({
2230
2240
  l.doc.resolve(d).nodeAfter || l.insert(d, t.paragraph.create()), l.setSelection(c.near(l.doc.resolve(u + 1))), o(l.scrollIntoView());
2231
2241
  }
2232
2242
  return !0;
2233
- }, i = (e, t) => je(1)(e, t) ? !0 : C(e) ? Ce(e, t && ((e) => t(Ir(e, Lr(e.selection)).scrollIntoView()))) : !1;
2243
+ }, i = (e, t) => je(1)(e, t) ? !0 : C(e) ? Ce(e, t && ((e) => t(Lr(e, Rr(e.selection)).scrollIntoView()))) : !1;
2234
2244
  return {
2235
2245
  insertTable: r,
2236
2246
  deleteTable: () => ke,
2237
2247
  addRowBefore: () => Q(we),
2238
2248
  addRowAfter: () => Q(Ce),
2239
- deleteRow: () => Q(zr("row", Oe)),
2249
+ deleteRow: () => Q(Br("row", Oe)),
2240
2250
  addColumnBefore: () => Q(Se),
2241
2251
  addColumnAfter: () => Q(xe),
2242
- deleteColumn: () => Q(zr("column", De)),
2252
+ deleteColumn: () => Q(Br("column", De)),
2243
2253
  mergeCells: () => Q(Me),
2244
2254
  splitCell: () => Q(Pe),
2245
2255
  toggleHeaderRow: () => Q(Ie("row")),
2246
2256
  toggleHeaderColumn: () => Q(Ie("column")),
2247
- selectRow: (e) => Br("row", e),
2248
- selectColumn: (e) => Br("column", e),
2249
- selectTable: (e) => Br("table", e),
2257
+ selectRow: (e) => Vr("row", e),
2258
+ selectColumn: (e) => Vr("column", e),
2259
+ selectTable: (e) => Vr("table", e),
2250
2260
  goToNextCell: () => i,
2251
2261
  goToPreviousCell: () => je(-1)
2252
2262
  };
@@ -2257,10 +2267,10 @@ var Kr = /* @__PURE__ */ P({
2257
2267
  }),
2258
2268
  plugins: () => [
2259
2269
  Ee(),
2260
- Ur(),
2261
- Wr()
2270
+ Wr(),
2271
+ Gr()
2262
2272
  ]
2263
- }), qr = class {
2273
+ }), Jr = class {
2264
2274
  view;
2265
2275
  getPos;
2266
2276
  dom;
@@ -2292,13 +2302,13 @@ var Kr = /* @__PURE__ */ P({
2292
2302
  };
2293
2303
  //#endregion
2294
2304
  //#region src/extensions/task-item/index.ts
2295
- function Jr(e) {
2305
+ function Yr(e) {
2296
2306
  return (t, n) => {
2297
2307
  let { $from: r } = t.selection, i = r.depth >= 2 ? r.node(-1) : null;
2298
- return i?.type === e && i.attrs.checked === !0 && r.parentOffset === 0 && r.index(-1) === 0 && r.parent.content.size > 0 ? he(e, { checked: !0 })(t, n && ((e) => n(e.setNodeAttribute(r.before(-1), "checked", !1)))) : he(e, { checked: !1 })(t, n);
2308
+ return i?.type === e && i.attrs.checked === !0 && r.parentOffset === 0 && r.index(-1) === 0 && r.parent.content.size > 0 ? x(e, { checked: !0 })(t, n && ((e) => n(e.setNodeAttribute(r.before(-1), "checked", !1)))) : x(e, { checked: !1 })(t, n);
2299
2309
  };
2300
2310
  }
2301
- function Yr(e, t) {
2311
+ function Xr(e, t) {
2302
2312
  let n = /* @__PURE__ */ new Map(), r = [], { from: i, to: a } = e.selection;
2303
2313
  return e.doc.nodesBetween(i, a, (e, i) => {
2304
2314
  let a = r.at(-1);
@@ -2309,10 +2319,10 @@ function Yr(e, t) {
2309
2319
  }), !e.isTextblock || (a && n.set(a.pos, a.node), !1);
2310
2320
  }), n;
2311
2321
  }
2312
- function Xr(e) {
2322
+ function Zr(e) {
2313
2323
  return (t, n) => {
2314
2324
  if (t.selection.$from.parent.type.spec.code) return !1;
2315
- let r = Yr(t, e);
2325
+ let r = Xr(t, e);
2316
2326
  if (r.size === 0) return !1;
2317
2327
  if (n) {
2318
2328
  let e = [...r.values()].some((e) => e.attrs.checked !== !0), i = t.doc.content.size, a = 0;
@@ -2339,7 +2349,7 @@ function Xr(e) {
2339
2349
  return !0;
2340
2350
  };
2341
2351
  }
2342
- var Zr = /* @__PURE__ */ P({
2352
+ var Qr = /* @__PURE__ */ P({
2343
2353
  name: "taskItem",
2344
2354
  nodes: () => ({ taskItem: {
2345
2355
  content: "paragraph block*",
@@ -2360,30 +2370,30 @@ var Zr = /* @__PURE__ */ P({
2360
2370
  commands: ({ schema: e }) => {
2361
2371
  let t = e.nodes.taskItem;
2362
2372
  return {
2363
- splitTaskItem: () => Jr(t),
2364
- sinkTaskItem: () => me(t),
2365
- liftTaskItem: () => x(t),
2366
- toggleTaskChecked: () => Xr(t)
2373
+ splitTaskItem: () => Yr(t),
2374
+ sinkTaskItem: () => he(t),
2375
+ liftTaskItem: () => b(t),
2376
+ toggleTaskChecked: () => Zr(t)
2367
2377
  };
2368
2378
  },
2369
2379
  keymap: ({ editor: e, schema: t }) => ({
2370
2380
  Enter: () => e.commands.splitTaskItem(),
2371
2381
  Tab: () => e.commands.sinkTaskItem(),
2372
2382
  "Shift-Tab": () => e.commands.liftTaskItem(),
2373
- Backspace: Xt(t.nodes.taskItem),
2383
+ Backspace: Zt(t.nodes.taskItem),
2374
2384
  "Mod-Enter": () => e.commands.toggleTaskChecked()
2375
2385
  }),
2376
- plugins: () => [new o({ props: { nodeViews: { taskItem: (e, t, n) => new qr(e, t, n) } } })]
2386
+ plugins: () => [new o({ props: { nodeViews: { taskItem: (e, t, n) => new Jr(e, t, n) } } })]
2377
2387
  });
2378
2388
  //#endregion
2379
2389
  //#region src/extensions/task-list/index.ts
2380
- function Qr(e) {
2390
+ function $r(e) {
2381
2391
  return new v(/^\s*\[([ xX])\]\s$/, (t, n, r, i) => {
2382
2392
  let a = t.tr.delete(r, i), o = a.doc.resolve(r).blockRange(), s = o && ae(o, e);
2383
2393
  return !o || !s ? null : (a.wrap(o, s), n[1] !== " " && a.setNodeAttribute(o.start + 1, "checked", !0), a.doc.resolve(o.start).nodeBefore?.type === e && ie(a.doc, o.start) && a.join(o.start), a);
2384
2394
  });
2385
2395
  }
2386
- var $r = /* @__PURE__ */ P({
2396
+ var ei = /* @__PURE__ */ P({
2387
2397
  name: "taskList",
2388
2398
  nodes: () => ({ taskList: {
2389
2399
  group: "block list",
@@ -2400,17 +2410,17 @@ var $r = /* @__PURE__ */ P({
2400
2410
  } }),
2401
2411
  commands: ({ schema: e }) => ({ toggleTaskList: () => I(e.nodes.taskList, e.nodes.taskItem) }),
2402
2412
  keymap: ({ editor: e }) => ({ "Mod-Shift-9": () => e.commands.toggleTaskList() }),
2403
- inputRules: ({ schema: e }) => [Qr(e.nodes.taskList)]
2404
- }), ei = /* @__PURE__ */ P({
2413
+ inputRules: ({ schema: e }) => [$r(e.nodes.taskList)]
2414
+ }), ti = /* @__PURE__ */ P({
2405
2415
  name: "text",
2406
2416
  nodes: () => ({ text: { group: "inline" } }),
2407
2417
  commands: () => ({ insertText: (e) => (t, n) => e ? (n?.(t.tr.insertText(e).scrollIntoView()), !0) : !1 })
2408
- }), ti = /* @__PURE__ */ P({
2418
+ }), ni = /* @__PURE__ */ P({
2409
2419
  name: "textAlign",
2410
2420
  priority: 101,
2411
2421
  commands: () => ({ setTextAlign: (e) => {
2412
2422
  let t = A("text-align", e);
2413
- return t ? H("textAlign", t === "left" ? null : t) : () => !1;
2423
+ return t ? W("textAlign", t === "left" ? null : t) : () => !1;
2414
2424
  } }),
2415
2425
  keymap: ({ editor: e }) => ({
2416
2426
  "Mod-Shift-l": () => e.commands.setTextAlign("left"),
@@ -2418,16 +2428,16 @@ var $r = /* @__PURE__ */ P({
2418
2428
  "Mod-Shift-r": () => e.commands.setTextAlign("right"),
2419
2429
  "Mod-Shift-j": () => e.commands.setTextAlign("justify")
2420
2430
  })
2421
- }), ni = /[\p{L}\p{N}\p{M}]/u, ri = /['’]/, ii = /[.!?…]/;
2422
- function ai(e, t) {
2431
+ }), ri = /[\p{L}\p{N}\p{M}]/u, ii = /['’]/, ai = /[.!?…]/;
2432
+ function oi(e, t) {
2423
2433
  let n = /* @__PURE__ */ new Set(), r = !0;
2424
2434
  for (let i = 0; i < e.length;) {
2425
2435
  let a = String.fromCodePoint(e.codePointAt(i));
2426
- ni.test(a) ? (r && n.add(i), r = !1) : (t === "title" ? !ri.test(a) : ii.test(a)) && (r = !0), i += a.length;
2436
+ ri.test(a) ? (r && n.add(i), r = !1) : (t === "title" ? !ii.test(a) : ai.test(a)) && (r = !0), i += a.length;
2427
2437
  }
2428
2438
  return n;
2429
2439
  }
2430
- function oi(e, t, n, r, i) {
2440
+ function si(e, t, n, r, i) {
2431
2441
  if (r === "upper") return e.slice(t, n).toUpperCase();
2432
2442
  if (r === "lower") return e.slice(t, n).toLowerCase();
2433
2443
  let a = "";
@@ -2437,14 +2447,14 @@ function oi(e, t, n, r, i) {
2437
2447
  }
2438
2448
  return a;
2439
2449
  }
2440
- function si(e, t, n, r, i) {
2450
+ function ci(e, t, n, r, i) {
2441
2451
  let a = t + e.nodeSize;
2442
2452
  if (!n.some((e) => e.$from.pos < a && e.$to.pos > t)) return e;
2443
2453
  let o = [];
2444
2454
  if (!e.isTextblock) return e.forEach((e, a) => {
2445
- o.push(si(e, t + 1 + a, n, r, i));
2455
+ o.push(ci(e, t + 1 + a, n, r, i));
2446
2456
  }), e.copy(h.fromArray(o));
2447
- let s = e.textBetween(0, e.content.size, void 0, ""), c = r === "title" || r === "sentence" ? ai(s, r) : null, l = t + 1;
2457
+ let s = e.textBetween(0, e.content.size, void 0, ""), c = r === "title" || r === "sentence" ? oi(s, r) : null, l = t + 1;
2448
2458
  return e.forEach((t, a) => {
2449
2459
  if (!t.isText) {
2450
2460
  o.push(t);
@@ -2455,13 +2465,13 @@ function si(e, t, n, r, i) {
2455
2465
  let n = Math.max(f.$from.pos - l, u), p = Math.min(f.$to.pos - l, d);
2456
2466
  if (n >= p) continue;
2457
2467
  n > u && o.push(t.cut(u - a, n - a));
2458
- let m = oi(s, n, p, r, c ?? /* @__PURE__ */ new Set());
2468
+ let m = si(s, n, p, r, c ?? /* @__PURE__ */ new Set());
2459
2469
  m.length !== p - n && i.push(l + n, p - n, m.length), o.push(e.type.schema.text(m, t.marks)), u = p;
2460
2470
  }
2461
2471
  u < d && o.push(t.cut(u - a));
2462
2472
  }), e.copy(h.fromArray(o));
2463
2473
  }
2464
- function ci(e) {
2474
+ function li(e) {
2465
2475
  return (t, n) => {
2466
2476
  let { selection: r, doc: i } = t;
2467
2477
  if (r.empty) return !1;
@@ -2469,18 +2479,18 @@ function ci(e) {
2469
2479
  let a = i.resolve(Math.min(...r.ranges.map((e) => e.$from.pos))), o = i.resolve(Math.max(...r.ranges.map((e) => e.$to.pos))), s = a.index(0), c = o.depth === 0 ? o.index(0) - 1 : o.index(0), l = a.depth === 0 ? a.pos : a.before(1), u = [], d = [], f = l;
2470
2480
  for (let t = s; t <= c; t++) {
2471
2481
  let n = i.child(t);
2472
- d.push(si(n, f, r.ranges, e, u)), f += n.nodeSize;
2482
+ d.push(ci(n, f, r.ranges, e, u)), f += n.nodeSize;
2473
2483
  }
2474
2484
  if (d.every((e, t) => e.eq(i.child(s + t)))) return !0;
2475
2485
  let p = t.tr.replaceWith(l, f, d);
2476
2486
  return n(p.setSelection(r.map(p.doc, new ne([new _(u)]))).scrollIntoView()), !0;
2477
2487
  };
2478
2488
  }
2479
- var li = /* @__PURE__ */ P({
2489
+ var ui = /* @__PURE__ */ P({
2480
2490
  name: "textCase",
2481
- commands: () => ({ setTextCase: ci })
2482
- }), ui = 1, di = 400, fi = 16;
2483
- function pi(e, t = fi) {
2491
+ commands: () => ({ setTextCase: li })
2492
+ }), di = 1, fi = 400, pi = 16;
2493
+ function mi(e, t = pi) {
2484
2494
  let n = /^(\d+(?:\.\d+)?)(px|pt|rem)$/.exec(e);
2485
2495
  if (!n) return null;
2486
2496
  let r = {
@@ -2490,35 +2500,35 @@ function pi(e, t = fi) {
2490
2500
  }[n[2]];
2491
2501
  return Number(n[1]) * r;
2492
2502
  }
2493
- function mi(e, t) {
2503
+ function hi(e, t) {
2494
2504
  let n = 10 ** t;
2495
2505
  return Math.round(e * n) / n;
2496
2506
  }
2497
- function hi(e, t) {
2498
- return mi(t === "pt" ? e * .75 : e, 1);
2507
+ function gi(e, t) {
2508
+ return hi(t === "pt" ? e * .75 : e, 1);
2499
2509
  }
2500
- function gi(e) {
2510
+ function _i(e) {
2501
2511
  let t = e.view.dom.ownerDocument.documentElement;
2502
- return pi(getComputedStyle(t).fontSize) ?? fi;
2512
+ return mi(getComputedStyle(t).fontSize) ?? pi;
2503
2513
  }
2504
- function _i(e, t) {
2514
+ function vi(e, t) {
2505
2515
  let { node: n, offset: r } = e.view.domAtPos(t, 1), i = n.nodeType === Node.TEXT_NODE ? n : n.childNodes[r] ?? n, a = i instanceof Element ? i : i.parentElement;
2506
- return a && pi(getComputedStyle(a).fontSize) || fi;
2516
+ return a && mi(getComputedStyle(a).fontSize) || pi;
2507
2517
  }
2508
- function vi(e, t = "pt", n) {
2518
+ function yi(e, t = "pt", n) {
2509
2519
  let { selection: r, storedMarks: i } = e.state, a = n === void 0 && r.empty ? i?.find((e) => e.type.name === "textStyle")?.attrs.fontSize : null;
2510
- return hi(typeof a == "string" && pi(a, gi(e)) || _i(e, n ?? r.from), t);
2520
+ return gi(typeof a == "string" && mi(a, _i(e)) || vi(e, n ?? r.from), t);
2511
2521
  }
2512
- function yi(e, t, n = "pt") {
2513
- return n === "rem" ? `${mi(t / gi(e), 4)}rem` : `${mi(t, 2)}${n}`;
2522
+ function bi(e, t, n = "pt") {
2523
+ return n === "rem" ? `${hi(t / _i(e), 4)}rem` : `${hi(t, 2)}${n}`;
2514
2524
  }
2515
- function bi(e, t) {
2525
+ function xi(e, t) {
2516
2526
  let n = t > 0 ? Math.floor(e) + t : Math.ceil(e) + t;
2517
- return Math.min(di, Math.max(ui, n));
2527
+ return Math.min(fi, Math.max(di, n));
2518
2528
  }
2519
2529
  //#endregion
2520
2530
  //#region src/extensions/text-style/index.ts
2521
- var xi = {
2531
+ var Si = {
2522
2532
  fontFamily: {
2523
2533
  property: "font-family",
2524
2534
  font: "face"
@@ -2531,7 +2541,7 @@ var xi = {
2531
2541
  property: "color",
2532
2542
  font: "color"
2533
2543
  }
2534
- }, Si = [
2544
+ }, Ci = [
2535
2545
  "10px",
2536
2546
  "13px",
2537
2547
  "16px",
@@ -2540,22 +2550,22 @@ var xi = {
2540
2550
  "32px",
2541
2551
  "48px"
2542
2552
  ];
2543
- function Ci(e, t) {
2544
- let { property: n, font: r } = xi[t], i = M(e, n);
2553
+ function wi(e, t) {
2554
+ let { property: n, font: r } = Si[t], i = M(e, n);
2545
2555
  if (i || e.tagName !== "FONT") return i;
2546
2556
  let a = e.getAttribute(r)?.trim();
2547
- return a ? t === "fontSize" ? /^[1-7]$/.test(a) ? Si[Number(a) - 1] : null : A(n, a) : null;
2557
+ return a ? t === "fontSize" ? /^[1-7]$/.test(a) ? Ci[Number(a) - 1] : null : A(n, a) : null;
2548
2558
  }
2549
- function wi(e) {
2559
+ function Ti(e) {
2550
2560
  let t = {
2551
2561
  fontFamily: null,
2552
2562
  fontSize: null,
2553
2563
  color: null
2554
2564
  };
2555
- for (let n = e; n; n = n.parentElement) if (n.tagName === "SPAN" || n.tagName === "FONT") for (let e of Object.keys(xi)) t[e] ??= Ci(n, e);
2565
+ for (let n = e; n; n = n.parentElement) if (n.tagName === "SPAN" || n.tagName === "FONT") for (let e of Object.keys(Si)) t[e] ??= wi(n, e);
2556
2566
  return Object.values(t).some((e) => e !== null) && t;
2557
2567
  }
2558
- var Ti = /* @__PURE__ */ P({
2568
+ var Ei = /* @__PURE__ */ P({
2559
2569
  name: "textStyle",
2560
2570
  priority: 101,
2561
2571
  marks: () => ({ textStyle: {
@@ -2566,10 +2576,10 @@ var Ti = /* @__PURE__ */ P({
2566
2576
  },
2567
2577
  parseDOM: [{
2568
2578
  tag: "span[style]",
2569
- getAttrs: wi
2579
+ getAttrs: Ti
2570
2580
  }, {
2571
2581
  tag: "font",
2572
- getAttrs: wi
2582
+ getAttrs: Ti
2573
2583
  }],
2574
2584
  group: "formatting",
2575
2585
  toDOM: (e) => [
@@ -2584,9 +2594,9 @@ var Ti = /* @__PURE__ */ P({
2584
2594
  } }),
2585
2595
  commands: ({ schema: e, editor: t }) => {
2586
2596
  let n = e.marks.textStyle, r = (e) => (t) => {
2587
- let r = A(xi[e].property, t);
2588
- return r ? Qt(n, { [e]: r }) : () => !1;
2589
- }, i = (e) => () => Qt(n, { [e]: null });
2597
+ let r = A(Si[e].property, t);
2598
+ return r ? B(n, { [e]: r }) : () => !1;
2599
+ }, i = (e) => () => B(n, { [e]: null });
2590
2600
  return {
2591
2601
  setColor: r("color"),
2592
2602
  unsetColor: i("color"),
@@ -2594,22 +2604,22 @@ var Ti = /* @__PURE__ */ P({
2594
2604
  unsetFontFamily: i("fontFamily"),
2595
2605
  setFontSize: r("fontSize"),
2596
2606
  unsetFontSize: i("fontSize"),
2597
- stepFontSize: (e, r = "pt") => (i, a) => Qt(n, (n) => ({ fontSize: yi(t, bi(vi(t, r, i.selection.empty ? void 0 : n), e), r) }))(i, a)
2607
+ stepFontSize: (e, r = "pt") => (i, a) => B(n, (n) => ({ fontSize: bi(t, xi(yi(t, r, i.selection.empty ? void 0 : n), e), r) }))(i, a)
2598
2608
  };
2599
2609
  }
2600
- }), Ei = /* @__PURE__ */ P({
2610
+ }), Di = /* @__PURE__ */ P({
2601
2611
  name: "underline",
2602
2612
  marks: () => ({ underline: {
2603
- parseDOM: [{ tag: "u" }, ...U("underline")],
2613
+ parseDOM: [{ tag: "u" }, ...G("underline")],
2604
2614
  group: "formatting",
2605
2615
  toDOM: () => ["u", 0]
2606
2616
  } }),
2607
2617
  commands: ({ schema: e }) => {
2608
2618
  let t = e.marks.underline;
2609
2619
  return {
2610
- setUnderline: () => L(t),
2611
- unsetUnderline: () => R(t),
2612
- toggleUnderline: () => z(t)
2620
+ setUnderline: () => R(t),
2621
+ unsetUnderline: () => z(t),
2622
+ toggleUnderline: () => V(t)
2613
2623
  };
2614
2624
  },
2615
2625
  keymap: ({ editor: e }) => ({ "Mod-u": () => e.commands.toggleUnderline() })
@@ -2619,44 +2629,44 @@ var Ti = /* @__PURE__ */ P({
2619
2629
  function $(e, t) {
2620
2630
  return t === !1 ? [] : [e(t)];
2621
2631
  }
2622
- function Di(e = {}) {
2632
+ function Oi(e = {}) {
2623
2633
  return [
2624
- ...$(vn, e.doc),
2625
- ...$(ei, e.text),
2626
- ...$(Jn, e.paragraph),
2627
- ...$(Sn, e.heading),
2628
- ...$(on, e.blockquote),
2629
- ...$(_n, e.codeBlock),
2630
- ...$(En, e.horizontalRule),
2631
- ...$(xn, e.hardBreak),
2632
- ...$(Pn, e.image),
2633
- ...$(Kr, e.table),
2634
- ...$(ln, e.bulletList),
2635
- ...$(Kn, e.orderedList),
2636
- ...$(Vn, e.listItem),
2637
- ...$($r, e.taskList),
2638
- ...$(Zr, e.taskItem),
2639
- ...$(cn, e.bold),
2640
- ...$(Fn, e.italic),
2641
- ...$(Ei, e.underline),
2642
- ...$(Cr, e.strike),
2643
- ...$(wr, e.subscript),
2644
- ...$(Tr, e.superscript),
2645
- ...$(fn, e.code),
2646
- ...$(Bn, e.link),
2647
- ...$(Ti, e.textStyle),
2648
- ...$(wn, e.highlight),
2649
- ...$(ti, e.textAlign),
2650
- ...$(In, e.lineHeight),
2651
- ...$(dn, e.clearFormatting),
2652
- ...$(li, e.textCase),
2653
- ...$(Tn, e.history),
2654
- ...$(Gn, e.moveBlock),
2655
- ...$(Yn, e.placeholder),
2656
- ...$(Sr, e.search),
2657
- ...$(yn, e.dropCursor),
2658
- ...$(bn, e.gapCursor)
2634
+ ...$(_n, e.doc),
2635
+ ...$(ti, e.text),
2636
+ ...$(qn, e.paragraph),
2637
+ ...$(xn, e.heading),
2638
+ ...$(an, e.blockquote),
2639
+ ...$(gn, e.codeBlock),
2640
+ ...$(Tn, e.horizontalRule),
2641
+ ...$(bn, e.hardBreak),
2642
+ ...$(Nn, e.image),
2643
+ ...$(qr, e.table),
2644
+ ...$(cn, e.bulletList),
2645
+ ...$(Gn, e.orderedList),
2646
+ ...$(Bn, e.listItem),
2647
+ ...$(ei, e.taskList),
2648
+ ...$(Qr, e.taskItem),
2649
+ ...$(sn, e.bold),
2650
+ ...$(Pn, e.italic),
2651
+ ...$(Di, e.underline),
2652
+ ...$(wr, e.strike),
2653
+ ...$(Tr, e.subscript),
2654
+ ...$(Er, e.superscript),
2655
+ ...$(dn, e.code),
2656
+ ...$(zn, e.link),
2657
+ ...$(Ei, e.textStyle),
2658
+ ...$(Cn, e.highlight),
2659
+ ...$(ni, e.textAlign),
2660
+ ...$(Fn, e.lineHeight),
2661
+ ...$(un, e.clearFormatting),
2662
+ ...$(ui, e.textCase),
2663
+ ...$(wn, e.history),
2664
+ ...$(Wn, e.moveBlock),
2665
+ ...$(Jn, e.placeholder),
2666
+ ...$(Cr, e.search),
2667
+ ...$(vn, e.dropCursor),
2668
+ ...$(yn, e.gapCursor)
2659
2669
  ];
2660
2670
  }
2661
2671
  //#endregion
2662
- export { E as $, Sn as A, on as B, Bn as C, En as D, Pn as E, _n as F, L as G, U as H, fn as I, I as J, z as K, dn as L, bn as M, yn as N, Tn as O, vn as P, Ht as Q, ln as R, Vn as S, Fn as T, en as U, an as V, B as W, Ut as X, F as Y, P as Z, xr as _, yi as a, Kn as b, ei as c, Kr as d, D as et, Gr as f, Sr as g, Cr as h, vi as i, xn as j, wn as k, $r as l, wr as m, Ei as n, w as nt, li as o, Tr as p, R as q, Ti as r, ti as s, Di as t, O as tt, Zr as u, Yn as v, In as w, Gn as x, Jn as y, cn as z };
2672
+ export { E as $, xn as A, an as B, zn as C, Tn as D, Nn as E, gn as F, R as G, G as H, dn as I, I as J, V as K, un as L, yn as M, vn as N, wn as O, _n as P, Ut as Q, cn as R, Bn as S, Pn as T, $t as U, rn as V, H as W, Wt as X, F as Y, P as Z, Sr as _, bi as a, Gn as b, ti as c, qr as d, D as et, Kr as f, Cr as g, wr as h, yi as i, bn as j, Cn as k, ei as l, Tr as m, Di as n, w as nt, ui as o, Er as p, z as q, Ei as r, ni as s, Oi as t, O as tt, Qr as u, Jn as v, Fn as w, Wn as x, qn as y, sn as z };