import { Decoration_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { EmptyDecoration } from "./empty-decoration.js";
class ItalicDecoration {
  constructor(customStyle) {
    this.type = Decoration_Type.ITALIC;
    this.customStyle = customStyle;
  }
  static of(decoration) {
    if (decoration.type !== Decoration_Type.ITALIC) {
      throw new TypeError(`invalid decoration initializer ${decoration}`);
    }
    return new ItalicDecoration(decoration.italicData ? { fontStyle: "italic" } : {});
  }
  getDecoration() {
    return {
      type: this.type,
      italicData: this.customStyle.fontStyle?.includes("italic")
    };
  }
  static fromCustomStyle(customStyle) {
    return new ItalicDecoration(customStyle);
  }
  fromCustomStyle(customStyle) {
    return ItalicDecoration.fromCustomStyle(customStyle);
  }
  toCustomStyle() {
    return this.customStyle;
  }
  overrideWith(decoration) {
    if (!(decoration instanceof ItalicDecoration || decoration instanceof EmptyDecoration)) {
      throw new TypeError(`invalid merge decoration ${decoration}`);
    }
    const customStyle = { ...this.customStyle, ...decoration.toCustomStyle() };
    return new ItalicDecoration(customStyle);
  }
}
export {
  ItalicDecoration
};
//# sourceMappingURL=italic-decoration.js.map
