import { Decoration_Type } from "./../../ricos-schema/next-schema/index.js";
const subscriptConverter = {
  fromPm: {
    type: Decoration_Type.SUBSCRIPT,
    convert: (mark) => {
      const { type: _, attrs } = mark;
      if (typeof attrs?.subscriptData === "undefined" || attrs.subscriptData) {
        return [{ type: Decoration_Type.SUBSCRIPT }];
      }
      return [{ type: Decoration_Type.SUBSCRIPT, ...attrs }];
    }
  },
  toPm: {
    type: Decoration_Type.SUBSCRIPT,
    convert: (decoration) => {
      const { type: _, ...data } = decoration;
      if (typeof data.subscriptData === "undefined") {
        return {
          type: Decoration_Type.SUBSCRIPT,
          attrs: { subscriptData: true }
        };
      }
      return {
        type: Decoration_Type.SUBSCRIPT,
        attrs: { ...data }
      };
    }
  }
};
export {
  subscriptConverter
};
//# sourceMappingURL=subscript-converter.js.map
