const require_chunk = require("./chunk-CKQMccvm.cjs");
let react = require("react");
react = require_chunk.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/ThemeProvider/swatches.ts
const BASE_SWATCHES = {
	neutral: {
		25: "oklch(0.994 0 89.876 / 1)",
		50: "oklch(0.985 0 89.876 / 1)",
		100: "oklch(0.97 0 89.876 / 1)",
		200: "oklch(0.922 0 89.876 / 1)",
		300: "oklch(0.87 0 89.876 / 1)",
		400: "oklch(0.715 0 89.876 / 1)",
		500: "oklch(0.556 0 89.876 / 1)",
		600: "oklch(0.439 0 89.876 / 1)",
		700: "oklch(0.371 0 89.876 / 1)",
		800: "oklch(0.269 0 89.876 / 1)",
		900: "oklch(0.205 0 0 / 1)",
		925: "oklch(0.173 0 0 / 1)",
		950: "oklch(0.145 0 0 / 1)",
		1e3: "oklch(0.097 0 0 / 1)"
	},
	slate: {
		25: "oklch(0.994 0.002 247.839 / 1)",
		50: "oklch(0.984 0.003 247.858 / 1)",
		100: "oklch(0.968 0.007 247.896 / 1)",
		200: "oklch(0.929 0.013 255.508 / 1)",
		300: "oklch(0.869 0.02 252.894 / 1)",
		400: "oklch(0.711 0.035 256.788 / 1)",
		500: "oklch(0.554 0.041 257.417 / 1)",
		600: "oklch(0.446 0.037 257.281 / 1)",
		700: "oklch(0.372 0.039 257.287 / 1)",
		800: "oklch(0.279 0.037 260.031 / 1)",
		900: "oklch(0.208 0.04 265.755 / 1)",
		925: "oklch(0.166 0.029 267.188 / 1)",
		950: "oklch(0.129 0.041 264.695 / 1)",
		1e3: "oklch(0.091 0.029 268.957 / 1)"
	},
	gray: {
		25: "oklch(0.991 0.001 286.376 / 1)",
		50: "oklch(0.985 0.002 247.839 / 1)",
		100: "oklch(0.967 0.003 264.542 / 1)",
		200: "oklch(0.928 0.006 264.531 / 1)",
		300: "oklch(0.872 0.009 258.338 / 1)",
		400: "oklch(0.714 0.019 261.325 / 1)",
		500: "oklch(0.551 0.023 264.364 / 1)",
		600: "oklch(0.446 0.026 256.802 / 1)",
		700: "oklch(0.373 0.031 259.733 / 1)",
		800: "oklch(0.278 0.03 256.848 / 1)",
		900: "oklch(0.21 0.032 264.665 / 1)",
		925: "oklch(0.171 0.028 267.356 / 1)",
		950: "oklch(0.13 0.027 261.692 / 1)",
		1e3: "oklch(0.089 0.024 267.878 / 1)"
	},
	zinc: {
		25: "oklch(0.994 0 89.876 / 1)",
		50: "oklch(0.985 0 89.876 / 1)",
		100: "oklch(0.967 0.001 286.375 / 1)",
		200: "oklch(0.92 0.004 286.32 / 1)",
		300: "oklch(0.871 0.005 286.286 / 1)",
		400: "oklch(0.712 0.013 286.067 / 1)",
		500: "oklch(0.552 0.014 285.938 / 1)",
		600: "oklch(0.442 0.015 285.786 / 1)",
		700: "oklch(0.37 0.012 285.805 / 1)",
		800: "oklch(0.274 0.005 286.033 / 1)",
		900: "oklch(0.21 0.006 285.885 / 1)",
		925: "oklch(0.179 0.004 285.981 / 1)",
		950: "oklch(0.141 0.004 285.823 / 1)",
		1e3: "oklch(0.108 0.004 285.762 / 1)"
	},
	stone: {
		25: "oklch(0.994 0.001 106.423 / 1)",
		50: "oklch(0.985 0.001 106.423 / 1)",
		100: "oklch(0.97 0.001 106.424 / 1)",
		200: "oklch(0.923 0.003 48.717 / 1)",
		300: "oklch(0.869 0.004 56.366 / 1)",
		400: "oklch(0.716 0.009 56.259 / 1)",
		500: "oklch(0.553 0.012 58.071 / 1)",
		600: "oklch(0.444 0.01 73.639 / 1)",
		700: "oklch(0.374 0.009 67.558 / 1)",
		800: "oklch(0.268 0.006 34.298 / 1)",
		900: "oklch(0.216 0.006 56.043 / 1)",
		925: "oklch(0.184 0.005 67.497 / 1)",
		950: "oklch(0.147 0.004 49.25 / 1)",
		1e3: "oklch(0.108 0.005 71.346 / 1)"
	},
	blue: {
		25: "oklch(0.986 0.007 247.894 / 1)",
		50: "oklch(0.97 0.014 254.604 / 1)",
		100: "oklch(0.932 0.032 255.585 / 1)",
		200: "oklch(0.882 0.057 254.128 / 1)",
		300: "oklch(0.809 0.096 251.813 / 1)",
		400: "oklch(0.714 0.143 254.624 / 1)",
		500: "oklch(0.623 0.188 259.815 / 1)",
		600: "oklch(0.546 0.215 262.881 / 1)",
		700: "oklch(0.488 0.217 264.376 / 1)",
		800: "oklch(0.424 0.181 265.638 / 1)",
		900: "oklch(0.379 0.138 265.522 / 1)",
		925: "oklch(0.328 0.111 266.206 / 1)",
		950: "oklch(0.282 0.087 267.935 / 1)",
		1e3: "oklch(0.217 0.066 266.921 / 1)"
	},
	sky: {
		25: "oklch(0.991 0.006 223.454 / 1)",
		50: "oklch(0.977 0.012 236.62 / 1)",
		100: "oklch(0.951 0.025 236.824 / 1)",
		200: "oklch(0.901 0.055 230.902 / 1)",
		300: "oklch(0.828 0.101 230.318 / 1)",
		400: "oklch(0.754 0.139 232.661 / 1)",
		500: "oklch(0.685 0.148 237.323 / 1)",
		600: "oklch(0.588 0.139 241.966 / 1)",
		700: "oklch(0.5 0.119 242.749 / 1)",
		800: "oklch(0.443 0.1 240.79 / 1)",
		900: "oklch(0.391 0.085 240.876 / 1)",
		925: "oklch(0.339 0.07 239.068 / 1)",
		950: "oklch(0.293 0.063 243.157 / 1)",
		1e3: "oklch(0.212 0.042 240.144 / 1)"
	},
	cyan: {
		25: "oklch(0.991 0.009 205.897 / 1)",
		50: "oklch(0.984 0.019 200.873 / 1)",
		100: "oklch(0.956 0.044 203.388 / 1)",
		200: "oklch(0.917 0.077 205.041 / 1)",
		300: "oklch(0.865 0.115 207.078 / 1)",
		400: "oklch(0.797 0.134 211.53 / 1)",
		500: "oklch(0.715 0.126 215.221 / 1)",
		600: "oklch(0.609 0.111 221.723 / 1)",
		700: "oklch(0.52 0.094 223.128 / 1)",
		800: "oklch(0.45 0.077 224.283 / 1)",
		900: "oklch(0.398 0.066 227.392 / 1)",
		925: "oklch(0.345 0.057 226.509 / 1)",
		950: "oklch(0.302 0.054 229.695 / 1)",
		1e3: "oklch(0.217 0.037 227.615 / 1)"
	},
	teal: {
		25: "oklch(0.992 0.007 174.385 / 1)",
		50: "oklch(0.984 0.014 180.72 / 1)",
		100: "oklch(0.953 0.05 180.801 / 1)",
		200: "oklch(0.91 0.093 180.426 / 1)",
		300: "oklch(0.855 0.125 181.071 / 1)",
		400: "oklch(0.785 0.133 181.912 / 1)",
		500: "oklch(0.704 0.123 182.503 / 1)",
		600: "oklch(0.6 0.104 184.704 / 1)",
		700: "oklch(0.511 0.086 186.391 / 1)",
		800: "oklch(0.437 0.071 188.216 / 1)",
		900: "oklch(0.386 0.059 188.416 / 1)",
		925: "oklch(0.335 0.051 189.115 / 1)",
		950: "oklch(0.277 0.045 192.524 / 1)",
		1e3: "oklch(0.206 0.033 191.443 / 1)"
	},
	emerald: {
		25: "oklch(0.99 0.01 164.879 / 1)",
		50: "oklch(0.979 0.021 166.113 / 1)",
		100: "oklch(0.95 0.051 163.051 / 1)",
		200: "oklch(0.905 0.089 164.15 / 1)",
		300: "oklch(0.845 0.13 164.978 / 1)",
		400: "oklch(0.773 0.153 163.223 / 1)",
		500: "oklch(0.696 0.149 162.48 / 1)",
		600: "oklch(0.596 0.127 163.225 / 1)",
		700: "oklch(0.508 0.105 165.612 / 1)",
		800: "oklch(0.432 0.086 166.913 / 1)",
		900: "oklch(0.378 0.073 168.94 / 1)",
		925: "oklch(0.325 0.062 169.847 / 1)",
		950: "oklch(0.262 0.049 172.552 / 1)",
		1e3: "oklch(0.188 0.033 177.113 / 1)"
	},
	lime: {
		25: "oklch(0.993 0.018 120.67 / 1)",
		50: "oklch(0.986 0.031 120.757 / 1)",
		100: "oklch(0.967 0.066 122.328 / 1)",
		200: "oklch(0.938 0.122 124.321 / 1)",
		300: "oklch(0.897 0.179 126.665 / 1)",
		400: "oklch(0.849 0.207 128.85 / 1)",
		500: "oklch(0.768 0.204 130.85 / 1)",
		600: "oklch(0.648 0.175 131.684 / 1)",
		700: "oklch(0.532 0.141 131.589 / 1)",
		800: "oklch(0.453 0.113 130.933 / 1)",
		900: "oklch(0.405 0.096 131.063 / 1)",
		925: "oklch(0.341 0.079 131.173 / 1)",
		950: "oklch(0.274 0.069 132.109 / 1)",
		1e3: "oklch(0.192 0.046 130.171 / 1)"
	},
	amber: {
		25: "oklch(0.993 0.012 96.417 / 1)",
		50: "oklch(0.987 0.021 95.277 / 1)",
		100: "oklch(0.962 0.058 95.617 / 1)",
		200: "oklch(0.924 0.115 95.746 / 1)",
		300: "oklch(0.879 0.153 91.605 / 1)",
		400: "oklch(0.837 0.164 84.429 / 1)",
		500: "oklch(0.769 0.165 70.08 / 1)",
		600: "oklch(0.666 0.157 58.318 / 1)",
		700: "oklch(0.555 0.146 48.998 / 1)",
		800: "oklch(0.473 0.125 46.201 / 1)",
		900: "oklch(0.414 0.105 45.904 / 1)",
		925: "oklch(0.35 0.087 45.765 / 1)",
		950: "oklch(0.279 0.074 45.635 / 1)",
		1e3: "oklch(0.206 0.05 48.704 / 1)"
	},
	orange: {
		25: "oklch(0.987 0.01 72.664 / 1)",
		50: "oklch(0.98 0.016 73.684 / 1)",
		100: "oklch(0.954 0.037 75.164 / 1)",
		200: "oklch(0.901 0.073 70.697 / 1)",
		300: "oklch(0.837 0.117 66.29 / 1)",
		400: "oklch(0.758 0.159 55.934 / 1)",
		500: "oklch(0.705 0.187 47.604 / 1)",
		600: "oklch(0.646 0.194 41.116 / 1)",
		700: "oklch(0.553 0.174 38.402 / 1)",
		800: "oklch(0.47 0.143 37.304 / 1)",
		900: "oklch(0.408 0.116 38.172 / 1)",
		925: "oklch(0.342 0.096 37.716 / 1)",
		950: "oklch(0.266 0.076 36.259 / 1)",
		1e3: "oklch(0.197 0.051 37.083 / 1)"
	},
	green: {
		25: "oklch(0.989 0.012 153.679 / 1)",
		50: "oklch(0.982 0.018 155.826 / 1)",
		100: "oklch(0.962 0.043 156.743 / 1)",
		200: "oklch(0.925 0.081 155.995 / 1)",
		300: "oklch(0.871 0.136 154.449 / 1)",
		400: "oklch(0.8 0.182 151.711 / 1)",
		500: "oklch(0.723 0.192 149.579 / 1)",
		600: "oklch(0.627 0.17 149.214 / 1)",
		700: "oklch(0.527 0.137 150.069 / 1)",
		800: "oklch(0.448 0.108 151.328 / 1)",
		900: "oklch(0.393 0.09 152.535 / 1)",
		925: "oklch(0.337 0.076 152.793 / 1)",
		950: "oklch(0.266 0.063 152.934 / 1)",
		1e3: "oklch(0.19 0.041 156.904 / 1)"
	},
	yellow: {
		25: "oklch(0.995 0.013 102.007 / 1)",
		50: "oklch(0.987 0.026 102.212 / 1)",
		100: "oklch(0.973 0.069 103.193 / 1)",
		200: "oklch(0.945 0.124 101.54 / 1)",
		300: "oklch(0.905 0.166 98.111 / 1)",
		400: "oklch(0.861 0.173 91.936 / 1)",
		500: "oklch(0.795 0.162 86.047 / 1)",
		600: "oklch(0.681 0.142 75.834 / 1)",
		700: "oklch(0.554 0.121 66.442 / 1)",
		800: "oklch(0.476 0.103 61.907 / 1)",
		900: "oklch(0.421 0.09 57.708 / 1)",
		925: "oklch(0.357 0.075 57.491 / 1)",
		950: "oklch(0.286 0.064 53.813 / 1)",
		1e3: "oklch(0.209 0.044 56.227 / 1)"
	},
	red: {
		25: "oklch(0.982 0.009 17.303 / 1)",
		50: "oklch(0.971 0.013 17.38 / 1)",
		100: "oklch(0.936 0.031 17.717 / 1)",
		200: "oklch(0.885 0.059 18.334 / 1)",
		300: "oklch(0.808 0.103 19.571 / 1)",
		400: "oklch(0.711 0.166 22.216 / 1)",
		500: "oklch(0.637 0.208 25.331 / 1)",
		600: "oklch(0.577 0.215 27.325 / 1)",
		700: "oklch(0.505 0.19 27.518 / 1)",
		800: "oklch(0.444 0.161 26.899 / 1)",
		900: "oklch(0.396 0.133 25.723 / 1)",
		925: "oklch(0.332 0.111 25.625 / 1)",
		950: "oklch(0.258 0.089 26.042 / 1)",
		1e3: "oklch(0.184 0.058 25.017 / 1)"
	},
	purple: {
		25: "oklch(0.987 0.009 314.783 / 1)",
		50: "oklch(0.977 0.014 308.299 / 1)",
		100: "oklch(0.946 0.033 307.174 / 1)",
		200: "oklch(0.902 0.06 306.703 / 1)",
		300: "oklch(0.827 0.108 306.383 / 1)",
		400: "oklch(0.722 0.177 305.504 / 1)",
		500: "oklch(0.627 0.233 303.9 / 1)",
		600: "oklch(0.558 0.252 302.321 / 1)",
		700: "oklch(0.496 0.237 301.924 / 1)",
		800: "oklch(0.438 0.198 303.724 / 1)",
		900: "oklch(0.381 0.166 304.987 / 1)",
		925: "oklch(0.325 0.142 305.38 / 1)",
		950: "oklch(0.291 0.143 302.717 / 1)",
		1e3: "oklch(0.205 0.098 304.68 / 1)"
	},
	violet: {
		25: "oklch(0.98 0.011 297.63 / 1)",
		50: "oklch(0.969 0.016 293.756 / 1)",
		100: "oklch(0.943 0.028 294.588 / 1)",
		200: "oklch(0.894 0.055 293.283 / 1)",
		300: "oklch(0.811 0.101 293.571 / 1)",
		400: "oklch(0.709 0.159 293.541 / 1)",
		500: "oklch(0.606 0.219 292.717 / 1)",
		600: "oklch(0.541 0.247 293.009 / 1)",
		700: "oklch(0.491 0.241 292.581 / 1)",
		800: "oklch(0.432 0.211 292.759 / 1)",
		900: "oklch(0.38 0.178 293.745 / 1)",
		925: "oklch(0.324 0.151 293.976 / 1)",
		950: "oklch(0.283 0.135 291.089 / 1)",
		1e3: "oklch(0.203 0.088 292.692 / 1)"
	},
	fuchsia: {
		25: "oklch(0.984 0.012 329.558 / 1)",
		50: "oklch(0.977 0.017 320.058 / 1)",
		100: "oklch(0.952 0.036 318.852 / 1)",
		200: "oklch(0.903 0.073 319.62 / 1)",
		300: "oklch(0.833 0.132 321.434 / 1)",
		400: "oklch(0.748 0.207 322.16 / 1)",
		500: "oklch(0.667 0.259 322.15 / 1)",
		600: "oklch(0.591 0.257 322.896 / 1)",
		700: "oklch(0.518 0.226 323.949 / 1)",
		800: "oklch(0.452 0.192 324.591 / 1)",
		900: "oklch(0.401 0.16 325.612 / 1)",
		925: "oklch(0.341 0.135 326.232 / 1)",
		950: "oklch(0.293 0.131 325.661 / 1)",
		1e3: "oklch(0.208 0.091 326.186 / 1)"
	},
	pink: {
		25: "oklch(0.986 0.009 341.798 / 1)",
		50: "oklch(0.971 0.014 343.198 / 1)",
		100: "oklch(0.948 0.028 342.258 / 1)",
		200: "oklch(0.899 0.059 343.231 / 1)",
		300: "oklch(0.823 0.11 346.018 / 1)",
		400: "oklch(0.725 0.175 349.761 / 1)",
		500: "oklch(0.656 0.212 354.308 / 1)",
		600: "oklch(0.592 0.218 0.584 / 1)",
		700: "oklch(0.525 0.199 3.958 / 1)",
		800: "oklch(0.459 0.17 3.815 / 1)",
		900: "oklch(0.408 0.144 2.432 / 1)",
		925: "oklch(0.347 0.124 2.558 / 1)",
		950: "oklch(0.284 0.105 3.907 / 1)",
		1e3: "oklch(0.201 0.073 1.239 / 1)"
	}
};
/** Absolute black in oklch format. */
const black = "oklch(0 0 0 / 1)";
/** Absolute white in oklch format. */
const white = "oklch(1 0 89.876 / 1)";
/**
* Return a copy of an oklch color string with its alpha channel replaced.
*
* @param color - An oklch color string with `/ 1` alpha (e.g. `"oklch(0.5 0.1 260 / 1)"`)
* @param alpha - New alpha value between 0 and 1
* @returns The color string with the updated alpha
*
* @example
* ```ts
* withAlpha("oklch(0.5 0.1 260 / 1)", 0.5)
* // => "oklch(0.5 0.1 260 / 0.5)"
* ```
*/
const withAlpha = (color, alpha) => color.replace(/\s\/\s(?:1|1\.0)\)$/, ` / ${alpha})`);
const STANDARD_ALPHA_STEPS = [
	.02,
	.04,
	.06,
	.08,
	.1,
	.12,
	.2,
	.3,
	.4,
	.5,
	.6,
	.7,
	.8,
	.9,
	1
];
const LEGACY_BLACK_WHITE_ALPHA_STEPS = [
	0,
	.16,
	.24,
	.32,
	.96
];
const SWATCH_SHADES = [
	25,
	50,
	100,
	200,
	300,
	400,
	500,
	600,
	700,
	800,
	900,
	925,
	950,
	1e3
];
const toAlphaSuffix = (alpha) => `a${Math.round(alpha * 100).toString().padStart(2, "0")}`;
const buildAlphaSwatches = () => {
	const map = {};
	for (const alpha of STANDARD_ALPHA_STEPS) {
		map[`black-${toAlphaSuffix(alpha)}`] = withAlpha(black, alpha);
		map[`white-${toAlphaSuffix(alpha)}`] = withAlpha(white, alpha);
	}
	for (const alpha of LEGACY_BLACK_WHITE_ALPHA_STEPS) {
		map[`black-${toAlphaSuffix(alpha)}`] = withAlpha(black, alpha);
		map[`white-${toAlphaSuffix(alpha)}`] = withAlpha(white, alpha);
	}
	for (const family of Object.keys(BASE_SWATCHES)) {
		const baseShade = family === "neutral" || family === "slate" || family === "gray" || family === "zinc" || family === "stone" ? 1e3 : 600;
		const base = BASE_SWATCHES[family][baseShade];
		for (const alpha of STANDARD_ALPHA_STEPS) map[`${family}-${baseShade}-${toAlphaSuffix(alpha)}`] = withAlpha(base, alpha);
	}
	return map;
};
const buildBaseTokenMap = () => {
	const map = {
		black,
		white
	};
	for (const family of Object.keys(BASE_SWATCHES)) for (const shade of SWATCH_SHADES) map[`${family}-${shade}`] = BASE_SWATCHES[family][shade];
	return map;
};
const SWATCH_TOKENS = {
	...buildBaseTokenMap(),
	...buildAlphaSwatches()
};
/**
* Look up a raw oklch color value by swatch family name and shade.
*
* @param name  - One of the 20 swatch families (e.g. `"blue"`, `"neutral"`)
* @param shade - Shade step from 25 (lightest) to 1000 (darkest)
* @returns The oklch color string
*
* @example
* ```ts
* swatch("blue", 600) // => "oklch(0.546 0.215 262.881 / 1)"
* ```
*/
const swatch = (name, shade) => BASE_SWATCHES[name][shade];
/**
* Resolve a flat token key (e.g. `"blue-600"`, `"black-a50"`) to its oklch
* color value. Returns `""` for unknown tokens.
*/
const swatchToken = (token) => SWATCH_TOKENS[token] ?? "";
/** The complete flat map of all swatch tokens (base shades + alpha variants). */
const swatchTokens = SWATCH_TOKENS;
//#endregion
//#region src/components/ThemeProvider/defaultTheme.ts
const LIGHT_SWATCHES = {
	neutralSwatch: "neutral",
	brandSwatch: "neutral"
};
const DARK_SWATCHES = {
	neutralSwatch: "neutral",
	brandSwatch: "neutral"
};
const SEMANTIC_SWATCHES = {
	info: "blue",
	success: "green",
	alert: "yellow",
	danger: "red",
	purple: "purple",
	pink: "pink"
};
const getBrandBaseShade = (brandSwatch) => brandSwatch === "neutral" || brandSwatch === "slate" || brandSwatch === "gray" || brandSwatch === "zinc" || brandSwatch === "stone" ? 1e3 : 600;
const AA_LARGE_CONTRAST_THRESHOLD = 3;
const clamp01 = (value) => Math.min(1, Math.max(0, value));
const parseOklch = (value) => {
	const match = value.match(/^oklch\(\s*([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)(?:\s*\/\s*[+-]?\d*\.?\d+)?\s*\)$/i);
	if (!match) return null;
	return {
		l: Number(match[1]),
		c: Number(match[2]),
		h: Number(match[3])
	};
};
const relativeLuminanceFromOklch = (oklchValue) => {
	const parsed = parseOklch(oklchValue);
	if (!parsed) return 0;
	const hRadians = parsed.h * Math.PI / 180;
	const a = parsed.c * Math.cos(hRadians);
	const b = parsed.c * Math.sin(hRadians);
	const lPrime = parsed.l + .3963377774 * a + .2158037573 * b;
	const mPrime = parsed.l - .1055613458 * a - .0638541728 * b;
	const sPrime = parsed.l - .0894841775 * a - 1.291485548 * b;
	const l = lPrime ** 3;
	const m = mPrime ** 3;
	const s = sPrime ** 3;
	const rLinear = clamp01(4.0767416621 * l - 3.3077115913 * m + .2309699292 * s);
	const gLinear = clamp01(-1.2684380046 * l + 2.6097574011 * m - .3413193965 * s);
	const bLinear = clamp01(-.0041960863 * l - .7034186147 * m + 1.707614701 * s);
	return .2126 * rLinear + .7152 * gLinear + .0722 * bLinear;
};
const contrastRatio = (foreground, background) => {
	const luminance1 = relativeLuminanceFromOklch(foreground);
	const luminance2 = relativeLuminanceFromOklch(background);
	const lighter = Math.max(luminance1, luminance2);
	const darker = Math.min(luminance1, luminance2);
	return (lighter + .05) / (darker + .05);
};
const pickAccentTextFromNeutral = ({ neutralSwatch, accentBackground }) => {
	const neutral25 = swatch(neutralSwatch, 25);
	const neutral1000 = swatch(neutralSwatch, 1e3);
	const ratio25 = contrastRatio(neutral25, accentBackground);
	const ratio1000 = contrastRatio(neutral1000, accentBackground);
	const pass25 = ratio25 >= AA_LARGE_CONTRAST_THRESHOLD;
	const pass1000 = ratio1000 >= AA_LARGE_CONTRAST_THRESHOLD;
	if (pass25 && pass1000) return neutral25;
	if (pass25) return neutral25;
	if (pass1000) return neutral1000;
	return neutral25;
};
const createColorTheme = ({ mode, neutralSwatch, brandSwatch }) => {
	const isDark = mode === "dark";
	const neutral = neutralSwatch;
	const brandBase = getBrandBaseShade(brandSwatch);
	const brandSolid = brandSwatch === "neutral" ? isDark ? swatch(neutral, 25) : swatch(neutral, 1e3) : swatch(brandSwatch, brandBase);
	const overlayBase = isDark ? swatch(neutral, 25) : swatch(neutral, 1e3);
	const neutralPrimary = isDark ? swatch(neutral, 50) : swatch(neutral, 1e3);
	const neutralSecondary = withAlpha(neutralPrimary, .5);
	const neutralTertiary = withAlpha(neutralPrimary, .2);
	const accentText = brandSwatch === "neutral" ? isDark ? swatch(neutral, 1e3) : swatch(neutral, 25) : pickAccentTextFromNeutral({
		neutralSwatch: neutral,
		accentBackground: brandSolid
	});
	const accentTextSecondary = withAlpha(accentText, .5);
	const accentTextTertiary = withAlpha(accentText, .2);
	const infoSwatch = SEMANTIC_SWATCHES.info;
	const successSwatch = SEMANTIC_SWATCHES.success;
	const alertSwatch = SEMANTIC_SWATCHES.alert;
	const dangerSwatch = SEMANTIC_SWATCHES.danger;
	const purpleSwatch = SEMANTIC_SWATCHES.purple;
	const pinkSwatch = SEMANTIC_SWATCHES.pink;
	return {
		background: isDark ? swatch(neutral, 950) : swatch(neutral, 100),
		foreground: isDark ? swatch(neutral, 900) : swatch(neutral, 25),
		popoverBackground: isDark ? swatch(neutral, 900) : swatch(neutral, 25),
		sunkLight: withAlpha(overlayBase, .02),
		sunk: withAlpha(overlayBase, .04),
		sunkDeep: withAlpha(overlayBase, .08),
		elevatedLight: withAlpha(overlayBase, .04),
		elevated: withAlpha(overlayBase, .08),
		elevatedStrong: withAlpha(overlayBase, .16),
		elevatedIntense: withAlpha(overlayBase, .32),
		overlay: isDark ? withAlpha(black, .6) : withAlpha(black, .4),
		highlightSubtle: withAlpha(overlayBase, .02),
		highlight: withAlpha(overlayBase, .04),
		highlightStrong: withAlpha(overlayBase, .08),
		highlightIntense: withAlpha(overlayBase, isDark ? .3 : .32),
		invertedBackground: isDark ? swatch(neutral, 25) : swatch(neutral, 1e3),
		infoBackground: withAlpha(swatch(infoSwatch, 500), .12),
		successBackground: withAlpha(swatch(successSwatch, 600), .12),
		alertBackground: withAlpha(swatch(alertSwatch, 500), .16),
		dangerBackground: withAlpha(swatch(dangerSwatch, 600), .12),
		purpleBackground: withAlpha(swatch(purpleSwatch, 500), .12),
		pinkBackground: withAlpha(swatch(pinkSwatch, 600), .12),
		textNeutralPrimary: neutralPrimary,
		textNeutralSecondary: neutralSecondary,
		textNeutralTertiary: neutralTertiary,
		textNeutralLink: neutralPrimary,
		textBrand: brandSolid,
		textWhite: white,
		textBlack: black,
		textAccentPrimary: accentText,
		textAccentSecondary: accentTextSecondary,
		textAccentTertiary: accentTextTertiary,
		textSuccessPrimary: isDark ? swatch(successSwatch, 300) : swatch(successSwatch, 800),
		textSuccessInverted: swatch(successSwatch, 100),
		textAlertPrimary: isDark ? swatch(alertSwatch, 300) : swatch(alertSwatch, 800),
		textAlertInverted: swatch(alertSwatch, 100),
		textDangerPrimary: isDark ? swatch(dangerSwatch, 300) : swatch(dangerSwatch, 700),
		textDangerSecondary: isDark ? swatch(dangerSwatch, 200) : swatch(dangerSwatch, 400),
		textDangerTertiary: isDark ? swatch(dangerSwatch, 100) : swatch(dangerSwatch, 300),
		textDangerInvertedPrimary: swatch(dangerSwatch, 25),
		textDangerInvertedSecondary: withAlpha(swatch(dangerSwatch, 25), .5),
		textDangerInvertedTertiary: withAlpha(swatch(dangerSwatch, 25), .3),
		textInfoPrimary: isDark ? swatch(infoSwatch, 300) : swatch(infoSwatch, 800),
		textInfoInverted: swatch(infoSwatch, 100),
		textPinkPrimary: isDark ? swatch(pinkSwatch, 300) : swatch(pinkSwatch, 800),
		textPinkInverted: swatch(pinkSwatch, 100),
		textPurplePrimary: isDark ? swatch(purpleSwatch, 300) : swatch(purpleSwatch, 800),
		textPurpleInverted: swatch(purpleSwatch, 100),
		interactiveAccentDefault: brandSolid,
		interactiveAccentHover: withAlpha(brandSolid, .8),
		interactiveAccentDisabled: withAlpha(brandSolid, .4),
		interactiveAccentPressed: brandSolid,
		interactiveDestructiveDefault: withAlpha(swatch(dangerSwatch, 600), .02),
		interactiveDestructiveHover: withAlpha(swatch(dangerSwatch, 600), .08),
		interactiveDestructiveDisabled: withAlpha(swatch(dangerSwatch, 600), .02),
		interactiveDestructivePressed: withAlpha(swatch(dangerSwatch, 600), .1),
		interactiveDestructiveAccentDefault: swatch(dangerSwatch, 600),
		interactiveDestructiveAccentHover: swatch(dangerSwatch, 500),
		interactiveDestructiveAccentPressed: swatch(dangerSwatch, 700),
		interactiveDestructiveAccentDisabled: withAlpha(swatch(dangerSwatch, 600), .4),
		chatUserResponseBg: withAlpha(brandSolid, .08),
		chatUserResponseText: neutralPrimary,
		borderDefault: withAlpha(overlayBase, isDark ? .06 : .06),
		borderInteractive: withAlpha(overlayBase, isDark ? .12 : .12),
		borderInteractiveEmphasis: withAlpha(overlayBase, isDark ? .4 : .3),
		borderInteractiveSelected: isDark ? swatch(neutral, 50) : swatch(neutral, 1e3),
		borderAccent: withAlpha(brandSolid, isDark ? .2 : .08),
		borderAccentEmphasis: withAlpha(brandSolid, isDark ? .4 : .3),
		borderInfo: withAlpha(swatch(infoSwatch, 500), .08),
		borderInfoEmphasis: swatch(infoSwatch, 600),
		borderAlert: withAlpha(swatch(alertSwatch, 400), .08),
		borderAlertEmphasis: swatch(alertSwatch, 600),
		borderSuccess: withAlpha(swatch(successSwatch, 600), .08),
		borderSuccessEmphasis: swatch(successSwatch, 600),
		borderDanger: withAlpha(swatch(dangerSwatch, 600), .08),
		borderDangerEmphasis: swatch(dangerSwatch, 600)
	};
};
const lightColorTheme = createColorTheme({
	mode: "light",
	...LIGHT_SWATCHES
});
const darkColorTheme = createColorTheme({
	mode: "dark",
	...DARK_SWATCHES
});
const SPACE_BASE = 2;
const RADIUS_BASE = 2;
const toPx = (base, multiplier) => {
	const value = base * multiplier;
	if (value === 0) return "0";
	return `${value}px`;
};
const layoutTheme = {
	space000: toPx(SPACE_BASE, 0),
	space3xs: toPx(SPACE_BASE, 1),
	space2xs: toPx(SPACE_BASE, 2),
	spaceXs: toPx(SPACE_BASE, 3),
	spaceS: toPx(SPACE_BASE, 4),
	spaceSM: toPx(SPACE_BASE, 5),
	spaceM: toPx(SPACE_BASE, 6),
	spaceML: toPx(SPACE_BASE, 8),
	spaceL: toPx(SPACE_BASE, 9),
	spaceXl: toPx(SPACE_BASE, 12),
	space2xl: toPx(SPACE_BASE, 18),
	space3xl: toPx(SPACE_BASE, 24),
	radiusNone: toPx(RADIUS_BASE, 0),
	radius3xs: toPx(RADIUS_BASE, .5),
	radius2xs: toPx(RADIUS_BASE, 1),
	radiusXs: toPx(RADIUS_BASE, 2),
	radiusS: toPx(RADIUS_BASE, 3),
	radiusM: toPx(RADIUS_BASE, 4),
	radiusL: toPx(RADIUS_BASE, 5),
	radiusXl: toPx(RADIUS_BASE, 6),
	radius2xl: toPx(RADIUS_BASE, 7),
	radius3xl: toPx(RADIUS_BASE, 8),
	radius4xl: toPx(RADIUS_BASE, 10),
	radius5xl: toPx(RADIUS_BASE, 12),
	radius6xl: toPx(RADIUS_BASE, 14),
	radius7xl: toPx(RADIUS_BASE, 16),
	radius8xl: toPx(RADIUS_BASE, 20),
	radius9xl: toPx(RADIUS_BASE, 24),
	radiusFull: "9999px"
};
const FONT_BODY = "\"Inter\", sans-serif";
const FONT_CODE = "\"SFMono-Regular\", Menlo, monospace";
const FONT_HEADING = "\"Inter\", sans-serif";
const FONT_LABEL = "\"Inter\", sans-serif";
const FONT_NUMBERS = "\"Inter\", sans-serif";
const typographyTheme = {
	fontBody: FONT_BODY,
	fontCode: FONT_CODE,
	fontHeading: FONT_HEADING,
	fontLabel: FONT_LABEL,
	fontNumbers: FONT_NUMBERS,
	fontSize2xs: "10px",
	fontSizeXs: "12px",
	fontSizeSm: "14px",
	fontSizeMd: "16px",
	fontSizeLg: "18px",
	fontSizeXl: "20px",
	fontSize2xl: "24px",
	fontSize3xl: "28px",
	fontSize4xl: "32px",
	fontSize5xl: "36px",
	fontWeightRegular: "400",
	fontWeightMedium: "500",
	fontWeightBold: "600",
	fontWeightHeavy: "700",
	lineHeightBody: "1.5",
	lineHeightHeading: "1.25",
	lineHeightHeadingLarge: "1.1",
	lineHeightLabel: "1.25",
	lineHeightCode: "1.5",
	letterSpacingNormal: "0",
	letterSpacingTight: "-0.1px",
	letterSpacingTighter: "-0.2px",
	textBodyXs: `400 12px/1.5 ${FONT_BODY}`,
	textBodyXsLetterSpacing: "0",
	textBodyXsHeavy: `500 12px/1.5 ${FONT_BODY}`,
	textBodyXsHeavyLetterSpacing: "0",
	textBodySm: `400 14px/1.5 ${FONT_BODY}`,
	textBodySmLetterSpacing: "0",
	textBodySmHeavy: `500 14px/1.5 ${FONT_BODY}`,
	textBodySmHeavyLetterSpacing: "0",
	textBodyDefault: `400 16px/1.5 ${FONT_BODY}`,
	textBodyDefaultLetterSpacing: "0",
	textBodyDefaultHeavy: `500 16px/1.5 ${FONT_BODY}`,
	textBodyDefaultHeavyLetterSpacing: "0",
	textBodyLg: `400 18px/1.5 ${FONT_BODY}`,
	textBodyLgLetterSpacing: "0",
	textBodyLgHeavy: `500 18px/1.5 ${FONT_BODY}`,
	textBodyLgHeavyLetterSpacing: "0",
	textHeadingXs: `600 16px/1.25 ${FONT_HEADING}`,
	textHeadingXsLetterSpacing: "0",
	textHeadingSm: `600 18px/1.25 ${FONT_HEADING}`,
	textHeadingSmLetterSpacing: "0",
	textHeadingMd: `600 24px/1.1 ${FONT_HEADING}`,
	textHeadingMdLetterSpacing: "0",
	textHeadingLg: `600 28px/1.1 ${FONT_HEADING}`,
	textHeadingLgLetterSpacing: "-0.1px",
	textHeadingXl: `700 32px/1.1 ${FONT_HEADING}`,
	textHeadingXlLetterSpacing: "-0.1px",
	textLabelXs: `400 12px/1.25 ${FONT_LABEL}`,
	textLabelXsLetterSpacing: "0",
	textLabelXsHeavy: `500 12px/1.25 ${FONT_LABEL}`,
	textLabelXsHeavyLetterSpacing: "0",
	textLabelSm: `400 14px/1.25 ${FONT_LABEL}`,
	textLabelSmLetterSpacing: "0",
	textLabelSmHeavy: `500 14px/1.25 ${FONT_LABEL}`,
	textLabelSmHeavyLetterSpacing: "0",
	textLabelDefault: `400 16px/1.25 ${FONT_LABEL}`,
	textLabelDefaultLetterSpacing: "0",
	textLabelDefaultHeavy: `500 16px/1.25 ${FONT_LABEL}`,
	textLabelDefaultHeavyLetterSpacing: "0",
	textLabelLg: `400 18px/1.25 ${FONT_LABEL}`,
	textLabelLgLetterSpacing: "0",
	textLabelLgHeavy: `500 18px/1.25 ${FONT_LABEL}`,
	textLabelLgHeavyLetterSpacing: "0",
	textNumbersXs: `400 12px/1.5 ${FONT_NUMBERS}`,
	textNumbersXsLetterSpacing: "0",
	textNumbersXsHeavy: `500 12px/1.5 ${FONT_NUMBERS}`,
	textNumbersXsHeavyLetterSpacing: "0",
	textNumbersSm: `400 14px/1.5 ${FONT_NUMBERS}`,
	textNumbersSmLetterSpacing: "0",
	textNumbersSmHeavy: `500 14px/1.5 ${FONT_NUMBERS}`,
	textNumbersSmHeavyLetterSpacing: "0",
	textNumbersDefault: `400 16px/1.5 ${FONT_NUMBERS}`,
	textNumbersDefaultLetterSpacing: "0",
	textNumbersDefaultHeavy: `500 16px/1.5 ${FONT_NUMBERS}`,
	textNumbersDefaultHeavyLetterSpacing: "0",
	textNumbersLg: `400 18px/1.5 ${FONT_NUMBERS}`,
	textNumbersLgLetterSpacing: "0",
	textNumbersLgHeavy: `500 18px/1.5 ${FONT_NUMBERS}`,
	textNumbersLgHeavyLetterSpacing: "0",
	textNumbersHeadingSm: `600 18px/1.25 ${FONT_NUMBERS}`,
	textNumbersHeadingSmLetterSpacing: "0",
	textNumbersHeadingMd: `600 24px/1.1 ${FONT_NUMBERS}`,
	textNumbersHeadingMdLetterSpacing: "0",
	textNumbersHeadingLg: `600 28px/1.1 ${FONT_NUMBERS}`,
	textNumbersHeadingLgLetterSpacing: "0",
	textNumbersHeadingXl: `600 32px/1.1 ${FONT_NUMBERS}`,
	textNumbersHeadingXlLetterSpacing: "0",
	textCodeSm: `400 12px/1.5 ${FONT_CODE}`,
	textCodeSmLetterSpacing: "0",
	textCodeSmHeavy: `700 12px/1.5 ${FONT_CODE}`,
	textCodeSmHeavyLetterSpacing: "0",
	textCodeDefault: `400 14px/1.5 ${FONT_CODE}`,
	textCodeDefaultLetterSpacing: "0",
	textCodeDefaultHeavy: `700 14px/1.5 ${FONT_CODE}`,
	textCodeDefaultHeavyLetterSpacing: "0"
};
const lightEffectTheme = {
	shadow0: "none",
	shadowS: "0 1px 3px -2px oklch(0 0 0 / 0.02), 0 2px 5px -2px oklch(0 0 0 / 0.04)",
	shadowM: "0 4px 6px -2px oklch(0 0 0 / 0.025), 0 2px 2px -2px oklch(0 0 0 / 0.05)",
	shadowL: "0 4px 4px -2px oklch(0 0 0 / 0.05), 0 4px 8px -2px oklch(0 0 0 / 0.04)",
	shadowXl: "0 8px 16px -4px oklch(0 0 0 / 0.08), 0 16px 32px -6px oklch(0 0 0 / 0.12)",
	shadow2xl: "0 12px 24px -6px oklch(0 0 0 / 0.12), 0 24px 48px -8px oklch(0 0 0 / 0.16)",
	shadow3xl: "0 16px 32px -8px oklch(0 0 0 / 0.16), 0 32px 64px -12px oklch(0 0 0 / 0.22)"
};
const darkEffectTheme = {
	shadow0: "none",
	shadowS: "0 1px 3px -2px oklch(0 0 0 / 0.06), 0 2px 5px -2px oklch(0 0 0 / 0.10)",
	shadowM: "0 4px 6px -2px oklch(0 0 0 / 0.08), 0 2px 2px -2px oklch(0 0 0 / 0.12)",
	shadowL: "0 4px 4px -2px oklch(0 0 0 / 0.12), 0 4px 8px -2px oklch(0 0 0 / 0.10)",
	shadowXl: "0 8px 16px -4px oklch(0 0 0 / 0.16), 0 16px 32px -6px oklch(0 0 0 / 0.20)",
	shadow2xl: "0 12px 24px -6px oklch(0 0 0 / 0.20), 0 24px 48px -8px oklch(0 0 0 / 0.24)",
	shadow3xl: "0 16px 32px -8px oklch(0 0 0 / 0.24), 0 32px 64px -12px oklch(0 0 0 / 0.28)"
};
/**
* The built-in light theme. Combines the neutral-swatch light color palette,
* shared layout and typography tokens, and light-mode shadow values.
*
* Used as the base when `ThemeProvider` is rendered with `mode="light"`.
*/
const defaultLightTheme = Object.freeze({
	...lightColorTheme,
	...layoutTheme,
	...typographyTheme,
	...lightEffectTheme
});
/**
* The built-in dark theme. Uses the neutral-swatch dark color palette with
* inverted surface lightness, higher shadow opacity, and shared layout /
* typography tokens.
*
* Used as the base when `ThemeProvider` is rendered with `mode="dark"`.
*/
const defaultDarkTheme = Object.freeze({
	...darkColorTheme,
	...layoutTheme,
	...typographyTheme,
	...darkEffectTheme
});
//#endregion
//#region src/components/ThemeProvider/utils.ts
/**
* Convert a camel case string to a kebab case string.
* @param str - The string to convert.
* @returns A kebab case string.
*/
function camelToKebab(str) {
	return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])(\d)/g, "$1-$2").toLowerCase();
}
/**
* Convert a theme object to a string of CSS variables.
* @param theme - The theme object to convert.
* @param prefix - The prefix to use for the CSS variables.
* @returns A string of CSS variables.
*/
function themeToCssVars(theme, prefix = "openui") {
	return Object.entries(theme).filter(([, v]) => typeof v === "string").map(([key, value]) => `--${prefix}-${camelToKebab(key)}: ${value};`).join("\n          ");
}
function levenshteinDistance(a, b) {
	const m = a.length;
	const n = b.length;
	const prev = Array(n + 1).fill(0);
	const curr = Array(n + 1).fill(0);
	for (let j = 0; j <= n; j++) prev[j] = j;
	for (let i = 1; i <= m; i++) {
		curr[0] = i;
		for (let j = 1; j <= n; j++) curr[j] = a[i - 1] === b[j - 1] ? prev[j - 1] : 1 + Math.min(prev[j], curr[j - 1], prev[j - 1]);
		for (let j = 0; j <= n; j++) prev[j] = curr[j];
	}
	return prev[n];
}
const _warnedKeys = /* @__PURE__ */ new Set();
/**
* Validate a partial theme object in development and return it as-is.
*
* Works for both light and dark overrides — call it once per theme object:
*
* ```tsx
* <ThemeProvider
*   lightTheme={createTheme({ interactiveAccentDefault: "oklch(0.6 0.2 260)" })}
*   darkTheme={createTheme({ interactiveAccentDefault: "oklch(0.4 0.2 260)" })}
* />
* ```
*
* In non-production builds this checks every key against the known theme keys
* and emits a `console.warn` with a "did you mean …?" suggestion for typos.
* In production the validation code is stripped by bundlers.
*
* @param theme - A partial {@link Theme} to validate (light or dark overrides).
* @returns The same `theme` object, unmodified.
*/
function createTheme(theme) {
	if (typeof process !== "undefined" && process.env?.["NODE_ENV"] !== "production") {
		const knownKeys = Object.keys(defaultLightTheme);
		for (const key of Object.keys(theme)) {
			if (knownKeys.includes(key) || _warnedKeys.has(key)) continue;
			_warnedKeys.add(key);
			let suggestion = "";
			let bestDist = Infinity;
			for (const known of knownKeys) {
				const dist = levenshteinDistance(key, known);
				if (dist < bestDist) {
					bestDist = dist;
					suggestion = known;
				}
			}
			const hint = bestDist <= 3 ? ` Did you mean "${suggestion}"?` : "";
			console.warn(`[OpenUI] Unknown theme key "${key}".${hint}`);
		}
	}
	return theme;
}
//#endregion
//#region src/components/ThemeProvider/ThemeProvider.tsx
/**
* React context that carries the resolved theme, active mode, and a CSS class
* name for portals. Consumed via {@link useTheme}.
*/
const ThemeContext = (0, react.createContext)({
	theme: defaultLightTheme,
	mode: "light",
	portalThemeClassName: ""
});
/**
* Access the current theme, mode, and portal class name from the nearest
* {@link ThemeProvider}.
*
* @returns An object with:
*  - `theme` – the fully resolved {@link Theme} object
*  - `mode` – `"light"` or `"dark"`
*  - `portalThemeClassName` – a unique CSS class name to apply on portal
*     containers so they inherit the same `--openui-*` custom properties
*
* Falls back to the default light theme when no provider is present.
*
* @example
* ```tsx
* const { theme, mode, portalThemeClassName } = useTheme();
* ```
*/
const useTheme = () => (0, react.useContext)(ThemeContext);
const themes = {
	light: defaultLightTheme,
	dark: defaultDarkTheme
};
const OPENUI_THEME_SENTINEL = Symbol("openui-theme-provider");
const InternalContext = (0, react.createContext)(null);
const _devWarned = /* @__PURE__ */ new Set();
function warnOnce(key, message) {
	if (_devWarned.has(key)) return;
	_devWarned.add(key);
	console.warn(message);
}
function cssSafeId(id) {
	return id.replace(/[^a-zA-Z0-9-_]/g, "");
}
const _knownThemeKeys = new Set(Object.keys(defaultLightTheme));
function validateThemeObject(themeObj, propName) {
	for (const [key, value] of Object.entries(themeObj)) {
		if (value !== void 0 && typeof value !== "string" && !Array.isArray(value)) warnOnce(`non-string:${propName}:${key}`, `[OpenUI] ${propName} key "${key}" has a non-string value (${typeof value}). All theme values should be strings.`);
		if (!_knownThemeKeys.has(key)) warnOnce(`unknown-key:${propName}:${key}`, `[OpenUI] ${propName} contains unknown key "${key}". It will be ignored. Use createTheme() for typo detection with suggestions.`);
	}
}
/**
* Injects the OpenUI design-token CSS custom properties (`--openui-*`) into the
* DOM and provides theme context to all descendant components.
*
* Supports automatic scoping when nested inside another ThemeProvider: the inner
* provider wraps its children in a `<div>` with `display: contents` and injects
* a scoped style rule instead of targeting `body`.
*
* @example
* ```tsx
* <ThemeProvider
*   mode="dark"
*   lightTheme={createTheme({ interactiveAccentDefault: "oklch(0.6 0.2 260)" })}
* >
*   <App />
* </ThemeProvider>
* ```
*/
const ThemeProvider = ({ mode = "light", children, lightTheme, darkTheme, theme: deprecatedTheme, cssSelector = "body" }) => {
	const id = cssSafeId((0, react.useId)());
	const isNested = (0, react.useContext)(InternalContext) != null;
	const effectiveCssSelector = cssSelector || "body";
	const hasExplicitSelector = effectiveCssSelector !== "body";
	const userLightTheme = lightTheme ?? deprecatedTheme ?? {};
	const userDarkTheme = darkTheme;
	if (typeof process !== "undefined" && process.env?.["NODE_ENV"] !== "production") {
		if (deprecatedTheme !== void 0 && lightTheme !== void 0) warnOnce("theme+lightTheme", "[OpenUI] Both \"theme\" and \"lightTheme\" were passed to ThemeProvider. \"lightTheme\" takes precedence. Remove the deprecated \"theme\" prop.");
		if (deprecatedTheme !== void 0 && lightTheme === void 0) warnOnce("deprecated-theme", "[OpenUI] The \"theme\" prop on ThemeProvider is deprecated. Use \"lightTheme\" instead.");
		validateThemeObject(userLightTheme, "lightTheme");
		if (userDarkTheme) validateThemeObject(userDarkTheme, "darkTheme");
	}
	const resolvedLightTheme = (0, react.useMemo)(() => ({
		...themes.light,
		...userLightTheme
	}), [userLightTheme]);
	const resolvedDarkTheme = (0, react.useMemo)(() => {
		const overrides = userDarkTheme ?? userLightTheme;
		return {
			...themes.dark,
			...overrides
		};
	}, [userDarkTheme, userLightTheme]);
	const activeTheme = mode === "light" ? resolvedLightTheme : resolvedDarkTheme;
	const cssVarsString = (0, react.useMemo)(() => themeToCssVars(activeTheme), [activeTheme]);
	const portalClassName = `openui-theme-portal-${id}`;
	const scopedClassName = `openui-theme-${id}`;
	const contextValue = (0, react.useMemo)(() => ({
		theme: activeTheme,
		mode,
		portalThemeClassName: portalClassName
	}), [
		activeTheme,
		mode,
		portalClassName
	]);
	const internalValue = (0, react.useMemo)(() => ({
		[OPENUI_THEME_SENTINEL]: true,
		theme: activeTheme,
		mode,
		portalThemeClassName: portalClassName
	}), [
		activeTheme,
		mode,
		portalClassName
	]);
	const useAutoScope = isNested && !hasExplicitSelector;
	const styleSelector = useAutoScope ? `.${scopedClassName}` : effectiveCssSelector;
	(0, react.useInsertionEffect)(() => {
		const style = document.createElement("style");
		style.setAttribute("data-openui-theme", id);
		style.textContent = `${styleSelector}, .${portalClassName} { ${cssVarsString} }`;
		document.head.appendChild(style);
		return () => style.remove();
	}, [
		cssVarsString,
		styleSelector,
		portalClassName,
		id
	]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalContext.Provider, {
		value: internalValue,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
			value: contextValue,
			children: useAutoScope ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
				className: scopedClassName,
				style: { display: "contents" },
				children
			}) : children
		})
	});
};
//#endregion
Object.defineProperty(exports, "ThemeContext", {
	enumerable: true,
	get: function() {
		return ThemeContext;
	}
});
Object.defineProperty(exports, "ThemeProvider", {
	enumerable: true,
	get: function() {
		return ThemeProvider;
	}
});
Object.defineProperty(exports, "black", {
	enumerable: true,
	get: function() {
		return black;
	}
});
Object.defineProperty(exports, "createTheme", {
	enumerable: true,
	get: function() {
		return createTheme;
	}
});
Object.defineProperty(exports, "defaultDarkTheme", {
	enumerable: true,
	get: function() {
		return defaultDarkTheme;
	}
});
Object.defineProperty(exports, "defaultLightTheme", {
	enumerable: true,
	get: function() {
		return defaultLightTheme;
	}
});
Object.defineProperty(exports, "swatch", {
	enumerable: true,
	get: function() {
		return swatch;
	}
});
Object.defineProperty(exports, "swatchToken", {
	enumerable: true,
	get: function() {
		return swatchToken;
	}
});
Object.defineProperty(exports, "swatchTokens", {
	enumerable: true,
	get: function() {
		return swatchTokens;
	}
});
Object.defineProperty(exports, "useTheme", {
	enumerable: true,
	get: function() {
		return useTheme;
	}
});
Object.defineProperty(exports, "white", {
	enumerable: true,
	get: function() {
		return white;
	}
});
Object.defineProperty(exports, "withAlpha", {
	enumerable: true,
	get: function() {
		return withAlpha;
	}
});

//# sourceMappingURL=ThemeProvider-0ytg6ico.cjs.map