var o = Object.defineProperty;
var n = (r, t, e) => t in r ? o(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
var s = (r, t, e) => (n(r, typeof t != "symbol" ? t + "" : t, e), e);
import c from "../blots/inline.mjs";
class i extends c {
  static create(t) {
    const e = super.create(t);
    return e.setAttribute("href", this.sanitize(t)), e.setAttribute("rel", "noopener noreferrer"), e.setAttribute("target", "_blank"), e;
  }
  static formats(t) {
    return t.getAttribute("href");
  }
  static sanitize(t) {
    return f(t, this.PROTOCOL_WHITELIST) ? t : this.SANITIZED_URL;
  }
  format(t, e) {
    t !== this.statics.blotName || !e ? super.format(t, e) : this.domNode.setAttribute("href", this.constructor.sanitize(e));
  }
}
s(i, "blotName", "link"), s(i, "tagName", "A"), s(i, "SANITIZED_URL", "about:blank"), s(i, "PROTOCOL_WHITELIST", ["http", "https", "mailto", "tel", "sms"]);
function f(r, t) {
  const e = document.createElement("a");
  e.href = r;
  const a = e.href.slice(0, e.href.indexOf(":"));
  return t.indexOf(a) > -1;
}
export {
  i as default,
  f as sanitize
};
