import N, { forwardRef as ae, useRef as L, useEffect as B, useState as x, useMemo as R, useCallback as z, createContext as fr, useContext as hr } from "react";
import { blockStyles as F, mergeCSSClasses as be, getDefaultSlashMenuItems as vr, defaultBlockSchema as ut, BlockNoteEditor as br, createTipTapBlock as xr, propsToAttributes as mr, parse as kr, render as yr, camelToDataKebab as pr } from "@blocknote/core";
import { createStyles as $, Group as He, Menu as w, Button as Ie, Stack as Be, Text as oe, ActionIcon as gt, Box as ft, TextInput as ht, FileInput as vt, Tabs as Q, LoadingOverlay as Cr, Badge as jr, MantineProvider as Tr } from "@mantine/core";
import { EditorContent as wr, NodeViewContent as Sr, ReactNodeViewRenderer as Mr, NodeViewWrapper as Rr } from "@tiptap/react";
import Er from "use-prefers-color-scheme";
import * as it from "lodash";
import O from "lodash";
import Y, { tippy as bt } from "@tippyjs/react";
import { sticky as zr } from "tippy.js";
var Me = { exports: {} }, re = {};
/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var at;
function Hr() {
  if (at)
    return re;
  at = 1;
  var e = N, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
  function u(g, a, y) {
    var h, p = {}, S = null, T = null;
    y !== void 0 && (S = "" + y), a.key !== void 0 && (S = "" + a.key), a.ref !== void 0 && (T = a.ref);
    for (h in a)
      i.call(a, h) && !c.hasOwnProperty(h) && (p[h] = a[h]);
    if (g && g.defaultProps)
      for (h in a = g.defaultProps, a)
        p[h] === void 0 && (p[h] = a[h]);
    return { $$typeof: n, type: g, key: S, ref: T, props: p, _owner: s.current };
  }
  return re.Fragment = o, re.jsx = u, re.jsxs = u, re;
}
var ne = {};
/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var lt;
function Ir() {
  return lt || (lt = 1, process.env.NODE_ENV !== "production" && function() {
    var e = N, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), g = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), D = Symbol.iterator, le = "@@iterator";
    function Bt(t) {
      if (t === null || typeof t != "object")
        return null;
      var l = D && t[D] || t[le];
      return typeof l == "function" ? l : null;
    }
    var J = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    function H(t) {
      {
        for (var l = arguments.length, d = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
          d[f - 1] = arguments[f];
        _t("error", t, d);
      }
    }
    function _t(t, l, d) {
      {
        var f = J.ReactDebugCurrentFrame, m = f.getStackAddendum();
        m !== "" && (l += "%s", d = d.concat([m]));
        var C = d.map(function(b) {
          return String(b);
        });
        C.unshift("Warning: " + l), Function.prototype.apply.call(console[t], console, C);
      }
    }
    var Dt = !1, Pt = !1, Ot = !1, Ft = !1, At = !1, De;
    De = Symbol.for("react.module.reference");
    function Lt(t) {
      return !!(typeof t == "string" || typeof t == "function" || t === i || t === c || At || t === s || t === y || t === h || Ft || t === T || Dt || Pt || Ot || typeof t == "object" && t !== null && (t.$$typeof === S || t.$$typeof === p || t.$$typeof === u || t.$$typeof === g || t.$$typeof === a || // This needs to include all possible module reference object
      // types supported by any Flight configuration anywhere since
      // we don't know which Flight build this will end up being used
      // with.
      t.$$typeof === De || t.getModuleId !== void 0));
    }
    function Vt(t, l, d) {
      var f = t.displayName;
      if (f)
        return f;
      var m = l.displayName || l.name || "";
      return m !== "" ? d + "(" + m + ")" : d;
    }
    function Pe(t) {
      return t.displayName || "Context";
    }
    function V(t) {
      if (t == null)
        return null;
      if (typeof t.tag == "number" && H("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
        return t.displayName || t.name || null;
      if (typeof t == "string")
        return t;
      switch (t) {
        case i:
          return "Fragment";
        case o:
          return "Portal";
        case c:
          return "Profiler";
        case s:
          return "StrictMode";
        case y:
          return "Suspense";
        case h:
          return "SuspenseList";
      }
      if (typeof t == "object")
        switch (t.$$typeof) {
          case g:
            var l = t;
            return Pe(l) + ".Consumer";
          case u:
            var d = t;
            return Pe(d._context) + ".Provider";
          case a:
            return Vt(t, t.render, "ForwardRef");
          case p:
            var f = t.displayName || null;
            return f !== null ? f : V(t.type) || "Memo";
          case S: {
            var m = t, C = m._payload, b = m._init;
            try {
              return V(b(C));
            } catch {
              return null;
            }
          }
        }
      return null;
    }
    var K = Object.assign, ee = 0, Oe, Fe, Ae, Le, Ve, Ue, Ne;
    function $e() {
    }
    $e.__reactDisabledLog = !0;
    function Ut() {
      {
        if (ee === 0) {
          Oe = console.log, Fe = console.info, Ae = console.warn, Le = console.error, Ve = console.group, Ue = console.groupCollapsed, Ne = console.groupEnd;
          var t = {
            configurable: !0,
            enumerable: !0,
            value: $e,
            writable: !0
          };
          Object.defineProperties(console, {
            info: t,
            log: t,
            warn: t,
            error: t,
            group: t,
            groupCollapsed: t,
            groupEnd: t
          });
        }
        ee++;
      }
    }
    function Nt() {
      {
        if (ee--, ee === 0) {
          var t = {
            configurable: !0,
            enumerable: !0,
            writable: !0
          };
          Object.defineProperties(console, {
            log: K({}, t, {
              value: Oe
            }),
            info: K({}, t, {
              value: Fe
            }),
            warn: K({}, t, {
              value: Ae
            }),
            error: K({}, t, {
              value: Le
            }),
            group: K({}, t, {
              value: Ve
            }),
            groupCollapsed: K({}, t, {
              value: Ue
            }),
            groupEnd: K({}, t, {
              value: Ne
            })
          });
        }
        ee < 0 && H("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
      }
    }
    var me = J.ReactCurrentDispatcher, ke;
    function ce(t, l, d) {
      {
        if (ke === void 0)
          try {
            throw Error();
          } catch (m) {
            var f = m.stack.trim().match(/\n( *(at )?)/);
            ke = f && f[1] || "";
          }
        return `
` + ke + t;
      }
    }
    var ye = !1, se;
    {
      var $t = typeof WeakMap == "function" ? WeakMap : Map;
      se = new $t();
    }
    function We(t, l) {
      if (!t || ye)
        return "";
      {
        var d = se.get(t);
        if (d !== void 0)
          return d;
      }
      var f;
      ye = !0;
      var m = Error.prepareStackTrace;
      Error.prepareStackTrace = void 0;
      var C;
      C = me.current, me.current = null, Ut();
      try {
        if (l) {
          var b = function() {
            throw Error();
          };
          if (Object.defineProperty(b.prototype, "props", {
            set: function() {
              throw Error();
            }
          }), typeof Reflect == "object" && Reflect.construct) {
            try {
              Reflect.construct(b, []);
            } catch (U) {
              f = U;
            }
            Reflect.construct(t, [], b);
          } else {
            try {
              b.call();
            } catch (U) {
              f = U;
            }
            t.call(b.prototype);
          }
        } else {
          try {
            throw Error();
          } catch (U) {
            f = U;
          }
          t();
        }
      } catch (U) {
        if (U && f && typeof U.stack == "string") {
          for (var v = U.stack.split(`
`), I = f.stack.split(`
`), M = v.length - 1, E = I.length - 1; M >= 1 && E >= 0 && v[M] !== I[E]; )
            E--;
          for (; M >= 1 && E >= 0; M--, E--)
            if (v[M] !== I[E]) {
              if (M !== 1 || E !== 1)
                do
                  if (M--, E--, E < 0 || v[M] !== I[E]) {
                    var _ = `
` + v[M].replace(" at new ", " at ");
                    return t.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", t.displayName)), typeof t == "function" && se.set(t, _), _;
                  }
                while (M >= 1 && E >= 0);
              break;
            }
        }
      } finally {
        ye = !1, me.current = C, Nt(), Error.prepareStackTrace = m;
      }
      var Z = t ? t.displayName || t.name : "", ot = Z ? ce(Z) : "";
      return typeof t == "function" && se.set(t, ot), ot;
    }
    function Wt(t, l, d) {
      return We(t, !1);
    }
    function Yt(t) {
      var l = t.prototype;
      return !!(l && l.isReactComponent);
    }
    function de(t, l, d) {
      if (t == null)
        return "";
      if (typeof t == "function")
        return We(t, Yt(t));
      if (typeof t == "string")
        return ce(t);
      switch (t) {
        case y:
          return ce("Suspense");
        case h:
          return ce("SuspenseList");
      }
      if (typeof t == "object")
        switch (t.$$typeof) {
          case a:
            return Wt(t.render);
          case p:
            return de(t.type, l, d);
          case S: {
            var f = t, m = f._payload, C = f._init;
            try {
              return de(C(m), l, d);
            } catch {
            }
          }
        }
      return "";
    }
    var ue = Object.prototype.hasOwnProperty, Ye = {}, qe = J.ReactDebugCurrentFrame;
    function ge(t) {
      if (t) {
        var l = t._owner, d = de(t.type, t._source, l ? l.type : null);
        qe.setExtraStackFrame(d);
      } else
        qe.setExtraStackFrame(null);
    }
    function qt(t, l, d, f, m) {
      {
        var C = Function.call.bind(ue);
        for (var b in t)
          if (C(t, b)) {
            var v = void 0;
            try {
              if (typeof t[b] != "function") {
                var I = Error((f || "React class") + ": " + d + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
                throw I.name = "Invariant Violation", I;
              }
              v = t[b](l, b, f, d, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
            } catch (M) {
              v = M;
            }
            v && !(v instanceof Error) && (ge(m), H("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", d, b, typeof v), ge(null)), v instanceof Error && !(v.message in Ye) && (Ye[v.message] = !0, ge(m), H("Failed %s type: %s", d, v.message), ge(null));
          }
      }
    }
    var Kt = Array.isArray;
    function pe(t) {
      return Kt(t);
    }
    function Gt(t) {
      {
        var l = typeof Symbol == "function" && Symbol.toStringTag, d = l && t[Symbol.toStringTag] || t.constructor.name || "Object";
        return d;
      }
    }
    function Jt(t) {
      try {
        return Ke(t), !1;
      } catch {
        return !0;
      }
    }
    function Ke(t) {
      return "" + t;
    }
    function Ge(t) {
      if (Jt(t))
        return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Gt(t)), Ke(t);
    }
    var te = J.ReactCurrentOwner, Xt = {
      key: !0,
      ref: !0,
      __self: !0,
      __source: !0
    }, Je, Xe, Ce;
    Ce = {};
    function Zt(t) {
      if (ue.call(t, "ref")) {
        var l = Object.getOwnPropertyDescriptor(t, "ref").get;
        if (l && l.isReactWarning)
          return !1;
      }
      return t.ref !== void 0;
    }
    function Qt(t) {
      if (ue.call(t, "key")) {
        var l = Object.getOwnPropertyDescriptor(t, "key").get;
        if (l && l.isReactWarning)
          return !1;
      }
      return t.key !== void 0;
    }
    function er(t, l) {
      if (typeof t.ref == "string" && te.current && l && te.current.stateNode !== l) {
        var d = V(te.current.type);
        Ce[d] || (H('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', V(te.current.type), t.ref), Ce[d] = !0);
      }
    }
    function tr(t, l) {
      {
        var d = function() {
          Je || (Je = !0, H("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
        };
        d.isReactWarning = !0, Object.defineProperty(t, "key", {
          get: d,
          configurable: !0
        });
      }
    }
    function rr(t, l) {
      {
        var d = function() {
          Xe || (Xe = !0, H("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
        };
        d.isReactWarning = !0, Object.defineProperty(t, "ref", {
          get: d,
          configurable: !0
        });
      }
    }
    var nr = function(t, l, d, f, m, C, b) {
      var v = {
        // This tag allows us to uniquely identify this as a React Element
        $$typeof: n,
        // Built-in properties that belong on the element
        type: t,
        key: l,
        ref: d,
        props: b,
        // Record the component responsible for creating this element.
        _owner: C
      };
      return v._store = {}, Object.defineProperty(v._store, "validated", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: !1
      }), Object.defineProperty(v, "_self", {
        configurable: !1,
        enumerable: !1,
        writable: !1,
        value: f
      }), Object.defineProperty(v, "_source", {
        configurable: !1,
        enumerable: !1,
        writable: !1,
        value: m
      }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
    };
    function or(t, l, d, f, m) {
      {
        var C, b = {}, v = null, I = null;
        d !== void 0 && (Ge(d), v = "" + d), Qt(l) && (Ge(l.key), v = "" + l.key), Zt(l) && (I = l.ref, er(l, m));
        for (C in l)
          ue.call(l, C) && !Xt.hasOwnProperty(C) && (b[C] = l[C]);
        if (t && t.defaultProps) {
          var M = t.defaultProps;
          for (C in M)
            b[C] === void 0 && (b[C] = M[C]);
        }
        if (v || I) {
          var E = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
          v && tr(b, E), I && rr(b, E);
        }
        return nr(t, v, I, m, f, te.current, b);
      }
    }
    var je = J.ReactCurrentOwner, Ze = J.ReactDebugCurrentFrame;
    function X(t) {
      if (t) {
        var l = t._owner, d = de(t.type, t._source, l ? l.type : null);
        Ze.setExtraStackFrame(d);
      } else
        Ze.setExtraStackFrame(null);
    }
    var Te;
    Te = !1;
    function we(t) {
      return typeof t == "object" && t !== null && t.$$typeof === n;
    }
    function Qe() {
      {
        if (je.current) {
          var t = V(je.current.type);
          if (t)
            return `

Check the render method of \`` + t + "`.";
        }
        return "";
      }
    }
    function ir(t) {
      {
        if (t !== void 0) {
          var l = t.fileName.replace(/^.*[\\\/]/, ""), d = t.lineNumber;
          return `

Check your code at ` + l + ":" + d + ".";
        }
        return "";
      }
    }
    var et = {};
    function ar(t) {
      {
        var l = Qe();
        if (!l) {
          var d = typeof t == "string" ? t : t.displayName || t.name;
          d && (l = `

Check the top-level render call using <` + d + ">.");
        }
        return l;
      }
    }
    function tt(t, l) {
      {
        if (!t._store || t._store.validated || t.key != null)
          return;
        t._store.validated = !0;
        var d = ar(l);
        if (et[d])
          return;
        et[d] = !0;
        var f = "";
        t && t._owner && t._owner !== je.current && (f = " It was passed a child from " + V(t._owner.type) + "."), X(t), H('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', d, f), X(null);
      }
    }
    function rt(t, l) {
      {
        if (typeof t != "object")
          return;
        if (pe(t))
          for (var d = 0; d < t.length; d++) {
            var f = t[d];
            we(f) && tt(f, l);
          }
        else if (we(t))
          t._store && (t._store.validated = !0);
        else if (t) {
          var m = Bt(t);
          if (typeof m == "function" && m !== t.entries)
            for (var C = m.call(t), b; !(b = C.next()).done; )
              we(b.value) && tt(b.value, l);
        }
      }
    }
    function lr(t) {
      {
        var l = t.type;
        if (l == null || typeof l == "string")
          return;
        var d;
        if (typeof l == "function")
          d = l.propTypes;
        else if (typeof l == "object" && (l.$$typeof === a || // Note: Memo only checks outer props here.
        // Inner props are checked in the reconciler.
        l.$$typeof === p))
          d = l.propTypes;
        else
          return;
        if (d) {
          var f = V(l);
          qt(d, t.props, "prop", f, t);
        } else if (l.PropTypes !== void 0 && !Te) {
          Te = !0;
          var m = V(l);
          H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
        }
        typeof l.getDefaultProps == "function" && !l.getDefaultProps.isReactClassApproved && H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
      }
    }
    function cr(t) {
      {
        for (var l = Object.keys(t.props), d = 0; d < l.length; d++) {
          var f = l[d];
          if (f !== "children" && f !== "key") {
            X(t), H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), X(null);
            break;
          }
        }
        t.ref !== null && (X(t), H("Invalid attribute `ref` supplied to `React.Fragment`."), X(null));
      }
    }
    function nt(t, l, d, f, m, C) {
      {
        var b = Lt(t);
        if (!b) {
          var v = "";
          (t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
          var I = ir(m);
          I ? v += I : v += Qe();
          var M;
          t === null ? M = "null" : pe(t) ? M = "array" : t !== void 0 && t.$$typeof === n ? (M = "<" + (V(t.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : M = typeof t, H("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, v);
        }
        var E = or(t, l, d, m, C);
        if (E == null)
          return E;
        if (b) {
          var _ = l.children;
          if (_ !== void 0)
            if (f)
              if (pe(_)) {
                for (var Z = 0; Z < _.length; Z++)
                  rt(_[Z], t);
                Object.freeze && Object.freeze(_);
              } else
                H("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
            else
              rt(_, t);
        }
        return t === i ? cr(E) : lr(E), E;
      }
    }
    function sr(t, l, d) {
      return nt(t, l, d, !0);
    }
    function dr(t, l, d) {
      return nt(t, l, d, !1);
    }
    var ur = dr, gr = sr;
    ne.Fragment = i, ne.jsx = ur, ne.jsxs = gr;
  }()), ne;
}
process.env.NODE_ENV === "production" ? Me.exports = Hr() : Me.exports = Ir();
var r = Me.exports;
const fe = (e) => {
  const n = `0 4px 12px ${e.colors.shadow}`, o = `1px solid ${e.colors.border}`, i = {
    default: e.colors.editor.text,
    gray: e.colors.highlightColors.gray.text,
    brown: e.colors.highlightColors.brown.text,
    red: e.colors.highlightColors.red.text,
    orange: e.colors.highlightColors.orange.text,
    yellow: e.colors.highlightColors.yellow.text,
    green: e.colors.highlightColors.green.text,
    blue: e.colors.highlightColors.blue.text,
    purple: e.colors.highlightColors.purple.text,
    pink: e.colors.highlightColors.pink.text
  }, s = {
    default: e.colors.editor.background,
    gray: e.colors.highlightColors.gray.background,
    brown: e.colors.highlightColors.brown.background,
    red: e.colors.highlightColors.red.background,
    orange: e.colors.highlightColors.orange.background,
    yellow: e.colors.highlightColors.yellow.background,
    green: e.colors.highlightColors.green.background,
    blue: e.colors.highlightColors.blue.background,
    purple: e.colors.highlightColors.purple.background,
    pink: e.colors.highlightColors.pink.background
  }, c = `${Math.max(e.borderRadius + 2, 1)}px`, u = `${e.borderRadius}px`, g = `${Math.max(e.borderRadius - 2, 1)}px`;
  return {
    activeStyles: {
      // Removes button press effect.
      transform: "none"
    },
    components: {
      // Slash Menu, Formatting Toolbar dropdown, color picker dropdown
      Menu: {
        styles: () => {
          var a;
          return {
            dropdown: O.merge(
              {
                backgroundColor: e.colors.menu.background,
                border: o,
                borderRadius: u,
                boxShadow: n,
                color: e.colors.menu.text,
                padding: "2px",
                overflowY: "scroll",
                ".mantine-Menu-label": {
                  backgroundColor: e.colors.menu.background,
                  color: e.colors.menu.text
                },
                ".mantine-Menu-item": {
                  backgroundColor: e.colors.menu.background,
                  border: "none",
                  borderRadius: g,
                  color: e.colors.menu.text
                },
                ".mantine-Menu-item[data-hovered]": {
                  backgroundColor: e.colors.hovered.background,
                  border: "none",
                  color: e.colors.hovered.text
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).Menu) || {}
            )
          };
        }
      },
      Tabs: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                width: "100%",
                backgroundColor: e.colors.menu.background
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).Tabs) || {}
            ),
            tabsList: {
              borderColor: e.colors.hovered.background
            },
            tab: {
              color: e.colors.menu.text,
              borderColor: e.colors.hovered.background,
              "&:hover": {
                color: e.colors.hovered.text,
                backgroundColor: e.colors.hovered.background,
                borderColor: e.colors.hovered.background
              },
              "&[data-active], &[data-active]&:hover": {
                color: e.colors.menu.text,
                borderColor: e.colors.menu.text
              }
            },
            panel: {
              padding: "8px",
              ".mantine-UnstyledButton-root": {
                width: "60%",
                border: `solid ${e.colors.border} 1px`,
                borderRadius: "4px",
                height: "32px"
              },
              ".mantine-UnstyledButton-root:hover": {
                color: e.colors.hovered.text,
                backgroundColor: e.colors.hovered.background
              }
            }
          };
        }
      },
      FileInput: {
        styles: () => {
          var a;
          return {
            root: ((a = e.componentStyles) == null ? void 0 : a.call(e, e).FileInput) || {},
            input: {
              color: e.colors.menu.text,
              backgroundColor: e.colors.menu.background,
              display: "flex",
              flexDirection: "row",
              alignItems: "center",
              justifyContent: "center",
              border: "none",
              borderRadius: "4px",
              "&:hover": {
                backgroundColor: e.colors.hovered.background
              }
            },
            wrapper: {
              border: `solid ${e.colors.border} 1px`,
              borderRadius: "4px"
            },
            placeholder: {
              color: `${e.colors.menu.text} !important`,
              fontWeight: 600
            }
          };
        }
      },
      TextInput: {
        styles: () => {
          var a;
          return {
            root: ((a = e.componentStyles) == null ? void 0 : a.call(e, e).TextInput) || {},
            input: {
              color: e.colors.menu.text,
              backgroundColor: e.colors.menu.background,
              border: `solid ${e.colors.border} 1px`,
              borderRadius: "4px",
              height: "32px"
            }
          };
        }
      },
      ColorIcon: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                border: o,
                borderRadius: g
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).ColorIcon) || {}
            )
          };
        }
      },
      DragHandleMenu: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                ".mantine-Menu-item": {
                  fontSize: "12px",
                  height: "30px"
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).DragHandleMenu) || {}
            )
          };
        }
      },
      Editor: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                ".ProseMirror": {
                  backgroundColor: e.colors.editor.background,
                  borderRadius: c,
                  color: e.colors.editor.text,
                  fontFamily: e.fontFamily
                },
                // Placeholders
                [`.${F.isEmpty} .${F.inlineContent}:before, .${F.isFilter} .${F.inlineContent}:before`]: {
                  color: e.colors.sideMenu
                },
                // Indent lines
                [`.${F.blockGroup}`]: {
                  [`.${F.blockGroup}`]: {
                    [`.${F.blockOuter}:not([data-prev-depth-changed])::before`]: {
                      borderLeft: `1px solid ${e.colors.sideMenu}`
                    }
                  }
                },
                // Highlight text colors
                ...Object.fromEntries(
                  Object.entries(i).map(([y, h]) => [
                    `[data-text-color="${y}"]`,
                    { color: h }
                  ])
                ),
                // Highlight background colors
                ...Object.fromEntries(
                  Object.entries(s).map(([y, h]) => [
                    `[data-background-color="${y}"]`,
                    { backgroundColor: h }
                  ])
                )
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).Editor) || {}
            )
          };
        }
      },
      Toolbar: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                backgroundColor: e.colors.menu.background,
                boxShadow: n,
                border: o,
                borderRadius: u,
                flexWrap: "nowrap",
                gap: "2px",
                padding: "2px",
                width: "fit-content",
                // Button (including dropdown target)
                ".mantine-Button-root, .mantine-ActionIcon-root": {
                  backgroundColor: e.colors.menu.background,
                  border: "none",
                  borderRadius: g,
                  color: e.colors.menu.text
                },
                // Hovered button
                ".mantine-Button-root:hover, .mantine-ActionIcon-root:hover": {
                  backgroundColor: e.colors.hovered.background,
                  border: "none",
                  color: e.colors.hovered.text
                },
                // Selected button
                ".mantine-Button-root[data-selected], .mantine-ActionIcon-root[data-selected]": {
                  backgroundColor: e.colors.selected.background,
                  border: "none",
                  color: e.colors.selected.text
                },
                // Disabled button
                ".mantine-Button-root[data-disabled], .mantine-ActionIcon-root[data-disabled]": {
                  backgroundColor: e.colors.disabled.background,
                  border: "none",
                  color: e.colors.disabled.text
                },
                // Dropdown
                ".mantine-Menu-dropdown": {
                  // Dropdown item
                  ".mantine-Menu-item": {
                    fontSize: "12px",
                    height: "30px",
                    ".mantine-Menu-itemRightSection": {
                      paddingLeft: "5px"
                    }
                  },
                  ".mantine-Menu-item:hover": {
                    backgroundColor: e.colors.hovered.background
                  }
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).Toolbar) || {}
            )
          };
        }
      },
      ToolbarInputDropdown: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                backgroundColor: e.colors.menu.background,
                border: o,
                borderRadius: u,
                boxShadow: n,
                color: e.colors.menu.text,
                gap: "4px",
                minWidth: "145px",
                padding: "2px",
                // Row
                ".mantine-Group-root": {
                  flexWrap: "nowrap",
                  // Row input field
                  ".mantine-TextInput-root, .mantine-FileInput-root": {
                    width: "300px",
                    ".mantine-TextInput-wrapper:hover": {
                      backgroundColor: e.colors.hovered.background
                    },
                    ".mantine-TextInput-wrapper, .mantine-FileInput-wrapper": {
                      padding: 0,
                      borderRadius: "4px",
                      ".mantine-FileInput-icon": {
                        color: e.colors.menu.text
                      },
                      ".mantine-TextInput-input, .mantine-FileInput-input": {
                        border: "none",
                        fontSize: "12px",
                        ".mantine-FileInput-placeholder": {
                          color: e.colors.menu.text
                        }
                      },
                      ".mantine-FileInput-input:hover": {
                        backgroundColor: e.colors.hovered.background
                      }
                    }
                  }
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).EditHyperlinkMenu) || {}
            )
          };
        }
      },
      Tooltip: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                backgroundColor: e.colors.tooltip.background,
                border: o,
                borderRadius: u,
                boxShadow: n,
                color: e.colors.tooltip.text,
                padding: "4px 10px",
                textAlign: "center",
                "div ~ div": {
                  color: e.colors.tooltip.text
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).Tooltip) || {}
            )
          };
        }
      },
      SlashMenu: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                position: "relative",
                ".mantine-Menu-item": {
                  // Icon
                  ".mantine-Menu-itemIcon": {
                    backgroundColor: e.colors.tooltip.background,
                    borderRadius: g,
                    color: e.colors.tooltip.text,
                    padding: "8px"
                  },
                  // Text
                  ".mantine-Menu-itemLabel": {
                    paddingRight: "16px",
                    ".mantine-Stack-root": {
                      gap: "0"
                    }
                  },
                  // Badge (keyboard shortcut)
                  ".mantine-Menu-itemRightSection": {
                    ".mantine-Badge-root": {
                      backgroundColor: e.colors.tooltip.background,
                      color: e.colors.tooltip.text
                    }
                  }
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).SlashMenu) || {}
            )
          };
        }
      },
      SideMenu: {
        styles: () => {
          var a;
          return {
            root: O.merge(
              {
                backgroundColor: "transparent",
                ".mantine-UnstyledButton-root": {
                  backgroundColor: "transparent",
                  color: e.colors.sideMenu
                },
                ".mantine-UnstyledButton-root:hover": {
                  backgroundColor: e.colors.hovered.background
                }
              },
              ((a = e.componentStyles) == null ? void 0 : a.call(e, e).SideMenu) || {}
            )
          };
        }
      }
    },
    fontFamily: e.fontFamily,
    other: {
      textColors: i,
      backgroundColors: s
    }
  };
}, _e = ae((e, n) => {
  const { classes: o } = $({ root: {} })(void 0, {
    name: "Toolbar"
  });
  return /* @__PURE__ */ r.jsx(
    He,
    {
      className: e.className ? `${o.root} ${e.className}` : o.root,
      ref: n,
      ...e,
      children: e.children
    }
  );
});
var xt = {
  color: void 0,
  size: void 0,
  className: void 0,
  style: void 0,
  attr: void 0
}, ct = N.createContext && N.createContext(xt), W = globalThis && globalThis.__assign || function() {
  return W = Object.assign || function(e) {
    for (var n, o = 1, i = arguments.length; o < i; o++) {
      n = arguments[o];
      for (var s in n)
        Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
    }
    return e;
  }, W.apply(this, arguments);
}, Br = globalThis && globalThis.__rest || function(e, n) {
  var o = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && n.indexOf(i) < 0 && (o[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var s = 0, i = Object.getOwnPropertySymbols(e); s < i.length; s++)
      n.indexOf(i[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[s]) && (o[i[s]] = e[i[s]]);
  return o;
};
function mt(e) {
  return e && e.map(function(n, o) {
    return N.createElement(n.tag, W({
      key: o
    }, n.attr), mt(n.child));
  });
}
function j(e) {
  return function(n) {
    return N.createElement(_r, W({
      attr: W({}, e.attr)
    }, n), mt(e.child));
  };
}
function _r(e) {
  var n = function(o) {
    var i = e.attr, s = e.size, c = e.title, u = Br(e, ["attr", "size", "title"]), g = s || o.size || "1em", a;
    return o.className && (a = o.className), e.className && (a = (a ? a + " " : "") + e.className), N.createElement("svg", W({
      stroke: "currentColor",
      fill: "currentColor",
      strokeWidth: "0"
    }, o.attr, i, u, {
      className: a,
      style: W(W({
        color: e.color || o.color
      }, o.style), e.style),
      height: g,
      width: g,
      xmlns: "http://www.w3.org/2000/svg"
    }), c && N.createElement("title", null, c), e.children);
  };
  return ct !== void 0 ? N.createElement(ct.Consumer, null, function(o) {
    return n(o);
  }) : n(xt);
}
function Dr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M23 12l-7.071 7.071-1.414-1.414L20.172 12l-5.657-5.657 1.414-1.414L23 12zM3.828 12l5.657 5.657-1.414 1.414L1 12l7.071-7.071 1.414 1.414L3.828 12z" } }] }] })(e);
}
function Pr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm2 15h14v2H5v-2zm-2-5h18v2H3v-2zm2-5h14v2H5V9z" } }] }] })(e);
}
function Or(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm0 15h18v2H3v-2zm0-5h18v2H3v-2zm0-5h18v2H3V9z" } }] }] })(e);
}
function Fr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm0 15h14v2H3v-2zm0-5h18v2H3v-2zm0-5h14v2H3V9z" } }] }] })(e);
}
function Ar(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm4 15h14v2H7v-2zm-4-5h18v2H3v-2zm4-5h14v2H7V9z" } }] }] })(e);
}
function Lr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M8 11h4.5a2.5 2.5 0 1 0 0-5H8v5zm10 4.5a4.5 4.5 0 0 1-4.5 4.5H6V4h6.5a4.5 4.5 0 0 1 3.256 7.606A4.498 4.498 0 0 1 18 15.5zM8 13v5h5.5a2.5 2.5 0 1 0 0-5H8z" } }] }] })(e);
}
function kt(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0H24V24H0z" } }, { tag: "path", attr: { d: "M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm8-12v12h-2v-9.796l-2 .536V8.67L19.5 8H21z" } }] }] })(e);
}
function yt(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0H24V24H0z" } }, { tag: "path", attr: { d: "M4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 4c2.071 0 3.75 1.679 3.75 3.75 0 .857-.288 1.648-.772 2.28l-.148.18L18.034 18H22v2h-7v-1.556l4.82-5.546c.268-.307.43-.709.43-1.148 0-.966-.784-1.75-1.75-1.75-.918 0-1.671.707-1.744 1.606l-.006.144h-2C14.75 9.679 16.429 8 18.5 8z" } }] }] })(e);
}
function pt(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0H24V24H0z" } }, { tag: "path", attr: { d: "M22 8l-.002 2-2.505 2.883c1.59.435 2.757 1.89 2.757 3.617 0 2.071-1.679 3.75-3.75 3.75-1.826 0-3.347-1.305-3.682-3.033l1.964-.382c.156.806.866 1.415 1.718 1.415.966 0 1.75-.784 1.75-1.75s-.784-1.75-1.75-1.75c-.286 0-.556.069-.794.19l-1.307-1.547L19.35 10H15V8h7zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z" } }] }] })(e);
}
function Vr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-8 3.5L7 9v7l-4-3.5z" } }] }] })(e);
}
function Ur(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-4 3.5L3 16V9l4 3.5z" } }] }] })(e);
}
function Nr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M15 20H7v-2h2.927l2.116-12H9V4h8v2h-2.927l-2.116 12H15z" } }] }] })(e);
}
function $r(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M17 17h5v2h-3v3h-2v-5zM7 7H2V5h3V2h2v5zm11.364 8.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z" } }] }] })(e);
}
function Ct(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M18.364 15.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z" } }] }] })(e);
}
function jt(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M8 4h13v2H8V4zM5 3v3h1v1H3V6h1V4H3V3h2zM3 14v-2.5h2V11H3v-1h3v2.5H4v.5h2v1H3zm2 5.5H3v-1h2V18H3v-1h3v4H3v-1h2v-.5zM8 11h13v2H8v-2zm0 7h13v2H8v-2z" } }] }] })(e);
}
function Tt(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M8 4h13v2H8V4zM4.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 6.9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM8 11h13v2H8v-2zm0 7h13v2H8v-2z" } }] }] })(e);
}
function Wr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z" } }] }] })(e);
}
function ie(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M13 6v15h-2V6H5V4h14v2z" } }] }] })(e);
}
function Yr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M8 3v9a4 4 0 1 0 8 0V3h2v9a6 6 0 1 1-12 0V3h2zM4 20h16v2H4v-2z" } }] }] })(e);
}
function qr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M5 11.1l2-2 5.5 5.5 3.5-3.5 3 3V5H5v6.1zM4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm11.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z" } }] }] })(e);
}
function Kr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0H24V24H0z" } }, { tag: "path", attr: { d: "M20 3c.552 0 1 .448 1 1v1.757l-2 2V5H5v8.1l4-4 4.328 4.329-1.327 1.327-.006 4.239 4.246.006 1.33-1.33L18.899 19H19v-2.758l2-2V20c0 .552-.448 1-1 1H4c-.552 0-1-.448-1-1V4c0-.552.448-1 1-1h16zm1.778 4.808l1.414 1.414L15.414 17l-1.416-.002.002-1.412 7.778-7.778zM15.5 7c.828 0 1.5.672 1.5 1.5s-.672 1.5-1.5 1.5S14 9.328 14 8.5 14.672 7 15.5 7z" } }] }] })(e);
}
function Gr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" } }, { tag: "path", attr: { d: "M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v9l-3.794-3.793-5.999 6-1.414-1.414 5.999-6L12 3h9z" } }] }] })(e);
}
function Re(e) {
  return j({ tag: "svg", attr: { version: "1.2", baseProfile: "tiny", viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M16.972 6.251c-.967-.538-2.185-.188-2.72.777l-3.713 6.682-2.125-2.125c-.781-.781-2.047-.781-2.828 0-.781.781-.781 2.047 0 2.828l4 4c.378.379.888.587 1.414.587l.277-.02c.621-.087 1.166-.46 1.471-1.009l5-9c.537-.966.189-2.183-.776-2.72z" } }] })(e);
}
function Jr(e) {
  const n = e.icon;
  return /* @__PURE__ */ r.jsx(
    w.Item,
    {
      onClick: e.onClick,
      icon: n && /* @__PURE__ */ r.jsx(n, { size: 16 }),
      rightSection: e.isSelected ? /* @__PURE__ */ r.jsx(Re, { size: 16 }) : (
        // Ensures space for tick even if item isn't currently selected.
        /* @__PURE__ */ r.jsx("div", { style: { width: "16px", padding: "0" } })
      ),
      disabled: e.isDisabled,
      children: e.text
    },
    e.text
  );
}
function Xr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" } }] })(e);
}
function Zr(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" } }] })(e);
}
const Qr = ae((e, n) => {
  const o = e.icon;
  return /* @__PURE__ */ r.jsx(
    Ie,
    {
      leftIcon: o && /* @__PURE__ */ r.jsx(o, { size: 16 }),
      rightIcon: /* @__PURE__ */ r.jsx(Xr, {}),
      size: "xs",
      variant: "subtle",
      disabled: e.isDisabled,
      onClick: e.onClick,
      ref: n,
      children: e.text
    }
  );
});
function xe() {
  const e = L(null);
  return {
    ref: e,
    updateMaxHeight: () => {
      setTimeout(() => {
        if (e.current && e.current.childElementCount > 0) {
          e.current.firstElementChild.style.maxHeight = "none";
          const n = e.current.firstElementChild.getBoundingClientRect();
          e.current.firstElementChild.style.maxHeight = `${Math.min(
            n.top >= 0 ? window.innerHeight - n.top - 20 : n.bottom - 20
          )}px`;
        }
      }, 10);
    }
  };
}
function en(e) {
  const n = e.items.filter((s) => s.isSelected)[0], { ref: o, updateMaxHeight: i } = xe();
  return n ? /* @__PURE__ */ r.jsxs(
    w,
    {
      exitTransitionDuration: 0,
      disabled: e.isDisabled,
      onOpen: i,
      children: [
        /* @__PURE__ */ r.jsx(w.Target, { children: /* @__PURE__ */ r.jsx(
          Qr,
          {
            text: n.text,
            icon: n.icon,
            isDisabled: n.isDisabled
          }
        ) }),
        /* @__PURE__ */ r.jsx("div", { ref: o, children: /* @__PURE__ */ r.jsx(w.Dropdown, { children: e.items.map((s) => /* @__PURE__ */ r.jsx(Jr, { ...s }, s.text)) }) })
      ]
    }
  ) : null;
}
function tn(e, n) {
  B(() => (e._tiptapEditor.on("update", n), () => {
    e._tiptapEditor.off("update", n);
  }), [n, e._tiptapEditor]);
}
function rn(e, n) {
  B(() => (e._tiptapEditor.on("selectionUpdate", n), () => {
    e._tiptapEditor.off("selectionUpdate", n);
  }), [n, e._tiptapEditor]);
}
function q(e, n) {
  tn(e, n), rn(e, n);
}
function G(e) {
  const [n, o] = x(
    () => {
      var i;
      return ((i = e.getSelection()) == null ? void 0 : i.blocks) || [e.getTextCursorPosition().block];
    }
  );
  return q(
    e,
    () => {
      var i;
      return o(
        ((i = e.getSelection()) == null ? void 0 : i.blocks) || [e.getTextCursorPosition().block]
      );
    }
  ), n;
}
const nn = [
  {
    name: "Paragraph",
    type: "paragraph",
    icon: ie,
    isSelected: (e) => e.type === "paragraph"
  },
  {
    name: "Heading 1",
    type: "heading",
    props: { level: 1 },
    icon: kt,
    isSelected: (e) => e.type === "heading" && "level" in e.props && e.props.level === 1
  },
  {
    name: "Heading 2",
    type: "heading",
    props: { level: 2 },
    icon: yt,
    isSelected: (e) => e.type === "heading" && "level" in e.props && e.props.level === 2
  },
  {
    name: "Heading 3",
    type: "heading",
    props: { level: 3 },
    icon: pt,
    isSelected: (e) => e.type === "heading" && "level" in e.props && e.props.level === 3
  },
  {
    name: "Bullet List",
    type: "bulletListItem",
    icon: Tt,
    isSelected: (e) => e.type === "bulletListItem"
  },
  {
    name: "Numbered List",
    type: "numberedListItem",
    icon: jt,
    isSelected: (e) => e.type === "numberedListItem"
  }
], on = (e) => {
  const n = G(e.editor), [o, i] = x(
    e.editor.getTextCursorPosition().block
  ), s = R(() => (e.items || nn).filter((g) => {
    if (!(g.type in e.editor.schema))
      return !1;
    for (const [a, y] of Object.entries(g.props || {})) {
      const h = e.editor.schema[g.type].propSchema;
      if (!(a in h) || h[a].values !== void 0 && !h[a].values.includes(y))
        return !1;
    }
    return !0;
  }), [e.editor, e.items]), c = R(
    () => s.find((g) => g.type === o.type) !== void 0,
    [o.type, s]
  ), u = R(() => {
    const g = (a) => {
      e.editor.focus();
      for (const y of n)
        e.editor.updateBlock(y, {
          type: a.type,
          props: a.props
        });
    };
    return s.map((a) => ({
      text: a.name,
      icon: a.icon,
      onClick: () => g(a),
      isSelected: a.isSelected(o)
    }));
  }, [o, s, e.editor, n]);
  return q(e.editor, () => {
    i(e.editor.getTextCursorPosition().block);
  }), c ? /* @__PURE__ */ r.jsx(en, { items: u }) : null;
}, an = (e) => {
  const { classes: n } = $({ root: {} })(void 0, {
    name: "Tooltip"
  });
  return /* @__PURE__ */ r.jsxs(Be, { spacing: 0, className: n.root, children: [
    /* @__PURE__ */ r.jsx(oe, { size: "sm", children: e.mainTooltip }),
    e.secondaryTooltip && /* @__PURE__ */ r.jsx(oe, { size: "xs", children: e.secondaryTooltip })
  ] });
}, P = ae(
  (e, n) => {
    const o = e.icon;
    return /* @__PURE__ */ r.jsx(
      Y,
      {
        content: /* @__PURE__ */ r.jsx(
          an,
          {
            mainTooltip: e.mainTooltip,
            secondaryTooltip: e.secondaryTooltip
          }
        ),
        trigger: "mouseenter",
        children: e.children ? /* @__PURE__ */ r.jsxs(
          Ie,
          {
            onClick: e.onClick,
            "data-selected": e.isSelected ? "true" : void 0,
            "data-test": e.mainTooltip.slice(0, 1).toLowerCase() + e.mainTooltip.replace(/\s+/g, "").slice(1),
            size: "xs",
            disabled: e.isDisabled || !1,
            ref: n,
            children: [
              o && /* @__PURE__ */ r.jsx(o, {}),
              e.children
            ]
          }
        ) : /* @__PURE__ */ r.jsx(
          gt,
          {
            onClick: e.onClick,
            "data-selected": e.isSelected ? "true" : void 0,
            "data-test": e.mainTooltip.slice(0, 1).toLowerCase() + e.mainTooltip.replace(/\s+/g, "").slice(1),
            size: 30,
            disabled: e.isDisabled || !1,
            ref: n,
            children: o && /* @__PURE__ */ r.jsx(o, {})
          }
        )
      }
    );
  }
), ln = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
function A(e) {
  return ln() ? e.replace("Mod", "⌘") : e.replace("Mod", "Ctrl");
}
const cn = {
  bold: "Mod+B",
  italic: "Mod+I",
  underline: "Mod+U",
  strike: "Mod+Shift+X",
  code: ""
}, sn = {
  bold: Lr,
  italic: Nr,
  underline: Yr,
  strike: Wr,
  code: Dr
}, he = (e) => {
  const n = G(e.editor), [o, i] = x(
    e.toggledStyle in e.editor.getActiveStyles()
  );
  q(e.editor, () => {
    i(e.toggledStyle in e.editor.getActiveStyles());
  });
  const s = (u) => {
    e.editor.focus(), e.editor.toggleStyles({ [u]: !0 });
  };
  return R(() => !!n.find((u) => u.content !== void 0), [n]) ? /* @__PURE__ */ r.jsx(
    P,
    {
      onClick: () => s(e.toggledStyle),
      isSelected: o,
      mainTooltip: e.toggledStyle.slice(0, 1).toUpperCase() + e.toggledStyle.slice(1),
      secondaryTooltip: A(cn[e.toggledStyle]),
      icon: sn[e.toggledStyle]
    }
  ) : null;
}, dn = {
  left: Fr,
  center: Pr,
  right: Ar,
  justify: Or
}, Se = (e) => {
  const n = G(e.editor), o = R(() => {
    const c = n[0];
    if ("textAlignment" in c.props)
      return c.props.textAlignment;
  }, [n]), i = z(
    (c) => {
      e.editor.focus();
      for (const u of n)
        e.editor.updateBlock(u, {
          props: { textAlignment: c }
        });
    },
    [e.editor, n]
  );
  return R(() => !!n.find((c) => "textAlignment" in c.props), [n]) ? /* @__PURE__ */ r.jsx(
    P,
    {
      onClick: () => i(e.textAlignment),
      isSelected: o === e.textAlignment,
      mainTooltip: e.textAlignment === "justify" ? "Justify Text" : "Align Text " + e.textAlignment.slice(0, 1).toUpperCase() + e.textAlignment.slice(1),
      icon: dn[e.textAlignment]
    }
  ) : null;
}, Ee = (e) => {
  const { classes: n } = $({ root: {} })(void 0, {
    name: "ColorIcon"
  }), o = e.textColor || "default", i = e.backgroundColor || "default", s = e.size || 16;
  return /* @__PURE__ */ r.jsx(
    ft,
    {
      className: n.root,
      sx: (c) => ({
        pointerEvents: "none",
        backgroundColor: c.other.backgroundColors[i],
        color: c.other.textColors[o],
        fontSize: (s * 0.75).toString() + "px",
        height: s.toString() + "px",
        lineHeight: s.toString() + "px",
        textAlign: "center",
        width: s.toString() + "px"
      }),
      children: "A"
    }
  );
}, wt = (e) => {
  const n = () => e.text ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
    /* @__PURE__ */ r.jsx(w.Label, { children: "Text" }),
    [
      "default",
      "gray",
      "brown",
      "red",
      "orange",
      "yellow",
      "green",
      "blue",
      "purple",
      "pink"
    ].map((i) => /* @__PURE__ */ r.jsx(
      w.Item,
      {
        onClick: () => {
          e.onClick && e.onClick(), e.text.setColor(i);
        },
        component: "div",
        "data-test": "text-color-" + i,
        icon: /* @__PURE__ */ r.jsx(Ee, { textColor: i, size: e.iconSize }),
        rightSection: e.text.color === i ? /* @__PURE__ */ r.jsx(Re, { size: 16, style: { paddingLeft: "8px" } }) : /* @__PURE__ */ r.jsx("div", { style: { width: "24px", padding: "0" } }),
        children: i.charAt(0).toUpperCase() + i.slice(1)
      },
      "text-color-" + i
    ))
  ] }) : null, o = () => e.background ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
    /* @__PURE__ */ r.jsx(w.Label, { children: "Background" }),
    [
      "default",
      "gray",
      "brown",
      "red",
      "orange",
      "yellow",
      "green",
      "blue",
      "purple",
      "pink"
    ].map((i) => /* @__PURE__ */ r.jsx(
      w.Item,
      {
        onClick: () => {
          e.onClick && e.onClick(), e.background.setColor(i);
        },
        component: "div",
        "data-test": "background-color-" + i,
        icon: /* @__PURE__ */ r.jsx(Ee, { backgroundColor: i, size: e.iconSize }),
        rightSection: e.background.color === i ? /* @__PURE__ */ r.jsx(Re, { size: 16, style: { paddingLeft: "8px" } }) : /* @__PURE__ */ r.jsx("div", { style: { width: "24px", padding: "0" } }),
        children: i.charAt(0).toUpperCase() + i.slice(1)
      },
      "background-color-" + i
    ))
  ] }) : null;
  return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
    /* @__PURE__ */ r.jsx(n, {}),
    /* @__PURE__ */ r.jsx(o, {})
  ] });
}, un = (e) => {
  const n = G(e.editor), [o, i] = x(
    e.editor.getActiveStyles().textColor || "default"
  ), [s, c] = x(
    e.editor.getActiveStyles().backgroundColor || "default"
  );
  q(e.editor, () => {
    i(e.editor.getActiveStyles().textColor || "default"), c(
      e.editor.getActiveStyles().backgroundColor || "default"
    );
  });
  const { ref: u, updateMaxHeight: g } = xe(), a = z(
    (p) => {
      e.editor.focus(), p === "default" ? e.editor.removeStyles({ textColor: p }) : e.editor.addStyles({ textColor: p });
    },
    [e.editor]
  ), y = z(
    (p) => {
      e.editor.focus(), p === "default" ? e.editor.removeStyles({ backgroundColor: p }) : e.editor.addStyles({ backgroundColor: p });
    },
    [e.editor]
  );
  return R(() => {
    for (const p of n)
      if (p.content !== void 0)
        return !0;
    return !1;
  }, [n]) ? /* @__PURE__ */ r.jsxs(w, { onOpen: g, children: [
    /* @__PURE__ */ r.jsx(w.Target, { children: /* @__PURE__ */ r.jsx(
      P,
      {
        mainTooltip: "Colors",
        icon: () => /* @__PURE__ */ r.jsx(
          Ee,
          {
            textColor: o,
            backgroundColor: s,
            size: 20
          }
        )
      }
    ) }),
    /* @__PURE__ */ r.jsx("div", { ref: u, children: /* @__PURE__ */ r.jsx(w.Dropdown, { children: /* @__PURE__ */ r.jsx(
      wt,
      {
        text: {
          color: o,
          setColor: a
        },
        background: {
          color: s,
          setColor: y
        }
      }
    ) }) })
  ] }) : null;
}, gn = (e) => {
  const [n, o] = x();
  q(e.editor, () => {
    o(e.editor.canNestBlock());
  });
  const i = z(() => {
    e.editor.focus(), e.editor.nestBlock();
  }, [e.editor]);
  return /* @__PURE__ */ r.jsx(
    P,
    {
      onClick: i,
      isDisabled: !n,
      mainTooltip: "Nest Block",
      secondaryTooltip: A("Tab"),
      icon: Ur
    }
  );
}, fn = (e) => {
  const [n, o] = x();
  q(e.editor, () => {
    o(e.editor.canUnnestBlock());
  });
  const i = z(() => {
    e.editor.focus(), e.editor.unnestBlock();
  }, [e]);
  return /* @__PURE__ */ r.jsx(
    P,
    {
      onClick: i,
      isDisabled: !n,
      mainTooltip: "Unnest Block",
      secondaryTooltip: A("Shift+Tab"),
      icon: Vr
    }
  );
}, St = (e) => {
  const [n, o] = x(!1), i = z(() => {
    o(!1);
  }, []), s = z(() => {
    o(!0);
  }, []);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      onShow: (c) => {
        var u;
        s(), (u = e.onShow) == null || u.call(e, c);
      },
      onHidden: (c) => {
        var u;
        i(), (u = e.onShow) == null || u.call(e, c);
      },
      content: n ? e.children[1] : null,
      trigger: e.visible === void 0 ? "click" : void 0,
      interactive: !0,
      maxWidth: 500,
      zIndex: 9e3,
      ...e,
      children: e.children[0]
    }
  );
}, Mt = ae(({ className: e, ...n }, o) => {
  const { classes: i } = $({ root: {} })(void 0, {
    name: "ToolbarInputDropdown"
  });
  return /* @__PURE__ */ r.jsx(
    Be,
    {
      ...n,
      className: be(i.root, e || ""),
      ref: o,
      children: n.children
    }
  );
}), hn = {
  text: ht,
  file: vt
}, ze = (e) => {
  const n = e.icon, o = hn[e.type];
  return /* @__PURE__ */ r.jsx(He, { children: /* @__PURE__ */ r.jsx(o, { size: "xs", icon: /* @__PURE__ */ r.jsx(n, {}), ...e.inputProps }) });
}, Rt = ae(({ url: e, text: n, update: o, ...i }, s) => {
  const [c, u] = x(e), [g, a] = x(n);
  B(() => {
    u(e), a(n);
  }, [n, e]);
  const y = z(
    (T) => {
      T.key === "Enter" && (T.preventDefault(), o(c, g));
    },
    [o, c, g]
  ), h = z(
    (T) => u(T.currentTarget.value),
    []
  ), p = z(
    (T) => a(T.currentTarget.value),
    []
  ), S = z(
    () => o(c, g),
    [o, c, g]
  );
  return /* @__PURE__ */ r.jsxs(Mt, { ...i, ref: s, children: [
    /* @__PURE__ */ r.jsx(
      ze,
      {
        type: "text",
        icon: Ct,
        inputProps: {
          autoFocus: !0,
          placeholder: "Edit URL",
          value: c,
          onKeyDown: y,
          onChange: h,
          onSubmit: S
        }
      }
    ),
    /* @__PURE__ */ r.jsx(
      ze,
      {
        type: "text",
        icon: ie,
        inputProps: {
          placeholder: "Edit Title",
          value: g,
          onKeyDown: y,
          onChange: p,
          onSubmit: S
        }
      }
    )
  ] });
}), vn = (e) => {
  const n = G(e.editor), [o, i] = x(
    e.editor.getSelectedLinkUrl() || ""
  ), [s, c] = x(e.editor.getSelectedText());
  q(e.editor, () => {
    c(e.editor.getSelectedText() || ""), i(e.editor.getSelectedLinkUrl() || "");
  });
  const u = z(
    (a, y) => {
      e.editor.createLink(a, y), e.editor.focus();
    },
    [e.editor]
  );
  return R(() => {
    for (const a of n)
      if (a.content === void 0)
        return !1;
    return !0;
  }, [n]) ? /* @__PURE__ */ r.jsxs(St, { children: [
    /* @__PURE__ */ r.jsx(
      P,
      {
        mainTooltip: "Create Link",
        secondaryTooltip: A("Mod+K"),
        icon: Ct
      }
    ),
    /* @__PURE__ */ r.jsx(Rt, { url: o, text: s, update: u })
  ] }) : null;
}, Et = (e) => {
  const [n, o] = x(
    e.editor.uploadFile !== void 0 ? "upload" : "embed"
  ), [i, s] = x(!1), [c, u] = x(!1);
  B(() => {
    c && setTimeout(() => {
      u(!1);
    }, 3e3);
  }, [c]);
  const g = z(
    async (T) => {
      if (s(!0), e.editor.uploadFile !== void 0)
        try {
          const D = await e.editor.uploadFile(T);
          e.editor.updateBlock(e.block, {
            type: "image",
            props: {
              url: D
            }
          });
        } catch {
          u(!0);
        } finally {
          s(!1);
        }
    },
    [e.block, e.editor]
  ), [a, y] = x(""), h = z(
    (T) => {
      y(T.currentTarget.value);
    },
    []
  ), p = z(
    (T) => {
      T.key === "Enter" && (T.preventDefault(), e.editor.updateBlock(e.block, {
        type: "image",
        props: {
          url: a
        }
      }));
    },
    [a, e.block, e.editor]
  ), S = z(() => {
    e.editor.updateBlock(e.block, {
      type: "image",
      props: {
        url: a
      }
    });
  }, [a, e.block, e.editor]);
  return /* @__PURE__ */ r.jsx(
    _e,
    {
      style: {
        width: "500px"
      },
      children: /* @__PURE__ */ r.jsxs(Q, { value: n, onTabChange: o, children: [
        i && /* @__PURE__ */ r.jsx(Cr, { visible: i }),
        /* @__PURE__ */ r.jsxs(Q.List, { children: [
          e.editor.uploadFile !== void 0 && /* @__PURE__ */ r.jsx(Q.Tab, { value: "upload", "data-test": "upload-tab", children: "Upload" }),
          /* @__PURE__ */ r.jsx(Q.Tab, { value: "embed", "data-test": "embed-tab", children: "Embed" })
        ] }),
        e.editor.uploadFile !== void 0 && /* @__PURE__ */ r.jsx(Q.Panel, { value: "upload", children: /* @__PURE__ */ r.jsxs(
          "div",
          {
            style: {
              display: "flex",
              flexDirection: "column",
              alignItems: "stretch",
              gap: "8px"
            },
            children: [
              /* @__PURE__ */ r.jsx(
                vt,
                {
                  placeholder: "Upload Image",
                  size: "xs",
                  value: null,
                  onChange: g,
                  "data-test": "upload-input"
                }
              ),
              c && /* @__PURE__ */ r.jsx(oe, { color: "red", size: 12, style: { textAlign: "center" }, children: "Error: Upload failed" })
            ]
          }
        ) }),
        /* @__PURE__ */ r.jsx(Q.Panel, { value: "embed", children: /* @__PURE__ */ r.jsxs(
          "div",
          {
            style: {
              width: "100%",
              display: "flex",
              flexDirection: "column",
              alignItems: "center",
              gap: "8px"
            },
            children: [
              /* @__PURE__ */ r.jsx(
                ht,
                {
                  size: "xs",
                  placeholder: "Enter URL",
                  value: a,
                  onChange: h,
                  onKeyDown: p,
                  style: { width: "100%" },
                  "data-test": "embed-input"
                }
              ),
              /* @__PURE__ */ r.jsx(
                Ie,
                {
                  onClick: S,
                  size: "xs",
                  "data-test": "embed-input-button",
                  children: "Embed Image"
                }
              )
            ]
          }
        ) })
      ] })
    }
  );
}, bn = (e) => {
  const n = G(e.editor), [o, i] = x(!1);
  return B(() => {
    i(!1);
  }, [n]), // Checks if only one block is selected.
  n.length === 1 && // Checks if the selected block is an image.
  n[0].type === "image" ? /* @__PURE__ */ r.jsx(
    Y,
    {
      visible: o,
      interactive: !0,
      content: /* @__PURE__ */ r.jsx(
        Et,
        {
          block: n[0],
          editor: e.editor
        }
      ),
      children: /* @__PURE__ */ r.jsx(
        P,
        {
          onClick: () => i(!o),
          isSelected: o,
          mainTooltip: "Replace Image",
          icon: Kr
        }
      )
    }
  ) : null;
}, xn = (e) => {
  const n = G(e.editor), o = R(
    () => (
      // Checks if only one block is selected.
      n.length === 1 && // Checks if the selected block is an image.
      n[0].type === "image" && // Checks if the block has a `caption` prop which can take any string
      // value.
      "caption" in e.editor.schema.image.propSchema && typeof e.editor.schema.image.propSchema.caption.default == "string" && e.editor.schema.image.propSchema.caption.values === void 0 && // Checks if the block has a `src` prop which can take any string value.
      "src" in e.editor.schema.image.propSchema && typeof e.editor.schema.image.propSchema.src.default == "string" && e.editor.schema.image.propSchema.src.values === void 0 && // Checks if the `src` prop is not set to an empty string.
      n[0].props.src !== ""
    ),
    [e.editor.schema, n]
  ), [i, s] = x(
    o ? n[0].props.caption : ""
  );
  B(
    () => s(
      o ? n[0].props.caption : ""
    ),
    [n, o]
  );
  const c = z(
    (g) => {
      g.key === "Enter" && (g.preventDefault(), e.editor.updateBlock(n[0], {
        type: "image",
        props: {
          caption: i
        }
      }));
    },
    [i, e.editor, n]
  ), u = z(
    (g) => s(g.currentTarget.value),
    []
  );
  return o ? /* @__PURE__ */ r.jsxs(St, { children: [
    /* @__PURE__ */ r.jsx(
      P,
      {
        mainTooltip: "Edit Caption",
        icon: ie,
        isSelected: n[0].props.caption !== ""
      }
    ),
    /* @__PURE__ */ r.jsx(Mt, { children: /* @__PURE__ */ r.jsx(
      ze,
      {
        type: "text",
        icon: ie,
        inputProps: {
          autoFocus: !0,
          placeholder: "Edit Caption",
          value: i,
          onKeyDown: c,
          onChange: u
        }
      }
    ) })
  ] }) : null;
}, mn = (e) => /* @__PURE__ */ r.jsxs(_e, { children: [
  /* @__PURE__ */ r.jsx(on, { ...e, items: e.blockTypeDropdownItems }),
  /* @__PURE__ */ r.jsx(xn, { editor: e.editor }),
  /* @__PURE__ */ r.jsx(bn, { editor: e.editor }),
  /* @__PURE__ */ r.jsx(he, { editor: e.editor, toggledStyle: "bold" }),
  /* @__PURE__ */ r.jsx(he, { editor: e.editor, toggledStyle: "italic" }),
  /* @__PURE__ */ r.jsx(he, { editor: e.editor, toggledStyle: "underline" }),
  /* @__PURE__ */ r.jsx(he, { editor: e.editor, toggledStyle: "strike" }),
  /* @__PURE__ */ r.jsx(Se, { editor: e.editor, textAlignment: "left" }),
  /* @__PURE__ */ r.jsx(Se, { editor: e.editor, textAlignment: "center" }),
  /* @__PURE__ */ r.jsx(Se, { editor: e.editor, textAlignment: "right" }),
  /* @__PURE__ */ r.jsx(un, { editor: e.editor }),
  /* @__PURE__ */ r.jsx(gn, { editor: e.editor }),
  /* @__PURE__ */ r.jsx(fn, { editor: e.editor }),
  /* @__PURE__ */ r.jsx(vn, { editor: e.editor })
] }), st = (e) => {
  switch (e) {
    case "left":
      return "top-start";
    case "center":
      return "top";
    case "right":
      return "top-end";
    default:
      return "top-start";
  }
}, kn = (e) => {
  const [n, o] = x(!1), [i, s] = x(
    () => {
      const a = e.editor.getTextCursorPosition().block;
      return "textAlignment" in a.props ? st(
        a.props.textAlignment
      ) : "top-start";
    }
  ), c = L();
  B(() => (bt.setDefaultProps({ maxWidth: "" }), e.editor.formattingToolbar.onUpdate((a) => {
    o(a.show), c.current = a.referencePos;
  })), [e.editor]), q(e.editor, () => {
    const a = e.editor.getTextCursorPosition().block;
    "textAlignment" in a.props ? s(
      st(
        a.props.textAlignment
      )
    ) : s("top-start");
  });
  const u = R(
    () => {
      if (c)
        return () => c.current;
    },
    [c.current]
    // eslint-disable-line
  ), g = R(() => {
    const a = e.formattingToolbar || mn;
    return /* @__PURE__ */ r.jsx(a, { editor: e.editor });
  }, [e.editor, e.formattingToolbar]);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      appendTo: e.editor.domElement.parentElement,
      content: g,
      getReferenceClientRect: u,
      interactive: !0,
      visible: n,
      animation: "fade",
      placement: i,
      sticky: !0,
      plugins: yn,
      zIndex: 3e3
    }
  );
}, yn = [zr], pn = (e) => {
  const [n, o] = x(!1), i = L(null);
  return n ? /* @__PURE__ */ r.jsx(
    Rt,
    {
      url: e.url,
      text: e.text,
      update: e.editHyperlink,
      onBlur: (s) => setTimeout(() => {
        var c;
        (c = i.current) != null && c.contains(s.relatedTarget) || o(!1);
      }, 500),
      ref: i
    }
  ) : /* @__PURE__ */ r.jsxs(
    _e,
    {
      onMouseEnter: e.stopHideTimer,
      onMouseLeave: e.startHideTimer,
      children: [
        /* @__PURE__ */ r.jsx(
          P,
          {
            mainTooltip: "Edit",
            isSelected: !1,
            onClick: () => o(!0),
            children: "Edit Link"
          }
        ),
        /* @__PURE__ */ r.jsx(
          P,
          {
            mainTooltip: "Open in new tab",
            isSelected: !1,
            onClick: () => {
              window.open(e.url, "_blank");
            },
            icon: Gr
          }
        ),
        /* @__PURE__ */ r.jsx(
          P,
          {
            mainTooltip: "Remove link",
            isSelected: !1,
            onClick: e.deleteHyperlink,
            icon: $r
          }
        )
      ]
    }
  );
}, Cn = (e) => {
  const [n, o] = x(!1), [i, s] = x(), [c, u] = x(), g = L();
  B(() => e.editor.hyperlinkToolbar.on(
    "update",
    (h) => {
      o(h.show), s(h.url), u(h.text), g.current = h.referencePos;
    }
  ), [e.editor]);
  const a = R(
    () => {
      if (g.current)
        return () => g.current;
    },
    [g.current]
    // eslint-disable-line
  ), y = R(() => {
    if (!i || !c)
      return null;
    const h = e.hyperlinkToolbar || pn;
    return /* @__PURE__ */ r.jsx(
      h,
      {
        url: i,
        text: c,
        editHyperlink: e.editor.hyperlinkToolbar.editHyperlink,
        deleteHyperlink: e.editor.hyperlinkToolbar.deleteHyperlink,
        startHideTimer: e.editor.hyperlinkToolbar.startHideTimer,
        stopHideTimer: e.editor.hyperlinkToolbar.stopHideTimer
      }
    );
  }, [e.hyperlinkToolbar, e.editor, c, i]);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      appendTo: e.editor.domElement.parentElement,
      content: y,
      getReferenceClientRect: a,
      interactive: !0,
      visible: n,
      animation: "fade",
      placement: "top-start",
      zIndex: 4e3
    }
  );
}, jn = (e) => {
  const { classes: n } = $({ root: {} })(void 0, {
    name: "SideMenu"
  });
  return /* @__PURE__ */ r.jsx(He, { className: n.root, spacing: 0, children: e.children });
};
function Tn(e) {
  return j({ tag: "svg", attr: { t: "1551322312294", style: "", viewBox: "0 0 1024 1024", version: "1.1" }, child: [{ tag: "defs", attr: {}, child: [] }, { tag: "path", attr: { d: "M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z" } }, { tag: "path", attr: { d: "M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z" } }] })(e);
}
const zt = (e) => /* @__PURE__ */ r.jsx(gt, { size: 24, children: e.children }), wn = (e) => /* @__PURE__ */ r.jsx(zt, { children: /* @__PURE__ */ r.jsx(
  Tn,
  {
    size: 24,
    onClick: e.addBlock,
    "data-test": "dragHandleAdd"
  }
) });
function Sn(e) {
  return j({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" } }, { tag: "path", attr: { d: "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" } }] })(e);
}
const Mn = (e) => {
  const { classes: n } = $({ root: {} })(void 0, {
    name: "DragHandleMenu"
  });
  return /* @__PURE__ */ r.jsx(w.Dropdown, { className: n.root, style: { overflow: "visible" }, children: e.children });
}, Ht = (e) => {
  const { children: n, ...o } = e;
  return /* @__PURE__ */ r.jsx(w.Item, { ...o, children: n });
}, Rn = (e) => /* @__PURE__ */ r.jsx(
  Ht,
  {
    onClick: () => e.editor.removeBlocks([e.block]),
    children: e.children
  }
), En = (e) => {
  const [n, o] = x(!1), { ref: i, updateMaxHeight: s } = xe(), c = L(), u = z(() => {
    c.current && clearTimeout(c.current), c.current = setTimeout(() => {
      o(!1);
    }, 250);
  }, []), g = z(() => {
    c.current && clearTimeout(c.current), n || s(), o(!0);
  }, [n, s]);
  return !("textColor" in e.block.props) && !("backgroundColor" in e.block.props) ? null : /* @__PURE__ */ r.jsx(
    Ht,
    {
      onMouseLeave: u,
      onMouseOver: g,
      children: /* @__PURE__ */ r.jsxs(w, { opened: n, position: "right", children: [
        /* @__PURE__ */ r.jsx(w.Target, { children: /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
          /* @__PURE__ */ r.jsx("div", { style: { flex: 1 }, children: e.children }),
          /* @__PURE__ */ r.jsx(ft, { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ r.jsx(Zr, { size: 15 }) })
        ] }) }),
        /* @__PURE__ */ r.jsx("div", { ref: i, children: /* @__PURE__ */ r.jsx(
          w.Dropdown,
          {
            onMouseLeave: u,
            onMouseOver: g,
            style: { marginLeft: "5px" },
            children: /* @__PURE__ */ r.jsx(
              wt,
              {
                iconSize: 18,
                text: "textColor" in e.block.props && typeof e.block.props.textColor == "string" ? {
                  color: e.block.props.textColor,
                  setColor: (a) => e.editor.updateBlock(e.block, {
                    props: { textColor: a }
                  })
                } : void 0,
                background: "backgroundColor" in e.block.props && typeof e.block.props.backgroundColor == "string" ? {
                  color: e.block.props.backgroundColor,
                  setColor: (a) => e.editor.updateBlock(e.block, {
                    props: { backgroundColor: a }
                  })
                } : void 0
              }
            )
          }
        ) })
      ] })
    }
  );
}, zn = (e) => /* @__PURE__ */ r.jsxs(Mn, { children: [
  /* @__PURE__ */ r.jsx(Rn, { ...e, children: "Delete" }),
  /* @__PURE__ */ r.jsx(En, { ...e, children: "Colors" })
] }), Hn = (e) => {
  const n = e.dragHandleMenu || zn;
  return /* @__PURE__ */ r.jsxs(
    w,
    {
      trigger: "click",
      onOpen: e.freezeMenu,
      onClose: e.unfreezeMenu,
      width: 100,
      position: "left",
      children: [
        /* @__PURE__ */ r.jsx(w.Target, { children: /* @__PURE__ */ r.jsx(
          "div",
          {
            draggable: "true",
            onDragStart: e.blockDragStart,
            onDragEnd: e.blockDragEnd,
            children: /* @__PURE__ */ r.jsx(zt, { children: /* @__PURE__ */ r.jsx(Sn, { size: 24, "data-test": "dragHandle" }) })
          }
        ) }),
        /* @__PURE__ */ r.jsx(n, { editor: e.editor, block: e.block })
      ]
    }
  );
}, In = (e) => /* @__PURE__ */ r.jsxs(jn, { children: [
  /* @__PURE__ */ r.jsx(wn, { ...e }),
  /* @__PURE__ */ r.jsx(Hn, { ...e })
] }), Bn = (e) => {
  const [n, o] = x(!1), [i, s] = x(), c = L();
  B(() => e.editor.sideMenu.onUpdate((a) => {
    o(a.show), s(a.block), c.current = a.referencePos;
  }), [e.editor]);
  const u = R(
    () => {
      if (c.current)
        return () => c.current;
    },
    [c.current]
    // eslint-disable-line
  ), g = R(() => {
    if (!i)
      return null;
    const a = e.sideMenu || In;
    return /* @__PURE__ */ r.jsx(
      a,
      {
        block: i,
        editor: e.editor,
        blockDragStart: e.editor.sideMenu.blockDragStart,
        blockDragEnd: e.editor.sideMenu.blockDragEnd,
        addBlock: e.editor.sideMenu.addBlock,
        freezeMenu: e.editor.sideMenu.freezeMenu,
        unfreezeMenu: e.editor.sideMenu.unfreezeMenu
      }
    );
  }, [i, e.editor, e.sideMenu]);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      appendTo: e.editor.domElement.parentElement,
      content: g,
      getReferenceClientRect: u,
      interactive: !0,
      visible: n,
      animation: "fade",
      offset: _n,
      placement: "left",
      popperOptions: Dn,
      zIndex: 1e3
    }
  );
}, _n = [0, 0], Dn = {
  modifiers: [
    {
      name: "flip",
      options: {
        fallbackPlacements: []
      }
    },
    {
      name: "preventOverflow",
      options: {
        mainAxis: !1,
        altAxis: !1
      }
    }
  ]
}, Pn = 5;
function On(e) {
  const n = L(null), { classes: o } = $({ root: {} })(void 0, {
    name: "SuggestionListItem"
  });
  function i() {
    var g;
    const c = e.isSelected, u = (g = n.current) == null ? void 0 : g.matches(":hover");
    return c || u;
  }
  function s() {
    var c, u;
    i() ? (c = n.current) == null || c.setAttribute("data-hovered", "true") : (u = n.current) == null || u.removeAttribute("data-hovered");
  }
  return B(() => {
    s(), i() && n.current && n.current.getBoundingClientRect().left > Pn && n.current.scrollIntoView({
      behavior: "smooth",
      block: "nearest"
    });
  }), /* @__PURE__ */ r.jsx(
    w.Item,
    {
      className: o.root,
      icon: e.icon,
      onClick: e.set,
      closeMenuOnClick: !1,
      onMouseLeave: () => {
        setTimeout(() => {
          s();
        }, 1);
      },
      ref: n,
      rightSection: e.shortcut && /* @__PURE__ */ r.jsx(jr, { size: "xs", children: e.shortcut }),
      children: /* @__PURE__ */ r.jsxs(Be, { children: [
        /* @__PURE__ */ r.jsx(oe, { size: 14, weight: 500, children: e.name }),
        /* @__PURE__ */ r.jsx(oe, { size: 10, children: e.hint })
      ] })
    }
  );
}
function Fn(e) {
  const { classes: n } = $({ root: {} })(void 0, {
    name: "SlashMenu"
  }), o = [];
  let i = 0;
  const s = it.groupBy(e.filteredItems, (c) => c.group);
  return it.forEach(s, (c) => {
    o.push(
      /* @__PURE__ */ r.jsx(w.Label, { children: c[0].group }, c[0].group)
    );
    for (const u of c)
      o.push(
        /* @__PURE__ */ r.jsx(
          On,
          {
            name: u.name,
            icon: u.icon,
            hint: u.hint,
            shortcut: u.shortcut,
            isSelected: e.keyboardHoveredItemIndex === i,
            set: () => e.itemCallback(u)
          },
          u.name
        )
      ), i++;
  }), /* @__PURE__ */ r.jsx(
    w,
    {
      defaultOpened: !0,
      trigger: "hover",
      closeDelay: 1e7,
      children: /* @__PURE__ */ r.jsx(
        w.Dropdown,
        {
          onMouseDown: (c) => c.preventDefault(),
          className: n.root,
          children: o.length > 0 ? o : /* @__PURE__ */ r.jsx(w.Item, { children: "No match found" })
        }
      )
    }
  );
}
const An = (e) => {
  const [n, o] = x(!1), [i, s] = x(), [c, u] = x(), g = L();
  B(() => e.editor.slashMenu.onUpdate((S) => {
    o(S.show), s(S.filteredItems), u(S.keyboardHoveredItemIndex), g.current = S.referencePos;
  }), [e.editor]);
  const a = R(
    () => {
      if (g.current)
        return () => g.current;
    },
    [g.current]
    // eslint-disable-line
  ), { ref: y, updateMaxHeight: h } = xe(), p = R(() => {
    if (!i || c === void 0)
      return null;
    const S = e.slashMenu || Fn;
    return /* @__PURE__ */ r.jsx("div", { ref: y, children: /* @__PURE__ */ r.jsx(
      S,
      {
        filteredItems: i,
        itemCallback: (T) => e.editor.slashMenu.itemCallback(T),
        keyboardHoveredItemIndex: c
      }
    ) });
  }, [
    i,
    c,
    e.editor.slashMenu,
    e.slashMenu,
    y
  ]);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      onShow: h,
      appendTo: e.editor.domElement.parentElement,
      content: p,
      getReferenceClientRect: a,
      interactive: !0,
      visible: n,
      animation: "fade",
      placement: "bottom-start",
      zIndex: 2e3
    }
  );
}, k = [
  "#FFFFFF",
  "#EFEFEF",
  "#CFCFCF",
  "#AFAFAF",
  "#7F7F7F",
  "#3F3F3F",
  "#1F1F1F",
  "#161616",
  "#0F0F0F",
  "#000000"
], ve = {
  colors: {
    editor: {
      text: k[5],
      background: k[0]
    },
    menu: {
      text: k[5],
      background: k[0]
    },
    tooltip: {
      text: k[5],
      background: k[1]
    },
    hovered: {
      text: k[5],
      background: k[1]
    },
    selected: {
      text: k[0],
      background: k[5]
    },
    disabled: {
      text: k[3],
      background: k[1]
    },
    shadow: k[2],
    border: k[1],
    sideMenu: k[2],
    highlightColors: {
      gray: {
        text: "#9b9a97",
        background: "#ebeced"
      },
      brown: {
        text: "#64473a",
        background: "#e9e5e3"
      },
      red: {
        text: "#e03e3e",
        background: "#fbe4e4"
      },
      orange: {
        text: "#d9730d",
        background: "#f6e9d9"
      },
      yellow: {
        text: "#dfab01",
        background: "#fbf3db"
      },
      green: {
        text: "#4d6461",
        background: "#ddedea"
      },
      blue: {
        text: "#0b6e99",
        background: "#ddebf1"
      },
      purple: {
        text: "#6940a5",
        background: "#eae4f2"
      },
      pink: {
        text: "#ad1a72",
        background: "#f4dfeb"
      }
    }
  },
  borderRadius: 6,
  fontFamily: '"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
}, dt = {
  colors: {
    editor: {
      text: k[2],
      background: k[6]
    },
    menu: {
      text: k[2],
      background: k[6]
    },
    tooltip: {
      text: k[2],
      background: k[7]
    },
    hovered: {
      text: k[2],
      background: k[7]
    },
    selected: {
      text: k[2],
      background: k[8]
    },
    disabled: {
      text: k[5],
      background: k[7]
    },
    shadow: k[8],
    border: k[7],
    sideMenu: k[4],
    highlightColors: {
      gray: {
        text: "#bebdb8",
        background: "#9b9a97"
      },
      brown: {
        text: "#8e6552",
        background: "#64473a"
      },
      red: {
        text: "#ec4040",
        background: "#be3434"
      },
      orange: {
        text: "#e3790d",
        background: "#b7600a"
      },
      yellow: {
        text: "#dfab01",
        background: "#b58b00"
      },
      green: {
        text: "#6b8b87",
        background: "#4d6461"
      },
      blue: {
        text: "#0e87bc",
        background: "#0b6e99"
      },
      purple: {
        text: "#8552d7",
        background: "#6940a5"
      },
      pink: {
        text: "#da208f",
        background: "#ad1a72"
      }
    }
  },
  borderRadius: ve.borderRadius,
  fontFamily: ve.fontFamily
}, Ln = (e) => {
  const [n, o] = x(!1), [i, s] = x(), c = L();
  B(() => (bt.setDefaultProps({ maxWidth: "" }), e.editor.imageToolbar.onUpdate((a) => {
    o(a.show), s(a.block), c.current = a.referencePos;
  })), [e.editor]);
  const u = R(
    () => {
      if (c)
        return () => c.current;
    },
    [c.current]
    // eslint-disable-line
  ), g = R(() => {
    const a = e.imageToolbar || Et;
    return /* @__PURE__ */ r.jsx(a, { editor: e.editor, block: i });
  }, [i, e.editor, e.imageToolbar]);
  return /* @__PURE__ */ r.jsx(
    Y,
    {
      appendTo: e.editor.domElement.parentElement,
      content: g,
      getReferenceClientRect: u,
      interactive: !0,
      visible: n,
      animation: "fade",
      placement: "bottom",
      zIndex: 5e3
    }
  );
};
function Vn(e) {
  var u;
  const { classes: n } = $({ root: {} })(void 0, {
    name: "Editor"
  }), { editor: o, children: i, className: s, ...c } = e;
  return /* @__PURE__ */ r.jsx(
    wr,
    {
      editor: (u = e.editor) == null ? void 0 : u._tiptapEditor,
      className: be(n.root, e.className || ""),
      ...c,
      children: e.children || /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
        /* @__PURE__ */ r.jsx(kn, { editor: e.editor }),
        /* @__PURE__ */ r.jsx(Cn, { editor: e.editor }),
        /* @__PURE__ */ r.jsx(An, { editor: e.editor }),
        /* @__PURE__ */ r.jsx(Bn, { editor: e.editor }),
        /* @__PURE__ */ r.jsx(Ln, { editor: e.editor })
      ] })
    }
  );
}
function eo(e) {
  const {
    theme: n = { light: ve, dark: dt },
    ...o
  } = e, i = Er(), s = R(() => n === "light" ? fe(ve) : n === "dark" ? fe(dt) : "light" in n && "dark" in n ? fe(
    n[i === "dark" ? "dark" : "light"]
  ) : fe(n), [i, n]);
  return /* @__PURE__ */ r.jsx(Tr, { theme: s, children: /* @__PURE__ */ r.jsx(Vn, { ...o }) });
}
const Un = {
  Heading: {
    group: "Headings",
    icon: /* @__PURE__ */ r.jsx(kt, { size: 18 }),
    hint: "Used for a top-level heading",
    shortcut: A("Mod-Alt-1")
  },
  "Heading 2": {
    group: "Headings",
    icon: /* @__PURE__ */ r.jsx(yt, { size: 18 }),
    hint: "Used for key sections",
    shortcut: A("Mod-Alt-2")
  },
  "Heading 3": {
    group: "Headings",
    icon: /* @__PURE__ */ r.jsx(pt, { size: 18 }),
    hint: "Used for subsections and group headings",
    shortcut: A("Mod-Alt-3")
  },
  "Numbered List": {
    group: "Basic blocks",
    icon: /* @__PURE__ */ r.jsx(jt, { size: 18 }),
    hint: "Used to display a numbered list",
    shortcut: A("Mod-Alt-7")
  },
  "Bullet List": {
    group: "Basic blocks",
    icon: /* @__PURE__ */ r.jsx(Tt, { size: 18 }),
    hint: "Used to display an unordered list",
    shortcut: A("Mod-Alt-9")
  },
  Paragraph: {
    group: "Basic blocks",
    icon: /* @__PURE__ */ r.jsx(ie, { size: 18 }),
    hint: "Used for the body of your document",
    shortcut: A("Mod-Alt-0")
  },
  Image: {
    group: "Media",
    icon: /* @__PURE__ */ r.jsx(qr, {}),
    hint: "Insert an image"
  }
};
function Nn(e = ut) {
  return vr(e).map((o) => ({
    ...o,
    ...Un[o.name]
  }));
}
const $n = (e) => new br({
  slashMenuItems: Nn(
    e.blockSchema || ut
  ),
  ...e
}), to = (e = {}, n = []) => {
  const o = L();
  return R(() => (o.current && o.current._tiptapEditor.destroy(), o.current = $n(e), o.current), n);
};
function Wn() {
  const [, e] = x(0);
  return () => e((n) => n + 1);
}
const ro = (e) => {
  const n = Wn();
  B(() => {
    const o = () => {
      requestAnimationFrame(() => {
        requestAnimationFrame(() => {
          n();
        });
      });
    };
    return e.on("transaction", o), () => {
      e.off("transaction", o);
    };
  }, [e]);
}, It = fr({}), no = (e) => {
  const n = hr(It).inlineContent || {}, o = be(
    e.className || "",
    F.inlineContent,
    n.class
  );
  return /* @__PURE__ */ r.jsx(
    Sr,
    {
      ...Object.fromEntries(
        Object.entries(n).filter(
          ([i]) => i !== "class"
        )
      ),
      ...e,
      className: o
    }
  );
};
function oo(e) {
  return {
    node: xr({
      name: e.type,
      content: e.containsInlineContent ? "inline*" : "",
      selectable: !0,
      addAttributes() {
        return mr(e);
      },
      parseHTML() {
        return kr(e);
      },
      renderHTML({ HTMLAttributes: o }) {
        return yr(e, o);
      },
      addNodeView() {
        return Mr((i) => {
          var T;
          const s = e.render, c = ((T = this.options.domAttributes) == null ? void 0 : T.blockContent) || {}, u = {};
          for (const [D, le] of Object.entries(i.node.attrs))
            D in e.propSchema && le !== e.propSchema[D].default && (u[pr(D)] = le);
          const g = this.options.editor, a = typeof i.getPos == "function" ? i.getPos() : void 0, p = g._tiptapEditor.state.doc.resolve(a).node().attrs.id, S = g.getBlock(p);
          if (S.type !== e.type)
            throw new Error("Block type does not match");
          return /* @__PURE__ */ r.jsx(
            Rr,
            {
              ...Object.fromEntries(
                Object.entries(c).filter(
                  ([D]) => D !== "class"
                )
              ),
              className: be(
                F.blockContent,
                c.class
              ),
              "data-content-type": e.type,
              ...u,
              children: /* @__PURE__ */ r.jsx(
                It.Provider,
                {
                  value: this.options.domAttributes || {},
                  children: /* @__PURE__ */ r.jsx(s, { block: S, editor: g })
                }
              )
            }
          );
        }, {
          className: F.reactNodeViewRenderer
        });
      }
    }),
    propSchema: e.propSchema
  };
}
export {
  wn as AddBlockButton,
  En as BlockColorsButton,
  eo as BlockNoteView,
  on as BlockTypeDropdown,
  un as ColorStyleButton,
  vn as CreateLinkButton,
  zn as DefaultDragHandleMenu,
  mn as DefaultFormattingToolbar,
  Et as DefaultImageToolbar,
  In as DefaultSideMenu,
  Fn as DefaultSlashMenu,
  Hn as DragHandle,
  Mn as DragHandleMenu,
  Ht as DragHandleMenuItem,
  kn as FormattingToolbarPositioner,
  Cn as HyperlinkToolbarPositioner,
  Ln as ImageToolbarPositioner,
  no as InlineContent,
  gn as NestBlockButton,
  Rn as RemoveBlockButton,
  jn as SideMenu,
  zt as SideMenuButton,
  Bn as SideMenuPositioner,
  On as SlashMenuItem,
  An as SlashMenuPositioner,
  Se as TextAlignButton,
  he as ToggledStyleButton,
  _e as Toolbar,
  P as ToolbarButton,
  en as ToolbarDropdown,
  fn as UnnestBlockButton,
  fe as blockNoteToMantineTheme,
  oo as createReactBlockSpec,
  dt as darkDefaultTheme,
  nn as defaultBlockTypeDropdownItems,
  k as defaultColorScheme,
  Nn as getDefaultReactSlashMenuItems,
  ve as lightDefaultTheme,
  to as useBlockNote,
  q as useEditorChange,
  tn as useEditorContentChange,
  ro as useEditorForceUpdate,
  rn as useEditorSelectionChange,
  G as useSelectedBlocks
};
//# sourceMappingURL=blocknote-react.js.map
