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 { defaultStyles as u } from "../../../utils/defaultStyles.es.js";
import { merge as c } from "../../../../../utilities/merge.es.js";
import { getColumnBreakClasses as C } from "../../ColumnBreakPlugin/utils/getColumnBreakClasses.es.js";
import { MarkupElement as f } from "../../MarkupElement.es.js";
import { Plugin as y } from "../../Plugin.es.js";
import { alignmentClassnames as d } from "../../helper.es.js";
import { TextStyles as m } from "../types.es.js";
const k = "textstyle-imageCaption-plugin";
class z extends y {
  constructor({ styles: a = u.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 f {
  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: c([r && d[r], C(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
