var l = Object.defineProperty;
var p = (t, e, a) => e in t ? l(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
var s = (t, e, a) => p(t, typeof e != "symbol" ? e + "" : e, a);
import { jsx as i } from "react/jsx-runtime";
import { createPluginFactory as g } from "@udecode/plate-core";
import { merge as u } from "../../../../../utilities/merge.es.js";
import { alignmentClassnames as c } from "../../helper.es.js";
import { TextStyles as m } from "../types.es.js";
import { Plugin as C } from "../../Plugin.es.js";
import { defaultStyles as f } from "../../../utils/defaultStyles.es.js";
import { MarkupElement as y } from "../../MarkupElement.es.js";
import { getColumnBreakClasses as d } from "../../ColumnBreakPlugin/utils/getColumnBreakClasses.es.js";
const k = "textstyle-imageCaption-plugin";
class z extends C {
  constructor({ styles: a = f.imageCaption, ...o } = {}) {
    super(m.imageCaption, {
      label: "Image Caption",
      markupElement: new x(),
      ...o
    });
    s(this, "styles", {});
    this.styles = a;
  }
  plugins() {
    return [I(this.styles)];
  }
}
class x extends y {
  constructor(e = k, a = n) {
    super(e, a);
  }
}
const n = ({ element: t, attributes: e, children: a, styles: o }) => {
  const r = t.align;
  return /* @__PURE__ */ i(
    "p",
    {
      ...e,
      className: u([r && c[r], d(t)]),
      style: o,
      children: a
    }
  );
}, I = (t) => g({
  key: m.imageCaption,
  isElement: !0,
  component: n,
  deserializeHtml: {
    rules: [{ validClassName: m.imageCaption }]
  }
})({
  component: (e) => /* @__PURE__ */ i(n, { ...e, styles: t })
});
export {
  z as ImageCaptionPlugin
};
//# sourceMappingURL=imageCaptionPlugin.es.js.map
