import { NodeSelection as ct, EditorState as Rt, Plugin as O, PluginKey as j, Selection as D, TextSelection as P, AllSelection as Lt } from "../../../../../prosemirror-state@1.4.3/node_modules/prosemirror-state/dist/index.js";
import { EditorView as zt } from "../../../../../prosemirror-view@1.40.0/node_modules/prosemirror-view/dist/index.js";
import { keymap as Ht } from "../../../../../prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js";
import { DOMSerializer as _t, Schema as Et, Fragment as I, Node as Vt, DOMParser as tt, Slice as Wt } from "../../../../../prosemirror-model@1.25.1/node_modules/prosemirror-model/dist/index.js";
import { findWrapping as Kt, canJoin as lt, canSplit as W, joinPoint as xt, liftTarget as Ut, ReplaceStep as Gt, ReplaceAroundStep as qt } from "../../../../../prosemirror-transform@1.10.4/node_modules/prosemirror-transform/dist/index.js";
import { wrapIn as Jt, setBlockType as gt, selectTextblockStart as Yt, selectTextblockEnd as Qt, selectParentNode as Xt, selectNodeForward as Zt, selectNodeBackward as te, newlineInCode as ee, liftEmptyBlock as ne, lift as re, joinUp as se, joinTextblockForward as oe, joinTextblockBackward as ie, joinForward as ae, joinDown as ce, joinBackward as le, exitCode as de, deleteSelection as ue, createParagraphNear as pe } from "../../../../../prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js";
import { wrapInList as fe, sinkListItem as he, liftListItem as me } from "../../../../../prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js";
function q(n) {
  const { state: t, transaction: e } = n;
  let { selection: r } = e, { doc: s } = e, { storedMarks: o } = e;
  return {
    ...t,
    apply: t.apply.bind(t),
    applyTransaction: t.applyTransaction.bind(t),
    plugins: t.plugins,
    schema: t.schema,
    reconfigure: t.reconfigure.bind(t),
    toJSON: t.toJSON.bind(t),
    get storedMarks() {
      return o;
    },
    get selection() {
      return r;
    },
    get doc() {
      return s;
    },
    get tr() {
      return r = e.selection, s = e.doc, o = e.storedMarks, e;
    }
  };
}
class J {
  constructor(t) {
    this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
  }
  get hasCustomState() {
    return !!this.customState;
  }
  get state() {
    return this.customState || this.editor.state;
  }
  get commands() {
    const { rawCommands: t, editor: e, state: r } = this, { view: s } = e, { tr: o } = r, i = this.buildProps(o);
    return Object.fromEntries(Object.entries(t).map(([c, a]) => [c, (...u) => {
      const d = a(...u)(i);
      return !o.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(o), d;
    }]));
  }
  get chain() {
    return () => this.createChain();
  }
  get can() {
    return () => this.createCan();
  }
  createChain(t, e = !0) {
    const { rawCommands: r, editor: s, state: o } = this, { view: i } = s, c = [], a = !!t, l = t || o.tr, u = () => (!a && e && !l.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(l), c.every((p) => p === !0)), d = {
      ...Object.fromEntries(Object.entries(r).map(([p, f]) => [p, (...h) => {
        const m = this.buildProps(l, e), k = f(...h)(m);
        return c.push(k), d;
      }])),
      run: u
    };
    return d;
  }
  createCan(t) {
    const { rawCommands: e, state: r } = this, s = !1, o = t || r.tr, i = this.buildProps(o, s);
    return {
      ...Object.fromEntries(Object.entries(e).map(([a, l]) => [a, (...u) => l(...u)({ ...i, dispatch: void 0 })])),
      chain: () => this.createChain(o, s)
    };
  }
  buildProps(t, e = !0) {
    const { rawCommands: r, editor: s, state: o } = this, { view: i } = s, c = {
      tr: t,
      editor: s,
      view: i,
      state: q({
        state: o,
        transaction: t
      }),
      dispatch: e ? () => {
      } : void 0,
      chain: () => this.createChain(t, e),
      can: () => this.createCan(t),
      get commands() {
        return Object.fromEntries(Object.entries(r).map(([a, l]) => [a, (...u) => l(...u)(c)]));
      }
    };
    return c;
  }
}
class ge {
  constructor() {
    this.callbacks = {};
  }
  on(t, e) {
    return this.callbacks[t] || (this.callbacks[t] = []), this.callbacks[t].push(e), this;
  }
  emit(t, ...e) {
    const r = this.callbacks[t];
    return r && r.forEach((s) => s.apply(this, e)), this;
  }
  off(t, e) {
    const r = this.callbacks[t];
    return r && (e ? this.callbacks[t] = r.filter((s) => s !== e) : delete this.callbacks[t]), this;
  }
  once(t, e) {
    const r = (...s) => {
      this.off(t, r), e.apply(this, s);
    };
    return this.on(t, r);
  }
  removeAllListeners() {
    this.callbacks = {};
  }
}
function y(n, t, e) {
  return n.config[t] === void 0 && n.parent ? y(n.parent, t, e) : typeof n.config[t] == "function" ? n.config[t].bind({
    ...e,
    parent: n.parent ? y(n.parent, t, e) : null
  }) : n.config[t];
}
function Y(n) {
  const t = n.filter((s) => s.type === "extension"), e = n.filter((s) => s.type === "node"), r = n.filter((s) => s.type === "mark");
  return {
    baseExtensions: t,
    nodeExtensions: e,
    markExtensions: r
  };
}
function Ct(n) {
  const t = [], { nodeExtensions: e, markExtensions: r } = Y(n), s = [...e, ...r], o = {
    default: null,
    rendered: !0,
    renderHTML: null,
    parseHTML: null,
    keepOnSplit: !0,
    isRequired: !1
  };
  return n.forEach((i) => {
    const c = {
      name: i.name,
      options: i.options,
      storage: i.storage,
      extensions: s
    }, a = y(i, "addGlobalAttributes", c);
    if (!a)
      return;
    a().forEach((u) => {
      u.types.forEach((d) => {
        Object.entries(u.attributes).forEach(([p, f]) => {
          t.push({
            type: d,
            name: p,
            attribute: {
              ...o,
              ...f
            }
          });
        });
      });
    });
  }), s.forEach((i) => {
    const c = {
      name: i.name,
      options: i.options,
      storage: i.storage
    }, a = y(i, "addAttributes", c);
    if (!a)
      return;
    const l = a();
    Object.entries(l).forEach(([u, d]) => {
      const p = {
        ...o,
        ...d
      };
      typeof p?.default == "function" && (p.default = p.default()), p?.isRequired && p?.default === void 0 && delete p.default, t.push({
        type: i.name,
        name: u,
        attribute: p
      });
    });
  }), t;
}
function S(n, t) {
  if (typeof n == "string") {
    if (!t.nodes[n])
      throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);
    return t.nodes[n];
  }
  return n;
}
function ye(...n) {
  return n.filter((t) => !!t).reduce((t, e) => {
    const r = { ...t };
    return Object.entries(e).forEach(([s, o]) => {
      if (!r[s]) {
        r[s] = o;
        return;
      }
      if (s === "class") {
        const c = o ? String(o).split(" ") : [], a = r[s] ? r[s].split(" ") : [], l = c.filter((u) => !a.includes(u));
        r[s] = [...a, ...l].join(" ");
      } else if (s === "style") {
        const c = o ? o.split(";").map((u) => u.trim()).filter(Boolean) : [], a = r[s] ? r[s].split(";").map((u) => u.trim()).filter(Boolean) : [], l = /* @__PURE__ */ new Map();
        a.forEach((u) => {
          const [d, p] = u.split(":").map((f) => f.trim());
          l.set(d, p);
        }), c.forEach((u) => {
          const [d, p] = u.split(":").map((f) => f.trim());
          l.set(d, p);
        }), r[s] = Array.from(l.entries()).map(([u, d]) => `${u}: ${d}`).join("; ");
      } else
        r[s] = o;
    }), r;
  }, {});
}
function st(n, t) {
  return t.filter((e) => e.type === n.type.name).filter((e) => e.attribute.rendered).map((e) => e.attribute.renderHTML ? e.attribute.renderHTML(n.attrs) || {} : {
    [e.name]: n.attrs[e.name]
  }).reduce((e, r) => ye(e, r), {});
}
function Tt(n) {
  return typeof n == "function";
}
function b(n, t = void 0, ...e) {
  return Tt(n) ? t ? n.bind(t)(...e) : n(...e) : n;
}
function ke(n = {}) {
  return Object.keys(n).length === 0 && n.constructor === Object;
}
function be(n) {
  return typeof n != "string" ? n : n.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(n) : n === "true" ? !0 : n === "false" ? !1 : n;
}
function yt(n, t) {
  return "style" in n ? n : {
    ...n,
    getAttrs: (e) => {
      const r = n.getAttrs ? n.getAttrs(e) : n.attrs;
      if (r === !1)
        return !1;
      const s = t.reduce((o, i) => {
        const c = i.attribute.parseHTML ? i.attribute.parseHTML(e) : be(e.getAttribute(i.name));
        return c == null ? o : {
          ...o,
          [i.name]: c
        };
      }, {});
      return { ...r, ...s };
    }
  };
}
function kt(n) {
  return Object.fromEntries(
    // @ts-ignore
    Object.entries(n).filter(([t, e]) => t === "attrs" && ke(e) ? !1 : e != null)
  );
}
function ve(n, t) {
  var e;
  const r = Ct(n), { nodeExtensions: s, markExtensions: o } = Y(n), i = (e = s.find((l) => y(l, "topNode"))) === null || e === void 0 ? void 0 : e.name, c = Object.fromEntries(s.map((l) => {
    const u = r.filter((k) => k.type === l.name), d = {
      name: l.name,
      options: l.options,
      storage: l.storage,
      editor: t
    }, p = n.reduce((k, v) => {
      const w = y(v, "extendNodeSchema", d);
      return {
        ...k,
        ...w ? w(l) : {}
      };
    }, {}), f = kt({
      ...p,
      content: b(y(l, "content", d)),
      marks: b(y(l, "marks", d)),
      group: b(y(l, "group", d)),
      inline: b(y(l, "inline", d)),
      atom: b(y(l, "atom", d)),
      selectable: b(y(l, "selectable", d)),
      draggable: b(y(l, "draggable", d)),
      code: b(y(l, "code", d)),
      whitespace: b(y(l, "whitespace", d)),
      linebreakReplacement: b(y(l, "linebreakReplacement", d)),
      defining: b(y(l, "defining", d)),
      isolating: b(y(l, "isolating", d)),
      attrs: Object.fromEntries(u.map((k) => {
        var v;
        return [k.name, { default: (v = k?.attribute) === null || v === void 0 ? void 0 : v.default }];
      }))
    }), g = b(y(l, "parseHTML", d));
    g && (f.parseDOM = g.map((k) => yt(k, u)));
    const h = y(l, "renderHTML", d);
    h && (f.toDOM = (k) => h({
      node: k,
      HTMLAttributes: st(k, u)
    }));
    const m = y(l, "renderText", d);
    return m && (f.toText = m), [l.name, f];
  })), a = Object.fromEntries(o.map((l) => {
    const u = r.filter((m) => m.type === l.name), d = {
      name: l.name,
      options: l.options,
      storage: l.storage,
      editor: t
    }, p = n.reduce((m, k) => {
      const v = y(k, "extendMarkSchema", d);
      return {
        ...m,
        ...v ? v(l) : {}
      };
    }, {}), f = kt({
      ...p,
      inclusive: b(y(l, "inclusive", d)),
      excludes: b(y(l, "excludes", d)),
      group: b(y(l, "group", d)),
      spanning: b(y(l, "spanning", d)),
      code: b(y(l, "code", d)),
      attrs: Object.fromEntries(u.map((m) => {
        var k;
        return [m.name, { default: (k = m?.attribute) === null || k === void 0 ? void 0 : k.default }];
      }))
    }), g = b(y(l, "parseHTML", d));
    g && (f.parseDOM = g.map((m) => yt(m, u)));
    const h = y(l, "renderHTML", d);
    return h && (f.toDOM = (m) => h({
      mark: m,
      HTMLAttributes: st(m, u)
    })), [l.name, f];
  }));
  return new Et({
    topNode: i,
    nodes: c,
    marks: a
  });
}
function et(n, t) {
  return t.nodes[n] || t.marks[n] || null;
}
function bt(n, t) {
  return Array.isArray(t) ? t.some((e) => (typeof e == "string" ? e : e.name) === n.name) : t;
}
function dt(n, t) {
  const e = _t.fromSchema(t).serializeFragment(n), s = document.implementation.createHTMLDocument().createElement("div");
  return s.appendChild(e), s.innerHTML;
}
const we = (n, t = 500) => {
  let e = "";
  const r = n.parentOffset;
  return n.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, c) => {
    var a, l;
    const u = ((l = (a = s.type.spec).toText) === null || l === void 0 ? void 0 : l.call(a, {
      node: s,
      pos: o,
      parent: i,
      index: c
    })) || s.textContent || "%leaf%";
    e += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
  }), e;
};
function ut(n) {
  return Object.prototype.toString.call(n) === "[object RegExp]";
}
class Q {
  constructor(t) {
    this.find = t.find, this.handler = t.handler;
  }
}
const Me = (n, t) => {
  if (ut(t))
    return t.exec(n);
  const e = t(n);
  if (!e)
    return null;
  const r = [e.text];
  return r.index = e.index, r.input = n, r.data = e.data, e.replaceWith && (e.text.includes(e.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(e.replaceWith)), r;
};
function z(n) {
  var t;
  const { editor: e, from: r, to: s, text: o, rules: i, plugin: c } = n, { view: a } = e;
  if (a.composing)
    return !1;
  const l = a.state.doc.resolve(r);
  if (
    // check for code node
    l.parent.type.spec.code || !((t = l.nodeBefore || l.nodeAfter) === null || t === void 0) && t.marks.find((p) => p.type.spec.code)
  )
    return !1;
  let u = !1;
  const d = we(l) + o;
  return i.forEach((p) => {
    if (u)
      return;
    const f = Me(d, p.find);
    if (!f)
      return;
    const g = a.state.tr, h = q({
      state: a.state,
      transaction: g
    }), m = {
      from: r - (f[0].length - o.length),
      to: s
    }, { commands: k, chain: v, can: w } = new J({
      editor: e,
      state: h
    });
    p.handler({
      state: h,
      range: m,
      match: f,
      commands: k,
      chain: v,
      can: w
    }) === null || !g.steps.length || (g.setMeta(c, {
      transform: g,
      from: r,
      to: s,
      text: o
    }), a.dispatch(g), u = !0);
  }), u;
}
function Se(n) {
  const { editor: t, rules: e } = n, r = new O({
    state: {
      init() {
        return null;
      },
      apply(s, o, i) {
        const c = s.getMeta(r);
        if (c)
          return c;
        const a = s.getMeta("applyInputRules");
        return !!a && setTimeout(() => {
          let { text: u } = a;
          typeof u == "string" ? u = u : u = dt(I.from(u), i.schema);
          const { from: d } = a, p = d + u.length;
          z({
            editor: t,
            from: d,
            to: p,
            text: u,
            rules: e,
            plugin: r
          });
        }), s.selectionSet || s.docChanged ? null : o;
      }
    },
    props: {
      handleTextInput(s, o, i, c) {
        return z({
          editor: t,
          from: o,
          to: i,
          text: c,
          rules: e,
          plugin: r
        });
      },
      handleDOMEvents: {
        compositionend: (s) => (setTimeout(() => {
          const { $cursor: o } = s.state.selection;
          o && z({
            editor: t,
            from: o.pos,
            to: o.pos,
            text: "",
            rules: e,
            plugin: r
          });
        }), !1)
      },
      // add support for input rules to trigger on enter
      // this is useful for example for code blocks
      handleKeyDown(s, o) {
        if (o.key !== "Enter")
          return !1;
        const { $cursor: i } = s.state.selection;
        return i ? z({
          editor: t,
          from: i.pos,
          to: i.pos,
          text: `
`,
          rules: e,
          plugin: r
        }) : !1;
      }
    },
    // @ts-ignore
    isInputRules: !0
  });
  return r;
}
function Ee(n) {
  return Object.prototype.toString.call(n).slice(8, -1);
}
function H(n) {
  return Ee(n) !== "Object" ? !1 : n.constructor === Object && Object.getPrototypeOf(n) === Object.prototype;
}
function X(n, t) {
  const e = { ...n };
  return H(n) && H(t) && Object.keys(t).forEach((r) => {
    H(t[r]) && H(n[r]) ? e[r] = X(n[r], t[r]) : e[r] = t[r];
  }), e;
}
class U {
  constructor(t = {}) {
    this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
      name: this.name,
      defaultOptions: {}
    }, this.config = {
      ...this.config,
      ...t
    }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = b(y(this, "addOptions", {
      name: this.name
    }))), this.storage = b(y(this, "addStorage", {
      name: this.name,
      options: this.options
    })) || {};
  }
  static create(t = {}) {
    return new U(t);
  }
  configure(t = {}) {
    const e = this.extend({
      ...this.config,
      addOptions: () => X(this.options, t)
    });
    return e.name = this.name, e.parent = this.parent, e;
  }
  extend(t = {}) {
    const e = new U(t);
    return e.parent = this, this.child = e, e.name = t.name ? t.name : e.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`), e.options = b(y(e, "addOptions", {
      name: e.name
    })), e.storage = b(y(e, "addStorage", {
      name: e.name,
      options: e.options
    })), e;
  }
  static handleExit({ editor: t, mark: e }) {
    const { tr: r } = t.state, s = t.state.selection.$from;
    if (s.pos === s.end()) {
      const i = s.marks();
      if (!!!i.find((l) => l?.type.name === e.name))
        return !1;
      const a = i.find((l) => l?.type.name === e.name);
      return a && r.removeStoredMark(a), r.insertText(" ", s.pos), t.view.dispatch(r), !0;
    }
    return !1;
  }
}
function xe(n) {
  return typeof n == "number";
}
class Ce {
  constructor(t) {
    this.find = t.find, this.handler = t.handler;
  }
}
const Te = (n, t, e) => {
  if (ut(t))
    return [...n.matchAll(t)];
  const r = t(n, e);
  return r ? r.map((s) => {
    const o = [s.text];
    return o.index = s.index, o.input = n, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
  }) : [];
};
function Ae(n) {
  const { editor: t, state: e, from: r, to: s, rule: o, pasteEvent: i, dropEvent: c } = n, { commands: a, chain: l, can: u } = new J({
    editor: t,
    state: e
  }), d = [];
  return e.doc.nodesBetween(r, s, (f, g) => {
    if (!f.isTextblock || f.type.spec.code)
      return;
    const h = Math.max(r, g), m = Math.min(s, g + f.content.size), k = f.textBetween(h - g, m - g, void 0, "￼");
    Te(k, o.find, i).forEach((w) => {
      if (w.index === void 0)
        return;
      const E = h + w.index + 1, M = E + w[0].length, x = {
        from: e.tr.mapping.map(E),
        to: e.tr.mapping.map(M)
      }, T = o.handler({
        state: e,
        range: x,
        match: w,
        commands: a,
        chain: l,
        can: u,
        pasteEvent: i,
        dropEvent: c
      });
      d.push(T);
    });
  }), d.every((f) => f !== null);
}
let _ = null;
const Pe = (n) => {
  var t;
  const e = new ClipboardEvent("paste", {
    clipboardData: new DataTransfer()
  });
  return (t = e.clipboardData) === null || t === void 0 || t.setData("text/html", n), e;
};
function Oe(n) {
  const { editor: t, rules: e } = n;
  let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
  try {
    c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
  } catch {
    c = null;
  }
  const a = ({ state: u, from: d, to: p, rule: f, pasteEvt: g }) => {
    const h = u.tr, m = q({
      state: u,
      transaction: h
    });
    if (!(!Ae({
      editor: t,
      state: m,
      from: Math.max(d - 1, 0),
      to: p.b - 1,
      rule: f,
      pasteEvent: g,
      dropEvent: c
    }) || !h.steps.length)) {
      try {
        c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
      } catch {
        c = null;
      }
      return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, h;
    }
  };
  return e.map((u) => new O({
    // we register a global drag handler to track the current drag source element
    view(d) {
      const p = (g) => {
        var h;
        r = !((h = d.dom.parentElement) === null || h === void 0) && h.contains(g.target) ? d.dom.parentElement : null, r && (_ = t);
      }, f = () => {
        _ && (_ = null);
      };
      return window.addEventListener("dragstart", p), window.addEventListener("dragend", f), {
        destroy() {
          window.removeEventListener("dragstart", p), window.removeEventListener("dragend", f);
        }
      };
    },
    props: {
      handleDOMEvents: {
        drop: (d, p) => {
          if (o = r === d.dom.parentElement, c = p, !o) {
            const f = _;
            f && setTimeout(() => {
              const g = f.state.selection;
              g && f.commands.deleteRange({ from: g.from, to: g.to });
            }, 10);
          }
          return !1;
        },
        paste: (d, p) => {
          var f;
          const g = (f = p.clipboardData) === null || f === void 0 ? void 0 : f.getData("text/html");
          return i = p, s = !!g?.includes("data-pm-slice"), !1;
        }
      }
    },
    appendTransaction: (d, p, f) => {
      const g = d[0], h = g.getMeta("uiEvent") === "paste" && !s, m = g.getMeta("uiEvent") === "drop" && !o, k = g.getMeta("applyPasteRules"), v = !!k;
      if (!h && !m && !v)
        return;
      if (v) {
        let { text: M } = k;
        typeof M == "string" ? M = M : M = dt(I.from(M), f.schema);
        const { from: x } = k, T = x + M.length, A = Pe(M);
        return a({
          rule: u,
          state: f,
          from: x,
          to: { b: T },
          pasteEvt: A
        });
      }
      const w = p.doc.content.findDiffStart(f.doc.content), E = p.doc.content.findDiffEnd(f.doc.content);
      if (!(!xe(w) || !E || w === E.b))
        return a({
          rule: u,
          state: f,
          from: w,
          to: E,
          pasteEvt: i
        });
    }
  }));
}
function Ie(n) {
  const t = n.filter((e, r) => n.indexOf(e) !== r);
  return Array.from(new Set(t));
}
class F {
  constructor(t, e) {
    this.splittableMarks = [], this.editor = e, this.extensions = F.resolve(t), this.schema = ve(this.extensions, e), this.setupExtensions();
  }
  /**
   * Returns a flattened and sorted extension list while
   * also checking for duplicated extensions and warns the user.
   * @param extensions An array of Tiptap extensions
   * @returns An flattened and sorted array of Tiptap extensions
   */
  static resolve(t) {
    const e = F.sort(F.flatten(t)), r = Ie(e.map((s) => s.name));
    return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), e;
  }
  /**
   * Create a flattened array of extensions by traversing the `addExtensions` field.
   * @param extensions An array of Tiptap extensions
   * @returns A flattened array of Tiptap extensions
   */
  static flatten(t) {
    return t.map((e) => {
      const r = {
        name: e.name,
        options: e.options,
        storage: e.storage
      }, s = y(e, "addExtensions", r);
      return s ? [e, ...this.flatten(s())] : e;
    }).flat(10);
  }
  /**
   * Sort extensions by priority.
   * @param extensions An array of Tiptap extensions
   * @returns A sorted array of Tiptap extensions by priority
   */
  static sort(t) {
    return t.sort((r, s) => {
      const o = y(r, "priority") || 100, i = y(s, "priority") || 100;
      return o > i ? -1 : o < i ? 1 : 0;
    });
  }
  /**
   * Get all commands from the extensions.
   * @returns An object with all commands where the key is the command name and the value is the command function
   */
  get commands() {
    return this.extensions.reduce((t, e) => {
      const r = {
        name: e.name,
        options: e.options,
        storage: e.storage,
        editor: this.editor,
        type: et(e.name, this.schema)
      }, s = y(e, "addCommands", r);
      return s ? {
        ...t,
        ...s()
      } : t;
    }, {});
  }
  /**
   * Get all registered Prosemirror plugins from the extensions.
   * @returns An array of Prosemirror plugins
   */
  get plugins() {
    const { editor: t } = this, e = F.sort([...this.extensions].reverse()), r = [], s = [], o = e.map((i) => {
      const c = {
        name: i.name,
        options: i.options,
        storage: i.storage,
        editor: t,
        type: et(i.name, this.schema)
      }, a = [], l = y(i, "addKeyboardShortcuts", c);
      let u = {};
      if (i.type === "mark" && y(i, "exitable", c) && (u.ArrowRight = () => U.handleExit({ editor: t, mark: i })), l) {
        const h = Object.fromEntries(Object.entries(l()).map(([m, k]) => [m, () => k({ editor: t })]));
        u = { ...u, ...h };
      }
      const d = Ht(u);
      a.push(d);
      const p = y(i, "addInputRules", c);
      bt(i, t.options.enableInputRules) && p && r.push(...p());
      const f = y(i, "addPasteRules", c);
      bt(i, t.options.enablePasteRules) && f && s.push(...f());
      const g = y(i, "addProseMirrorPlugins", c);
      if (g) {
        const h = g();
        a.push(...h);
      }
      return a;
    }).flat();
    return [
      Se({
        editor: t,
        rules: r
      }),
      ...Oe({
        editor: t,
        rules: s
      }),
      ...o
    ];
  }
  /**
   * Get all attributes from the extensions.
   * @returns An array of attributes
   */
  get attributes() {
    return Ct(this.extensions);
  }
  /**
   * Get all node views from the extensions.
   * @returns An object with all node views where the key is the node name and the value is the node view function
   */
  get nodeViews() {
    const { editor: t } = this, { nodeExtensions: e } = Y(this.extensions);
    return Object.fromEntries(e.filter((r) => !!y(r, "addNodeView")).map((r) => {
      const s = this.attributes.filter((a) => a.type === r.name), o = {
        name: r.name,
        options: r.options,
        storage: r.storage,
        editor: t,
        type: S(r.name, this.schema)
      }, i = y(r, "addNodeView", o);
      if (!i)
        return [];
      const c = (a, l, u, d, p) => {
        const f = st(a, s);
        return i()({
          // pass-through
          node: a,
          view: l,
          getPos: u,
          decorations: d,
          innerDecorations: p,
          // tiptap-specific
          editor: t,
          extension: r,
          HTMLAttributes: f
        });
      };
      return [r.name, c];
    }));
  }
  /**
   * Go through all extensions, create extension storages & setup marks
   * & bind editor event listener.
   */
  setupExtensions() {
    this.extensions.forEach((t) => {
      var e;
      this.editor.extensionStorage[t.name] = t.storage;
      const r = {
        name: t.name,
        options: t.options,
        storage: t.storage,
        editor: this.editor,
        type: et(t.name, this.schema)
      };
      t.type === "mark" && (!((e = b(y(t, "keepOnSplit", r))) !== null && e !== void 0) || e) && this.splittableMarks.push(t.name);
      const s = y(t, "onBeforeCreate", r), o = y(t, "onCreate", r), i = y(t, "onUpdate", r), c = y(t, "onSelectionUpdate", r), a = y(t, "onTransaction", r), l = y(t, "onFocus", r), u = y(t, "onBlur", r), d = y(t, "onDestroy", r);
      s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), c && this.editor.on("selectionUpdate", c), a && this.editor.on("transaction", a), l && this.editor.on("focus", l), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
    });
  }
}
class C {
  constructor(t = {}) {
    this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
      name: this.name,
      defaultOptions: {}
    }, this.config = {
      ...this.config,
      ...t
    }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = b(y(this, "addOptions", {
      name: this.name
    }))), this.storage = b(y(this, "addStorage", {
      name: this.name,
      options: this.options
    })) || {};
  }
  static create(t = {}) {
    return new C(t);
  }
  configure(t = {}) {
    const e = this.extend({
      ...this.config,
      addOptions: () => X(this.options, t)
    });
    return e.name = this.name, e.parent = this.parent, e;
  }
  extend(t = {}) {
    const e = new C({ ...this.config, ...t });
    return e.parent = this, this.child = e, e.name = t.name ? t.name : e.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`), e.options = b(y(e, "addOptions", {
      name: e.name
    })), e.storage = b(y(e, "addStorage", {
      name: e.name,
      options: e.options
    })), e;
  }
}
function At(n, t, e) {
  const { from: r, to: s } = t, { blockSeparator: o = `

`, textSerializers: i = {} } = e || {};
  let c = "";
  return n.nodesBetween(r, s, (a, l, u, d) => {
    var p;
    a.isBlock && l > r && (c += o);
    const f = i?.[a.type.name];
    if (f)
      return u && (c += f({
        node: a,
        pos: l,
        parent: u,
        index: d,
        range: t
      })), !1;
    a.isText && (c += (p = a?.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, l) - l, s - l));
  }), c;
}
function Pt(n) {
  return Object.fromEntries(Object.entries(n.nodes).filter(([, t]) => t.spec.toText).map(([t, e]) => [t, e.spec.toText]));
}
const $e = C.create({
  name: "clipboardTextSerializer",
  addOptions() {
    return {
      blockSeparator: void 0
    };
  },
  addProseMirrorPlugins() {
    return [
      new O({
        key: new j("clipboardTextSerializer"),
        props: {
          clipboardTextSerializer: () => {
            const { editor: n } = this, { state: t, schema: e } = n, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), c = Math.max(...o.map((u) => u.$to.pos)), a = Pt(e);
            return At(r, { from: i, to: c }, {
              ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
              textSerializers: a
            });
          }
        }
      })
    ];
  }
}), Be = () => ({ editor: n, view: t }) => (requestAnimationFrame(() => {
  var e;
  n.isDestroyed || (t.dom.blur(), (e = window?.getSelection()) === null || e === void 0 || e.removeAllRanges());
}), !0), Ne = (n = !1) => ({ commands: t }) => t.setContent("", n), je = () => ({ state: n, tr: t, dispatch: e }) => {
  const { selection: r } = t, { ranges: s } = r;
  return e && s.forEach(({ $from: o, $to: i }) => {
    n.doc.nodesBetween(o.pos, i.pos, (c, a) => {
      if (c.type.isText)
        return;
      const { doc: l, mapping: u } = t, d = l.resolve(u.map(a)), p = l.resolve(u.map(a + c.nodeSize)), f = d.blockRange(p);
      if (!f)
        return;
      const g = Ut(f);
      if (c.type.isTextblock) {
        const { defaultType: h } = d.parent.contentMatchAt(d.index());
        t.setNodeMarkup(f.start, h);
      }
      (g || g === 0) && t.lift(f, g);
    });
  }), !0;
}, Fe = (n) => (t) => n(t), De = () => ({ state: n, dispatch: t }) => pe(n, t), Re = (n, t) => ({ editor: e, tr: r }) => {
  const { state: s } = e, o = s.doc.slice(n.from, n.to);
  r.deleteRange(n.from, n.to);
  const i = r.mapping.map(t);
  return r.insert(i, o.content), r.setSelection(new P(r.doc.resolve(i - 1))), !0;
}, Le = () => ({ tr: n, dispatch: t }) => {
  const { selection: e } = n, r = e.$anchor.node();
  if (r.content.size > 0)
    return !1;
  const s = n.selection.$anchor;
  for (let o = s.depth; o > 0; o -= 1)
    if (s.node(o).type === r.type) {
      if (t) {
        const c = s.before(o), a = s.after(o);
        n.delete(c, a).scrollIntoView();
      }
      return !0;
    }
  return !1;
}, ze = (n) => ({ tr: t, state: e, dispatch: r }) => {
  const s = S(n, e.schema), o = t.selection.$anchor;
  for (let i = o.depth; i > 0; i -= 1)
    if (o.node(i).type === s) {
      if (r) {
        const a = o.before(i), l = o.after(i);
        t.delete(a, l).scrollIntoView();
      }
      return !0;
    }
  return !1;
}, He = (n) => ({ tr: t, dispatch: e }) => {
  const { from: r, to: s } = n;
  return e && t.delete(r, s), !0;
}, _e = () => ({ state: n, dispatch: t }) => ue(n, t), Ve = () => ({ commands: n }) => n.keyboardShortcut("Enter"), We = () => ({ state: n, dispatch: t }) => de(n, t);
function G(n, t, e = { strict: !0 }) {
  const r = Object.keys(t);
  return r.length ? r.every((s) => e.strict ? t[s] === n[s] : ut(t[s]) ? t[s].test(n[s]) : t[s] === n[s]) : !0;
}
function Ot(n, t, e = {}) {
  return n.find((r) => r.type === t && G(
    // Only check equality for the attributes that are provided
    Object.fromEntries(Object.keys(e).map((s) => [s, r.attrs[s]])),
    e
  ));
}
function vt(n, t, e = {}) {
  return !!Ot(n, t, e);
}
function pt(n, t, e) {
  var r;
  if (!n || !t)
    return;
  let s = n.parent.childAfter(n.parentOffset);
  if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = n.parent.childBefore(n.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (e = e || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !Ot([...s.node.marks], t, e)))
    return;
  let i = s.index, c = n.start() + s.offset, a = i + 1, l = c + s.node.nodeSize;
  for (; i > 0 && vt([...n.parent.child(i - 1).marks], t, e); )
    i -= 1, c -= n.parent.child(i).nodeSize;
  for (; a < n.parent.childCount && vt([...n.parent.child(a).marks], t, e); )
    l += n.parent.child(a).nodeSize, a += 1;
  return {
    from: c,
    to: l
  };
}
function $(n, t) {
  if (typeof n == "string") {
    if (!t.marks[n])
      throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);
    return t.marks[n];
  }
  return n;
}
const Ke = (n, t = {}) => ({ tr: e, state: r, dispatch: s }) => {
  const o = $(n, r.schema), { doc: i, selection: c } = e, { $from: a, from: l, to: u } = c;
  if (s) {
    const d = pt(a, o, t);
    if (d && d.from <= l && d.to >= u) {
      const p = P.create(i, d.from, d.to);
      e.setSelection(p);
    }
  }
  return !0;
}, Ue = (n) => (t) => {
  const e = typeof n == "function" ? n(t) : n;
  for (let r = 0; r < e.length; r += 1)
    if (e[r](t))
      return !0;
  return !1;
};
function It(n) {
  return n instanceof P;
}
function N(n = 0, t = 0, e = 0) {
  return Math.min(Math.max(n, t), e);
}
function $t(n, t = null) {
  if (!t)
    return null;
  const e = D.atStart(n), r = D.atEnd(n);
  if (t === "start" || t === !0)
    return e;
  if (t === "end")
    return r;
  const s = e.from, o = r.to;
  return t === "all" ? P.create(n, N(0, s, o), N(n.content.size, s, o)) : P.create(n, N(t, s, o), N(t, s, o));
}
function Ge() {
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
}
function ft() {
  return [
    "iPad Simulator",
    "iPhone Simulator",
    "iPod Simulator",
    "iPad",
    "iPhone",
    "iPod"
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
}
const qe = (n = null, t = {}) => ({ editor: e, view: r, tr: s, dispatch: o }) => {
  t = {
    scrollIntoView: !0,
    ...t
  };
  const i = () => {
    (ft() || Ge()) && r.dom.focus(), requestAnimationFrame(() => {
      e.isDestroyed || (r.focus(), t?.scrollIntoView && e.commands.scrollIntoView());
    });
  };
  if (r.hasFocus() && n === null || n === !1)
    return !0;
  if (o && n === null && !It(e.state.selection))
    return i(), !0;
  const c = $t(s.doc, n) || e.state.selection, a = e.state.selection.eq(c);
  return o && (a || s.setSelection(c), a && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
}, Je = (n, t) => (e) => n.every((r, s) => t(r, { ...e, index: s })), Ye = (n, t) => ({ tr: e, commands: r }) => r.insertContentAt({ from: e.selection.from, to: e.selection.to }, n, t), Bt = (n) => {
  const t = n.childNodes;
  for (let e = t.length - 1; e >= 0; e -= 1) {
    const r = t[e];
    r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? n.removeChild(r) : r.nodeType === 1 && Bt(r);
  }
  return n;
};
function V(n) {
  const t = `<body>${n}</body>`, e = new window.DOMParser().parseFromString(t, "text/html").body;
  return Bt(e);
}
function R(n, t, e) {
  if (n instanceof Vt || n instanceof I)
    return n;
  e = {
    slice: !0,
    parseOptions: {},
    ...e
  };
  const r = typeof n == "object" && n !== null, s = typeof n == "string";
  if (r)
    try {
      if (Array.isArray(n) && n.length > 0)
        return I.fromArray(n.map((c) => t.nodeFromJSON(c)));
      const i = t.nodeFromJSON(n);
      return e.errorOnInvalidContent && i.check(), i;
    } catch (o) {
      if (e.errorOnInvalidContent)
        throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
      return console.warn("[tiptap warn]: Invalid content.", "Passed value:", n, "Error:", o), R("", t, e);
    }
  if (s) {
    if (e.errorOnInvalidContent) {
      let i = !1, c = "";
      const a = new Et({
        topNode: t.spec.topNode,
        marks: t.spec.marks,
        // Prosemirror's schemas are executed such that: the last to execute, matches last
        // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
        nodes: t.spec.nodes.append({
          __tiptap__private__unknown__catch__all__node: {
            content: "inline*",
            group: "block",
            parseDOM: [
              {
                tag: "*",
                getAttrs: (l) => (i = !0, c = typeof l == "string" ? l : l.outerHTML, null)
              }
            ]
          }
        })
      });
      if (e.slice ? tt.fromSchema(a).parseSlice(V(n), e.parseOptions) : tt.fromSchema(a).parse(V(n), e.parseOptions), e.errorOnInvalidContent && i)
        throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${c}`) });
    }
    const o = tt.fromSchema(t);
    return e.slice ? o.parseSlice(V(n), e.parseOptions).content : o.parse(V(n), e.parseOptions);
  }
  return R("", t, e);
}
function Qe(n, t, e) {
  const r = n.steps.length - 1;
  if (r < t)
    return;
  const s = n.steps[r];
  if (!(s instanceof Gt || s instanceof qt))
    return;
  const o = n.mapping.maps[r];
  let i = 0;
  o.forEach((c, a, l, u) => {
    i === 0 && (i = u);
  }), n.setSelection(D.near(n.doc.resolve(i), e));
}
const Xe = (n) => !("type" in n), Ze = (n, t, e) => ({ tr: r, dispatch: s, editor: o }) => {
  var i;
  if (s) {
    e = {
      parseOptions: o.options.parseOptions,
      updateSelection: !0,
      applyInputRules: !1,
      applyPasteRules: !1,
      ...e
    };
    let c;
    const a = (m) => {
      o.emit("contentError", {
        editor: o,
        error: m,
        disableCollaboration: () => {
          o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
        }
      });
    }, l = {
      preserveWhitespace: "full",
      ...e.parseOptions
    };
    if (!e.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError)
      try {
        R(t, o.schema, {
          parseOptions: l,
          errorOnInvalidContent: !0
        });
      } catch (m) {
        a(m);
      }
    try {
      c = R(t, o.schema, {
        parseOptions: l,
        errorOnInvalidContent: (i = e.errorOnInvalidContent) !== null && i !== void 0 ? i : o.options.enableContentCheck
      });
    } catch (m) {
      return a(m), !1;
    }
    let { from: u, to: d } = typeof n == "number" ? { from: n, to: n } : { from: n.from, to: n.to }, p = !0, f = !0;
    if ((Xe(c) ? c : [c]).forEach((m) => {
      m.check(), p = p ? m.isText && m.marks.length === 0 : !1, f = f ? m.isBlock : !1;
    }), u === d && f) {
      const { parent: m } = r.doc.resolve(u);
      m.isTextblock && !m.type.spec.code && !m.childCount && (u -= 1, d += 1);
    }
    let h;
    if (p) {
      if (Array.isArray(t))
        h = t.map((m) => m.text || "").join("");
      else if (t instanceof I) {
        let m = "";
        t.forEach((k) => {
          k.text && (m += k.text);
        }), h = m;
      } else typeof t == "object" && t && t.text ? h = t.text : h = t;
      r.insertText(h, u, d);
    } else
      h = c, r.replaceWith(u, d, h);
    e.updateSelection && Qe(r, r.steps.length - 1, -1), e.applyInputRules && r.setMeta("applyInputRules", { from: u, text: h }), e.applyPasteRules && r.setMeta("applyPasteRules", { from: u, text: h });
  }
  return !0;
}, tn = () => ({ state: n, dispatch: t }) => se(n, t), en = () => ({ state: n, dispatch: t }) => ce(n, t), nn = () => ({ state: n, dispatch: t }) => le(n, t), rn = () => ({ state: n, dispatch: t }) => ae(n, t), sn = () => ({ state: n, dispatch: t, tr: e }) => {
  try {
    const r = xt(n.doc, n.selection.$from.pos, -1);
    return r == null ? !1 : (e.join(r, 2), t && t(e), !0);
  } catch {
    return !1;
  }
}, on = () => ({ state: n, dispatch: t, tr: e }) => {
  try {
    const r = xt(n.doc, n.selection.$from.pos, 1);
    return r == null ? !1 : (e.join(r, 2), t && t(e), !0);
  } catch {
    return !1;
  }
}, an = () => ({ state: n, dispatch: t }) => ie(n, t), cn = () => ({ state: n, dispatch: t }) => oe(n, t);
function Nt() {
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
}
function ln(n) {
  const t = n.split(/-(?!$)/);
  let e = t[t.length - 1];
  e === "Space" && (e = " ");
  let r, s, o, i;
  for (let c = 0; c < t.length - 1; c += 1) {
    const a = t[c];
    if (/^(cmd|meta|m)$/i.test(a))
      i = !0;
    else if (/^a(lt)?$/i.test(a))
      r = !0;
    else if (/^(c|ctrl|control)$/i.test(a))
      s = !0;
    else if (/^s(hift)?$/i.test(a))
      o = !0;
    else if (/^mod$/i.test(a))
      ft() || Nt() ? i = !0 : s = !0;
    else
      throw new Error(`Unrecognized modifier name: ${a}`);
  }
  return r && (e = `Alt-${e}`), s && (e = `Ctrl-${e}`), i && (e = `Meta-${e}`), o && (e = `Shift-${e}`), e;
}
const dn = (n) => ({ editor: t, view: e, tr: r, dispatch: s }) => {
  const o = ln(n).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), c = new KeyboardEvent("keydown", {
    key: i === "Space" ? " " : i,
    altKey: o.includes("Alt"),
    ctrlKey: o.includes("Ctrl"),
    metaKey: o.includes("Meta"),
    shiftKey: o.includes("Shift"),
    bubbles: !0,
    cancelable: !0
  }), a = t.captureTransaction(() => {
    e.someProp("handleKeyDown", (l) => l(e, c));
  });
  return a?.steps.forEach((l) => {
    const u = l.map(r.mapping);
    u && s && r.maybeStep(u);
  }), !0;
};
function L(n, t, e = {}) {
  const { from: r, to: s, empty: o } = n.selection, i = t ? S(t, n.schema) : null, c = [];
  n.doc.nodesBetween(r, s, (d, p) => {
    if (d.isText)
      return;
    const f = Math.max(r, p), g = Math.min(s, p + d.nodeSize);
    c.push({
      node: d,
      from: f,
      to: g
    });
  });
  const a = s - r, l = c.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => G(d.node.attrs, e, { strict: !1 }));
  return o ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= a;
}
const un = (n, t = {}) => ({ state: e, dispatch: r }) => {
  const s = S(n, e.schema);
  return L(e, s, t) ? re(e, r) : !1;
}, pn = () => ({ state: n, dispatch: t }) => ne(n, t), fn = (n) => ({ state: t, dispatch: e }) => {
  const r = S(n, t.schema);
  return me(r)(t, e);
}, hn = () => ({ state: n, dispatch: t }) => ee(n, t);
function Z(n, t) {
  return t.nodes[n] ? "node" : t.marks[n] ? "mark" : null;
}
function wt(n, t) {
  const e = typeof t == "string" ? [t] : t;
  return Object.keys(n).reduce((r, s) => (e.includes(s) || (r[s] = n[s]), r), {});
}
const mn = (n, t) => ({ tr: e, state: r, dispatch: s }) => {
  let o = null, i = null;
  const c = Z(typeof n == "string" ? n : n.name, r.schema);
  return c ? (c === "node" && (o = S(n, r.schema)), c === "mark" && (i = $(n, r.schema)), s && e.selection.ranges.forEach((a) => {
    r.doc.nodesBetween(a.$from.pos, a.$to.pos, (l, u) => {
      o && o === l.type && e.setNodeMarkup(u, void 0, wt(l.attrs, t)), i && l.marks.length && l.marks.forEach((d) => {
        i === d.type && e.addMark(u, u + l.nodeSize, i.create(wt(d.attrs, t)));
      });
    });
  }), !0) : !1;
}, gn = () => ({ tr: n, dispatch: t }) => (t && n.scrollIntoView(), !0), yn = () => ({ tr: n, dispatch: t }) => {
  if (t) {
    const e = new Lt(n.doc);
    n.setSelection(e);
  }
  return !0;
}, kn = () => ({ state: n, dispatch: t }) => te(n, t), bn = () => ({ state: n, dispatch: t }) => Zt(n, t), vn = () => ({ state: n, dispatch: t }) => Xt(n, t), wn = () => ({ state: n, dispatch: t }) => Qt(n, t), Mn = () => ({ state: n, dispatch: t }) => Yt(n, t);
function ot(n, t, e = {}, r = {}) {
  return R(n, t, {
    slice: !1,
    parseOptions: e,
    errorOnInvalidContent: r.errorOnInvalidContent
  });
}
const Sn = (n, t = !1, e = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: c }) => {
  var a, l;
  const { doc: u } = o;
  if (e.preserveWhitespace !== "full") {
    const d = ot(n, s.schema, e, {
      errorOnInvalidContent: (a = r.errorOnInvalidContent) !== null && a !== void 0 ? a : s.options.enableContentCheck
    });
    return i && o.replaceWith(0, u.content.size, d).setMeta("preventUpdate", !t), !0;
  }
  return i && o.setMeta("preventUpdate", !t), c.insertContentAt({ from: 0, to: u.content.size }, n, {
    parseOptions: e,
    errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
  });
};
function jt(n, t) {
  const e = $(t, n.schema), { from: r, to: s, empty: o } = n.selection, i = [];
  o ? (n.storedMarks && i.push(...n.storedMarks), i.push(...n.selection.$head.marks())) : n.doc.nodesBetween(r, s, (a) => {
    i.push(...a.marks);
  });
  const c = i.find((a) => a.type.name === e.name);
  return c ? { ...c.attrs } : {};
}
function En(n) {
  for (let t = 0; t < n.edgeCount; t += 1) {
    const { type: e } = n.edge(t);
    if (e.isTextblock && !e.hasRequiredAttrs())
      return e;
  }
  return null;
}
function xn(n, t) {
  for (let e = n.depth; e > 0; e -= 1) {
    const r = n.node(e);
    if (t(r))
      return {
        pos: e > 0 ? n.before(e) : 0,
        start: n.start(e),
        depth: e,
        node: r
      };
  }
}
function ht(n) {
  return (t) => xn(t.$from, n);
}
function Cn(n, t) {
  const e = {
    from: 0,
    to: n.content.size
  };
  return At(n, e, t);
}
function Tn(n, t) {
  const e = S(t, n.schema), { from: r, to: s } = n.selection, o = [];
  n.doc.nodesBetween(r, s, (c) => {
    o.push(c);
  });
  const i = o.reverse().find((c) => c.type.name === e.name);
  return i ? { ...i.attrs } : {};
}
function An(n, t) {
  const e = Z(typeof t == "string" ? t : t.name, n.schema);
  return e === "node" ? Tn(n, t) : e === "mark" ? jt(n, t) : {};
}
function Ft(n, t, e) {
  const r = [];
  return n === t ? e.resolve(n).marks().forEach((s) => {
    const o = e.resolve(n), i = pt(o, s.type);
    i && r.push({
      mark: s,
      ...i
    });
  }) : e.nodesBetween(n, t, (s, o) => {
    !s || s?.nodeSize === void 0 || r.push(...s.marks.map((i) => ({
      from: o,
      to: o + s.nodeSize,
      mark: i
    })));
  }), r;
}
function K(n, t, e) {
  return Object.fromEntries(Object.entries(e).filter(([r]) => {
    const s = n.find((o) => o.type === t && o.name === r);
    return s ? s.attribute.keepOnSplit : !1;
  }));
}
function it(n, t, e = {}) {
  const { empty: r, ranges: s } = n.selection, o = t ? $(t, n.schema) : null;
  if (r)
    return !!(n.storedMarks || n.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => G(d.attrs, e, { strict: !1 }));
  let i = 0;
  const c = [];
  if (s.forEach(({ $from: d, $to: p }) => {
    const f = d.pos, g = p.pos;
    n.doc.nodesBetween(f, g, (h, m) => {
      if (!h.isText && !h.marks.length)
        return;
      const k = Math.max(f, m), v = Math.min(g, m + h.nodeSize), w = v - k;
      i += w, c.push(...h.marks.map((E) => ({
        mark: E,
        from: k,
        to: v
      })));
    });
  }), i === 0)
    return !1;
  const a = c.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => G(d.mark.attrs, e, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = c.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
  return (a > 0 ? a + l : a) >= i;
}
function Pn(n, t, e = {}) {
  if (!t)
    return L(n, null, e) || it(n, null, e);
  const r = Z(t, n.schema);
  return r === "node" ? L(n, t, e) : r === "mark" ? it(n, t, e) : !1;
}
function Mt(n, t) {
  const { nodeExtensions: e } = Y(t), r = e.find((i) => i.name === n);
  if (!r)
    return !1;
  const s = {
    name: r.name,
    options: r.options,
    storage: r.storage
  }, o = b(y(r, "group", s));
  return typeof o != "string" ? !1 : o.split(" ").includes("list");
}
function mt(n, { checkChildren: t = !0, ignoreWhitespace: e = !1 } = {}) {
  var r;
  if (e) {
    if (n.type.name === "hardBreak")
      return !0;
    if (n.isText)
      return /^\s*$/m.test((r = n.text) !== null && r !== void 0 ? r : "");
  }
  if (n.isText)
    return !n.text;
  if (n.isAtom || n.isLeaf)
    return !1;
  if (n.content.childCount === 0)
    return !0;
  if (t) {
    let s = !0;
    return n.content.forEach((o) => {
      s !== !1 && (mt(o, { ignoreWhitespace: e, checkChildren: t }) || (s = !1));
    }), s;
  }
  return !1;
}
function fr(n) {
  return n instanceof ct;
}
function On(n, t, e) {
  var r;
  const { selection: s } = t;
  let o = null;
  if (It(s) && (o = s.$cursor), o) {
    const c = (r = n.storedMarks) !== null && r !== void 0 ? r : o.marks();
    return !!e.isInSet(c) || !c.some((a) => a.type.excludes(e));
  }
  const { ranges: i } = s;
  return i.some(({ $from: c, $to: a }) => {
    let l = c.depth === 0 ? n.doc.inlineContent && n.doc.type.allowsMarkType(e) : !1;
    return n.doc.nodesBetween(c.pos, a.pos, (u, d, p) => {
      if (l)
        return !1;
      if (u.isInline) {
        const f = !p || p.type.allowsMarkType(e), g = !!e.isInSet(u.marks) || !u.marks.some((h) => h.type.excludes(e));
        l = f && g;
      }
      return !l;
    }), l;
  });
}
const In = (n, t = {}) => ({ tr: e, state: r, dispatch: s }) => {
  const { selection: o } = e, { empty: i, ranges: c } = o, a = $(n, r.schema);
  if (s)
    if (i) {
      const l = jt(r, a);
      e.addStoredMark(a.create({
        ...l,
        ...t
      }));
    } else
      c.forEach((l) => {
        const u = l.$from.pos, d = l.$to.pos;
        r.doc.nodesBetween(u, d, (p, f) => {
          const g = Math.max(f, u), h = Math.min(f + p.nodeSize, d);
          p.marks.find((k) => k.type === a) ? p.marks.forEach((k) => {
            a === k.type && e.addMark(g, h, a.create({
              ...k.attrs,
              ...t
            }));
          }) : e.addMark(g, h, a.create(t));
        });
      });
  return On(r, e, a);
}, $n = (n, t) => ({ tr: e }) => (e.setMeta(n, t), !0), Bn = (n, t = {}) => ({ state: e, dispatch: r, chain: s }) => {
  const o = S(n, e.schema);
  let i;
  return e.selection.$anchor.sameParent(e.selection.$head) && (i = e.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: c }) => gt(o, { ...i, ...t })(e) ? !0 : c.clearNodes()).command(({ state: c }) => gt(o, { ...i, ...t })(c, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
}, Nn = (n) => ({ tr: t, dispatch: e }) => {
  if (e) {
    const { doc: r } = t, s = N(n, 0, r.content.size), o = ct.create(r, s);
    t.setSelection(o);
  }
  return !0;
}, jn = (n) => ({ tr: t, dispatch: e }) => {
  if (e) {
    const { doc: r } = t, { from: s, to: o } = typeof n == "number" ? { from: n, to: n } : n, i = P.atStart(r).from, c = P.atEnd(r).to, a = N(s, i, c), l = N(o, i, c), u = P.create(r, a, l);
    t.setSelection(u);
  }
  return !0;
}, Fn = (n) => ({ state: t, dispatch: e }) => {
  const r = S(n, t.schema);
  return he(r)(t, e);
};
function St(n, t) {
  const e = n.storedMarks || n.selection.$to.parentOffset && n.selection.$from.marks();
  if (e) {
    const r = e.filter((s) => t?.includes(s.type.name));
    n.tr.ensureMarks(r);
  }
}
const Dn = ({ keepMarks: n = !0 } = {}) => ({ tr: t, state: e, dispatch: r, editor: s }) => {
  const { selection: o, doc: i } = t, { $from: c, $to: a } = o, l = s.extensionManager.attributes, u = K(l, c.node().type.name, c.node().attrs);
  if (o instanceof ct && o.node.isBlock)
    return !c.parentOffset || !W(i, c.pos) ? !1 : (r && (n && St(e, s.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
  if (!c.parent.isBlock)
    return !1;
  const d = a.parentOffset === a.parent.content.size, p = c.depth === 0 ? void 0 : En(c.node(-1).contentMatchAt(c.indexAfter(-1)));
  let f = d && p ? [
    {
      type: p,
      attrs: u
    }
  ] : void 0, g = W(t.doc, t.mapping.map(c.pos), 1, f);
  if (!f && !g && W(t.doc, t.mapping.map(c.pos), 1, p ? [{ type: p }] : void 0) && (g = !0, f = p ? [
    {
      type: p,
      attrs: u
    }
  ] : void 0), r) {
    if (g && (o instanceof P && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, f), p && !d && !c.parentOffset && c.parent.type !== p)) {
      const h = t.mapping.map(c.before()), m = t.doc.resolve(h);
      c.node(-1).canReplaceWith(m.index(), m.index() + 1, p) && t.setNodeMarkup(t.mapping.map(c.before()), p);
    }
    n && St(e, s.extensionManager.splittableMarks), t.scrollIntoView();
  }
  return g;
}, Rn = (n, t = {}) => ({ tr: e, state: r, dispatch: s, editor: o }) => {
  var i;
  const c = S(n, r.schema), { $from: a, $to: l } = r.selection, u = r.selection.node;
  if (u && u.isBlock || a.depth < 2 || !a.sameParent(l))
    return !1;
  const d = a.node(-1);
  if (d.type !== c)
    return !1;
  const p = o.extensionManager.attributes;
  if (a.parent.content.size === 0 && a.node(-1).childCount === a.indexAfter(-1)) {
    if (a.depth === 2 || a.node(-3).type !== c || a.index(-2) !== a.node(-2).childCount - 1)
      return !1;
    if (s) {
      let k = I.empty;
      const v = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
      for (let A = a.depth - v; A >= a.depth - 3; A -= 1)
        k = I.from(a.node(A).copy(k));
      const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, E = {
        ...K(p, a.node().type.name, a.node().attrs),
        ...t
      }, M = ((i = c.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(E)) || void 0;
      k = k.append(I.from(c.createAndFill(null, M) || void 0));
      const x = a.before(a.depth - (v - 1));
      e.replace(x, a.after(-w), new Wt(k, 4 - v, 0));
      let T = -1;
      e.doc.nodesBetween(x, e.doc.content.size, (A, Dt) => {
        if (T > -1)
          return !1;
        A.isTextblock && A.content.size === 0 && (T = Dt + 1);
      }), T > -1 && e.setSelection(P.near(e.doc.resolve(T))), e.scrollIntoView();
    }
    return !0;
  }
  const f = l.pos === a.end() ? d.contentMatchAt(0).defaultType : null, g = {
    ...K(p, d.type.name, d.attrs),
    ...t
  }, h = {
    ...K(p, a.node().type.name, a.node().attrs),
    ...t
  };
  e.delete(a.pos, l.pos);
  const m = f ? [
    { type: c, attrs: g },
    { type: f, attrs: h }
  ] : [{ type: c, attrs: g }];
  if (!W(e.doc, a.pos, 2))
    return !1;
  if (s) {
    const { selection: k, storedMarks: v } = r, { splittableMarks: w } = o.extensionManager, E = v || k.$to.parentOffset && k.$from.marks();
    if (e.split(a.pos, 2, m).scrollIntoView(), !E || !s)
      return !0;
    const M = E.filter((x) => w.includes(x.type.name));
    e.ensureMarks(M);
  }
  return !0;
}, nt = (n, t) => {
  const e = ht((i) => i.type === t)(n.selection);
  if (!e)
    return !0;
  const r = n.doc.resolve(Math.max(0, e.pos - 1)).before(e.depth);
  if (r === void 0)
    return !0;
  const s = n.doc.nodeAt(r);
  return e.node.type === s?.type && lt(n.doc, e.pos) && n.join(e.pos), !0;
}, rt = (n, t) => {
  const e = ht((i) => i.type === t)(n.selection);
  if (!e)
    return !0;
  const r = n.doc.resolve(e.start).after(e.depth);
  if (r === void 0)
    return !0;
  const s = n.doc.nodeAt(r);
  return e.node.type === s?.type && lt(n.doc, r) && n.join(r), !0;
}, Ln = (n, t, e, r = {}) => ({ editor: s, tr: o, state: i, dispatch: c, chain: a, commands: l, can: u }) => {
  const { extensions: d, splittableMarks: p } = s.extensionManager, f = S(n, i.schema), g = S(t, i.schema), { selection: h, storedMarks: m } = i, { $from: k, $to: v } = h, w = k.blockRange(v), E = m || h.$to.parentOffset && h.$from.marks();
  if (!w)
    return !1;
  const M = ht((x) => Mt(x.type.name, d))(h);
  if (w.depth >= 1 && M && w.depth - M.depth <= 1) {
    if (M.node.type === f)
      return l.liftListItem(g);
    if (Mt(M.node.type.name, d) && f.validContent(M.node.content) && c)
      return a().command(() => (o.setNodeMarkup(M.pos, f), !0)).command(() => nt(o, f)).command(() => rt(o, f)).run();
  }
  return !e || !E || !c ? a().command(() => u().wrapInList(f, r) ? !0 : l.clearNodes()).wrapInList(f, r).command(() => nt(o, f)).command(() => rt(o, f)).run() : a().command(() => {
    const x = u().wrapInList(f, r), T = E.filter((A) => p.includes(A.type.name));
    return o.ensureMarks(T), x ? !0 : l.clearNodes();
  }).wrapInList(f, r).command(() => nt(o, f)).command(() => rt(o, f)).run();
}, zn = (n, t = {}, e = {}) => ({ state: r, commands: s }) => {
  const { extendEmptyMarkRange: o = !1 } = e, i = $(n, r.schema);
  return it(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
}, Hn = (n, t, e = {}) => ({ state: r, commands: s }) => {
  const o = S(n, r.schema), i = S(t, r.schema), c = L(r, o, e);
  let a;
  return r.selection.$anchor.sameParent(r.selection.$head) && (a = r.selection.$anchor.parent.attrs), c ? s.setNode(i, a) : s.setNode(o, { ...a, ...e });
}, _n = (n, t = {}) => ({ state: e, commands: r }) => {
  const s = S(n, e.schema);
  return L(e, s, t) ? r.lift(s) : r.wrapIn(s, t);
}, Vn = () => ({ state: n, dispatch: t }) => {
  const e = n.plugins;
  for (let r = 0; r < e.length; r += 1) {
    const s = e[r];
    let o;
    if (s.spec.isInputRules && (o = s.getState(n))) {
      if (t) {
        const i = n.tr, c = o.transform;
        for (let a = c.steps.length - 1; a >= 0; a -= 1)
          i.step(c.steps[a].invert(c.docs[a]));
        if (o.text) {
          const a = i.doc.resolve(o.from).marks();
          i.replaceWith(o.from, o.to, n.schema.text(o.text, a));
        } else
          i.delete(o.from, o.to);
      }
      return !0;
    }
  }
  return !1;
}, Wn = () => ({ tr: n, dispatch: t }) => {
  const { selection: e } = n, { empty: r, ranges: s } = e;
  return r || t && s.forEach((o) => {
    n.removeMark(o.$from.pos, o.$to.pos);
  }), !0;
}, Kn = (n, t = {}) => ({ tr: e, state: r, dispatch: s }) => {
  var o;
  const { extendEmptyMarkRange: i = !1 } = t, { selection: c } = e, a = $(n, r.schema), { $from: l, empty: u, ranges: d } = c;
  if (!s)
    return !0;
  if (u && i) {
    let { from: p, to: f } = c;
    const g = (o = l.marks().find((m) => m.type === a)) === null || o === void 0 ? void 0 : o.attrs, h = pt(l, a, g);
    h && (p = h.from, f = h.to), e.removeMark(p, f, a);
  } else
    d.forEach((p) => {
      e.removeMark(p.$from.pos, p.$to.pos, a);
    });
  return e.removeStoredMark(a), !0;
}, Un = (n, t = {}) => ({ tr: e, state: r, dispatch: s }) => {
  let o = null, i = null;
  const c = Z(typeof n == "string" ? n : n.name, r.schema);
  return c ? (c === "node" && (o = S(n, r.schema)), c === "mark" && (i = $(n, r.schema)), s && e.selection.ranges.forEach((a) => {
    const l = a.$from.pos, u = a.$to.pos;
    let d, p, f, g;
    e.selection.empty ? r.doc.nodesBetween(l, u, (h, m) => {
      o && o === h.type && (f = Math.max(m, l), g = Math.min(m + h.nodeSize, u), d = m, p = h);
    }) : r.doc.nodesBetween(l, u, (h, m) => {
      m < l && o && o === h.type && (f = Math.max(m, l), g = Math.min(m + h.nodeSize, u), d = m, p = h), m >= l && m <= u && (o && o === h.type && e.setNodeMarkup(m, void 0, {
        ...h.attrs,
        ...t
      }), i && h.marks.length && h.marks.forEach((k) => {
        if (i === k.type) {
          const v = Math.max(m, l), w = Math.min(m + h.nodeSize, u);
          e.addMark(v, w, i.create({
            ...k.attrs,
            ...t
          }));
        }
      }));
    }), p && (d !== void 0 && e.setNodeMarkup(d, void 0, {
      ...p.attrs,
      ...t
    }), i && p.marks.length && p.marks.forEach((h) => {
      i === h.type && e.addMark(f, g, i.create({
        ...h.attrs,
        ...t
      }));
    }));
  }), !0) : !1;
}, Gn = (n, t = {}) => ({ state: e, dispatch: r }) => {
  const s = S(n, e.schema);
  return Jt(s, t)(e, r);
}, qn = (n, t = {}) => ({ state: e, dispatch: r }) => {
  const s = S(n, e.schema);
  return fe(s, t)(e, r);
};
var Jn = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  blur: Be,
  clearContent: Ne,
  clearNodes: je,
  command: Fe,
  createParagraphNear: De,
  cut: Re,
  deleteCurrentNode: Le,
  deleteNode: ze,
  deleteRange: He,
  deleteSelection: _e,
  enter: Ve,
  exitCode: We,
  extendMarkRange: Ke,
  first: Ue,
  focus: qe,
  forEach: Je,
  insertContent: Ye,
  insertContentAt: Ze,
  joinBackward: nn,
  joinDown: en,
  joinForward: rn,
  joinItemBackward: sn,
  joinItemForward: on,
  joinTextblockBackward: an,
  joinTextblockForward: cn,
  joinUp: tn,
  keyboardShortcut: dn,
  lift: un,
  liftEmptyBlock: pn,
  liftListItem: fn,
  newlineInCode: hn,
  resetAttributes: mn,
  scrollIntoView: gn,
  selectAll: yn,
  selectNodeBackward: kn,
  selectNodeForward: bn,
  selectParentNode: vn,
  selectTextblockEnd: wn,
  selectTextblockStart: Mn,
  setContent: Sn,
  setMark: In,
  setMeta: $n,
  setNode: Bn,
  setNodeSelection: Nn,
  setTextSelection: jn,
  sinkListItem: Fn,
  splitBlock: Dn,
  splitListItem: Rn,
  toggleList: Ln,
  toggleMark: zn,
  toggleNode: Hn,
  toggleWrap: _n,
  undoInputRule: Vn,
  unsetAllMarks: Wn,
  unsetMark: Kn,
  updateAttributes: Un,
  wrapIn: Gn,
  wrapInList: qn
});
const Yn = C.create({
  name: "commands",
  addCommands() {
    return {
      ...Jn
    };
  }
}), Qn = C.create({
  name: "drop",
  addProseMirrorPlugins() {
    return [
      new O({
        key: new j("tiptapDrop"),
        props: {
          handleDrop: (n, t, e, r) => {
            this.editor.emit("drop", {
              editor: this.editor,
              event: t,
              slice: e,
              moved: r
            });
          }
        }
      })
    ];
  }
}), Xn = C.create({
  name: "editable",
  addProseMirrorPlugins() {
    return [
      new O({
        key: new j("editable"),
        props: {
          editable: () => this.editor.options.editable
        }
      })
    ];
  }
}), Zn = new j("focusEvents"), tr = C.create({
  name: "focusEvents",
  addProseMirrorPlugins() {
    const { editor: n } = this;
    return [
      new O({
        key: Zn,
        props: {
          handleDOMEvents: {
            focus: (t, e) => {
              n.isFocused = !0;
              const r = n.state.tr.setMeta("focus", { event: e }).setMeta("addToHistory", !1);
              return t.dispatch(r), !1;
            },
            blur: (t, e) => {
              n.isFocused = !1;
              const r = n.state.tr.setMeta("blur", { event: e }).setMeta("addToHistory", !1);
              return t.dispatch(r), !1;
            }
          }
        }
      })
    ];
  }
}), er = C.create({
  name: "keymap",
  addKeyboardShortcuts() {
    const n = () => this.editor.commands.first(({ commands: i }) => [
      () => i.undoInputRule(),
      // maybe convert first text block node to default node
      () => i.command(({ tr: c }) => {
        const { selection: a, doc: l } = c, { empty: u, $anchor: d } = a, { pos: p, parent: f } = d, g = d.parent.isTextblock && p > 0 ? c.doc.resolve(p - 1) : d, h = g.parent.type.spec.isolating, m = d.pos - d.parentOffset, k = h && g.parent.childCount === 1 ? m === d.pos : D.atStart(l).from === p;
        return !u || !f.type.isTextblock || f.textContent.length || !k || k && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
      }),
      () => i.deleteSelection(),
      () => i.joinBackward(),
      () => i.selectNodeBackward()
    ]), t = () => this.editor.commands.first(({ commands: i }) => [
      () => i.deleteSelection(),
      () => i.deleteCurrentNode(),
      () => i.joinForward(),
      () => i.selectNodeForward()
    ]), r = {
      Enter: () => this.editor.commands.first(({ commands: i }) => [
        () => i.newlineInCode(),
        () => i.createParagraphNear(),
        () => i.liftEmptyBlock(),
        () => i.splitBlock()
      ]),
      "Mod-Enter": () => this.editor.commands.exitCode(),
      Backspace: n,
      "Mod-Backspace": n,
      "Shift-Backspace": n,
      Delete: t,
      "Mod-Delete": t,
      "Mod-a": () => this.editor.commands.selectAll()
    }, s = {
      ...r
    }, o = {
      ...r,
      "Ctrl-h": n,
      "Alt-Backspace": n,
      "Ctrl-d": t,
      "Ctrl-Alt-Backspace": t,
      "Alt-Delete": t,
      "Alt-d": t,
      "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
      "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
    };
    return ft() || Nt() ? o : s;
  },
  addProseMirrorPlugins() {
    return [
      // With this plugin we check if the whole document was selected and deleted.
      // In this case we will additionally call `clearNodes()` to convert e.g. a heading
      // to a paragraph if necessary.
      // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
      // with many other commands.
      new O({
        key: new j("clearDocument"),
        appendTransaction: (n, t, e) => {
          if (n.some((h) => h.getMeta("composition")))
            return;
          const r = n.some((h) => h.docChanged) && !t.doc.eq(e.doc), s = n.some((h) => h.getMeta("preventClearDocument"));
          if (!r || s)
            return;
          const { empty: o, from: i, to: c } = t.selection, a = D.atStart(t.doc).from, l = D.atEnd(t.doc).to;
          if (o || !(i === a && c === l) || !mt(e.doc))
            return;
          const p = e.tr, f = q({
            state: e,
            transaction: p
          }), { commands: g } = new J({
            editor: this.editor,
            state: f
          });
          if (g.clearNodes(), !!p.steps.length)
            return p;
        }
      })
    ];
  }
}), nr = C.create({
  name: "paste",
  addProseMirrorPlugins() {
    return [
      new O({
        key: new j("tiptapPaste"),
        props: {
          handlePaste: (n, t, e) => {
            this.editor.emit("paste", {
              editor: this.editor,
              event: t,
              slice: e
            });
          }
        }
      })
    ];
  }
}), rr = C.create({
  name: "tabindex",
  addProseMirrorPlugins() {
    return [
      new O({
        key: new j("tabindex"),
        props: {
          attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
        }
      })
    ];
  }
});
class B {
  get name() {
    return this.node.type.name;
  }
  constructor(t, e, r = !1, s = null) {
    this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = e, this.currentNode = s;
  }
  get node() {
    return this.currentNode || this.resolvedPos.node();
  }
  get element() {
    return this.editor.view.domAtPos(this.pos).node;
  }
  get depth() {
    var t;
    return (t = this.actualDepth) !== null && t !== void 0 ? t : this.resolvedPos.depth;
  }
  get pos() {
    return this.resolvedPos.pos;
  }
  get content() {
    return this.node.content;
  }
  set content(t) {
    let e = this.from, r = this.to;
    if (this.isBlock) {
      if (this.content.size === 0) {
        console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
        return;
      }
      e = this.from + 1, r = this.to - 1;
    }
    this.editor.commands.insertContentAt({ from: e, to: r }, t);
  }
  get attributes() {
    return this.node.attrs;
  }
  get textContent() {
    return this.node.textContent;
  }
  get size() {
    return this.node.nodeSize;
  }
  get from() {
    return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
  }
  get range() {
    return {
      from: this.from,
      to: this.to
    };
  }
  get to() {
    return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
  }
  get parent() {
    if (this.depth === 0)
      return null;
    const t = this.resolvedPos.start(this.resolvedPos.depth - 1), e = this.resolvedPos.doc.resolve(t);
    return new B(e, this.editor);
  }
  get before() {
    let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
    return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new B(t, this.editor);
  }
  get after() {
    let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
    return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new B(t, this.editor);
  }
  get children() {
    const t = [];
    return this.node.content.forEach((e, r) => {
      const s = e.isBlock && !e.isTextblock, o = e.isAtom && !e.isText, i = this.pos + r + (o ? 0 : 1), c = this.resolvedPos.doc.resolve(i);
      if (!s && c.depth <= this.depth)
        return;
      const a = new B(c, this.editor, s, s ? e : null);
      s && (a.actualDepth = this.depth + 1), t.push(new B(c, this.editor, s, s ? e : null));
    }), t;
  }
  get firstChild() {
    return this.children[0] || null;
  }
  get lastChild() {
    const t = this.children;
    return t[t.length - 1] || null;
  }
  closest(t, e = {}) {
    let r = null, s = this.parent;
    for (; s && !r; ) {
      if (s.node.type.name === t)
        if (Object.keys(e).length > 0) {
          const o = s.node.attrs, i = Object.keys(e);
          for (let c = 0; c < i.length; c += 1) {
            const a = i[c];
            if (o[a] !== e[a])
              break;
          }
        } else
          r = s;
      s = s.parent;
    }
    return r;
  }
  querySelector(t, e = {}) {
    return this.querySelectorAll(t, e, !0)[0] || null;
  }
  querySelectorAll(t, e = {}, r = !1) {
    let s = [];
    if (!this.children || this.children.length === 0)
      return s;
    const o = Object.keys(e);
    return this.children.forEach((i) => {
      r && s.length > 0 || (i.node.type.name === t && o.every((a) => e[a] === i.node.attrs[a]) && s.push(i), !(r && s.length > 0) && (s = s.concat(i.querySelectorAll(t, e, r))));
    }), s;
  }
  setAttribute(t) {
    const { tr: e } = this.editor.state;
    e.setNodeMarkup(this.from, void 0, {
      ...this.node.attrs,
      ...t
    }), this.editor.view.dispatch(e);
  }
}
const sr = `.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}

.tippy-box[data-animation=fade][data-state=hidden] {
  opacity: 0
}`;
function or(n, t, e) {
  const r = document.querySelector("style[data-tiptap-style]");
  if (r !== null)
    return r;
  const s = document.createElement("style");
  return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = n, document.getElementsByTagName("head")[0].appendChild(s), s;
}
class hr extends ge {
  constructor(t = {}) {
    super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
      element: document.createElement("div"),
      content: "",
      injectCSS: !0,
      injectNonce: void 0,
      extensions: [],
      autofocus: !1,
      editable: !0,
      editorProps: {},
      parseOptions: {},
      coreExtensionOptions: {},
      enableInputRules: !0,
      enablePasteRules: !0,
      enableCoreExtensions: !0,
      enableContentCheck: !1,
      emitContentError: !1,
      onBeforeCreate: () => null,
      onCreate: () => null,
      onUpdate: () => null,
      onSelectionUpdate: () => null,
      onTransaction: () => null,
      onFocus: () => null,
      onBlur: () => null,
      onDestroy: () => null,
      onContentError: ({ error: e }) => {
        throw e;
      },
      onPaste: () => null,
      onDrop: () => null
    }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.createView(), this.injectCSS(), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: r, moved: s }) => this.options.onDrop(e, r, s)), this.on("paste", ({ event: e, slice: r }) => this.options.onPaste(e, r)), window.setTimeout(() => {
      this.isDestroyed || (this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
    }, 0);
  }
  /**
   * Returns the editor storage.
   */
  get storage() {
    return this.extensionStorage;
  }
  /**
   * An object of all registered commands.
   */
  get commands() {
    return this.commandManager.commands;
  }
  /**
   * Create a command chain to call multiple commands at once.
   */
  chain() {
    return this.commandManager.chain();
  }
  /**
   * Check if a command or a command chain can be executed. Without executing it.
   */
  can() {
    return this.commandManager.can();
  }
  /**
   * Inject CSS styles.
   */
  injectCSS() {
    this.options.injectCSS && document && (this.css = or(sr, this.options.injectNonce));
  }
  /**
   * Update editor options.
   *
   * @param options A list of options
   */
  setOptions(t = {}) {
    this.options = {
      ...this.options,
      ...t
    }, !(!this.view || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
  }
  /**
   * Update editable state of the editor.
   */
  setEditable(t, e = !0) {
    this.setOptions({ editable: t }), e && this.emit("update", { editor: this, transaction: this.state.tr });
  }
  /**
   * Returns whether the editor is editable.
   */
  get isEditable() {
    return this.options.editable && this.view && this.view.editable;
  }
  /**
   * Returns the editor state.
   */
  get state() {
    return this.view.state;
  }
  /**
   * Register a ProseMirror plugin.
   *
   * @param plugin A ProseMirror plugin
   * @param handlePlugins Control how to merge the plugin into the existing plugins.
   * @returns The new editor state
   */
  registerPlugin(t, e) {
    const r = Tt(e) ? e(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
    return this.view.updateState(s), s;
  }
  /**
   * Unregister a ProseMirror plugin.
   *
   * @param nameOrPluginKeyToRemove The plugins name
   * @returns The new editor state or undefined if the editor is destroyed
   */
  unregisterPlugin(t) {
    if (this.isDestroyed)
      return;
    const e = this.state.plugins;
    let r = e;
    if ([].concat(t).forEach((o) => {
      const i = typeof o == "string" ? `${o}$` : o.key;
      r = r.filter((c) => !c.key.startsWith(i));
    }), e.length === r.length)
      return;
    const s = this.state.reconfigure({
      plugins: r
    });
    return this.view.updateState(s), s;
  }
  /**
   * Creates an extension manager.
   */
  createExtensionManager() {
    var t, e;
    const s = [...this.options.enableCoreExtensions ? [
      Xn,
      $e.configure({
        blockSeparator: (e = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || e === void 0 ? void 0 : e.blockSeparator
      }),
      Yn,
      tr,
      er,
      rr,
      Qn,
      nr
    ].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o?.type));
    this.extensionManager = new F(s, this);
  }
  /**
   * Creates an command manager.
   */
  createCommandManager() {
    this.commandManager = new J({
      editor: this
    });
  }
  /**
   * Creates a ProseMirror schema.
   */
  createSchema() {
    this.schema = this.extensionManager.schema;
  }
  /**
   * Creates a ProseMirror view.
   */
  createView() {
    var t;
    let e;
    try {
      e = ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
    } catch (i) {
      if (!(i instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(i.message))
        throw i;
      this.emit("contentError", {
        editor: this,
        error: i,
        disableCollaboration: () => {
          this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((c) => c.name !== "collaboration"), this.createExtensionManager();
        }
      }), e = ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
    }
    const r = $t(e, this.options.autofocus);
    this.view = new zt(this.options.element, {
      ...this.options.editorProps,
      attributes: {
        // add `role="textbox"` to the editor element
        role: "textbox",
        ...(t = this.options.editorProps) === null || t === void 0 ? void 0 : t.attributes
      },
      dispatchTransaction: this.dispatchTransaction.bind(this),
      state: Rt.create({
        doc: e,
        selection: r || void 0
      })
    });
    const s = this.state.reconfigure({
      plugins: this.extensionManager.plugins
    });
    this.view.updateState(s), this.createNodeViews(), this.prependClass();
    const o = this.view.dom;
    o.editor = this;
  }
  /**
   * Creates all node views.
   */
  createNodeViews() {
    this.view.isDestroyed || this.view.setProps({
      nodeViews: this.extensionManager.nodeViews
    });
  }
  /**
   * Prepend class name to element.
   */
  prependClass() {
    this.view.dom.className = `tiptap ${this.view.dom.className}`;
  }
  captureTransaction(t) {
    this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
    const e = this.capturedTransaction;
    return this.capturedTransaction = null, e;
  }
  /**
   * The callback over which to send transactions (state updates) produced by the view.
   *
   * @param transaction An editor state transaction
   */
  dispatchTransaction(t) {
    if (this.view.isDestroyed)
      return;
    if (this.isCapturingTransaction) {
      if (!this.capturedTransaction) {
        this.capturedTransaction = t;
        return;
      }
      t.steps.forEach((i) => {
        var c;
        return (c = this.capturedTransaction) === null || c === void 0 ? void 0 : c.step(i);
      });
      return;
    }
    const e = this.state.apply(t), r = !this.state.selection.eq(e.selection);
    this.emit("beforeTransaction", {
      editor: this,
      transaction: t,
      nextState: e
    }), this.view.updateState(e), this.emit("transaction", {
      editor: this,
      transaction: t
    }), r && this.emit("selectionUpdate", {
      editor: this,
      transaction: t
    });
    const s = t.getMeta("focus"), o = t.getMeta("blur");
    s && this.emit("focus", {
      editor: this,
      event: s.event,
      transaction: t
    }), o && this.emit("blur", {
      editor: this,
      event: o.event,
      transaction: t
    }), !(!t.docChanged || t.getMeta("preventUpdate")) && this.emit("update", {
      editor: this,
      transaction: t
    });
  }
  /**
   * Get attributes of the currently selected node or mark.
   */
  getAttributes(t) {
    return An(this.state, t);
  }
  isActive(t, e) {
    const r = typeof t == "string" ? t : null, s = typeof t == "string" ? e : t;
    return Pn(this.state, r, s);
  }
  /**
   * Get the document as JSON.
   */
  getJSON() {
    return this.state.doc.toJSON();
  }
  /**
   * Get the document as HTML.
   */
  getHTML() {
    return dt(this.state.doc.content, this.schema);
  }
  /**
   * Get the document as text.
   */
  getText(t) {
    const { blockSeparator: e = `

`, textSerializers: r = {} } = t || {};
    return Cn(this.state.doc, {
      blockSeparator: e,
      textSerializers: {
        ...Pt(this.schema),
        ...r
      }
    });
  }
  /**
   * Check if there is no content.
   */
  get isEmpty() {
    return mt(this.state.doc);
  }
  /**
   * Get the number of characters for the current document.
   *
   * @deprecated
   */
  getCharacterCount() {
    return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'), this.state.doc.content.size - 2;
  }
  /**
   * Destroy the editor.
   */
  destroy() {
    if (this.emit("destroy"), this.view) {
      const t = this.view.dom;
      t && t.editor && delete t.editor, this.view.destroy();
    }
    this.removeAllListeners();
  }
  /**
   * Check if the editor is already destroyed.
   */
  get isDestroyed() {
    var t;
    return !(!((t = this.view) === null || t === void 0) && t.docView);
  }
  $node(t, e) {
    var r;
    return ((r = this.$doc) === null || r === void 0 ? void 0 : r.querySelector(t, e)) || null;
  }
  $nodes(t, e) {
    var r;
    return ((r = this.$doc) === null || r === void 0 ? void 0 : r.querySelectorAll(t, e)) || null;
  }
  $pos(t) {
    const e = this.state.doc.resolve(t);
    return new B(e, this);
  }
  get $doc() {
    return this.$pos(0);
  }
}
function mr(n) {
  return new Q({
    find: n.find,
    handler: ({ state: t, range: e, match: r }) => {
      const s = b(n.getAttributes, void 0, r);
      if (s === !1 || s === null)
        return null;
      const { tr: o } = t, i = r[r.length - 1], c = r[0];
      if (i) {
        const a = c.search(/\S/), l = e.from + c.indexOf(i), u = l + i.length;
        if (Ft(e.from, e.to, t.doc).filter((f) => f.mark.type.excluded.find((h) => h === n.type && h !== f.mark.type)).filter((f) => f.to > l).length)
          return null;
        u < e.to && o.delete(u, e.to), l > e.from && o.delete(e.from + a, l);
        const p = e.from + a + i.length;
        o.addMark(e.from + a, p, n.type.create(s || {})), o.removeStoredMark(n.type);
      }
    }
  });
}
function gr(n) {
  return new Q({
    find: n.find,
    handler: ({ state: t, range: e, match: r }) => {
      const s = b(n.getAttributes, void 0, r) || {}, { tr: o } = t, i = e.from;
      let c = e.to;
      const a = n.type.create(s);
      if (r[1]) {
        const l = r[0].lastIndexOf(r[1]);
        let u = i + l;
        u > c ? u = c : c = u + r[1].length;
        const d = r[0][r[0].length - 1];
        o.insertText(d, i + r[0].length - 1), o.replaceWith(u, c, a);
      } else if (r[0]) {
        const l = n.type.isInline ? i : i - 1;
        o.insert(l, n.type.create(s)).delete(o.mapping.map(i), o.mapping.map(c));
      }
      o.scrollIntoView();
    }
  });
}
function yr(n) {
  return new Q({
    find: n.find,
    handler: ({ state: t, range: e, match: r }) => {
      const s = t.doc.resolve(e.from), o = b(n.getAttributes, void 0, r) || {};
      if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), n.type))
        return null;
      t.tr.delete(e.from, e.to).setBlockType(e.from, e.from, n.type, o);
    }
  });
}
function kr(n) {
  return new Q({
    find: n.find,
    handler: ({ state: t, range: e, match: r, chain: s }) => {
      const o = b(n.getAttributes, void 0, r) || {}, i = t.tr.delete(e.from, e.to), a = i.doc.resolve(e.from).blockRange(), l = a && Kt(a, n.type, o);
      if (!l)
        return null;
      if (i.wrap(a, l), n.keepMarks && n.editor) {
        const { selection: d, storedMarks: p } = t, { splittableMarks: f } = n.editor.extensionManager, g = p || d.$to.parentOffset && d.$from.marks();
        if (g) {
          const h = g.filter((m) => f.includes(m.type.name));
          i.ensureMarks(h);
        }
      }
      if (n.keepAttributes) {
        const d = n.type.name === "bulletList" || n.type.name === "orderedList" ? "listItem" : "taskList";
        s().updateAttributes(d, o).run();
      }
      const u = i.doc.resolve(e.from - 1).nodeBefore;
      u && u.type === n.type && lt(i.doc, e.from - 1) && (!n.joinPredicate || n.joinPredicate(r, u)) && i.join(e.from - 1);
    }
  });
}
class at {
  constructor(t = {}) {
    this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
      name: this.name,
      defaultOptions: {}
    }, this.config = {
      ...this.config,
      ...t
    }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = b(y(this, "addOptions", {
      name: this.name
    }))), this.storage = b(y(this, "addStorage", {
      name: this.name,
      options: this.options
    })) || {};
  }
  static create(t = {}) {
    return new at(t);
  }
  configure(t = {}) {
    const e = this.extend({
      ...this.config,
      addOptions: () => X(this.options, t)
    });
    return e.name = this.name, e.parent = this.parent, e;
  }
  extend(t = {}) {
    const e = new at(t);
    return e.parent = this, this.child = e, e.name = t.name ? t.name : e.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`), e.options = b(y(e, "addOptions", {
      name: e.name
    })), e.storage = b(y(e, "addStorage", {
      name: e.name,
      options: e.options
    })), e;
  }
}
function br(n) {
  return new Ce({
    find: n.find,
    handler: ({ state: t, range: e, match: r, pasteEvent: s }) => {
      const o = b(n.getAttributes, void 0, r, s);
      if (o === !1 || o === null)
        return null;
      const { tr: i } = t, c = r[r.length - 1], a = r[0];
      let l = e.to;
      if (c) {
        const u = a.search(/\S/), d = e.from + a.indexOf(c), p = d + c.length;
        if (Ft(e.from, e.to, t.doc).filter((g) => g.mark.type.excluded.find((m) => m === n.type && m !== g.mark.type)).filter((g) => g.to > d).length)
          return null;
        p < e.to && i.delete(p, e.to), d > e.from && i.delete(e.from + u, d), l = e.from + u + c.length, i.addMark(e.from + u, l, n.type.create(o || {})), i.removeStoredMark(n.type);
      }
    }
  });
}
function vr(n) {
  return n.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
export {
  J as CommandManager,
  hr as Editor,
  C as Extension,
  Q as InputRule,
  U as Mark,
  at as Node,
  B as NodePos,
  Ce as PasteRule,
  b as callOrReturn,
  q as createChainableState,
  ot as createDocument,
  R as createNodeFromContent,
  or as createStyleTag,
  En as defaultBlockAt,
  wt as deleteProps,
  V as elementFromString,
  vr as escapeForRegEx,
  Ie as findDuplicates,
  ht as findParentNode,
  xn as findParentNodeClosestToPos,
  be as fromString,
  An as getAttributes,
  Ct as getAttributesFromExtensions,
  y as getExtensionField,
  dt as getHTMLFromFragment,
  jt as getMarkAttributes,
  pt as getMarkRange,
  $ as getMarkType,
  Ft as getMarksBetween,
  Tn as getNodeAttributes,
  S as getNodeType,
  st as getRenderedAttributes,
  ve as getSchemaByResolvedExtensions,
  et as getSchemaTypeByName,
  Z as getSchemaTypeNameByName,
  K as getSplittedAttributes,
  Cn as getText,
  At as getTextBetween,
  we as getTextContentFromNodes,
  Pt as getTextSerializersFromSchema,
  yt as injectExtensionAttributesToParseRule,
  Se as inputRulesPlugin,
  Pn as isActive,
  ke as isEmptyObject,
  bt as isExtensionRulesEnabled,
  Tt as isFunction,
  Mt as isList,
  Nt as isMacOS,
  it as isMarkActive,
  L as isNodeActive,
  mt as isNodeEmpty,
  fr as isNodeSelection,
  xe as isNumber,
  H as isPlainObject,
  ut as isRegExp,
  It as isTextSelection,
  ft as isiOS,
  mr as markInputRule,
  br as markPasteRule,
  ye as mergeAttributes,
  X as mergeDeep,
  N as minMax,
  gr as nodeInputRule,
  G as objectIncludes,
  Oe as pasteRulesPlugin,
  $t as resolveFocusPosition,
  Qe as selectionToInsertionEnd,
  Y as splitExtensions,
  yr as textblockTypeInputRule,
  kr as wrappingInputRule
};
//# sourceMappingURL=index.js.map
