"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var TimelineIndicator_exports = {};
__export(TimelineIndicator_exports, {
  default: () => TimelineIndicator_default
});
module.exports = __toCommonJS(TimelineIndicator_exports);
var import_react = __toESM(require("react"));
var import_CircledCheckSolidMedium = __toESM(require("@ledgerhq/icons-ui/reactLegacy/CircledCheckSolidMedium"));
var import_styled_components = __toESM(require("styled-components"));
var import_Flex = __toESM(require("../../Flex"));
const linesWidth = 2;
const BottomSegment = (0, import_styled_components.default)(import_Flex.default)`
  flex: 1;
  border-left-width: ${(p) => p.hidden ? 0 : linesWidth}px;
  border-right-width: 0;
  border-style: dashed;
  border-color: ${(p) => p.status === "completed" ? p.theme.colors.primary.c80 : p.theme.colors.neutral.c40};
  background: ${(p) => p.status === "completed" && p.theme.colors.primary.c80};
`;
const getIconBackground = (theme, status, isLastItem) => {
  if (isLastItem) {
    if (status === "inactive")
      return theme.colors.success.c10;
    return "transparent";
  } else if (status === "active") {
    return theme.colors.neutral.c40;
  } else {
    return "transparent";
  }
};
const getIconBorder = (theme, status, isLastItem) => {
  if (isLastItem) {
    return theme.colors.success.c70;
  } else if (status === "inactive") {
    return theme.colors.neutral.c40;
  }
  return theme.colors.primary.c80;
};
const CenterCircle = (0, import_styled_components.default)(import_Flex.default)`
  border-radius: 9999px;
  width: 100%;
  background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem)};
  border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem)};
  align-items: center;
  justify-content: center;
  position: relative;
`;
const IconWrapper = (0, import_styled_components.default)(import_Flex.default)`
  height: 16px;
  width: 16px;
`;
const topSegmentDefaultHeight = 23;
const Container = (0, import_styled_components.default)(import_Flex.default)`
  flex-direction: column;
  align-items: center;
  margin-bottom: ${-topSegmentDefaultHeight}px;
  padding-top: ${topSegmentDefaultHeight}px;
`;
function TimelineIndicator({ status, isLastItem, ...props }) {
  const { colors } = (0, import_styled_components.useTheme)();
  return /* @__PURE__ */ import_react.default.createElement(Container, { ...props }, /* @__PURE__ */ import_react.default.createElement(IconWrapper, null, /* @__PURE__ */ import_react.default.createElement(CenterCircle, { status, isLastItem }, status === "completed" && /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { position: "absolute" }, /* @__PURE__ */ import_react.default.createElement(
    import_CircledCheckSolidMedium.default,
    {
      color: isLastItem ? colors.success.c70 : colors.primary.c80,
      size: 20
    }
  )))), isLastItem ? null : /* @__PURE__ */ import_react.default.createElement(BottomSegment, { status }));
}
var TimelineIndicator_default = import_react.default.memo(TimelineIndicator);
TimelineIndicator.topSegmentDefaultHeight = topSegmentDefaultHeight;
//# sourceMappingURL=TimelineIndicator.js.map
