var n = Object.defineProperty;
var p = (o, t, i) => t in o ? n(o, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[t] = i;
var a = (o, t, i) => (p(o, typeof t != "symbol" ? t + "" : t, i), i);
import { InlineBlot as d, EmbedBlot as f, Scope as m } from "../../../../parchment@3.0.0/node_modules/parchment/dist/parchment.mjs";
import h from "./break.mjs";
import u from "./text.mjs";
const r = class r extends d {
  static compare(t, i) {
    const e = r.order.indexOf(t), s = r.order.indexOf(i);
    return e >= 0 || s >= 0 ? e - s : t === i ? 0 : t < i ? -1 : 1;
  }
  formatAt(t, i, e, s) {
    if (r.compare(this.statics.blotName, e) < 0 && this.scroll.query(e, m.BLOT)) {
      const l = this.isolate(t, i);
      s && l.wrap(e, s);
    } else
      super.formatAt(t, i, e, s);
  }
  optimize(t) {
    if (super.optimize(t), this.parent instanceof r && r.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
      const i = this.parent.isolate(this.offset(), this.length());
      this.moveChildren(i), i.wrap(this);
    }
  }
};
a(r, "allowedChildren", [r, h, f, u]), // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
a(r, "order", [
  "cursor",
  "inline",
  // Must be lower
  "link",
  // Chrome wants <a> to be lower
  "underline",
  "strike",
  "italic",
  "bold",
  "script",
  "code"
  // Must be higher
]);
let c = r;
export {
  c as default
};
