const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", le = "__editoraCommandEditorRoot", ie = "rte-smart-paste-styles", u = "rte-smart-paste-panel", x = "smart-paste", E = "smartPaste", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ke = typeof NodeFilter != "undefined" ? NodeFilter.SHOW_COMMENT : 128, ce = "__editoraSmartPasteHandled", Ce = /* @__PURE__ */ new Set([
  "script",
  "style",
  "meta",
  "link",
  "object",
  "embed",
  "iframe",
  "svg",
  "canvas",
  "math",
  "form",
  "input",
  "button",
  "textarea",
  "select",
  "option"
]), Te = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Ae = /* @__PURE__ */ new Set(["span", "font"]), Pe = /^(https?:|mailto:|tel:|#|\/)/i, Le = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, we = /* @__PURE__ */ new Set([
  "color",
  "background-color",
  "font-weight",
  "font-style",
  "text-decoration",
  "text-align",
  "font-size",
  "font-family",
  "line-height",
  "letter-spacing",
  "word-spacing",
  "white-space",
  "vertical-align",
  "margin-left",
  "margin-right",
  "margin-top",
  "margin-bottom",
  "padding-left",
  "padding-right",
  "padding-top",
  "padding-bottom",
  "text-indent",
  "border",
  "border-top",
  "border-right",
  "border-bottom",
  "border-left",
  "border-color",
  "border-width",
  "border-style",
  "list-style-type"
]), $e = {
  panelTitle: "Smart Paste",
  panelAriaLabel: "Smart paste panel",
  enabledText: "Smart paste is enabled",
  disabledText: "Smart paste is disabled",
  toggleOnText: "Disable Smart Paste",
  toggleOffText: "Enable Smart Paste",
  cycleProfileText: "Cycle Profile",
  profileLabel: "Profile",
  fidelityText: "Fidelity",
  balancedText: "Balanced",
  plainText: "Plain Text",
  lastPasteHeading: "Last Paste Result",
  lastPasteEmptyText: "Paste content to see cleanup metrics.",
  lastPasteSourceLabel: "Source",
  lastPasteProfileLabel: "Profile",
  lastPasteRemovedLabel: "Removed",
  lastPasteCharsLabel: "Output Chars",
  closeText: "Close",
  shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",
  readonlyMessage: "Editor is read-only. Smart paste was skipped."
}, Y = {
  fidelity: {
    keepStyles: !0,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !0
  },
  balanced: {
    keepStyles: !1,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !0
  },
  plain: {
    keepStyles: !1,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !1
  }
}, d = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Set();
let W = 0, Me = 0, O = null, b = null, L = null, w = null, A = null, $ = null;
function X(e) {
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
}
function Oe(e) {
  return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
`);
}
function H(e) {
  return e === "balanced" || e === "plain" ? e : "fidelity";
}
function Z(e, t) {
  var a, r, n, o;
  return {
    keepStyles: (a = e == null ? void 0 : e.keepStyles) != null ? a : t.keepStyles,
    keepClasses: (r = e == null ? void 0 : e.keepClasses) != null ? r : t.keepClasses,
    keepDataAttributes: (n = e == null ? void 0 : e.keepDataAttributes) != null ? n : t.keepDataAttributes,
    preserveTables: (o = e == null ? void 0 : e.preserveTables) != null ? o : t.preserveTables
  };
}
function V(e = {}) {
  var a;
  const t = e.profileOptions || {};
  return {
    enabled: e.enabled !== !1,
    defaultProfile: H(e.defaultProfile),
    maxHtmlLength: Math.max(8e3, Math.min(8e5, Number((a = e.maxHtmlLength) != null ? a : 22e4))),
    removeComments: e.removeComments !== !1,
    normalizeWhitespace: e.normalizeWhitespace !== !1,
    labels: {
      ...$e,
      ...e.labels || {}
    },
    normalizeText: e.normalizeText || Oe,
    profileOptions: {
      fidelity: Z(t.fidelity, Y.fidelity),
      balanced: Z(t.balanced, Y.balanced),
      plain: Z(t.plain, Y.plain)
    }
  };
}
function de(e) {
  return {
    enabled: e.enabled,
    defaultProfile: e.defaultProfile,
    maxHtmlLength: e.maxHtmlLength,
    removeComments: e.removeComments,
    normalizeWhitespace: e.normalizeWhitespace,
    labels: { ...e.labels },
    normalizeText: e.normalizeText,
    profileOptions: {
      fidelity: { ...e.profileOptions.fidelity },
      balanced: { ...e.profileOptions.balanced },
      plain: { ...e.profileOptions.plain }
    }
  };
}
function te(e) {
  return e.closest(ee) || e;
}
function D(e) {
  if (!e) return null;
  if (e.matches(v)) return e;
  const t = e.querySelector(v);
  return t instanceof HTMLElement ? t : null;
}
function Re() {
  if (typeof window == "undefined") return null;
  const e = window[le];
  if (!(e instanceof HTMLElement)) return null;
  window[le] = null;
  const t = D(e);
  if (t) return t;
  const a = e.closest(ee);
  if (a) {
    const n = D(a);
    if (n) return n;
  }
  const r = e.closest(v);
  return r instanceof HTMLElement ? r : null;
}
function ze(e) {
  const t = e.closest("[data-editora-editor]");
  if (t && D(t) === e)
    return t;
  let a = e;
  for (; a; ) {
    if (a.matches(ee) && (a === e || D(a) === e))
      return a;
    a = a.parentElement;
  }
  return te(e);
}
function me(e) {
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
}
function T(e, t = !0, a = !0) {
  if (j(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
    const s = D(e.editorElement);
    if (s) return s;
  }
  const r = Re();
  if (r) return r;
  const n = window.getSelection();
  if (n && n.rangeCount > 0) {
    const s = me(n.getRangeAt(0).startContainer), l = s == null ? void 0 : s.closest(v);
    if (l) return l;
  }
  const o = document.activeElement;
  if (o) {
    if (o.matches(v)) return o;
    const s = o.closest(v);
    if (s) return s;
  }
  if (a) {
    if (b && b.isConnected) return b;
    b && !b.isConnected && (b = null);
  }
  return t ? document.querySelector(v) : null;
}
function _e(e) {
  const t = e.target;
  if (t) {
    const r = t.closest(v);
    if (r) return r;
  }
  const a = window.getSelection();
  if (a && a.rangeCount > 0) {
    const r = me(a.getRangeAt(0).startContainer), n = r == null ? void 0 : r.closest(v);
    if (n) return n;
  }
  return null;
}
function K(e) {
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
}
function He(e) {
  const t = te(e);
  if (K(t)) return !0;
  const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
  return K(a) ? !0 : K(document.documentElement) || K(document.body);
}
function G(e, t) {
  e.classList.remove("rte-smart-paste-theme-dark"), He(t) && e.classList.add("rte-smart-paste-theme-dark");
}
function ue(e) {
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
}
function N(e, t, a) {
  const r = ze(e);
  Array.from(
    r.querySelectorAll(
      `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
    )
  ).forEach((o) => {
    o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
  });
}
function m(e, t) {
  d.has(e) || d.set(e, t);
  let a = M.get(e);
  return a || (a = {
    enabled: t.enabled,
    profile: t.defaultProfile,
    lastReport: null
  }, M.set(e, a)), et(e), _.add(e), a;
}
function be(e) {
  const t = F.get(e);
  t && (e.removeEventListener("paste", t, !0), F.delete(e));
}
function ge(e) {
  var t;
  be(e), (t = h.get(e)) == null || t.remove(), h.delete(e), I.delete(e), d.delete(e), M.delete(e), _.delete(e), b === e && (b = null);
}
function j() {
  Array.from(_).forEach((t) => {
    t.isConnected || ge(t);
  });
}
function De(e) {
  var t, a, r, n;
  for (let o = 0; o < e.length; o += 1) {
    const s = e[o];
    if (!(s.type !== "childList" || s.removedNodes.length === 0))
      for (let l = 0; l < s.removedNodes.length; l += 1) {
        const c = s.removedNodes[l];
        if (c.nodeType !== Node.ELEMENT_NODE) continue;
        const i = c;
        if ((t = i.matches) != null && t.call(i, v) || (a = i.matches) != null && a.call(i, `.${u}`) || (r = i.querySelector) != null && r.call(i, v) || (n = i.querySelector) != null && n.call(i, `.${u}`))
          return !0;
      }
  }
  return !1;
}
function re(e) {
  return I.get(e) === !0;
}
function R(e, t) {
  const a = e.querySelector(".rte-smart-paste-live");
  a && (a.textContent = t);
}
function J(e, t) {
  const a = t.normalizeText(e);
  return t.normalizeWhitespace ? a.split(`
`).map((n) => n.replace(/[\t ]+/g, " ").trimEnd()).join(`
`).replace(/\n{3,}/g, `

`).trim() : a;
}
function Ne(e) {
  return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
}
function qe(e) {
  return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
}
function Ie(e, t) {
  return e ? Ne(e) ? "word" : qe(e) ? "google-docs" : "html" : t ? "plain" : "html";
}
function We(e) {
  return e.split(/\s+/).map((a) => a.trim()).filter(Boolean).filter((a) => !/^mso/i.test(a)).filter((a) => !/^docs-/i.test(a)).filter((a) => !/^c\d+$/i.test(a)).join(" ");
}
function Ke(e) {
  if (!e) return { value: "", changed: !1 };
  const t = e.split(";"), a = [];
  let r = !1;
  return t.forEach((n) => {
    const o = n.indexOf(":");
    if (o <= 0) {
      n.trim() && (r = !0);
      return;
    }
    const s = n.slice(0, o).trim().toLowerCase(), l = n.slice(o + 1).trim();
    if (!s || !l) {
      r = !0;
      return;
    }
    if (!we.has(s)) {
      r = !0;
      return;
    }
    if (/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)) {
      r = !0;
      return;
    }
    a.push(`${s}: ${l}`);
  }), {
    value: a.join("; "),
    changed: r
  };
}
function fe(e) {
  const t = e.trim();
  return t && (Pe.test(t) || Le.test(t)) ? t : "";
}
function pe(e) {
  const t = e.parentNode;
  if (t) {
    for (; e.firstChild; )
      t.insertBefore(e.firstChild, e);
    t.removeChild(e);
  }
}
function Be(e, t, a, r) {
  const n = e.tagName.toLowerCase();
  if (Ce.has(n)) {
    r.removedElements += 1, e.remove();
    return;
  }
  if (!t.preserveTables && Te.has(n)) {
    const s = e.textContent || "", l = document.createTextNode(s);
    e.replaceWith(l), r.removedElements += 1;
    return;
  }
  if (Array.from(e.attributes).forEach((s) => {
    const l = s.name.toLowerCase(), c = s.value;
    if (l.startsWith("on")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "style") {
      if (!t.keepStyles) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      const i = Ke(c);
      if (!i.value) {
        e.removeAttribute(s.name), r.removedAttributes += 1, i.changed && (r.normalizedStyles += 1);
        return;
      }
      (i.changed || i.value !== c) && (e.setAttribute("style", i.value), r.normalizedStyles += 1);
      return;
    }
    if (l === "class") {
      if (!t.keepClasses) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      const i = We(c);
      if (!i) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      i !== c && (e.setAttribute("class", i), r.removedAttributes += 1);
      return;
    }
    if (l.startsWith("data-") && !t.keepDataAttributes) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "id" || l === "xmlns" || l.startsWith("xml")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if ((a === "word" || a === "google-docs") && (l === "lang" || l === "dir")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "href" || l === "src" || l === "xlink:href") {
      const i = fe(c);
      if (!i) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      i !== c && e.setAttribute(s.name, i);
    }
  }), n === "a") {
    if (!e.getAttribute("href")) {
      pe(e), r.removedElements += 1;
      return;
    }
    e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
  }
  if (n === "img") {
    const s = e.getAttribute("src");
    if (!s || !fe(s)) {
      r.removedElements += 1, e.remove();
      return;
    }
  }
  if (Ae.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
    const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
    if (!s && !l) {
      e.remove(), r.removedElements += 1;
      return;
    }
    !s && l && (pe(e), r.removedElements += 1);
  }
}
function Ve(e, t, a, r, n) {
  const o = document.createElement("template");
  o.innerHTML = e;
  const s = {
    removedElements: 0,
    removedAttributes: 0,
    removedComments: 0,
    normalizedStyles: 0
  };
  if (r.removeComments)
    try {
      const f = document.createTreeWalker(o.content, ke, null), p = [];
      let y = f.nextNode();
      for (; y; )
        p.push(y), y = f.nextNode();
      p.forEach((g) => {
        g.remove(), s.removedComments += 1;
      });
    } catch (f) {
    }
  Array.from(o.content.querySelectorAll("*")).forEach((f) => {
    f.isConnected && Be(f, t, a, s);
  });
  let c = o.innerHTML;
  r.normalizeWhitespace && n !== "fidelity" ? c = c.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (c = c.trim());
  const i = (o.content.textContent || "").trim().length;
  return {
    html: c,
    textLength: i,
    counters: s
  };
}
function he(e) {
  const t = window.getSelection();
  if (!t || t.rangeCount === 0) return null;
  const a = t.getRangeAt(0);
  return e.contains(a.commonAncestorContainer) ? a : null;
}
function ye(e, t) {
  if (!e.isConnected) return;
  const a = window.getSelection();
  a && (a.removeAllRanges(), a.addRange(t));
}
function je(e, t) {
  e.focus({ preventScroll: !0 });
  try {
    if (document.execCommand("insertHTML", !1, t))
      return !0;
  } catch (s) {
  }
  const a = he(e);
  if (!a) return !1;
  a.deleteContents();
  const r = document.createElement("template");
  r.innerHTML = t;
  const n = r.content, o = n.lastChild;
  if (a.insertNode(n), o) {
    const s = document.createRange();
    s.setStartAfter(o), s.collapse(!0), ye(e, s);
  }
  return !0;
}
function Fe(e, t) {
  e.focus({ preventScroll: !0 });
  try {
    if (document.execCommand("insertText", !1, t))
      return !0;
  } catch (o) {
  }
  const a = he(e);
  if (!a) return !1;
  a.deleteContents();
  const r = document.createTextNode(t);
  a.insertNode(r);
  const n = document.createRange();
  return n.setStart(r, r.length), n.collapse(!0), ye(e, n), !0;
}
function Ge(e, t) {
  if (t === e.innerHTML) return;
  const a = window.execEditorCommand || window.executeEditorCommand;
  if (typeof a == "function")
    try {
      a("recordDomTransaction", e, t, e.innerHTML);
    } catch (r) {
    }
}
function Ue(e) {
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
}
function B(e, t, a, r, n, o) {
  return {
    source: e,
    profile: t,
    inputHtmlLength: a,
    outputHtmlLength: r,
    outputTextLength: n,
    removedElements: o.removedElements,
    removedAttributes: o.removedAttributes,
    removedComments: o.removedComments,
    normalizedStyles: o.normalizedStyles,
    createdAt: (/* @__PURE__ */ new Date()).toISOString()
  };
}
function Ye(e, t, a, r) {
  const n = Ie(e, t);
  if (a === "plain") {
    const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
    return {
      mode: "text",
      value: c,
      report: B(
        n,
        a,
        e.length,
        0,
        c.length,
        {
          removedElements: 0,
          removedAttributes: 0,
          removedComments: 0,
          normalizedStyles: 0
        }
      )
    };
  }
  if (!e || e.length > r.maxHtmlLength) {
    const l = J(t || e.replace(/<[^>]*>/g, " "), r);
    return {
      mode: "text",
      value: l,
      report: B(
        n,
        a,
        e.length,
        0,
        l.length,
        {
          removedElements: 0,
          removedAttributes: 0,
          removedComments: 0,
          normalizedStyles: 0
        }
      )
    };
  }
  const o = r.profileOptions[a], s = Ve(e, o, n, r, a);
  if (!s.html) {
    const l = J(t || e.replace(/<[^>]*>/g, " "), r);
    return {
      mode: "text",
      value: l,
      report: B(n, a, e.length, 0, l.length, s.counters)
    };
  }
  return {
    mode: "html",
    value: s.html,
    report: B(
      n,
      a,
      e.length,
      s.html.length,
      s.textLength,
      s.counters
    )
  };
}
function U(e, t) {
  return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
}
function ae(e) {
  return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
}
function Xe(e, t) {
  e.setAttribute("aria-label", t.labels.panelAriaLabel);
  const a = e.querySelector(".rte-smart-paste-title");
  a && (a.textContent = t.labels.panelTitle);
  const r = e.querySelector('[data-action="close"]');
  r && r.setAttribute("aria-label", t.labels.closeText);
  const n = e.querySelector('[data-action="toggle-enabled"]');
  if (n) {
    const Ee = n.getAttribute("data-enabled") === "true";
    n.textContent = Ee ? t.labels.toggleOnText : t.labels.toggleOffText;
  }
  const o = e.querySelector('[data-action="cycle-profile"]');
  o && (o.textContent = t.labels.cycleProfileText);
  const s = e.querySelector(".rte-smart-paste-profile-heading");
  s && (s.textContent = t.labels.profileLabel);
  const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
  l && l.setAttribute("aria-label", t.labels.profileLabel);
  const c = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
  c && (c.textContent = t.labels.fidelityText);
  const i = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
  i && (i.textContent = t.labels.balancedText);
  const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
  f && (f.textContent = t.labels.plainText);
  const p = e.querySelector(".rte-smart-paste-report-title");
  p && (p.textContent = t.labels.lastPasteHeading);
  const y = e.querySelector(".rte-smart-paste-empty");
  y && (y.textContent = t.labels.lastPasteEmptyText);
  const g = e.querySelector('[data-key="source-label"]');
  g && (g.textContent = t.labels.lastPasteSourceLabel);
  const P = e.querySelector('[data-key="profile-label"]');
  P && (P.textContent = t.labels.lastPasteProfileLabel);
  const C = e.querySelector('[data-key="removed-label"]');
  C && (C.textContent = t.labels.lastPasteRemovedLabel);
  const ne = e.querySelector('[data-key="chars-label"]');
  ne && (ne.textContent = t.labels.lastPasteCharsLabel);
  const se = e.querySelector(".rte-smart-paste-shortcut");
  se && (se.textContent = t.labels.shortcutText);
}
function S(e) {
  const t = h.get(e), a = d.get(e) || O, r = M.get(e);
  if (!t || !a || !r) return;
  Xe(t, a);
  const n = t.querySelector(".rte-smart-paste-status");
  n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
  const o = t.querySelector('[data-action="toggle-enabled"]');
  o && (o.setAttribute("data-enabled", r.enabled ? "true" : "false"), o.textContent = r.enabled ? a.labels.toggleOnText : a.labels.toggleOffText, o.setAttribute("aria-pressed", r.enabled ? "true" : "false")), Array.from(
    t.querySelectorAll('[data-action="set-profile"][data-profile]')
  ).forEach((g) => {
    const C = H(g.getAttribute("data-profile")) === r.profile;
    g.classList.toggle("active", C), g.setAttribute("aria-pressed", C ? "true" : "false");
  });
  const l = t.querySelector(".rte-smart-paste-empty"), c = t.querySelector(".rte-smart-paste-report"), i = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), p = t.querySelector('[data-key="removed-value"]'), y = t.querySelector('[data-key="chars-value"]');
  if (!r.lastReport) {
    l && (l.hidden = !1), c && (c.hidden = !0);
    return;
  }
  if (l && (l.hidden = !0), c && (c.hidden = !1), i && (i.textContent = r.lastReport.source), f && (f.textContent = U(r.lastReport.profile, a.labels)), p) {
    const g = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
    p.textContent = String(g);
  }
  y && (y.textContent = String(r.lastReport.outputTextLength));
}
function Q(e, t) {
  if (!t.classList.contains("show")) return;
  const a = te(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360), n = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10, a.top + 12));
  t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(240, window.innerHeight - 20)}px`;
}
function q(e, t = !1) {
  const a = h.get(e);
  a && (a.classList.remove("show"), I.set(e, !1), N(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
}
function Ze(e) {
  const t = h.get(e);
  if (t) return t;
  const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${Me++}`, n = document.createElement("section");
  return n.className = u, n.id = r, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", a.labels.panelAriaLabel), n.innerHTML = `
    <header class="rte-smart-paste-header">
      <h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
      <button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
    </header>
    <div class="rte-smart-paste-body">
      <p class="rte-smart-paste-status"></p>
      <div class="rte-smart-paste-controls">
        <button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
        <button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
      </div>
      <div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
        <p class="rte-smart-paste-profile-heading"></p>
        <div class="rte-smart-paste-profile-grid">
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
        </div>
      </div>
      <section class="rte-smart-paste-metrics" aria-live="polite">
        <h3 class="rte-smart-paste-report-title"></h3>
        <p class="rte-smart-paste-empty"></p>
        <dl class="rte-smart-paste-report" hidden>
          <div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
        </dl>
      </section>
      <p class="rte-smart-paste-shortcut"></p>
    </div>
    <div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
  `, n.addEventListener("click", (o) => {
    const s = o.target, l = s == null ? void 0 : s.closest("[data-action]");
    if (!l) return;
    const c = l.getAttribute("data-action");
    if (c) {
      if (c === "close") {
        q(e, !0);
        return;
      }
      if (c === "toggle-enabled") {
        const i = m(e, d.get(e) || a);
        i.enabled = !i.enabled, N(e, "toggleSmartPasteEnabled", i.enabled), S(e), R(n, i.enabled ? a.labels.enabledText : a.labels.disabledText);
        return;
      }
      if (c === "cycle-profile") {
        const i = m(e, d.get(e) || a);
        i.profile = ae(i.profile), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
        return;
      }
      if (c === "set-profile") {
        const i = m(e, d.get(e) || a);
        i.profile = H(l.getAttribute("data-profile")), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
      }
    }
  }), n.addEventListener("keydown", (o) => {
    if (o.key === "Escape") {
      o.preventDefault(), q(e, !0);
      return;
    }
    if (o.key !== "ArrowRight" && o.key !== "ArrowLeft") return;
    const s = Array.from(
      n.querySelectorAll('[data-action="set-profile"][data-profile]')
    );
    if (s.length === 0) return;
    const l = s.findIndex((f) => f === document.activeElement);
    if (l < 0) return;
    const c = o.key === "ArrowRight" ? 1 : -1, i = (l + c + s.length) % s.length;
    o.preventDefault(), s[i].focus();
  }), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
}
function xe(e) {
  const t = Ze(e);
  h.forEach((r, n) => {
    n !== e && q(n, !1);
  }), t.classList.add("show"), I.set(e, !0), N(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
  const a = t.querySelector('[data-action="toggle-enabled"]');
  a == null || a.focus();
}
function ve(e, t) {
  const a = re(e);
  return (typeof t == "boolean" ? t : !a) ? xe(e) : q(e, !1), !0;
}
function Se(e) {
  return {
    enabled: e.enabled,
    profile: e.profile,
    lastReport: e.lastReport ? { ...e.lastReport } : null
  };
}
function Je(e, t) {
  const a = d.get(e) || O;
  if (!a) return !1;
  const r = m(e, a);
  if (!r.enabled || ue(e)) {
    const p = h.get(e);
    return p && ue(e) && R(p, a.labels.readonlyMessage), !1;
  }
  const n = t.clipboardData;
  if (!n) return !1;
  const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
  if (!o && !s) return !1;
  const l = Ye(o, s, r.profile, a);
  if (!l.value) return !1;
  const c = e.innerHTML;
  if (!(l.mode === "html" ? je(e, l.value) : Fe(e, l.value))) return !1;
  r.lastReport = { ...l.report }, M.set(e, r), Ge(e, c), Ue(e), e.dispatchEvent(
    new CustomEvent("editora:smart-paste", {
      bubbles: !0,
      detail: Se(r)
    })
  ), S(e);
  const f = h.get(e);
  if (f) {
    const p = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
    R(
      f,
      `${a.labels.panelTitle}: ${U(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${p}.`
    );
  }
  return !0;
}
function Qe(e) {
  return (t) => {
    t.defaultPrevented || t[ce] === !0 || (b = e, !Je(e, t)) || (t[ce] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
  };
}
function et(e) {
  if (F.has(e)) return;
  const t = Qe(e);
  e.addEventListener("paste", t, !0), F.set(e, t);
}
function z(e) {
  const t = M.get(e);
  N(e, "toggleSmartPastePanel", re(e)), N(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
}
function oe(e) {
  return typeof e.key == "string" ? e.key.toLowerCase() : "";
}
function tt(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
}
function rt(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
}
function at(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
}
function ot(e) {
  O = e, L || (L = (t) => {
    j();
    const a = t.target, r = a == null ? void 0 : a.closest(v);
    if (!r) return;
    const n = d.get(r) || e;
    m(r, n), d.set(r, n), b = r, z(r);
    const o = h.get(r);
    o && (G(o, r), Q(r, o), S(r));
  }, document.addEventListener("focusin", L, !0)), w || (w = (t) => {
    if (t.defaultPrevented) return;
    const a = t.target;
    if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
    const r = _e(t);
    if (!r) return;
    const n = d.get(r) || O || e;
    if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
      t.preventDefault(), q(r, !0);
      return;
    }
    if (tt(t)) {
      t.preventDefault(), t.stopPropagation(), ve(r);
      return;
    }
    if (rt(t)) {
      t.preventDefault(), t.stopPropagation();
      const o = m(r, n);
      o.profile = ae(o.profile), S(r);
      return;
    }
    if (at(t)) {
      t.preventDefault(), t.stopPropagation();
      const o = m(r, n);
      o.enabled = !o.enabled, z(r), S(r);
    }
  }, document.addEventListener("keydown", w, !0)), A || (A = () => {
    j(), h.forEach((t, a) => {
      !a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
    });
  }, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver != "undefined" && document.body && ($ = new MutationObserver((t) => {
    De(t) && j();
  }), $.observe(document.body, {
    childList: !0,
    subtree: !0
  }));
}
function nt() {
  L && (document.removeEventListener("focusin", L, !0), L = null), w && (document.removeEventListener("keydown", w, !0), w = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), $ && ($.disconnect(), $ = null), h.forEach((e) => e.remove()), h.clear(), _.forEach((e) => be(e)), _.clear(), O = null, b = null;
}
function st() {
  if (typeof document == "undefined" || document.getElementById(ie)) return;
  const e = document.createElement("style");
  e.id = ie, e.textContent = `
    .rte-toolbar-group-items.${x},
    .editora-toolbar-group-items.${x},
    .rte-toolbar-group-items.${E},
    .editora-toolbar-group-items.${E} {
      display: flex;
      border: 1px solid #ccc;
      border-radius: 3px;
      background: #fff;
    }

    .rte-toolbar-group-items.${x} .rte-toolbar-button,
    .editora-toolbar-group-items.${x} .editora-toolbar-button,
    .rte-toolbar-group-items.${E} .rte-toolbar-button,
    .editora-toolbar-group-items.${E} .editora-toolbar-button {
      border: none;
      border-right: 1px solid #ccc;
      border-radius: 0;
    }

    .rte-toolbar-group-items.${x} .rte-toolbar-item:last-child .rte-toolbar-button,
    .editora-toolbar-group-items.${x} .editora-toolbar-item:last-child .editora-toolbar-button,
    .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
    .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button {
      border-right: none;
    }

    .rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
    .editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
      background-color: #ccc;
    }

    ${k} .rte-toolbar-group-items.${x},
    ${k} .editora-toolbar-group-items.${x},
    ${k} .rte-toolbar-group-items.${E},
    ${k} .editora-toolbar-group-items.${E},
    .${u}.rte-smart-paste-theme-dark {
      border-color: #566275;
    }

    ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button svg,
    ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button svg,
    ${k} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
    ${k} .editora-toolbar-group-items.${E} .editora-toolbar-button svg {
      fill: none;
    }

    ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button,
    ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button
    {
      border-color: #566275;
    }
    
    .${u} {
      position: fixed;
      z-index: 12000;
      display: none;
      width: min(360px, calc(100vw - 20px));
      max-height: calc(100vh - 20px);
      border: 1px solid #d1d5db;
      border-radius: 14px;
      background: #ffffff;
      color: #111827;
      box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
      overflow: hidden;
    }

    .${u}.show {
      display: flex;
      flex-direction: column;
    }

    .${u}.rte-smart-paste-theme-dark {
      border-color: #334155;
      background: #0f172a;
      color: #e2e8f0;
      box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
    }

    .rte-smart-paste-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 12px 14px;
      border-bottom: 1px solid #e5e7eb;
      background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
      border-color: #1e293b;
      background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    }

    .rte-smart-paste-title {
      margin: 0;
      font-size: 15px;
      line-height: 1.2;
      font-weight: 700;
    }

    .rte-smart-paste-icon-btn {
      width: 34px;
      height: 34px;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      background: #ffffff;
      color: #0f172a;
      font-size: 16px;
      line-height: 1;
      font-weight: 600;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .rte-smart-paste-icon-btn:hover,
    .rte-smart-paste-icon-btn:focus-visible {
      outline: none;
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
      background: #0f172a;
      border-color: #475569;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
      border-color: #60a5fa;
      box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
    }

    .rte-smart-paste-body {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 12px;
      overflow: auto;
    }

    .rte-smart-paste-status {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      color: #475569;
      font-weight: 600;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
      color: #94a3b8;
    }

    .rte-smart-paste-controls {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .rte-smart-paste-btn {
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      height: 34px;
      padding: 0 10px;
      background: #ffffff;
      color: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .rte-smart-paste-btn:hover,
    .rte-smart-paste-btn:focus-visible {
      border-color: #94a3b8;
      background: #f8fafc;
      outline: none;
    }

    .rte-smart-paste-btn-primary {
      border-color: #0284c7;
      background: #0ea5e9;
      color: #f8fafc;
    }

    .rte-smart-paste-btn-primary:hover,
    .rte-smart-paste-btn-primary:focus-visible {
      border-color: #0369a1;
      background: #0284c7;
      color: #ffffff;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
      border-color: #334155;
      background: #111827;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
      border-color: #475569;
      background: #1e293b;
    }

    .rte-smart-paste-profile {
      display: grid;
      gap: 6px;
    }

    .rte-smart-paste-profile-heading {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      font-weight: 700;
      color: #334155;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
      color: #cbd5e1;
    }

    .rte-smart-paste-profile-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }

    .rte-smart-paste-chip {
      height: 34px;
      border-radius: 9px;
      border: 1px solid #cbd5e1;
      background: #ffffff;
      color: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .rte-smart-paste-chip:hover,
    .rte-smart-paste-chip:focus-visible {
      border-color: #0284c7;
      outline: none;
    }

    .rte-smart-paste-chip.active {
      border-color: #0284c7;
      background: rgba(14, 165, 233, 0.14);
      color: #0c4a6e;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
      border-color: #334155;
      background: #0b1220;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
      border-color: #38bdf8;
      background: rgba(14, 165, 233, 0.2);
      color: #e0f2fe;
    }

    .rte-smart-paste-metrics {
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      padding: 10px;
      background: #f8fafc;
      display: grid;
      gap: 8px;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
      border-color: #334155;
      background: #0b1220;
    }

    .rte-smart-paste-report-title {
      margin: 0;
      font-size: 12px;
      line-height: 1.3;
      font-weight: 700;
    }

    .rte-smart-paste-empty {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      color: #475569;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
      color: #94a3b8;
    }

    .rte-smart-paste-report {
      margin: 0;
      display: grid;
      gap: 6px;
    }

    .rte-smart-paste-line {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      font-size: 12px;
      line-height: 1.3;
    }

    .rte-smart-paste-line dt {
      margin: 0;
      color: #475569;
      font-weight: 600;
    }

    .rte-smart-paste-line dd {
      margin: 0;
      font-weight: 700;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
      color: #94a3b8;
    }

    .rte-smart-paste-shortcut {
      margin: 2px 0 0;
      font-size: 11px;
      color: #64748b;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
      color: #94a3b8;
    }

    .rte-smart-paste-live {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0 0 0 0);
      border: 0;
    }

    @media (max-width: 768px) {
      .${u} {
        left: 10px !important;
        right: 10px;
        top: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 20px);
      }

      .rte-smart-paste-profile-grid {
        grid-template-columns: 1fr;
      }
    }
  `, document.head.appendChild(e);
}
const lt = (e = {}) => {
  const t = V(e), a = /* @__PURE__ */ new Set();
  return st(), {
    name: "smartPaste",
    toolbar: [
      {
        id: "smartPasteGroup",
        label: "Smart Paste",
        type: "group",
        command: "smartPaste",
        items: [
          {
            id: "smartPaste",
            label: "Smart Paste Panel",
            command: "toggleSmartPastePanel",
            shortcut: "Mod-Alt-Shift-s",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
          },
          {
            id: "smartPasteProfile",
            label: "Cycle Smart Paste Profile",
            command: "cycleSmartPasteProfile",
            shortcut: "Mod-Alt-Shift-v",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'
          },
          {
            id: "smartPasteToggle",
            label: "Toggle Smart Paste",
            command: "toggleSmartPasteEnabled",
            shortcut: "Mod-Alt-Shift-g",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
          }
        ]
      }
    ],
    commands: {
      smartPaste: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t;
        return m(o, s), d.set(o, s), b = o, xe(o), !0;
      },
      toggleSmartPastePanel: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t;
        return m(o, s), d.set(o, s), b = o, ve(o, typeof r == "boolean" ? r : void 0);
      },
      cycleSmartPasteProfile: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = m(o, s);
        return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
      },
      setSmartPasteProfile: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = m(o, s);
        return d.set(o, s), l.profile = H(r), S(o), !0;
      },
      toggleSmartPasteEnabled: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = m(o, s);
        return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, z(o), S(o), !0;
      },
      setSmartPasteOptions: (r, n) => {
        var f, p, y, g, P, C;
        const o = T(n, !1, !1);
        if (!o || !r || typeof r != "object") return !1;
        const s = d.get(o) || t, l = de(s), c = V({
          ...l,
          ...r,
          labels: {
            ...s.labels,
            ...r.labels || {}
          },
          profileOptions: {
            ...l.profileOptions,
            ...r.profileOptions || {},
            fidelity: {
              ...((f = l.profileOptions) == null ? void 0 : f.fidelity) || {},
              ...((p = r.profileOptions) == null ? void 0 : p.fidelity) || {}
            },
            balanced: {
              ...((y = l.profileOptions) == null ? void 0 : y.balanced) || {},
              ...((g = r.profileOptions) == null ? void 0 : g.balanced) || {}
            },
            plain: {
              ...((P = l.profileOptions) == null ? void 0 : P.plain) || {},
              ...((C = r.profileOptions) == null ? void 0 : C.plain) || {}
            }
          },
          normalizeText: r.normalizeText || s.normalizeText
        });
        d.set(o, c);
        const i = m(o, c);
        return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o), z(o), !0;
      },
      getSmartPasteState: (r, n) => {
        const o = T(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = m(o, s), c = Se(l);
        if (typeof r == "function")
          try {
            r(c);
          } catch (i) {
          }
        return o.__smartPasteState = c, o.dispatchEvent(
          new CustomEvent("editora:smart-paste-state", {
            bubbles: !0,
            detail: c
          })
        ), !0;
      }
    },
    keymap: {
      "Mod-Alt-Shift-s": "toggleSmartPastePanel",
      "Mod-Alt-Shift-S": "toggleSmartPastePanel",
      "Mod-Alt-Shift-v": "cycleSmartPasteProfile",
      "Mod-Alt-Shift-V": "cycleSmartPasteProfile",
      "Mod-Alt-Shift-g": "toggleSmartPasteEnabled",
      "Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
    },
    init: function(n) {
      W += 1;
      const o = this && typeof this.__pluginConfig == "object" ? V({ ...de(t), ...this.__pluginConfig }) : t;
      ot(o);
      const s = T(
        n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
        !1,
        !1
      );
      if (!s) return;
      b = s, a.add(s);
      const l = m(s, o);
      l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
    },
    destroy: () => {
      a.forEach((r) => ge(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && nt();
    }
  };
};
export {
  lt as SmartPastePlugin
};
//# sourceMappingURL=SmartPastePlugin.native-CZAEHkyt.mjs.map
