"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
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 PlanCard_exports = {};
__export(PlanCard_exports, {
  PLAN_LINE_HEIGHT: () => PLAN_LINE_HEIGHT,
  default: () => PlanCard_default
});
module.exports = __toCommonJS(PlanCard_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_prop_types = require("prop-types");
var import_Box = __toESM(require("../../../Box"));
var import_Text = __toESM(require("../../../Text"));
const PLAN_LINE_HEIGHT = 4;
const DISCOUNT_HEIGHT = 28;
const Plan = import_styled_components.default.article`
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 312px;

  overflow: hidden;

  ${(props) => {
  const theme = props.theme.yoga;
  const { plan } = theme.components.card;
  return import_styled_components.css`
      padding: ${plan.padding.top}px ${plan.padding.right}px
        ${plan.padding.bottom}px ${plan.padding.left}px;
      border: ${theme.borders.small}px solid ${theme.colors.light};
      border-radius: ${plan.radius}px;

      background-color: ${theme.colors.white};
    `;
}}
`;
const Border = import_styled_components.default.span`
  ${({ variant, hasRightMask, theme }) => {
  const { spacing, colors } = theme.yoga;
  const color = colors[variant] || variant;
  const MASK_SIZE = 112;
  const baseMaskStyle = import_styled_components.css`
      position: absolute;
      height: ${MASK_SIZE}px;
      width: ${MASK_SIZE}px;
      content: '';
      background: radial-gradient(
        50% 50% at 50% 50%,
        ${colors.white} 0%,
        transparent 100%
      );
      border-radius: 50%;
    `;
  return import_styled_components.css`
      position: absolute;
      top: 0;
      left: 0;

      display: inline-block;
      width: 100%;

      height: ${PLAN_LINE_HEIGHT}px;
      background-color: ${color};

      ::before {
        ${baseMaskStyle}
        left: ${spacing.large}px;
        top: -${MASK_SIZE - DISCOUNT_HEIGHT}px;
        opacity: 0.8;
      }

      ${hasRightMask && import_styled_components.css`
        ::after {
          ${baseMaskStyle}
          top: -${MASK_SIZE - DISCOUNT_HEIGHT + PLAN_LINE_HEIGHT}px;
          right: ${spacing.large}px;
          opacity: 0.5;
        }
      `}
    `;
}}
`;
const DiscountWrapper = (0, import_styled_components.default)(import_Box.default).attrs({
  ph: "xsmall",
  pv: "xxxsmall"
})`
  ${({ bg, theme }) => {
  const { spacing, colors } = theme.yoga;
  return import_styled_components.css`
      position: absolute;
      top: 0;
      right: 0;
      display: flex;
      align-items: center;
      min-height: ${DISCOUNT_HEIGHT}px;
      border-bottom-left-radius: ${spacing.small}px;

      ::before {
        content: '';
        position: absolute;
        left: -${DISCOUNT_HEIGHT}px;
        height: ${DISCOUNT_HEIGHT / 2 - PLAN_LINE_HEIGHT}px;
        width: ${DISCOUNT_HEIGHT}px;
        top: ${PLAN_LINE_HEIGHT}px;
        background: transparent;
        border-top-right-radius: ${spacing.small}px;
        box-shadow: ${colors[bg] || bg} ${spacing.xsmall}px -1px;
      }
    `;
}}
`;
function PlanCard(_a) {
  var _b = _a, { children, discount, variant = "deepPurple" } = _b, rest = __objRest(_b, ["children", "discount", "variant"]);
  const hasDiscount = !!discount;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Plan, __spreadProps(__spreadValues({}, rest), { children: [
    hasDiscount && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DiscountWrapper, { bg: variant, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Tiny, { color: "white", fontWeight: "medium", children: discount }) }),
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Border, { variant, hasRightMask: hasDiscount }),
    children
  ] }));
}
PlanCard.propTypes = {
  children: import_prop_types.node,
  discount: import_prop_types.string,
  variant: import_prop_types.string
};
PlanCard.displayName = "PlanCard";
var PlanCard_default = PlanCard;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  PLAN_LINE_HEIGHT
});
