import classnames from "classnames";
import React, { useContext } from "react";
import {
  RicosAlignmentContext,
  RicosNodeContextProvider,
  VisibleIndentationContext,
  VisibleIndentationContextProvider
} from "./../../../../../ricos-context/index.js";
import { TextStyle_TextAlignment } from "./../../../../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import alignmentStyle from "../../../../statics/alignment-scss.js";
import styles from "./lists-scss.js";
const OrderedList = ({ node, nodeIndex, RicosNodesRenderer }) => {
  const { textAlignment } = useContext(RicosAlignmentContext);
  const { visibleIndentation } = useContext(VisibleIndentationContext);
  const currIndentation = visibleIndentation?.indentation || 0;
  const currOffset = node.orderedListData?.offset || 0;
  const indentation = (visibleIndentation && visibleIndentation?.nodeId !== node.id ? 1 : 0) + currIndentation + currOffset;
  const orderedListClassName = classnames(
    styles.orderedlist,
    alignmentStyle[textAlignment || TextStyle_TextAlignment.AUTO]
  );
  return /* @__PURE__ */ React.createElement("ol", { className: orderedListClassName, start: node.orderedListData?.start }, /* @__PURE__ */ React.createElement(VisibleIndentationContextProvider, { visibleIndentation: { indentation, nodeId: node.id } }, /* @__PURE__ */ React.createElement(RicosNodeContextProvider, { parentNode: node, parentIndex: nodeIndex }, /* @__PURE__ */ React.createElement(RicosNodesRenderer, { nodes: node.nodes ?? [] }))));
};
const OrderedListRenderer = ({ node, ...props }) => {
  return /* @__PURE__ */ React.createElement(OrderedList, { key: node.id, node, ...props });
};
var ordered_list_default = OrderedListRenderer;
export {
  ordered_list_default as default
};
//# sourceMappingURL=ordered-list.js.map
