"use strict";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
  value: true
}), mod);
var themes_old_exports = {};
__export(themes_old_exports, {
  themes: () => themes
});
module.exports = __toCommonJS(themes_old_exports);
var import_create_theme = require("@tamagui/create-theme");
var import_tokens = require("./tokens.native.js");
var lightTransparent = "rgba(255,255,255,0)";
var darkTransparent = "rgba(10,10,10,0)";
var palettes = {
  dark: [darkTransparent, "#050505", "#151515", "#191919", "#232323", "#282828", "#323232", "#424242", "#494949", "#545454", "#626262", "#a5a5a5", "#fff", lightTransparent],
  light: [lightTransparent, "#fff", "#f9f9f9", "hsl(0, 0%, 97.3%)", "hsl(0, 0%, 95.1%)", "hsl(0, 0%, 94.0%)", "hsl(0, 0%, 92.0%)", "hsl(0, 0%, 89.5%)", "hsl(0, 0%, 81.0%)", "hsl(0, 0%, 56.1%)", "hsl(0, 0%, 50.3%)", "hsl(0, 0%, 42.5%)", "hsl(0, 0%, 9.0%)", darkTransparent]
};
var templateColors = {
  color1: 1,
  color2: 2,
  color3: 3,
  color4: 4,
  color5: 5,
  color6: 6,
  color7: 7,
  color8: 8,
  color9: 9,
  color10: 10,
  color11: 11,
  color12: 12
};
var templateShadows = {
  shadowColor: 1,
  shadowColorHover: 1,
  shadowColorPress: 2,
  shadowColorFocus: 2
};
var toSkip = {
  ...templateShadows
};
var override = Object.fromEntries(Object.entries(toSkip).map(function (param) {
  var [k] = param;
  return [k, 0];
}));
var overrideShadows = Object.fromEntries(Object.entries(templateShadows).map(function (param) {
  var [k] = param;
  return [k, 0];
}));
var overrideWithColors = {
  ...override,
  color: 0,
  colorHover: 0,
  colorFocus: 0,
  colorPress: 0
};
var template = {
  ...templateColors,
  ...toSkip,
  // the background, color, etc keys here work like generics - they make it so you
  // can publish components for others to use without mandating a specific color scale
  // the @tamagui/button Button component looks for `$background`, so you set the
  // dark_red_Button theme to have a stronger background than the dark_red theme.
  background: 2,
  backgroundHover: 3,
  backgroundPress: 4,
  backgroundFocus: 5,
  backgroundStrong: 1,
  backgroundTransparent: 0,
  color: -1,
  colorHover: -2,
  colorPress: -1,
  colorFocus: -2,
  colorTransparent: -0,
  borderColor: 4,
  borderColorHover: 5,
  borderColorPress: 3,
  borderColorFocus: 4,
  placeholderColor: -4
};
var lightShadowColor = "rgba(0,0,0,0.02)";
var lightShadowColorStrong = "rgba(0,0,0,0.066)";
var darkShadowColor = "rgba(0,0,0,0.2)";
var darkShadowColorStrong = "rgba(0,0,0,0.3)";
var lightShadows = {
  shadowColor: lightShadowColorStrong,
  shadowColorHover: lightShadowColorStrong,
  shadowColorPress: lightShadowColor,
  shadowColorFocus: lightShadowColor
};
var darkShadows = {
  shadowColor: darkShadowColorStrong,
  shadowColorHover: darkShadowColorStrong,
  shadowColorPress: darkShadowColor,
  shadowColorFocus: darkShadowColor
};
var lightTemplate = {
  ...template,
  background: 2,
  backgroundHover: 3,
  backgroundPress: 4,
  // our light color palette is... a bit unique
  borderColor: 6,
  borderColorHover: 7,
  borderColorFocus: 5,
  borderColorPress: 6,
  ...lightShadows
};
var darkTemplate = {
  ...template,
  ...darkShadows
};
var light = (0, import_create_theme.createTheme)(palettes.light, lightTemplate);
var dark = (0, import_create_theme.createTheme)(palettes.dark, darkTemplate);
var baseThemes = {
  light,
  dark
};
var masks = {
  skip: import_create_theme.skipMask,
  weaker: (0, import_create_theme.createWeakenMask)(),
  stronger: (0, import_create_theme.createStrengthenMask)()
};
var maskOptions = {
  override,
  skip: toSkip,
  // avoids the transparent ends
  max: palettes.light.length - 2,
  min: 1
};
var transparent = function (hsl) {
  var opacity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  return hsl.replace(`%)`, `%, ${opacity})`).replace(`hsl(`, `hsla(`);
};
var [lightColorThemes, darkColorThemes] = [import_tokens.colorTokens.light, import_tokens.colorTokens.dark].map(function (colorSet, i) {
  var isLight = i === 0;
  var theme = baseThemes[isLight ? "light" : "dark"];
  return Object.fromEntries(Object.keys(colorSet).map(function (color) {
    var colorPalette = Object.values(colorSet[color]);
    var [head, tail] = [colorPalette.slice(0, 6), colorPalette.slice(colorPalette.length - 5)];
    var palette = [transparent(colorPalette[0]), ...head, ...tail, theme.color, transparent(colorPalette[colorPalette.length - 1])];
    var colorTheme = (0, import_create_theme.createTheme)(palette, isLight ? {
      ...lightTemplate,
      // light color themes are a bit less sensitive
      borderColor: 4,
      borderColorHover: 5,
      borderColorFocus: 4,
      borderColorPress: 4
    } : darkTemplate);
    return [color, colorTheme];
  }));
});
var allThemes = (0, import_create_theme.addChildren)(baseThemes, function (name, theme) {
  var isLight = name === "light";
  var inverseName = isLight ? "dark" : "light";
  var inverseTheme = baseThemes[inverseName];
  var colorThemes = isLight ? lightColorThemes : darkColorThemes;
  var inverseColorThemes = isLight ? darkColorThemes : lightColorThemes;
  var allColorThemes = (0, import_create_theme.addChildren)(colorThemes, function (colorName, colorTheme) {
    var inverse = inverseColorThemes[colorName];
    return {
      ...getAltThemes({
        theme: colorTheme,
        inverse,
        isLight
      }),
      ...getComponentThemes(colorTheme, inverse, isLight)
    };
  });
  var baseSubThemes = {
    ...getAltThemes({
      theme,
      inverse: inverseTheme,
      isLight
    }),
    ...getComponentThemes(theme, inverseTheme, isLight)
  };
  return {
    ...baseSubThemes,
    ...allColorThemes
  };
});
function getAltThemes(param) {
  var {
    theme,
    inverse,
    isLight,
    activeTheme
  } = param;
  var maskOptionsAlt = {
    ...maskOptions,
    override: overrideShadows
  };
  var alt1 = (0, import_create_theme.applyMask)(theme, masks.weaker, maskOptionsAlt);
  var alt2 = (0, import_create_theme.applyMask)(alt1, masks.weaker, maskOptionsAlt);
  var active = activeTheme !== null && activeTheme !== void 0 ? activeTheme : process.env.ACTIVE_THEME_INVERSE ? inverse : function () {
    return (0, import_create_theme.applyMask)(theme, masks.weaker, {
      ...maskOptions,
      strength: 3,
      skip: {
        ...maskOptions.skip,
        color: 1
      }
    });
  }();
  return (0, import_create_theme.addChildren)({
    alt1,
    alt2,
    active
  }, function (_, subTheme) {
    return getComponentThemes(subTheme, subTheme === inverse ? theme : inverse, isLight);
  });
}
function getComponentThemes(theme, inverse, isLight) {
  var componentMaskOptions = {
    ...maskOptions,
    override: overrideWithColors,
    skip: {
      ...maskOptions.skip,
      // skip colors too just for component sub themes
      ...templateColors
    }
  };
  var weaker1 = (0, import_create_theme.applyMask)(theme, masks.weaker, componentMaskOptions);
  var base = (0, import_create_theme.applyMask)(weaker1, masks.stronger, componentMaskOptions);
  var weaker2 = (0, import_create_theme.applyMask)(weaker1, masks.weaker, componentMaskOptions);
  var stronger1 = (0, import_create_theme.applyMask)(theme, masks.stronger, componentMaskOptions);
  var inverse1 = (0, import_create_theme.applyMask)(inverse, masks.weaker, componentMaskOptions);
  var inverse2 = (0, import_create_theme.applyMask)(inverse1, masks.weaker, componentMaskOptions);
  var strongerBorderLighterBackground = isLight ? {
    ...stronger1,
    borderColor: weaker1.borderColor,
    borderColorHover: weaker1.borderColorHover,
    borderColorPress: weaker1.borderColorPress,
    borderColorFocus: weaker1.borderColorFocus
  } : {
    ...(0, import_create_theme.applyMask)(theme, masks.skip, componentMaskOptions),
    borderColor: weaker1.borderColor,
    borderColorHover: weaker1.borderColorHover,
    borderColorPress: weaker1.borderColorPress,
    borderColorFocus: weaker1.borderColorFocus
  };
  var overlayTheme = {
    background: isLight ? "rgba(0,0,0,0.5)" : "rgba(0,0,0,0.9)"
  };
  var weaker2WithoutBorder = {
    ...weaker2,
    borderColor: "transparent",
    borderColorHover: "transparent"
  };
  return {
    ListItem: isLight ? stronger1 : base,
    Card: weaker1,
    Button: weaker2WithoutBorder,
    Checkbox: weaker2,
    DrawerFrame: weaker1,
    SliderTrack: stronger1,
    SliderTrackActive: weaker2,
    SliderThumb: inverse1,
    Progress: weaker1,
    ProgressIndicator: inverse,
    Switch: weaker2,
    SwitchThumb: inverse2,
    TooltipArrow: weaker1,
    TooltipContent: weaker2,
    Input: strongerBorderLighterBackground,
    TextArea: strongerBorderLighterBackground,
    Tooltip: inverse1,
    // make overlays always dark
    SheetOverlay: overlayTheme,
    DialogOverlay: overlayTheme,
    ModalOverlay: overlayTheme
  };
}
var themes = {
  ...allThemes,
  // bring back the full type, the rest use a subset to avoid clogging up ts,
  // tamagui will be smart and use the top level themes as the type for useTheme() etc
  light: (0, import_create_theme.createTheme)(palettes.light, lightTemplate, {
    nonInheritedValues: import_tokens.lightColors
  }),
  dark: (0, import_create_theme.createTheme)(palettes.dark, darkTemplate, {
    nonInheritedValues: import_tokens.darkColors
  })
};
//# sourceMappingURL=themes-old.native.js.map
