"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 Link_exports = {};
__export(Link_exports, {
  Base: () => Base,
  DEFAULT_ICON_POSITION: () => DEFAULT_ICON_POSITION,
  DEFAULT_SIZE: () => DEFAULT_SIZE,
  DEFAULT_TYPE: () => DEFAULT_TYPE,
  default: () => Link_default
});
module.exports = __toCommonJS(Link_exports);
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_getLinkStyle = require("./getLinkStyle");
var import_getCtaStyle = require("../getCtaStyle");
var import_asorted = require("../../asorted");
var import_styled = __toESM(require("../../styled"));
const DEFAULT_ICON_POSITION = "right";
const DEFAULT_SIZE = "medium";
const DEFAULT_TYPE = "main";
const IconContainer = import_styled_components.default.div`
  ${(p) => p.iconLink ? "" : p.iconPosition === "left" ? `margin-right: 6px;` : `margin-left: 6px;`}
  display: flex;
  align-items: center;
  justify-content: center;
`;
const Base = import_styled.default.a`
  color: ${({ color, theme, disabled, type = "main" }) => color || (0, import_getLinkStyle.getLinkColors)(theme.colors)[disabled ? "disabled" : type]["default"]};
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  text-align: center;
  align-items: center;
  justify-content: center;

  &:hover {
    text-decoration: underline;
  }
  &:active {
    color: ${({ color, theme, type = "main" }) => color || (0, import_getLinkStyle.getLinkColors)(theme.colors)[type]["pressed"]};
    text-decoration: underline;
  }

  text-decoration: ${(p) => p.alwaysUnderline ? "underline" : "none"};

`;
const LinkContainer = ({
  Icon,
  iconPosition = DEFAULT_ICON_POSITION,
  children,
  color,
  size = DEFAULT_SIZE,
  textProps
}) => {
  const text = /* @__PURE__ */ import_react.default.createElement(
    import_asorted.Text,
    {
      variant: import_getCtaStyle.ctaTextType[size],
      fontWeight: "semiBold",
      color: color || "inherit",
      ...textProps
    },
    children
  );
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, iconPosition === "right" && children ? text : null, Icon ? /* @__PURE__ */ import_react.default.createElement(IconContainer, { iconLink: !children, iconPosition }, /* @__PURE__ */ import_react.default.createElement(Icon, { size: import_getCtaStyle.ctaIconSize[size], color: color || "currentcolor" })) : null, iconPosition === "left" && children ? text : null);
};
const Link = (props) => {
  const { type = DEFAULT_TYPE, size = DEFAULT_SIZE, color } = props;
  return /* @__PURE__ */ import_react.default.createElement(Base, { color, ...props }, /* @__PURE__ */ import_react.default.createElement(LinkContainer, { ...props, type, size }));
};
var Link_default = Link;
//# sourceMappingURL=index.js.map
