"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 libs_exports = {};
__export(libs_exports, {
  withTokens: () => withTokens
});
module.exports = __toCommonJS(libs_exports);
var import_memoize = __toESM(require("lodash/memoize"));
var import_styled_components = require("styled-components");
var import_design_tokens = require("./design-tokens");
const overrideOther = {
  "radius-m": "12px",
  // missing from tokens
  "radius-s": "8px",
  // missing from tokens
  "radius-xs": "4px",
  // missing from tokens
  "border-width-default": "1px",
  // missing from tokens
  "border-width-focus": "2px",
  // missing from tokens
  "margin-xs": "8px",
  // redefines marging-xs
  "margin-s": "16px",
  // redefines marging-s
  "margin-m": "24px",
  // redefines marging-m
  "margin-l": "32px",
  // redefines marging-l
  "spacing-xs": "12px",
  // override from "spacing-xxs": "12px"
  "spacing-xxs": "8px"
  // override from "spacing-xs": "8px"
};
const overrideColor = {
  light: {
    "surface-transparent-hover": "#0000000D",
    // override from colours
    "surface-transparent-pressed": "#0000001A",
    // override from colours
    "border-subdued-default-hover": "#D5D5D5",
    // override from colours
    "border-subdued-default-pressed": "#C1C1C1",
    // missing from colours
    "background-active": "#D4A0FF"
  },
  dark: {
    "opacity-default-10": "#FFFFFF1A",
    // missing from colours
    "background-active": "#D4A0FF"
  }
};
const withTokens = (...usedTokens) => {
  const filterTokens = (0, import_memoize.default)((theme) => {
    const colors = {
      dark: { ...import_design_tokens.dark, ...overrideColor.dark },
      light: { ...import_design_tokens.light, ...overrideColor.light }
    }[theme];
    const colorEntries = Object.entries(colors).flatMap(([key, value]) => {
      const color = `colors-${key}`;
      if (!usedTokens.includes(color))
        return [];
      return [[`--${color}`, value]];
    });
    const otherEntries = [import_design_tokens.spacing, overrideOther].flatMap(Object.entries).flatMap(([key, value]) => {
      if (!usedTokens.includes(key))
        return [];
      return [[`--${key}`, value]];
    });
    return Object.fromEntries([...colorEntries, ...otherEntries]);
  });
  return (0, import_styled_components.css)(({ theme }) => filterTokens(theme.colors.type));
};
//# sourceMappingURL=index.js.map
